Menu

#225 7.1.0 C output: ENTRY_STATE macro in generated header undefined

Assigned
closed-fixed
None
5
2021-01-01
2020-11-14
David Rea
No

In 7.0.0 and before, C generated header files from a .sm file where any state includes Entry {} actions contained the following:

#define AppClassContext_EnterStartState(fsm) \
    do { \
        if (getState(fsm)->Entry != NULL) { \
            getState(fsm)->Entry(fsm); \
        } \
    } while (0)

In SMC 7.1.0, this is replaced by:

#define AppClassContext_EnterStartState(fsm) \
    ENTRY_STATE(getState(fsm))

However the ENTRY_STATE macro is defined in the generated source file, not the header, so compiling can fail with an undefined symbol error.

Whether this happens (or is just reported as a warning) depends on the strictness of the compiler and whether building with NO_xyz_SM_MACRO defined. gcc throws an implicit definition warning and links it happily, while Keil throws a linker error:

Error: L6218E: Undefined symbol ENTRY_STATE (referred from fsm.o).

Discussion

  • Charles Rapp

    Charles Rapp - 2020-12-30
    • status: open --> open-accepted
     
  • Charles Rapp

    Charles Rapp - 2020-12-30

    I assume the above comments apply to EXIT_STATE macro as well. As such a fix will be applied to both ENTRY_STATE and EXIT_STATE macros.

     
  • Charles Rapp

    Charles Rapp - 2021-01-01
    • status: open-accepted --> closed-fixed
    • assigned_to: Charles Rapp
     
  • Charles Rapp

    Charles Rapp - 2021-01-01

    Corrected in SMC release 7.2.0.

     

Log in to post a comment.

MongoDB Logo MongoDB