I've run into an issue with the prototypes generated for a state chart. Maybe I've missed an option somewhere.
The code generates a prototype for a user supplied function as
extern sc_integer xonxoffIface_getTimems(Xonxoff* handle);
It gets used in the code generated for the statechart as follows
static sc_boolean xonxoff_check_main_region_SerialTxRx_Transmit_Stalled_tr1_tr1(const Xonxoff* handle) {
return (bool_true) && (xonxoffIface_getTimems(handle) - handle->internal.start_state) > handle->iface.XOFF_TIMEOUT;
}
The problem is that means you are now passing a const pointer as a non-const argument. As a result lint gives the following complaint (quite legitimately)
return (bool_true) && (xonxoffIface_getTimems(handle) - handle->internal.start_state) > handle->iface.XOFF_TIMEOUT;
"src-gen\Xonxoff.c",287 Warning 605: Increase in pointer capability (arg. no.
1)
and even if I turn the lint complaint off the compiler refuses to compile it with the following error
return (bool_true) && (xonxoffIface_getTimems(handle) - handle->internal.start_state) > handle->iface.XOFF_TIMEOUT;
^
"C:\Users\E9877365\Documents\solar\IO\EQ-89-caux-modbus-serial-i-o\Code\src-gen\Xonxoff.c",287 Error[Pe167]:
argument of type "Xonxoff const *" is incompatible with parameter of
type "Xonxoff *"
Either the xonxoff_check_main_region_SerialTxRx_Transmit_Stalled_tr1_tr1 should be defined with a non-const argument or the operation should be prototyped with a const argument.
An advantage of doing the later is that you would get a compile time complaint if you tried to raise an event from within an operation.
Robert