Menu

#187 History not working in sub-state machines

QM3
closed
submachines (2)
1
2019-04-26
2017-10-17
Anonymous
No

Using QPCPP v5.9.1, against a model generated by QM v4.0.3, we get this compiler error when we attempt to use history in a sub state machine:

g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\Demo1Qt -I. -I..\Demo1Qt -I....\Demo1 -I......\qpcpp\include -I......\qpcpp\ports\qt -I......\qpcpp\source -IC:\Qt\5.5\mingw492_32\include -IC:\Qt\5.5\mingw492_32\include\QtWidgets -IC:\Qt\5.5\mingw492_32\include\QtGui -IC:\Qt\5.5\mingw492_32\include\QtANGLE -IC:\Qt\5.5\mingw492_32\include\QtCore -Idebug -I. -IC:\Qt\5.5\mingw492_32\mkspecs\win32-g++ -o debug\myao.o ..\myao.cpp
..\myao.cpp:39:66: warning: unused parameter 'e' [-Wunused-parameter]
QP::QState MyAO::initial(MyAO * const me, QP::QEvt const * const e) {
^

..\myao.cpp: In static member function 'static QP::QState demo::MyAO::SM_PreReusable::sub_A2_x(demo::MyAO)':
..\myao.cpp:550:9: error: 'demo::MyAO::his_SM_PreReusable' has not been declared
me->his_SM_PreReusable::sub_A2 = me->stateObj();
^
In file included from ......\qpcpp\ports\qt/qep_port.h:51:0,
from ......\qpcpp\ports\qt/qf_port.h:72,
from ......\qpcpp\include/qpcpp.h:64,
from ..\myao.cpp:20:
..\myao.cpp: In static member function 'static QP::QState demo::MyAO::SM_PreReusable::sub_D2(demo::MyAO
, const QP::QEvt*)':
..\myao.cpp:720:40: error: 'class demo::MyAO' has no member named 'his_sub_A2'
status_ = QM_TRAN_HIST(me->his_sub_A2, &tatbl_);
^
......\qpcpp\include/qep.h:629:25: note: in definition of macro 'QM_TRAN_HIST'
(me->qm_tran_hist_((history_), \ ^

Makefile.Debug:558: recipe for target 'debug/myao.o' failed

See the attached SubSM_History.png for an example of how to reproduce this error.

Basically, any sub state machine that contains a history-transition into any nested child state causes this problem. It appears the declarations for the history transitions are created by the QM code generator.

1 Attachments

Discussion

  • Anonymous

    Anonymous - 2017-10-20

    Attached is a zipped Qt project that illustrates the problem (apologize for the confusing naming). Within is "Demo3/Demo1/Demo1Qt/Demo1Qt.pro". This contains the code generated by a QM which has history in it, and thus causes a compiler error when we try to build it.

    Please note we discovered this problem in our real application state machines, and were able to distill it down to this example and get the same results.

    Thanks,
    -Mike

     
  • Quantum Leaps

    Quantum Leaps - 2017-11-11
    • labels: --> submachines
    • status: open --> accepted
    • Group: QTools --> QM
     
  • Quantum Leaps

    Quantum Leaps - 2017-11-11

    This bug will be addressed by disallowing history connectors inside submachines. The QM tool will not allow attaching the history connector to any sub-state of a submachine. In the sub-machine diagram, the history connectors will be only allowed to attach to the sub-machine boundary, but not to any of the nested sub-states.
    --MM

     
  • Quantum Leaps

    Quantum Leaps - 2017-11-15
    • status: accepted --> closed
     
  • Quantum Leaps

    Quantum Leaps - 2017-11-15

    This bug was fixed in QM 4.1.0 by disallowing history connectors inside submachines. The documentation of the History connector has been updated as well.
    --MMS

     

Anonymous
Anonymous

Add attachments
Cancel