diff --git a/compiler2/Value.cc b/compiler2/Value.cc index fc36b72798b786702d4bc05a3e928552f6be0b3c..b7350369fb995ae008b714fe2955ff8fa952d120 100644 --- a/compiler2/Value.cc +++ b/compiler2/Value.cc @@ -30,6 +30,7 @@ ******************************************************************************/ #include "../common/dbgnew.hh" #include "Value.hh" +#include "AST.hh" #include "Identifier.hh" #include "Valuestuff.hh" #include "PredefFunc.hh" @@ -410,6 +411,285 @@ namespace Common { } // switch } + void Value::chk_expr_immutability() { + switch (valuetype) { + case V_REFD: {/**< referenced */ + int asstype = get_reference()->get_refd_assignment()->get_asstype(); + switch (asstype) { + case Assignment::A_TYPE: /**< type */ + case Assignment::A_CONST: /**< value (const) */ + case Assignment::A_UNDEF: /**< undefined/undecided (ASN.1) */ + case Assignment::A_ERROR: /**< erroneous; the kind cannot be deduced (ASN.1) */ + case Assignment::A_OC: /**< information object class (ASN.1) */ + case Assignment::A_OBJECT: /**< information object (ASN.1) */ + case Assignment::A_OS: /**< information object set (ASN.1) */ + case Assignment::A_VS: /**< value set (ASN.1) */ + case Assignment::A_EXT_CONST: /**< external constant (TTCN-3) */ + case Assignment::A_MODULEPAR: /**< module parameter (TTCN-3) */ + case Assignment::A_MODULEPAR_TEMP: /**< template module parameter */ + case Assignment::A_VAR: /**< variable (TTCN-3) */ + case Assignment::A_VAR_TEMPLATE: /**< template variable: dynamic template (TTCN-3) */ + case Assignment::A_TIMER: /**< timer (TTCN-3) */ + case Assignment::A_PORT: /**< port (TTCN-3) */ + case Assignment::A_ALTSTEP: /**< altstep (TTCN-3) */ + case Assignment::A_TESTCASE: /**< testcase Assignment::(TTCN-3) */ + case Assignment::A_PAR_TIMER: /**< formal parameter (timer) (TTCN-3) */ + case Assignment::A_PAR_PORT: /**< formal parameter (port) (TTCN-3) */ + break; + case Assignment::A_TEMPLATE: + if(get_reference()->get_parlist()) + get_reference()->get_parlist()->chk_immutability(); + break; + case Assignment::A_FUNCTION: /**< function without return type (TTCN-3) */ + case Assignment::A_FUNCTION_RVAL: /**< function that returns a value (TTCN-3) */ + case Assignment::A_FUNCTION_RTEMP: /**< function that returns a template (TTCN-3) */ + case Assignment::A_EXT_FUNCTION: /**< external function without return type (TTCN-3) */ + case Assignment::A_EXT_FUNCTION_RVAL: /**< ext. func that returns a value (TTCN-3) */ + case Assignment::A_EXT_FUNCTION_RTEMP: /**< ext. func that returns a template (TTCN-3) */ + warning("Function invocation '%s' may change the actual snapshot.", + get_reference()->get_dispname().c_str()); + break; + case Assignment::A_PAR_VAL: /**< formal parameter (value) (TTCN-3) */ + case Assignment::A_PAR_VAL_IN: /**< formal parameter (in value) (TTCN-3) */ + case Assignment::A_PAR_VAL_OUT: /**< formal parameter (out value) (TTCN-3) */ + // TODO: @fuzzy INOUT parameter is not valid + case Assignment::A_PAR_VAL_INOUT: /**< formal parameter (inout value) (TTCN-3) */ + case Assignment::A_PAR_TEMPL_IN: /**< formal parameter ([in] template) (TTCN-3) */ + case Assignment::A_PAR_TEMPL_OUT: /**< formal parameter (out template) (TTCN-3) */ + case Assignment::A_PAR_TEMPL_INOUT:/**< formal parameter (inout template) (TTCN-3) */ + if (get_reference()->get_refd_assignment()->get_eval_type() == FUZZY_EVAL) + warning("Fuzzy parameter '%s' may change (during) the actual snapshot.", + get_reference()->get_dispname().c_str()); + break; + default: + FATAL_ERROR("Value::chk_expr_immutability()"); + } + break;} + case V_EXPR: /**< expressions */ + switch (u.expr.v_optype) { + case OPTYPE_TESTCASENAME: // - + break; + case OPTYPE_RND: // - + case OPTYPE_RNDWITHVAL: /** \todo -> SEED */ // v1 + warning("Random number generation 'rnd()' change the actual snapshot."); + break; + case OPTYPE_UNARYPLUS: // v1 + case OPTYPE_UNARYMINUS: // v1 + case OPTYPE_NOT: // v1 + case OPTYPE_NOT4B: // v1 + case OPTYPE_BIT2HEX: // v1 6 + case OPTYPE_BIT2INT: // v1 + case OPTYPE_BIT2OCT: // v1 + case OPTYPE_BIT2STR: // v1 + case OPTYPE_CHAR2INT: // v1 10 + case OPTYPE_CHAR2OCT: // v1 + case OPTYPE_FLOAT2INT: // v1 + case OPTYPE_FLOAT2STR: // v1 + case OPTYPE_HEX2BIT: // v1 + case OPTYPE_HEX2INT: // v1 + case OPTYPE_HEX2OCT: // v1 + case OPTYPE_HEX2STR: // v1 + case OPTYPE_INT2CHAR: // v1 + case OPTYPE_INT2FLOAT: // v1 + case OPTYPE_INT2STR: // v1 20 + case OPTYPE_INT2UNICHAR: // v1 + case OPTYPE_OCT2BIT: // v1 + case OPTYPE_OCT2CHAR: // v1 + case OPTYPE_OCT2HEX: // v1 + case OPTYPE_OCT2INT: // v1 + case OPTYPE_OCT2STR: // v1 + case OPTYPE_STR2BIT: // v1 + case OPTYPE_STR2FLOAT: // v1 + case OPTYPE_STR2HEX: // v1 + case OPTYPE_STR2INT: // v1 30 + case OPTYPE_STR2OCT: // v1 + case OPTYPE_UNICHAR2INT: // v1 + case OPTYPE_UNICHAR2CHAR: // v1 + case OPTYPE_ENUM2INT: // v1 + case OPTYPE_REMOVE_BOM: //v1 + case OPTYPE_GET_STRINGENCODING: //v1 + case OPTYPE_DECODE_BASE64: //v1 + case OPTYPE_CBOR2JSON: // v1 + case OPTYPE_JSON2CBOR: // v1 + case OPTYPE_BSON2JSON: // v1 + case OPTYPE_JSON2BSON: // v1 + u.expr.v1->chk_expr_immutability(); + break; + case OPTYPE_UNICHAR2OCT: // v1 [v2] + case OPTYPE_OCT2UNICHAR: // v1 [v2] + case OPTYPE_ENCODE_BASE64: //v1 [v2] + u.expr.v1->chk_expr_immutability(); + if (u.expr.v2) u.expr.v2->chk_expr_immutability(); + break; + case OPTYPE_ADD: // v1 v2 + case OPTYPE_SUBTRACT: // v1 v2 + case OPTYPE_MULTIPLY: // v1 v2 + case OPTYPE_DIVIDE: // v1 v2 40 + case OPTYPE_MOD: // v1 v2 + case OPTYPE_REM: // v1 v2 + case OPTYPE_CONCAT: // v1 v2 + case OPTYPE_EQ: // v1 v2 == + case OPTYPE_LT: // v1 v2 < + case OPTYPE_GT: // v1 v2 > + case OPTYPE_NE: // v1 v2 != + case OPTYPE_GE: // v1 v2 >= + case OPTYPE_LE: // v1 v2 <= + case OPTYPE_AND: // v1 v2 50 + case OPTYPE_OR: // v1 v2 + case OPTYPE_XOR: // v1 v2 + case OPTYPE_AND4B: // v1 v2 + case OPTYPE_OR4B: // v1 v2 + case OPTYPE_XOR4B: // v1 v2 + case OPTYPE_SHL: // v1 v2 + case OPTYPE_SHR: // v1 v2 + case OPTYPE_ROTL: // v1 v2 + case OPTYPE_ROTR: // v1 v2 + case OPTYPE_INT2BIT: // v1 v2 60 + case OPTYPE_INT2HEX: // v1 v2 + case OPTYPE_INT2OCT: // v1 v2 + u.expr.v1->chk_expr_immutability(); + u.expr.v2->chk_expr_immutability(); + break; + case OPTYPE_ENCODE: // ti1 [v2] [v3] 35 + case OPTYPE_DECODE: // r1 r2 [v3] [v4] + // not yet done. + break; + case OPTYPE_SUBSTR: + u.expr.ti1->chk_immutability(); + u.expr.v2->chk_expr_immutability(); + u.expr.v3->chk_expr_immutability(); + break; + case OPTYPE_REGEXP: + u.expr.ti1->chk_immutability(); + u.expr.t2->chk_immutability(); + u.expr.v3->chk_expr_immutability(); + break; + case OPTYPE_DECOMP: // not implemented (reference guide) + u.expr.v1->chk_expr_immutability(); + u.expr.v2->chk_expr_immutability(); + u.expr.v3->chk_expr_immutability(); + break; + case OPTYPE_REPLACE: // ti1 v2 v3 ti4 + u.expr.ti1->chk_immutability(); + u.expr.v2->chk_expr_immutability(); + u.expr.v3->chk_expr_immutability(); + u.expr.ti4->chk_immutability(); + break; + case OPTYPE_ISVALUE: // ti1 68 + case OPTYPE_ISBOUND: // ti1 + case OPTYPE_ISPRESENT: // ti1 + case OPTYPE_LENGTHOF: // ti1 + case OPTYPE_SIZEOF: // ti1 + case OPTYPE_VALUEOF: // ti1 + case OPTYPE_TTCN2STRING: // ti1 + u.expr.ti1->chk_immutability(); + break; + case OPTYPE_ISCHOSEN: // r1 i2 + break; + case OPTYPE_ISCHOSEN_V: // v1 i2 + u.expr.v1->chk_expr_immutability(); + break; + case OPTYPE_ISCHOSEN_T: // t1 i2 + u.expr.t1->chk_immutability(); + break; + case OPTYPE_MATCH: // v1 t2 + u.expr.v1->chk_expr_immutability(); + u.expr.t2->chk_immutability(); + break; + case OPTYPE_UNDEF_RUNNING: + case OPTYPE_COMP_NULL: + case OPTYPE_COMP_MTC: + case OPTYPE_COMP_SYSTEM: + case OPTYPE_COMP_SELF: + case OPTYPE_COMP_CREATE: // r1 [v2] [v3] b4 + break; + case OPTYPE_COMP_RUNNING: // v1 [r2] b4 + case OPTYPE_COMP_RUNNING_ANY: // - + case OPTYPE_COMP_RUNNING_ALL: // - + case OPTYPE_COMP_ALIVE: // v1 + case OPTYPE_COMP_ALIVE_ANY: // - + case OPTYPE_COMP_ALIVE_ALL: // - + warning("State of component(s) may change during the actual snapshot."); + break; + case OPTYPE_TMR_READ: // r1 90 + case OPTYPE_TMR_RUNNING: // r1 [r2] b4 + case OPTYPE_TMR_RUNNING_ANY: // - + warning("State of timer(s) may change during the actual snapshot."); + break; + case OPTYPE_GETVERDICT: // - + case OPTYPE_ACTIVATE: // r1 + case OPTYPE_ACTIVATE_REFD: //v1 t_list2 + case OPTYPE_EXECUTE: // r1 [v2] + case OPTYPE_EXECUTE_REFD: // v1 t_list2 [v3] + case OPTYPE_LOG2STR: // logargs + case OPTYPE_PROF_RUNNING: // - 99 + case OPTYPE_ENCVALUE_UNICHAR: // ti1 [v2] [v3] [v4] + case OPTYPE_DECVALUE_UNICHAR: // r1 r2 [v3] [v4] [v5] + case OPTYPE_GET_PORT_REF: // -optypes + case OPTYPE_ANY2UNISTR: // logarg: length = 1 + break; + case OPTYPE_CHECKSTATE_ANY: // [r1] v2: port or any + case OPTYPE_CHECKSTATE_ALL: // [r1] v2: port or all + u.expr.v2->chk_expr_immutability(); + break; + case OPTYPE_HOSTID: // [v1] + if (u.expr.v1) u.expr.v1->chk_expr_immutability(); + break; + case OPTYPE_ISTEMPLATEKIND: // ti1 v2 + u.expr.v2->chk_expr_immutability(); + u.expr.ti1->chk_immutability(); + break; + default: + FATAL_ERROR("Value::chk_expr_immutability()"); + } + break; + case V_ERROR: /**< erroneous */ + case V_UNDEF_LOWERID: /**< undefined loweridentifier */ + case V_NULL: /**< NULL (for ASN.1 NULL type: also in TTCN-3) */ + case V_BOOL: /**< boolean */ + case V_NAMEDINT: /**< integer / named number */ + case V_NAMEDBITS: /**< named bits (identifiers) */ + case V_INT: /**< integer */ + case V_REAL: /**< real/float */ + case V_ENUM: /**< enumerated */ + case V_BSTR: /**< bitstring */ + case V_HSTR: /**< hexstring */ + case V_OSTR: /**< octetstring */ + case V_CSTR: /**< charstring */ + case V_USTR: /**< universal charstring */ + case V_ISO2022STR: /**< ISO-2022 string (treat as octetstring) */ + case V_CHARSYMS: /**< parsed ASN.1 universal string notation */ + case V_OID: /**< object identifier */ + case V_ROID: /**< relative object identifier */ + case V_CHOICE: /**< choice; set directly by the ASN.1 parser */ + case V_SEQOF: /**< sequence (record) of */ + case V_SETOF: /**< set of */ + case V_ARRAY: /**< array */ + case V_SEQ: /**< sequence (record) */ + // TODO test? + case V_SET: /**< set */ + case V_OPENTYPE: /**< open type */ + case V_UNDEF_BLOCK: /**< undefined {block} */ + case V_OMIT: /**< special value for optional values */ + case V_VERDICT: /**< verdict */ + case V_TTCN3_NULL: /**< TTCN-3 null (for component or default references) */ + case V_DEFAULT_NULL: /**< null default reference */ + case V_FAT_NULL: /**< null for function: altstep and testcase */ + case V_MACRO: /**< macros (%%something) */ + case V_NOTUSED: /**< not used symbol ('-') */ + case V_FUNCTION: /**< function */ + case V_ALTSTEP: /**< altstep */ + case V_TESTCASE: /**< testcase */ + case V_INVOKE: /**< invoke operation */ + case V_REFER: /**< refer(function) */ + case V_ANY_VALUE: /**< any value (?) - used by template concatenation */ + case V_ANY_OR_OMIT: /**< any or omit (*) - used by template concatenation */ + break; + default: + FATAL_ERROR("Value::chk_expr_immutability()"); + } // switch + } + void Value::clean_up() { switch (valuetype) { diff --git a/compiler2/Value.hh b/compiler2/Value.hh index f274472ed82e2d80ec4a1d58daec55ab12bcff69..847887227ea040369e8f1329d8376858826953d3 100644 --- a/compiler2/Value.hh +++ b/compiler2/Value.hh @@ -741,6 +741,8 @@ namespace Common { /** Checks that the value (expression) evals to a default value */ inline void chk_expr_default(Type::expected_value_t exp_val) { chk_expr_type(Type::T_DEFAULT, "default", exp_val); } + + void chk_expr_immutability(); /** Checks that the value is (or evaluates to) a valid universal charstring * encoding format. */ diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc index 5d0b5f6553d836d81c048cd55c7b35bf5067d220..5e6618c70c76cad734788f33d203e7b83ec28684 100644 --- a/compiler2/ttcn3/AST_ttcn3.cc +++ b/compiler2/ttcn3/AST_ttcn3.cc @@ -10614,6 +10614,38 @@ namespace Ttcn { params[i]->chk_recursions(refch); } + void ActualParList::chk_immutability() { + size_t num = this->get_nof_pars(); + for (size_t i = 0; i < num; ++i) { + const Ttcn::ActualPar *ap = this->get_par(i); + deeper: + switch (ap->get_selection()) { + case ActualPar::AP_ERROR: + break; + case ActualPar::AP_VALUE: ///< "in" value parameter + ap->get_Value()->chk_expr_immutability(); + break; + case ActualPar::AP_TEMPLATE: ///< "in" template parameter + ap->get_TemplateInstance()->chk_immutability(); + break; + case ActualPar::AP_REF: ///< out/inout value or template parameter + // TODO: test! + if(ap->get_Value()) + ap->get_Value()->chk_expr_immutability(); + if(ap->get_TemplateInstance()) + ap->get_TemplateInstance()->chk_immutability(); + break; + case ActualPar::AP_DEFAULT: { ///< created from the default value of a formal parameter + // TODO: test! + ap = ap->get_ActualPar(); + goto deeper; + break; + } + // no default + } // switch actual par selection + } // next + } + void ActualParList::generate_code_noalias(expression_struct *expr, FormalParList *p_fpl) { size_t nof_pars = params.size(); diff --git a/compiler2/ttcn3/AST_ttcn3.hh b/compiler2/ttcn3/AST_ttcn3.hh index 5363ef0a5b86b68086ef9f0ca66360cff9d038c8..459a54ea336d4fc71435659fbad4903a0e23555b 100644 --- a/compiler2/ttcn3/AST_ttcn3.hh +++ b/compiler2/ttcn3/AST_ttcn3.hh @@ -164,6 +164,8 @@ namespace Ttcn { /** Checks the embedded recursions within the values and template * instances of actual parameters. */ void chk_recursions(ReferenceChain& refch); + + void chk_immutability(); /** Generates the C++ equivalent of the actual parameter list without * considering any aliasing between variables and 'in' parameters. */ void generate_code_noalias(expression_struct *expr, FormalParList *p_fpl); diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc index 0fb80d2ac5732e788a298d8a470a4a32da586006..6b3ba9bd13527a78c99ec9abd2b5e12392a8e5ba 100644 --- a/compiler2/ttcn3/Statement.cc +++ b/compiler2/ttcn3/Statement.cc @@ -4089,6 +4089,11 @@ error: chk_index_redirect(port_op.r.redirect.index, t_ass != NULL ? t_ass->get_Dimensions() : NULL, port_op.anyfrom, "port"); } + + // checking deterministic + if (port_op.r.rcvpar) { + port_op.r.rcvpar->chk_immutability(); + } } void Statement::chk_getcall() @@ -12749,6 +12754,7 @@ error: if (expr) { Error_Context cntxt(expr, "In guard expression"); expr->chk_expr_bool(Type::EXPECTED_DYNAMIC_VALUE); + expr->chk_expr_immutability(); } { Error_Context cntxt(stmt, "In guard operation"); @@ -12760,6 +12766,7 @@ error: if (expr) { Error_Context cntxt(expr, "In guard expression"); expr->chk_expr_bool(Type::EXPECTED_DYNAMIC_VALUE); + expr->chk_expr_immutability(); } { Error_Context cntxt(ref, "In guard statement"); @@ -12779,6 +12786,7 @@ error: if (expr) { Error_Context cntxt(expr, "In guard expression"); expr->chk_expr_bool(Type::EXPECTED_DYNAMIC_VALUE); + expr->chk_expr_immutability(); } { if (!invoke.t_list) return; //already_checked diff --git a/compiler2/ttcn3/TtcnTemplate.cc b/compiler2/ttcn3/TtcnTemplate.cc index f88429d465f7ef90deb58e1d652649b8c795a099..ca55e42c29cd49ebc2d7421ae65284862851ee0c 100644 --- a/compiler2/ttcn3/TtcnTemplate.cc +++ b/compiler2/ttcn3/TtcnTemplate.cc @@ -2474,6 +2474,94 @@ end: } } + void Template::chk_immutability() + { + switch (templatetype) { + case TEMPLATE_ERROR: /**< erroneous template */ + case TEMPLATE_NOTUSED: /**< not used symbol (-) */ + case OMIT_VALUE: /**< omit */ + case ANY_VALUE: /**< any value (?) */ + case ANY_OR_OMIT: /**< any or omit (*) */ + case TEMPLATE_INVOKE: /** template returning invoke */ + case BSTR_PATTERN: /**< bitstring pattern */ + case HSTR_PATTERN: /**< hexstring pattern */ + case OSTR_PATTERN: /**< octetstring pattern */ + case CSTR_PATTERN: /**< character string pattern */ + case USTR_PATTERN: /**< universal charstring pattern */ + break; + case ALL_FROM: + u.all_from->chk_immutability(); + break; + case SPECIFIC_VALUE: + u.specific_value->chk_expr_immutability(); + break; + case TEMPLATE_REFD: { + Ttcn::ActualParList *aplist = get_reference()->get_parlist(); + if (aplist) { + aplist->chk_immutability(); + } + + if (get_template_refd_last()->templatetype == TEMPLATE_REFD) + { + Assignment *formal_param_ass = get_template_refd_last()->get_reference()->get_refd_assignment(); + if (formal_param_ass->get_asstype() >= Assignment::A_PAR_VAL) + if (formal_param_ass->get_asstype() <= Assignment::A_PAR_TEMPL_INOUT) + if (formal_param_ass->get_eval_type() != NORMAL_EVAL) + warning("Fuzzy parameter '%s' may change (during) the actual snapshot.", + get_reference()->get_dispname().c_str()); + } + if(aplist && get_template_refd_last()->templatetype == TEMPLATE_REFD) + warning("Function invocation '%s' may change the actual snapshot.", + get_reference()->get_dispname().c_str()); + break; + } + case NAMED_TEMPLATE_LIST: { + size_t nnt = get_nof_comps(); + for (size_t i = 0; i < nnt; ++i) + { + Ttcn::NamedTemplate *nt = get_namedtemp_byIndex(i); + nt->get_template()->chk_immutability(); + } + break; + } + case INDEXED_TEMPLATE_LIST: { + size_t nnt = get_nof_comps(); + for (size_t i = 0; i < nnt; ++i) + { + Ttcn::IndexedTemplate *it = get_indexedtemp_byIndex(i); + it->get_index().get_val()->chk_expr_immutability(); + it->get_template()->chk_immutability(); + } + break; + } + case TEMPLATE_LIST: /**< value list notation */ + case SUPERSET_MATCH: /**< superset match */ + case SUBSET_MATCH: /**< subset match */ + case PERMUTATION_MATCH: /**< permutation match */ + case COMPLEMENTED_LIST: /**< complemented list match */ + case VALUE_LIST: { + size_t num = get_nof_comps(); + for (size_t i = 0; i < num; ++i) { + get_temp_byIndex(i)->chk_immutability(); + } + break; + } + case VALUE_RANGE: + get_value_range()->get_min_v()->chk_expr_immutability(); + get_value_range()->get_max_v()->chk_expr_immutability(); + break; + case DECODE_MATCH: /**< decoded content match */ + get_decode_target()->get_Template()->chk_immutability(); + break; + case TEMPLATE_CONCAT: + u.concat.op1->chk_immutability(); + u.concat.op2->chk_immutability(); + break; + default: + FATAL_ERROR("Template::chk_immutability()"); + } + } + Templates *Template::harbinger(Template *t, bool from_permutation, bool killer) { Templates *new_templates = new Templates; @@ -5676,6 +5764,57 @@ compile_time: return needs_runtime_check; } + void TemplateInstance::chk_immutability() const { + if (derived_reference) { + int asstype = ((Reference*)derived_reference)->get_refd_assignment()->get_asstype(); + switch (asstype) { + case Assignment::A_TYPE: /**< type */ + case Assignment::A_CONST: /**< value (const) */ + case Assignment::A_UNDEF: /**< undefined/undecided (ASN.1) */ + case Assignment::A_ERROR: /**< erroneous; the kind cannot be deduced (ASN.1) */ + case Assignment::A_OC: /**< information object class (ASN.1) */ + case Assignment::A_OBJECT: /**< information object (ASN.1) */ + case Assignment::A_OS: /**< information object set (ASN.1) */ + case Assignment::A_VS: /**< value set (ASN.1) */ + case Assignment::A_EXT_CONST: /**< external constant (TTCN-3) */ + case Assignment::A_MODULEPAR: /**< module parameter (TTCN-3) */ + case Assignment::A_MODULEPAR_TEMP: /**< template module parameter */ + case Assignment::A_VAR: /**< variable (TTCN-3) */ + case Assignment::A_VAR_TEMPLATE: /**< template variable: dynamic template (TTCN-3) */ + case Assignment::A_TIMER: /**< timer (TTCN-3) */ + case Assignment::A_PORT: /**< port (TTCN-3) */ + case Assignment::A_ALTSTEP: /**< altstep (TTCN-3) */ + case Assignment::A_TESTCASE: /**< testcase Assignment::(TTCN-3) */ + case Assignment::A_PAR_TIMER: /**< formal parameter (timer) (TTCN-3) */ + case Assignment::A_PAR_PORT: /**< formal parameter (port) (TTCN-3) */ + case Assignment::A_FUNCTION: /**< function without return type (TTCN-3) */ + case Assignment::A_FUNCTION_RVAL: /**< function that returns a value (TTCN-3) */ + case Assignment::A_FUNCTION_RTEMP: /**< function that returns a template (TTCN-3) */ + case Assignment::A_EXT_FUNCTION: /**< external function without return type (TTCN-3) */ + case Assignment::A_EXT_FUNCTION_RVAL: /**< ext. func that returns a value (TTCN-3) */ + case Assignment::A_EXT_FUNCTION_RTEMP: /**< ext. func that returns a template (TTCN-3) */ + break; + case Assignment::A_TEMPLATE: /**< template (TTCN-3) */ + ((Reference*)derived_reference)->get_parlist()->chk_immutability(); + break; + case Assignment::A_PAR_VAL: /**< formal parameter (value) (TTCN-3) */ + case Assignment::A_PAR_VAL_IN: /**< formal parameter (in value) (TTCN-3) */ + case Assignment::A_PAR_VAL_OUT: /**< formal parameter (out value) (TTCN-3) */ + case Assignment::A_PAR_VAL_INOUT: /**< formal parameter (inout value) (TTCN-3) */ + case Assignment::A_PAR_TEMPL_IN: /**< formal parameter ([in] template) (TTCN-3) */ + case Assignment::A_PAR_TEMPL_OUT: /**< formal parameter (out template) (TTCN-3) */ + case Assignment::A_PAR_TEMPL_INOUT:/**< formal parameter (inout template) (TTCN-3) */ + if (((Reference*)derived_reference)->get_refd_assignment()->get_eval_type() == FUZZY_EVAL) + warning("Fuzzy parameter '%s' may change (during) the actual snapshot.", + ((Reference*)derived_reference)->get_dispname().c_str()); + break; + default: + FATAL_ERROR("Value::chk_expr_immutability()"); + } + } + template_body->chk_immutability(); + } + bool TemplateInstance::has_single_expr() { if (derived_reference) return false; diff --git a/compiler2/ttcn3/TtcnTemplate.hh b/compiler2/ttcn3/TtcnTemplate.hh index 7c0283a88b1725eb115f1991d12f119a57c95fba..68965b7103d7c99fd6e6eecfe2adbe8b0dfd4713 100644 --- a/compiler2/ttcn3/TtcnTemplate.hh +++ b/compiler2/ttcn3/TtcnTemplate.hh @@ -363,6 +363,8 @@ namespace Ttcn { void chk_invoke(); void chk_concat_double_length_res(); + void chk_immutability(); + /** Copy template elements from the "all from" into the template. * * @param from_permutation \a true if the "all from" occurs inside @@ -593,6 +595,8 @@ namespace Ttcn { bool chk_restriction(const char* definition_name, template_restriction_t template_restriction, const Location* usage_loc); + void chk_immutability() const ; + /** Returns whether the template instance can be represented by an in-line * C++ expression. */ bool has_single_expr(); diff --git a/function_test/Semantic_Analyser/TTCN3_SA_9_TD.script b/function_test/Semantic_Analyser/TTCN3_SA_9_TD.script index 196904e59c0c543b1c1fc52f0fa235881d5f432e..60bdf5aecc60ed732d75e0a0245c73969e99c80e 100644 --- a/function_test/Semantic_Analyser/TTCN3_SA_9_TD.script +++ b/function_test/Semantic_Analyser/TTCN3_SA_9_TD.script @@ -831,6 +831,883 @@ module ModuleA { <END_TC> :exmp. +.*---------------------------------------------------------------------* +:h3.Functions->invoking functions from specific places +.*---------------------------------------------------------------------* +Requirement: Functions->invoking functions from specific places (16.1.4) +:nl.Explanation: +:nl.Invoking functions and some other features (e.g. get state of port or components) +:nl.may have side effects or different return-value +:nl.and it's can create unexpected changes on the actual snapshot. +:nl.In these cases the compiler gives warnings. +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_REFD->A_FUNCTION_RVAL +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_REFD->A_FUNCTION_RVAL> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + function FB() return boolean { return true; } + testcase T() runs on C { + timer t := 5.0; t.start; + var boolean VB := FB(); + alt { + [VB] t.timeout {} + [FB()] t.timeout {} + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_REFD->A_EXT_FUNCTION_RVAL +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_REFD->A_EXT_FUNCTION_RVAL> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + external function FB() return boolean; + testcase T() runs on C { + timer t := 5.0; t.start; + var boolean VB := FB(); + alt { + [VB] t.timeout {} // OK + [FB()] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_REFD->A_PAR_VAL_IN->FUZZY_EVAL +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_REFD->A_PAR_VAL_IN->FUZZY_EVAL> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + testcase T(in @fuzzy boolean FFP_B) runs on C { + timer t := 5.0; t.start; + var boolean VB := FFP_B; + alt { + [VB] t.timeout {} // OK + [FFP_B] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_RND +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_RND> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + testcase T() runs on C { + timer t := 5.0; t.start; + var float VF := rnd(); + alt { + [VF < 1.0] t.timeout {} // OK + [rnd() < 1.0] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bRandom number generation\b.+?\bchange the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_RNDWITHVAL +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_RNDWITHVAL> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + testcase T() runs on C { + timer t := 5.0; t.start; + var float VF := rnd(2.0); + alt { + [VF < 1.0] t.timeout {} // OK + [rnd(2.0) < 1.0] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bRandom number generation\b.+?\bchange the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_NOT +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_NOT> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + function FB() return boolean { return true; } + testcase T() runs on C { + timer t := 5.0; t.start; + var boolean VB := FB(); + alt { + [not VB] t.timeout {} // OK + [not FB()] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_AND +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_AND> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + function FB1() return boolean { return true; } + function FB2() return boolean { return true; } + testcase T() runs on C { + timer t := 5.0; t.start; + var boolean VB1 := FB1(); + var boolean VB2 := FB2(); + alt { + [VB1 and VB2] t.timeout {} // OK + [FB1() and FB2()] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 2> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_EQ +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_EQ> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + function FB1() return boolean { return true; } + function FB2() return boolean { return true; } + testcase T() runs on C { + timer t := 5.0; t.start; + var boolean VB1 := FB1(); + var boolean VB2 := FB2(); + alt { + [VB1 == VB2] t.timeout {} // OK + [FB1() == FB2()] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 2> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_SUBSTR +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_SUBSTR> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + function FI1() return integer { return 0; } + function FI2() return integer { return 1; } + function FS() return charstring { return "ABC"; } + testcase T() runs on C { + timer t := 5.0; t.start; + alt { + ["A" == substr("ABC",0,1)] t.timeout {} // OK + ["A" == substr(FS(),0,1)] t.timeout {} // NOT OK + ["A" == substr("ABC",FI1(),1)] t.timeout {} // NOT OK + ["A" == substr("ABC",0,FI2())] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 3> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_REGEXP +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_REGEXP> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + function FI() return integer { return 1; } + function FS1() return charstring { return "ABC"; } + function FS2() return charstring { return "?+"; } + testcase T() runs on C { + timer t := 5.0; t.start; + alt { + ["ABC" == regexp("ABC",charstring:"?+",1)] t.timeout {} // OK + ["ABC" == regexp(FS1(),charstring:"?+",1)] t.timeout {} // NOT OK + ["ABC" == regexp("ABC",FS2(),1)] t.timeout {} // NOT OK + ["ABC" == regexp("ABC",charstring:"?+",FI())] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 3> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_REPLACE +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_REPLACE> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + function FI() return integer { return 1; } + function FS1() return charstring { return "ACC"; } + function FS2() return charstring { return "B"; } + testcase T() runs on C { + timer t := 5.0; t.start; + alt { ["ABC" == replace("ACC",1,1,"B")] t.timeout {} } // OK + alt { ["ABC" == replace(FS1(),1,1,"B")] t.timeout {} } // NOT OK + alt { ["ABC" == replace("ACC",FI(),1,"B")] t.timeout {} } // NOT OK + alt { ["ABC" == replace("ACC",1,FI(),"B")] t.timeout {} } // NOT OK + alt { ["ABC" == replace("ACC",1,1,FS2())] t.timeout {} } // NOT OK + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 4> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_ISVALUE ti1 +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_ISVALUE ti1> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + type record R { integer field, boolean field2 optional } + template R TR := {field1 := FI(), field2 := omit} + template R PTR (boolean field_param) := {field1 := FI(), field2 := field_param} + function FB() return boolean { return true; } + function FI() return integer { return 1; } + testcase T() runs on C { + timer t := 5.0; t.start; + alt { + [isvalue(R:PTR(true))] t.timeout {} // OK + [isvalue(R:PTR(FB()))] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_ISCHOSEN_V +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_ISCHOSEN_V> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + type union U { boolean option1, boolean option2 } + testcase T(in @fuzzy U FFP_U) runs on C { + timer t := 5.0; t.start; + var U VU := { option2 := true } + alt { + [ischosen(VU.option1)] t.timeout {} // OK + [ischosen(FFP_U.option1)] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_ISCHOSEN_T +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_ISCHOSEN_T> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + type union U { boolean option1, boolean option2 } + template U UT := { option2 := true } + testcase T(in template @fuzzy U FFP_UT) runs on C { + timer t := 5.0; t.start; + alt { + [ischosen(UT.option1)] t.timeout {} // OK + [ischosen(FFP_UT.option1)] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_MATCH +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_MATCH> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + function FI() return integer { return 1 } + function FTI() return template integer { return ? } + template integer PTI (integer param1) := param1 * FI(); // NOT CHECKED + testcase T(in @fuzzy integer FFP_I, in template @fuzzy integer FFP_TI) runs on C { + timer t := 5.0; t.start; + var template integer VTI := FTI(); + alt { + [match(1,VTI)] t.timeout {} // OK + [match(1,PTI(1))] t.timeout {} // OK + [match(1,FTI())] t.timeout {} // NOT OK + [match(1,FFP_TI)] t.timeout {} // NOT OK + [match(FFP_I, 1)] t.timeout {} // NOT OK + [match(FI(),?)] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 2> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<RESULT IF_FAIL COUNT 2> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_COMP_RUNNING* +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_COMP_RUNNING*> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + testcase T() runs on C { + timer t := 5.0; t.start; + var C PTC := C.create; + alt { + [PTC.running] t.timeout {} // NOT OK + [any component.running] t.timeout {} // NOT OK + [all component.running] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 3> +(?im)\bwarning\b.+?\bState of component\(s\) may change during the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_TMR_RUNNING* +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_TMR_RUNNING*> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + testcase T() runs on C { + timer t := 5.0; t.start; + alt { + [t.running] t.timeout {} // NOT OK + [any timer.running] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 2> +(?im)\bwarning\b.+?\bState of timer\(s\) may change during the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_CHECKSTATE* +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_CHECKSTATE*> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout integer } + type component C { port P p }; + function FS() return charstring { return "Connected" } + testcase T() runs on C { + timer t := 5.0; t.start; + alt { + [(p.checkstate("Connected"))] t.timeout {} // OK? + [(any port.checkstate("Connected"))] t.timeout {} // OK? + [(p.checkstate(FS()))] t.timeout {} // NOT OK + [(any port.checkstate(FS()))] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 2> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_HOSTID +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_HOSTID> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + function FS() return charstring { return "ABC" } + function FI() return integer { return 3 } + testcase T() runs on C { + timer t := 5.0; t.start; + alt { + [hostid() == ""] t.timeout {} // OK + [hostid("") == ""] t.timeout {} // OK + [hostid(FS()) == ""] t.timeout {} // NOT OK + [hostid(substr("ABC",0,FI())) == ""] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 2> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_ISTEMPLATEKIND +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Value::chk_expr_immutability: V_EXPR->OPTYPE_ISTEMPLATEKIND> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type component C {}; + template boolean PT(boolean param1) := param1 and true; + function FS() return charstring { return "AnyValue" } + function FB() return boolean { return true } + testcase T() runs on C { + timer t := 5.0; t.start; + alt { + [istemplatekind(PT(true),"AnyValue")] t.timeout {} // OK + [istemplatekind(PT(FB()),"AnyValue")] t.timeout {} // NOT OK + [istemplatekind(PT(true),FS())] t.timeout {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 2> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::TemplateInstance::chk_immutability: template_body->chk_immutability +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::TemplateInstance::chk_immutability: template_body->chk_immutability> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout integer } + type component C { port P p }; + function FI() return integer { return 2 } + testcase T() runs on C { + alt { + [] p.receive(integer:?) {} // OK + [] p.receive(integer:FI()) {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::TemplateInstance::chk_immutability: derived_reference->A_TEMPLATE +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::TemplateInstance::chk_immutability: derived_reference->A_TEMPLATE> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout R } + type component C { port P p }; + function FI() return integer { return 2 } + type record R { integer field1 } + template R PTR (integer param1) := { field1 := param1 }; + testcase T(in @fuzzy integer FFP_I) runs on C { + alt { + [] p.receive(R:?) {} // OK + [] p.receive(R: {field1 := 3}) {} // OK + [] p.receive(R: modifies PTR(2) := {field1 := 3}) {} // OK + [] p.receive(R: modifies PTR(FI()) := {field1 := 3}) {} // NOT OK + [] p.receive(R: modifies PTR(FFP_I) := {field1 := 3}) {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::TemplateInstance::chk_immutability: derived_reference->A_PAR_TEMPL_IN +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::TemplateInstance::chk_immutability: derived_reference->A_PAR_TEMPL_IN> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout R } + type component C { port P p }; + function FI() return integer { return 2 } + type record R { integer field1 } + testcase T(in template @fuzzy R FFP_TR) runs on C { + alt { + [] p.receive(R: modifies FFP_TR := {field1 := 3}) {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Template::chk_immutability: templatetype->ALL_FROM/SPECIFIC_VALUE +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Template::chk_immutability: templatetype->ALL_FROM/SPECIFIC_VALUE> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout integer } + type component C { port P p }; + function FI() return integer { return 2 } + + type record of integer RoI; + + template RoI TRoI := {0, (2..5)} + template RoI PTRoI (integer param1) := {0, (param1..5)} + + testcase T(in template @fuzzy RoI FFP_TRoI) runs on C { + alt { + [] p.receive(integer: (all from TRoI)) {} // OK + [] p.receive(integer: (all from PTRoI(2))) {} // OK + [] p.receive(integer: (all from PTRoI(FI()))) {} // NOT OK + [] p.receive(integer: (all from FFP_TRoI)) {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Template::chk_immutability: templatetype->TEMPLATE_REFD +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Template::chk_immutability: templatetype->TEMPLATE_REFD> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout R } + type component C { port P p }; + function FB() return boolean { return true } + type record R { boolean field1 } + template R PTR (boolean param1) := { field1 := param1 } + testcase T(in @fuzzy boolean FFP_B) runs on C { + alt { + [] p.receive(PTR(false)) {} // OK + [] p.receive(PTR(FB())) {} // NOT OK + [] p.receive(PTR(FFP_B)) {} // NOT OK + [] p.receive(PTR(all component.running)) {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bState of component\(s\) may change during the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + + +.*---------------------------------------------------------------------* +:h4.TTCN3::Template::chk_immutability: templatetype->TEMPLATE_REFD->A_PAR_TEMPL_IN->FUZZY_EVAL +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Template::chk_immutability: templatetype->TEMPLATE_REFD->A_PAR_TEMPL_IN->FUZZY_EVAL> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout boolean } + type component C { port P p }; + testcase T(in template @fuzzy boolean FFP_TB) runs on C { + alt { [] p.receive(FFP_TB) {} } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Template::chk_immutability: templatetype->INDEXED_TEMPLATE_LIST +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Template::chk_immutability: templatetype->INDEXED_TEMPLATE_LIST> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout RoI } + type component C { port P p }; + type record of integer RoI; + function FI() return integer { return 2 } + testcase T() runs on C { + alt { + [] p.receive(RoI: {[0]:=0,[2]:=(0,1,2)}) {} // OK + [] p.receive(RoI: {[0]:=0,[2]:=(0,1,FI())}) {} // NOT OK + [] p.receive(RoI: {[0]:=0,[FI()]:=(0,1,2)}) {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 2> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<RESULT IF_FAIL COUNT 0> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Template::chk_immutability: templatetype->SUBSET_MATCH +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Template::chk_immutability: templatetype->SUBSET_MATCH> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout SoI } + type component C { port P p }; + type set of integer SoI; + function FI() return integer { return 2 } + testcase T() runs on C { + alt { + [] p.receive(SoI: subset(0,1,2,3)) {} // OK + [] p.receive(SoI: subset(0,FI(),2,3)) {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 1> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<RESULT IF_FAIL COUNT 0> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Template::chk_immutability: templatetype->VALUE_RANGE +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Template::chk_immutability: templatetype->VALUE_RANGE> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout RoI } + type component C { port P p }; + type record of integer RoI; + function FI() return integer { return 2 } + testcase T() runs on C { + alt { + [] p.receive(RoI: {(0..10)}) {} // OK + [] p.receive(RoI: {(0..FI())}) {} // NOT OK + [] p.receive(RoI: {(FI()..10)}) {} // NOT OK + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 2> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<RESULT IF_FAIL COUNT 0> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + +.*---------------------------------------------------------------------* +:h4.TTCN3::Template::chk_immutability: templatetype->TEMPLATE_CONCAT +.*---------------------------------------------------------------------* +:xmp tab=0. +<TC - TTCN3::Template::chk_immutability: templatetype->TEMPLATE_CONCAT> +<COMPILE> +<VERDICT_LEAF FAIL> +<MODULE TTCN M M.ttcn> +module M { + type port P message { inout SoI } + type component C { port P p }; + type set of integer SoI; + function FI() return integer { return 2 } + testcase T() runs on C { + alt { + // [] p.receive(SoI: ({0,2} & {1})) {} // SYNTAX ERROR + } + } +} +<END_MODULE> +<RESULT IF_FAIL COUNT 0> +(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b +<END_RESULT> +<RESULT IF_FAIL COUNT 0> +(?im)\bwarning\b.+?\bFuzzy parameter\b.+?\bmay change \(during\) the actual snapshot\b +<END_RESULT> +<END_TC> +:exmp. + .*---------------------------------------------------------------------* :h3.Altsteps->runs on clause SA-9/9 .*---------------------------------------------------------------------* diff --git a/function_test/Semantic_Analyser/invoking_function_from_specific_places/.gitignore b/function_test/Semantic_Analyser/invoking_function_from_specific_places/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2d293255e6d2f314e34950e486a48630d873491 --- /dev/null +++ b/function_test/Semantic_Analyser/invoking_function_from_specific_places/.gitignore @@ -0,0 +1,2 @@ +!Makefile +!*.ttcn diff --git a/function_test/Semantic_Analyser/invoking_function_from_specific_places/InvokingFunctionFromSpecificPlaces_SW.ttcn b/function_test/Semantic_Analyser/invoking_function_from_specific_places/InvokingFunctionFromSpecificPlaces_SW.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..e12cad11c051270e2f33805db26903baf45a1a7b --- /dev/null +++ b/function_test/Semantic_Analyser/invoking_function_from_specific_places/InvokingFunctionFromSpecificPlaces_SW.ttcn @@ -0,0 +1,228 @@ +/****************************************************************************** + * Copyright (c) 2000-2018 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Aron Simon + * + ******************************************************************************/ + +module InvokingFunctionFromSpecificPlaces_SW { //^In TTCN-3 module// + + modulepar boolean mp := true; + + type component MTC { port P p } + type component PTC { } + + type record R { integer field, boolean field2 optional } + type record SR { R field } + + type union U {integer i1, integer i2} + template U TU := { i1 := 1 } + + type port P message { inout R, SR, RoI, SoI } + + template R T := {field := fi(), field2 := omit} + template R PT (boolean field_param) := {field := fi(), field2 := field_param} + template R PTD (boolean field_param := false) := {field := fi(), field2 := field_param} + template SR ST := {field := T} + template SR PST (template R field_param) := { field := field_param} + + type record of integer RoI; + template RoI roi := {1,2,3,(4..6)} + template RoI proi (integer ip) := {1,2,3,ip} + + type set of integer SoI; + + + function fb() return boolean { return true; } + function fi() return integer { return 1; } + function fs() return charstring { return "abcabc"; } + external function ef() return boolean; + + testcase //^In testcase definition// + tc(in boolean fp, + in @fuzzy boolean ffp, + in template @fuzzy R ftfp, + in template @fuzzy U futfp, + in @fuzzy U fuvfp, + in @fuzzy RoI froifp + ) + runs on MTC { + var boolean vb := true; + var @fuzzy boolean fvb := true; + var PTC ptc := PTC.create; + + var template R VT := { field := fi() } + var U VU := { i1 := 1 } + + + timer t := 1.0; t.start; + + alt { //^In alt construct// + /* A_MODULEPAR */ + [mp] t.timeout {} + + /* A_VAR */ + [vb] t.timeout {} + + /* A_FUNCTION_RVAL */ + [fb()] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* A_EXT_FUNCTION_RVAL */ + [ef()] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* A_PAR_VAL_IN */ + [fp] t.timeout {} + + /* A_PAR_VAL_IN @fuzzy */ + [ffp] t.timeout {} //^In guard expression// //^warning\: Fuzzy parameter// + + /* OPTYPE_RND */ + [rnd() < 1.0] t.timeout {} //^In guard expression// //Random number generation// + + /* OPTYPE_RNDWITHVAL */ + [rnd(5.0) < 1.0] t.timeout {} //^In guard expression// //Random number generation// + + /* OPTYPE_ with v1 */ + [+(fi()) < 5] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [-(fi()) < 5] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [not fb()] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [int2float(fi()) < 5.0] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + + /* OPTYPE_ with v1 v2 */ + [fi() + 1 < 5] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [fi() - 1 <= 5] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [fi() + 1 == 5] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [fi() / 1 > 5] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [fi() * 1 >= 5] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* OPTYPE_SUBSTR */ + ["abc" == substr("abcabc",0,3)] t.timeout {} + ["abc" == substr("abcabc",0,fi())] t.timeout {} //^In guard expression// //^warning\: Function invocation// + ["abc" == substr("abcabc",fi(),3)] t.timeout {} //^In guard expression// //^warning\: Function invocation// + ["abc" == substr(fs(),0,3)] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* OPTYPE_REGEXP */ + ["abc" == regexp(fs(),charstring:"?+",1)] t.timeout {} //^In guard expression// //^warning\: Function invocation// + ["abc" == regexp("asd",fs(),1)] t.timeout {} //^In guard expression// //^warning\: Function invocation// + ["abc" == regexp("asd",charstring:"?+",fi())] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* OPTYPE_REPLACE */ + ["abc" == replace("acc",1,1,"b")] t.timeout {} + ["abc" == replace(fs(),1,1,"b")] t.timeout {} //^In guard expression// //^warning\: Function invocation// + ["abc" == replace("acc",fi(),1,"b")] t.timeout {} //^In guard expression// //^warning\: Function invocation// + ["abc" == replace("acc",1,fi(),"b")] t.timeout {} //^In guard expression// //^warning\: Function invocation// + ["abc" == replace("acc",1,1,fs())] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* OPTYPE_ISVALUE */ + [isvalue(R:T)] t.timeout {} + [isvalue(R:PT(fb()))] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* OPTYPE_ISCHOSEN_T */ + [ischosen(TU.i1)] t.timeout {} + [ischosen(futfp.i1)] t.timeout {} //^In guard expression// //^warning\: Fuzzy parameter// + + /* OPTYPE_ISCHOSEN_V */ + [ischosen(VU.i1)] t.timeout {} + [ischosen(fuvfp.i1)] t.timeout {} //^In guard expression// //^warning\: Fuzzy parameter// + + /* OPTYPE_MATCH VALUE_RANGE (Template::chk_immutability()) */ + [match(2,(fi()..3))] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [match(2,(1..fi()))] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [match(fi(),(1..3))] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* OPTYPE_COMP_RUNNING_ALL */ + [all component.running] t.timeout {} //^In guard expression// //^warning\: State of component// + /* OPTYPE_COMP_RUNNING_ANY */ + [any component.running] t.timeout {} //^In guard expression// //^warning\: State of component// + /* OPTYPE_COMP_RUNNING */ + [ptc.running] t.timeout {} //^In guard expression// //^warning\: State of component// + + /* OPTYPE_TMR_RUNNING_ANY */ + [any timer.running] t.timeout {} //^In guard expression// //^warning\: State of timer// + /* OPTYPE_TMR_RUNNING */ + [t.running] t.timeout {} //^In guard expression// //^warning\: State of timer// + + /* OPTYPE_CHECKSTATE_ANY */ + [(any port.checkstate("Connected"))] t.timeout {} + [(any port.checkstate(fs()))] t.timeout {} //^In guard expression// //^warning\: Function invocation// + /* OPTYPE_CHECKSTATE_ALL */ + [(all port.checkstate(fs()))] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* OPTYPE_HOSTID */ + [hostid() == ""] t.timeout {} + [hostid("") == ""] t.timeout {} + [hostid(fs()) == ""] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [hostid(substr("abcabc",0,fi())) == ""] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* OPTYPE_ISTEMPLATEKIND */ + [istemplatekind(PT(fb()),"AnyValue")] t.timeout {} //^In guard expression// //^warning\: Function invocation// + [istemplatekind(PT(true),fs())] t.timeout {} //^In guard expression// //^warning\: Function invocation// + + /* correct use of receive */ + [] p.receive(R:?) {} + [] p.receive(R:T) {} + [] p.receive(T) {} + + /* A_PAR_TEMPL_IN @fuzzy */ + [] p.receive(ftfp) {} //^In guard operation// //^In receive statement// //^warning\: Fuzzy parameter// + /* +inline template */ + [] p.receive(SR:{field:=ftfp}) {} //^In guard operation// //^In receive statement// //^warning\: Fuzzy parameter// + + /* A_FUNCTION_RVAL */ + [] p.receive(R:{field:=fi(), field2:=true}) {} //^In guard operation// //^In receive statement// //^warning\: Function invocation// + + [] p.receive(PTD(false)) {} + [] p.receive(PTD()) {} + + [] p.receive(VT) {} + + /* modifies base_template, (NAMED_TEMPLATE_LIST) */ + [] p.receive(R: modifies VT := { field := 2 }) {} + [] p.receive(R: modifies PT(false) := { field := 2 }) {} + [] p.receive(R: modifies PT(fb()) := { field := 2 }) {}//^In guard operation// //^In receive statement// //^warning\: Function invocation// + [] p.receive(R: modifies ftfp := { field := 2 }) {} //^In guard operation// //^In receive statement// //^warning\: Fuzzy parameter// + /* modifies template_body */ + [] p.receive(R: modifies VT := ftfp) {} //^In guard operation// //^In receive statement// //^warning\: Fuzzy parameter// + + /* ALL_FROM, (SPECIFIC_VALUE) */ + [] p.receive(R:{field := (all from roi), field2 := true }) {} + [] p.receive(R:{field := (all from froifp), field2 := true }) {} //^In guard operation// //^In receive statement// //^warning\: Fuzzy parameter// + [] p.receive(R:{field := (all from proi(3)), field2 := true }) {} + [] p.receive(R:{field := (all from proi(fi())), field2 := true }) {} //^In guard operation// //^In receive statement// //^warning\: Function invocation// + + /* TEMPLATE_REFD */ + [] p.receive(PT(false)) {} + [] p.receive(PT(fb())) {} //^In guard operation// //^In receive statement// //^warning\: Function invocation// + [] p.receive(SR:PST(PT(fb()))) {} //^In guard operation// //^In receive statement// //^warning\: Function invocation// + [] p.receive(SR:PST(PT(all component.running))) {} //^In guard operation// //^In receive statement// //^warning\: State of component// + + /* TEMPLATE_REFD @fuzzy */ + [] p.receive(SR:PST(ftfp)) {} //^In guard operation// //^In receive statement// //^warning\: Fuzzy parameter// + + /* INDEXED_TEMPLATE_LIST */ + [] p.receive(RoI: {[0]:=0,[2]:=(0,1,2)}) {} + [] p.receive(RoI: {[0]:=0,[2]:=(0,1,fi())}) {} //^In guard operation// //^In receive statement// //^warning\: Function invocation// + + /* SUBSET_MATCH */ + [] p.receive(SoI: subset(0,1,2,3)) {} + [] p.receive(SoI: subset(0,fi(),2,3)) {} //^In guard operation// //^In receive statement// //^warning\: Function invocation// + + /* VALUE_RANGE */ + [] p.receive(RoI: {(0..10)}) {} + [] p.receive(RoI: {(0..fi())}) {} //^In guard operation// //^In receive statement// //^warning\: Function invocation// + [] p.receive(RoI: {(fi()..10)}) {} //^In guard operation// //^In receive statement// //^warning\: Function invocation// + + /* TEMPLATE_CONCAT */ + // [] p.receive(SoI: {0,2} & {1}) {} + } + } +} + + +// get_reference()->get_refd_assignment()->chk_immutability(get_reference()->get_dispname().c_str()); \ No newline at end of file diff --git a/function_test/Semantic_Analyser/invoking_function_from_specific_places/Makefile b/function_test/Semantic_Analyser/invoking_function_from_specific_places/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..e33989b4433214b462838356b12c8b72f1277a7f --- /dev/null +++ b/function_test/Semantic_Analyser/invoking_function_from_specific_places/Makefile @@ -0,0 +1,12 @@ +############################################################################## +# Copyright (c) 2000-2018 Ericsson Telecom AB +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html +# +# Contributors: +# Aron Simon +# +############################################################################## +include ../common.mk diff --git a/function_test/Semantic_Analyser/invoking_function_from_specific_places/t b/function_test/Semantic_Analyser/invoking_function_from_specific_places/t new file mode 100644 index 0000000000000000000000000000000000000000..3a4b58ec16cf2f1390a36c7a92f8823e3b94b425 --- /dev/null +++ b/function_test/Semantic_Analyser/invoking_function_from_specific_places/t @@ -0,0 +1,9 @@ +#!/usr/bin/perl +# note this is called through "perl -w" +use strict; + +my $self = $0; +$self =~ s!/t!!; + +exec('make check --no-print-directory -s -C ' . $self); +