Menu

#233 Generated Source Files marked as "external" duplicates the QP version check

QM
closed
1
2019-05-06
2019-02-07
Anonymous
No

Steps to recreate error:
1. Create a model using the simple.qm template.
2. Check the "external" checkbox for the source file, "myao.cpp".
3. Generate the code multiple times.
4. Open up the source file, "myao.cpp". There are duplicate checks for the minimum required QP version.

Note that there should be only one check. There is a check every time you re-generate the source file from QM. The code block below shows the result of re-generating the source file two more times.

// Check for the minimum required QP version
#if (QP_VERSION < 630U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U))
#error qpcpp version 6.3.0 or higher required
#endif

// Check for the minimum required QP version
#if (QP_VERSION < 630U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U))
#error qpcpp version 6.3.0 or higher required
#endif

// Check for the minimum required QP version
#if (QP_VERSION < 630U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U))
#error qpcpp version 6.3.0 or higher required
#endif

//$define${AOs::MyAO} ########################################################
//${AOs::MyAO} ...............................................................
//${AOs::MyAO::MyAO} .........................................................
MyAO::MyAO()
  : QActive(Q_STATE_CAST(&MyAO::initial))
{
    // body
}

//${AOs::MyAO::SM} ...........................................................
QP::QState MyAO::initial(MyAO * const me, QP::QEvt const * const e) {
    //${AOs::MyAO::SM::initial}
    return Q_TRAN(&state1);
}
//${AOs::MyAO::SM::state1} ...................................................
QP::QState MyAO::state1(MyAO * const me, QP::QEvt const * const e) {
    QP::QState status_;
    switch (e->sig) {
        default: {
            status_ = Q_SUPER(&top);
            break;
        }
    }
    return status_;
}
//$enddef${AOs::MyAO} ########################################################

// define other elements...

Discussion

  • Quantum Leaps

    Quantum Leaps - 2019-02-07
    • status: open --> accepted
     
  • Quantum Leaps

    Quantum Leaps - 2019-02-07

    Thanks for reporting.

    The version-check must be generated within a protected section, which is first deleted and re-generated.

    This bug has been accepted into the next QM release.

    --MMS

     
  • Quantum Leaps

    Quantum Leaps - 2019-05-06
    • status: accepted --> closed
     
  • Quantum Leaps

    Quantum Leaps - 2019-05-06

    Fixed in QM 4.5.0.
    --MMS

     

Anonymous
Anonymous

Add attachments
Cancel