Commit b3db6647 authored by Kristof Szabados's avatar Kristof Szabados
Browse files

When there are only a few enumeration value we shouldn't use default.


This way should we need to add +1 element to the enumeration the static analyzers will point out all the location where it might need to be used.
Signed-off-by: Kristof Szabados's avatarkristof <Kristof.Szabados@ericsson.com>
parent 8a8078b3
......@@ -1022,7 +1022,7 @@ CHARACTER_STRING_identification_template::CHARACTER_STRING_identification_templa
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of union type CHARACTER STRING.identification from an unbound optional field.");
}
}
......@@ -1063,7 +1063,7 @@ CHARACTER_STRING_identification_template& CHARACTER_STRING_identification_templa
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of union type CHARACTER STRING.identification.");
}
return *this;
......@@ -2029,7 +2029,7 @@ CHARACTER_STRING_identification_syntaxes_template::CHARACTER_STRING_identificati
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of type CHARACTER STRING.identification.syntaxes from an unbound optional field.");
}
}
......@@ -2070,7 +2070,7 @@ CHARACTER_STRING_identification_syntaxes_template& CHARACTER_STRING_identificati
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of type CHARACTER STRING.identification.syntaxes.");
}
return *this;
......@@ -2763,7 +2763,7 @@ CHARACTER_STRING_identification_context__negotiation_template::CHARACTER_STRING_
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of type CHARACTER STRING.identification.context-negotiation from an unbound optional field.");
}
}
......@@ -2804,7 +2804,7 @@ CHARACTER_STRING_identification_context__negotiation_template& CHARACTER_STRING_
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of type CHARACTER STRING.identification.context-negotiation.");
}
return *this;
......@@ -3647,7 +3647,7 @@ CHARACTER_STRING_template::CHARACTER_STRING_template(const OPTIONAL<CHARACTER_ST
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of type CHARACTER STRING from an unbound optional field.");
}
}
......@@ -3688,7 +3688,7 @@ CHARACTER_STRING_template& CHARACTER_STRING_template::operator=(const OPTIONAL<C
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of type CHARACTER STRING.");
}
return *this;
......
......@@ -1017,7 +1017,7 @@ EMBEDDED_PDV_identification_template::EMBEDDED_PDV_identification_template(const
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of union type EMBEDDED PDV.identification from an unbound optional field.");
}
}
......@@ -1058,7 +1058,7 @@ EMBEDDED_PDV_identification_template& EMBEDDED_PDV_identification_template::oper
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of union type EMBEDDED PDV.identification.");
}
return *this;
......@@ -2033,7 +2033,7 @@ EMBEDDED_PDV_identification_syntaxes_template::EMBEDDED_PDV_identification_synta
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of type EMBEDDED PDV.identification.syntaxes from an unbound optional field.");
}
}
......@@ -2074,7 +2074,7 @@ EMBEDDED_PDV_identification_syntaxes_template& EMBEDDED_PDV_identification_synta
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of type EMBEDDED PDV.identification.syntaxes.");
}
return *this;
......@@ -2775,7 +2775,7 @@ EMBEDDED_PDV_identification_context__negotiation_template::EMBEDDED_PDV_identifi
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of type EMBEDDED PDV.identification.context-negotiation from an unbound optional field.");
}
}
......@@ -2816,7 +2816,7 @@ EMBEDDED_PDV_identification_context__negotiation_template& EMBEDDED_PDV_identifi
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of type EMBEDDED PDV.identification.context-negotiation.");
}
return *this;
......@@ -3664,7 +3664,7 @@ EMBEDDED_PDV_template::EMBEDDED_PDV_template(const OPTIONAL<EMBEDDED_PDV>& other
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of type EMBEDDED PDV from an unbound optional field.");
}
}
......@@ -3705,7 +3705,7 @@ EMBEDDED_PDV_template& EMBEDDED_PDV_template::operator=(const OPTIONAL<EMBEDDED_
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of type EMBEDDED PDV.");
}
return *this;
......
......@@ -1412,7 +1412,7 @@ EXTERNAL_identification_template::EXTERNAL_identification_template(const OPTIONA
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of union type EXTERNAL.identification from an unbound optional field.");
}
}
......@@ -1453,7 +1453,7 @@ EXTERNAL_identification_template& EXTERNAL_identification_template::operator=(co
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of union type EXTERNAL.identification.");
}
return *this;
......@@ -2335,7 +2335,7 @@ EXTERNAL_identification_syntaxes_template::EXTERNAL_identification_syntaxes_temp
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of type EXTERNAL.identification.syntaxes from an unbound optional field.");
}
}
......@@ -2376,7 +2376,7 @@ EXTERNAL_identification_syntaxes_template& EXTERNAL_identification_syntaxes_temp
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of type EXTERNAL.identification.syntaxes.");
}
return *this;
......@@ -2982,7 +2982,7 @@ EXTERNAL_identification_context__negotiation_template::EXTERNAL_identification_c
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of type EXTERNAL.identification.context-negotiation from an unbound optional field.");
}
}
......@@ -3023,7 +3023,7 @@ EXTERNAL_identification_context__negotiation_template& EXTERNAL_identification_c
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of type EXTERNAL.identification.context-negotiation.");
}
return *this;
......@@ -3753,7 +3753,7 @@ EXTERNAL_template::EXTERNAL_template(const OPTIONAL<EXTERNAL>& other_value)
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of type EXTERNAL from an unbound optional field.");
}
}
......@@ -3794,7 +3794,7 @@ EXTERNAL_template& EXTERNAL_template::operator=(const OPTIONAL<EXTERNAL>& other_
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of type EXTERNAL.");
}
return *this;
......
......@@ -389,7 +389,7 @@ ASN_NULL_template::ASN_NULL_template(const OPTIONAL<ASN_NULL>& other_value)
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a template of ASN.1 NULL type from an unbound "
"optional field.");
}
......@@ -441,7 +441,7 @@ ASN_NULL_template& ASN_NULL_template::operator=
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a template of "
"ASN.1 NULL type.");
}
......
......@@ -1629,7 +1629,7 @@ BITSTRING_template::BITSTRING_template(const OPTIONAL<BITSTRING>& other_value)
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a bitstring template from an unbound optional field.");
}
}
......@@ -1692,7 +1692,7 @@ BITSTRING_template& BITSTRING_template::operator=
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a bitstring "
"template.");
}
......
......@@ -875,7 +875,7 @@ BOOLEAN_template::BOOLEAN_template(const OPTIONAL<BOOLEAN>& other_value)
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a boolean template from an unbound optional field.");
}
}
......@@ -929,7 +929,7 @@ BOOLEAN_template& BOOLEAN_template::operator=
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a boolean "
"template.");
}
......
......@@ -2216,7 +2216,7 @@ CHARSTRING_template::CHARSTRING_template(const OPTIONAL<CHARSTRING>& other_value
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a charstring template from an unbound optional "
"field.");
}
......@@ -2287,7 +2287,7 @@ CHARSTRING_template& CHARSTRING_template::operator=
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a charstring "
"template.");
}
......
......@@ -1268,7 +1268,7 @@ FLOAT_template::FLOAT_template(const OPTIONAL<FLOAT>& other_value)
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a float template from an unbound optional field.");
}
}
......@@ -1321,7 +1321,7 @@ FLOAT_template& FLOAT_template::operator=(const OPTIONAL<FLOAT>& other_value)
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a float template.");
}
return *this;
......
......@@ -1513,7 +1513,7 @@ HEXSTRING_template::HEXSTRING_template(const OPTIONAL<HEXSTRING>& other_value)
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a hexstring template from an unbound optional field.");
}
}
......@@ -1581,7 +1581,7 @@ HEXSTRING_template& HEXSTRING_template::operator=(
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a hexstring "
"template.");
}
......
......@@ -2001,7 +2001,7 @@ INTEGER_template::INTEGER_template(const OPTIONAL<INTEGER>& other_value)
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating an integer template from an unbound optional field.");
}
}
......@@ -2064,7 +2064,7 @@ INTEGER_template& INTEGER_template::operator=
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to an integer "
"template.");
}
......
......@@ -721,7 +721,7 @@ OBJID_template::OBJID_template(const OPTIONAL<OBJID>& other_value)
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating an objid template from an unbound optional field.");
}
}
......@@ -766,7 +766,7 @@ OBJID_template& OBJID_template::operator=(const OPTIONAL<OBJID>& other_value)
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to an objid template.");
}
return *this;
......
......@@ -1750,7 +1750,7 @@ OCTETSTRING_template::OCTETSTRING_template
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating an octetstring template from an unbound optional "
"field.");
}
......@@ -1823,7 +1823,7 @@ OCTETSTRING_template& OCTETSTRING_template::operator=
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to an octetstring "
"template.");
}
......
......@@ -440,7 +440,7 @@ OPTIONAL<T_type>::OPTIONAL(const OPTIONAL& other_value)
break;
case OPTIONAL_OMIT:
break;
default:
case OPTIONAL_UNBOUND:
break;
}
}
......@@ -458,7 +458,7 @@ OPTIONAL<T_type>::OPTIONAL(const OPTIONAL<T_tmp>& other_value)
break;
case OPTIONAL_OMIT:
break;
default:
case OPTIONAL_UNBOUND:
break;
}
}
......@@ -510,7 +510,7 @@ OPTIONAL<T_type>& OPTIONAL<T_type>::operator=(const OPTIONAL& other_value)
case OPTIONAL_OMIT:
if (&other_value != this) set_to_omit();
break;
default:
case OPTIONAL_UNBOUND:
clean_up();
break;
}
......@@ -535,7 +535,7 @@ OPTIONAL<T_type>::operator=(const OPTIONAL<T_tmp>& other_value)
case OPTIONAL_OMIT:
set_to_omit();
break;
default:
case OPTIONAL_UNBOUND:
clean_up();
break;
}
......@@ -622,7 +622,7 @@ boolean OPTIONAL<T_type>::is_equal(const T_tmp& other_value) const
return *optional_value == other_value;
case OPTIONAL_OMIT:
return FALSE;
default:
case OPTIONAL_UNBOUND:
TTCN_error("The left operand of comparison is an unbound optional value.");
}
return FALSE;
......@@ -669,7 +669,7 @@ boolean OPTIONAL<T_type>::is_bound() const
case OPTIONAL_PRESENT:
case OPTIONAL_OMIT:
return TRUE;
default:
case OPTIONAL_UNBOUND:
if (NULL != optional_value) {
return optional_value->is_bound();
}
......@@ -684,7 +684,7 @@ boolean OPTIONAL<T_type>::is_present() const
case OPTIONAL_PRESENT:
return TRUE;
case OPTIONAL_OMIT:
default:
case OPTIONAL_UNBOUND:
if (NULL != optional_value) {
return optional_value->is_bound();
}
......@@ -706,7 +706,7 @@ boolean OPTIONAL<T_type>::ispresent() const
}
#endif
return FALSE;
default:
case OPTIONAL_UNBOUND:
#ifdef TITAN_RUNTIME_2
if (NULL != optional_value && optional_value->is_bound()) {
return TRUE;
......@@ -746,7 +746,7 @@ void OPTIONAL<T_type>::log() const
case OPTIONAL_OMIT:
TTCN_Logger::log_event_str("omit");
break;
default:
case OPTIONAL_UNBOUND:
TTCN_Logger::log_event_unbound();
break;
}
......@@ -780,7 +780,7 @@ Module_Param* OPTIONAL<T_type>::get_param(Module_Param_Name& param_name) const
return optional_value->get_param(param_name);
case OPTIONAL_OMIT:
return new Module_Param_Omit();
default:
case OPTIONAL_UNBOUND:
return new Module_Param_Unbound();
}
}
......@@ -801,7 +801,7 @@ void OPTIONAL<T_type>::encode_text(Text_Buf& text_buf) const
text_buf.push_int((RInt)TRUE);
optional_value->encode_text(text_buf);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Text encoder: Encoding an unbound optional value.");
}
}
......@@ -827,7 +827,7 @@ int OPTIONAL<T_type>::JSON_encode(const TTCN_Typedescriptor_t& p_td, JSON_Tokeni
return optional_value->JSON_encode(p_td, p_tok);
case OPTIONAL_OMIT:
return p_tok.put_next_token(JSON_TOKEN_LITERAL_NULL, NULL);
default:
case OPTIONAL_UNBOUND:
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND,
"Encoding an unbound optional value.");
return -1;
......@@ -845,7 +845,7 @@ int OPTIONAL<T_type>::JSON_encode_negtest(const Erroneous_descriptor_t* p_err_de
return optional_value->JSON_encode_negtest(p_err_descr, p_td, p_tok);
case OPTIONAL_OMIT:
return p_tok.put_next_token(JSON_TOKEN_LITERAL_NULL, NULL);
default:
case OPTIONAL_UNBOUND:
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND,
"Encoding an unbound optional value.");
return -1;
......@@ -942,7 +942,7 @@ OPTIONAL<T_type>::BER_encode_TLV(const TTCN_Typedescriptor_t& p_td,
return optional_value->BER_encode_TLV(p_td, p_coding);
case OPTIONAL_OMIT:
return ASN_BER_TLV_t::construct();
default:
case OPTIONAL_UNBOUND:
return ASN_BER_V2TLV(BER_encode_chk_bound(FALSE), p_td, p_coding);
}
}
......@@ -963,7 +963,7 @@ OPTIONAL<T_type>::BER_encode_TLV_negtest(const Erroneous_descriptor_t* p_err_des
return optional_value->BER_encode_TLV_negtest(p_err_descr, p_td, p_coding);
case OPTIONAL_OMIT:
return ASN_BER_TLV_t::construct();
default:
case OPTIONAL_UNBOUND:
return ASN_BER_V2TLV(BER_encode_chk_bound(FALSE), p_td, p_coding);
}
}
......@@ -993,7 +993,7 @@ OPTIONAL<T_type>::XER_encode(const XERdescriptor_t& p_td, TTCN_Buffer& buf, unsi
return optional_value->XER_encode(p_td, buf, flavor, flavor2, indent, emb_val);
case OPTIONAL_OMIT:
return 0; // nothing to do !
default:
case OPTIONAL_UNBOUND:
TTCN_EncDec_ErrorContext::error(
TTCN_EncDec::ET_UNBOUND, "Encoding an unbound optional value.");
return 0;
......@@ -1012,7 +1012,7 @@ OPTIONAL<T_type>::XER_encode_negtest(const Erroneous_descriptor_t* p_err_descr,
return optional_value->XER_encode_negtest(p_err_descr, p_td, buf, flavor, flavor2, indent, emb_val);
case OPTIONAL_OMIT:
return 0; // nothing to do !
default:
case OPTIONAL_UNBOUND:
TTCN_EncDec_ErrorContext::error(
TTCN_EncDec::ET_UNBOUND, "Encoding an unbound optional value.");
return 0;
......@@ -1141,7 +1141,7 @@ char ** OPTIONAL<T_type>::collect_ns(const XERdescriptor_t& p_td, size_t& num, b
def_ns = FALSE;
num = 0;
return 0;
default:
case OPTIONAL_UNBOUND:
TTCN_EncDec_ErrorContext::error(
TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
return 0;
......
......@@ -3924,7 +3924,7 @@ UNIVERSAL_CHARSTRING_template::UNIVERSAL_CHARSTRING_template
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a universal charstring template from an unbound "
"optional field.");
}
......@@ -3941,7 +3941,7 @@ UNIVERSAL_CHARSTRING_template::UNIVERSAL_CHARSTRING_template
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a universal charstring template from an unbound "
"optional field.");
}
......@@ -4043,7 +4043,7 @@ UNIVERSAL_CHARSTRING_template& UNIVERSAL_CHARSTRING_template::operator=
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a universal "
"charstring template.");
}
......@@ -4062,7 +4062,7 @@ UNIVERSAL_CHARSTRING_template& UNIVERSAL_CHARSTRING_template::operator=
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a universal "
"charstring template.");
}
......
......@@ -514,7 +514,7 @@ VERDICTTYPE_template::VERDICTTYPE_template
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Creating a verdict template from an unbound optional field.");
}
}
......@@ -568,7 +568,7 @@ VERDICTTYPE_template& VERDICTTYPE_template::operator=
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
case OPTIONAL_UNBOUND:
TTCN_error("Assignment of an unbound optional field to a verdict "
"template.");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment