itemisCREATE / statecharts

YAKINDU Statechart Tools (http://www.statecharts.org)
Eclipse Public License 1.0
174 stars 86 forks source link

Usage of 'always' leads to superfluous code in case condition is also provided (C code generator) #295

Closed nyssen closed 5 years ago

nyssen commented 8 years ago

When using 'always' on a transition together with a guard expression, the check function is generated with 'bool_true && ...' in its body, e.g.:

static sc_boolean sCT_check_Active_Calltr0_tr0(const SCT\* handle) {
    return ((bool_true) && handle->ifacePhone.duration > 5) ? bool_true : bool_false;
}

This is superfluous and could be optimized away to only use the guard expression:

static sc_boolean sCT_check_Active_Calltr0_tr0(const SCT\* handle) {
    return (handle->ifacePhone.duration > 5) ? bool_true : bool_false;
}
andreasmuelder commented 6 years ago

@terfloth I think this is fixed with the current PR you are working on?

terfloth commented 5 years ago

This issue still exists.