Commit 48e82d1f authored by Lev Walkin's avatar Lev Walkin

removed gcc-7 warnings

parent b2d896e4
...@@ -328,10 +328,13 @@ main(int ac, char **av) { ...@@ -328,10 +328,13 @@ main(int ac, char **av) {
ret = asn1f_process(asn, asn1_fixer_flags, ret = asn1f_process(asn, asn1_fixer_flags,
NULL /* default fprintf(stderr) */); NULL /* default fprintf(stderr) */);
switch(ret) { switch(ret) {
case 1:
if(!warnings_as_errors) /* Fall through */
case 0: case 0:
break; /* All clear */ break; /* All clear */
case 1:
if(!warnings_as_errors) {
break;
}
/* Fall through */
case -1: case -1:
exit_code = EX_DATAERR; /* Fatal failure */ exit_code = EX_DATAERR; /* Fatal failure */
goto cleanup; goto cleanup;
...@@ -467,7 +470,7 @@ importStandardModules(asn1p_t *asn, const char *skeletons_dir) { ...@@ -467,7 +470,7 @@ importStandardModules(asn1p_t *asn, const char *skeletons_dir) {
/* /*
* Print the usage screen and exit(EX_USAGE). * Print the usage screen and exit(EX_USAGE).
*/ */
static void static void __attribute__((noreturn))
usage(const char *av0) { usage(const char *av0) {
/* clang-format off */ /* clang-format off */
fprintf(stderr, fprintf(stderr,
......
...@@ -173,7 +173,6 @@ process_line(const char *fname, char *line, int lineno) { ...@@ -173,7 +173,6 @@ process_line(const char *fname, char *line, int lineno) {
ber_tlv_len_t tlv_len; ber_tlv_len_t tlv_len;
ber_tlv_len_t opt_tl_len; /* optional TL length */ ber_tlv_len_t opt_tl_len; /* optional TL length */
ssize_t ret; ssize_t ret;
(void)fname;
/* Skip the whitespace */ /* Skip the whitespace */
for(; *line == ' ' || *line == '\t'; line++) for(; *line == ' ' || *line == '\t'; line++)
...@@ -184,11 +183,15 @@ process_line(const char *fname, char *line, int lineno) { ...@@ -184,11 +183,15 @@ process_line(const char *fname, char *line, int lineno) {
switch(*op) { switch(*op) {
case '<': /* That's what we want! A tag opening */ case '<': /* That's what we want! A tag opening */
break; break;
case '-': /* This is a comment (dash-dash) */ case '\r':
if(op[1] == *op) case '\r':
case '\n': case '\n':
case '#': /* This is a comment */ case '#': /* This is a comment */
return 0; return 0;
case '-': /* This is a comment (dash-dash) */
if(op[1] == '-') {
return 0;
}
/* Fall through */
default: default:
fprintf(stderr, "%s: Missing '<' after whitespace at line %d\n", fname, fprintf(stderr, "%s: Missing '<' after whitespace at line %d\n", fname,
lineno); lineno);
......
...@@ -2333,6 +2333,7 @@ try_inline_default(arg_t *arg, asn1p_expr_t *expr, int out) { ...@@ -2333,6 +2333,7 @@ try_inline_default(arg_t *arg, asn1p_expr_t *expr, int out) {
switch(etype) { switch(etype) {
case ASN_BASIC_BOOLEAN: case ASN_BASIC_BOOLEAN:
fits_long = 1; fits_long = 1;
/* Fall through */
case ASN_BASIC_INTEGER: case ASN_BASIC_INTEGER:
case ASN_BASIC_ENUMERATED: case ASN_BASIC_ENUMERATED:
if(expr->marker.default_value == NULL if(expr->marker.default_value == NULL
...@@ -3439,11 +3440,13 @@ static int compar_cameo(const void *ap, const void *bp) { ...@@ -3439,11 +3440,13 @@ static int compar_cameo(const void *ap, const void *bp) {
&atag, AFT_IMAGINARY_ANY | AFT_CANON_CHOICE))) &atag, AFT_IMAGINARY_ANY | AFT_CANON_CHOICE)))
return 1; return 1;
if(WITH_MODULE_NAMESPACE(b->expr->module, expr_ns, if(WITH_MODULE_NAMESPACE(
asn1f_fetch_outmost_tag( b->expr->module, expr_ns,
arg->asn, expr_ns, b->expr->module, b->expr, asn1f_fetch_outmost_tag(arg->asn, expr_ns, b->expr->module, b->expr,
&btag, AFT_IMAGINARY_ANY | AFT_CANON_CHOICE))) &btag,
AFT_IMAGINARY_ANY | AFT_CANON_CHOICE))) {
return -1; return -1;
}
if(atag.tag_class < btag.tag_class) if(atag.tag_class < btag.tag_class)
return -1; return -1;
......
...@@ -463,8 +463,10 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) { ...@@ -463,8 +463,10 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) {
/* Special case for unsigned */ /* Special case for unsigned */
if(!(arg->flags & A1C_USE_WIDE_TYPES) && left.type == ARE_VALUE if(!(arg->flags & A1C_USE_WIDE_TYPES) && left.type == ARE_VALUE
&& left.value >= 0 && left.value <= 2147483647 && right.type == ARE_MAX) && left.value >= 0 && left.value <= 2147483647
&& right.type == ARE_MAX) {
return FL_FITS_UNSIGN; return FL_FITS_UNSIGN;
}
if(left.type == ARE_VALUE if(left.type == ARE_VALUE
&& left.value >= 0 && left.value >= 0
&& right.type == ARE_VALUE && right.type == ARE_VALUE
......
...@@ -711,8 +711,9 @@ include_type_to_pdu_collection(arg_t *arg) { ...@@ -711,8 +711,9 @@ include_type_to_pdu_collection(arg_t *arg) {
return 0; return 0;
/* Parameterized types can't serve as PDU's without instantiation. */ /* Parameterized types can't serve as PDU's without instantiation. */
if(arg->expr->lhs_params) if(arg->expr->lhs_params) {
return 0; return 0;
}
if((arg->flags & A1C_PDU_ALL) if((arg->flags & A1C_PDU_ALL)
|| ((arg->flags & A1C_PDU_AUTO) && !arg->expr->_type_referenced) || ((arg->flags & A1C_PDU_AUTO) && !arg->expr->_type_referenced)
......
...@@ -112,6 +112,7 @@ asn1f_fix_bit_string_value(arg_t *arg, asn1p_expr_t *ttype) { ...@@ -112,6 +112,7 @@ asn1f_fix_bit_string_value(arg_t *arg, asn1p_expr_t *ttype) {
break; break;
} }
/* Fall through: remove trailing zero bits */ /* Fall through: remove trailing zero bits */
/* Fall through */
case ATV_BITVECTOR: case ATV_BITVECTOR:
asn1f_BS_remove_trailing_zero_bits(expr->value); asn1f_BS_remove_trailing_zero_bits(expr->value);
break; break;
......
...@@ -135,6 +135,7 @@ asn1f_fix_constr_ext(arg_t *arg) { ...@@ -135,6 +135,7 @@ asn1f_fix_constr_ext(arg_t *arg) {
case 3: case 3:
FATAL("Third extension marker " FATAL("Third extension marker "
"is not allowed at line %d", v->_lineno); "is not allowed at line %d", v->_lineno);
/* Fall through */
default: default:
r_value = -1; r_value = -1;
} }
......
...@@ -1040,8 +1040,9 @@ asn1constraint_compute_constraint_range( ...@@ -1040,8 +1040,9 @@ asn1constraint_compute_constraint_range(
range->not_OER_visible = 1; range->not_OER_visible = 1;
if(!ct if(!ct
|| (range->not_OER_visible && (cpr_flags & CPR_strict_OER_visibility))) || (range->not_OER_visible && (cpr_flags & CPR_strict_OER_visibility))) {
return range; return range;
}
switch(ct->type) { switch(ct->type) {
case ACT_EL_VALUE: case ACT_EL_VALUE:
......
...@@ -125,8 +125,7 @@ _asn1f_parse_object_cb(const uint8_t *buf, size_t size, void *keyp) { ...@@ -125,8 +125,7 @@ _asn1f_parse_object_cb(const uint8_t *buf, size_t size, void *keyp) {
ret = _asn1f_parse_class_object_data(arg, eclass, row, eclass->with_syntax, ret = _asn1f_parse_class_object_data(arg, eclass, row, eclass->with_syntax,
buf, buf + size, 0, 0, key->sequence); buf, buf + size, 0, 0, key->sequence);
if(ret) { if(ret) {
LOG((int)(ret < 0), LOG(ret, "Cannot parse %s of CLASS %s found at line %d",
"Cannot parse %s of CLASS %s found at line %d",
expr->Identifier, eclass->Identifier, expr->_lineno); expr->Identifier, eclass->Identifier, expr->_lineno);
asn1p_ioc_row_delete(row); asn1p_ioc_row_delete(row);
return ret; return ret;
......
...@@ -83,12 +83,18 @@ typedef struct arg_s { ...@@ -83,12 +83,18 @@ typedef struct arg_s {
* Merge the return value of the called function with the already * Merge the return value of the called function with the already
* partially computed return value of the current function. * partially computed return value of the current function.
*/ */
#define RET2RVAL(ret,rv) do { \ #define RET2RVAL(ret, rv) \
do { \
int __ret = ret; \ int __ret = ret; \
switch(__ret) { \ switch(__ret) { \
case 0: break; \ case 0: \
case 1: if(rv) break; \ break; \
case -1: rv = __ret; break; \ case 1: \
if(rv) break; \
/* Fall through */ \
case -1: \
rv = __ret; \
break; \
default: \ default: \
assert(__ret >= -1 && __ret <= 1); \ assert(__ret >= -1 && __ret <= 1); \
rv = -1; \ rv = -1; \
......
...@@ -66,6 +66,7 @@ asn1p_value_compare(const asn1p_value_t *a, const asn1p_value_t *b) { ...@@ -66,6 +66,7 @@ asn1p_value_compare(const asn1p_value_t *a, const asn1p_value_t *b) {
!= 0) { != 0) {
return -1; return -1;
} }
return 0;
case ATV_VALUESET: case ATV_VALUESET:
return asn1p_constraint_compare(a->value.constraint, return asn1p_constraint_compare(a->value.constraint,
b->value.constraint); b->value.constraint);
......
...@@ -417,11 +417,11 @@ asn1print_constraint(const asn1p_constraint_t *ct, enum asn1print_flags flags) { ...@@ -417,11 +417,11 @@ asn1print_constraint(const asn1p_constraint_t *ct, enum asn1print_flags flags) {
safe_printf("PATTERN "); safe_printf("PATTERN ");
asn1print_value(ct->value, flags); asn1print_value(ct->value, flags);
break; break;
case ACT_CA_SET: symno++; case ACT_CA_SET: symno++; /* Fall through */
case ACT_CA_CRC: symno++; case ACT_CA_CRC: symno++; /* Fall through */
case ACT_CA_CSV: symno++; case ACT_CA_CSV: symno++; /* Fall through */
case ACT_CA_UNI: symno++; case ACT_CA_UNI: symno++; /* Fall through */
case ACT_CA_INT: symno++; case ACT_CA_INT: symno++; /* Fall through */
case ACT_CA_EXC: case ACT_CA_EXC:
{ {
char *symtable[] = { " EXCEPT ", " ^ ", " | ", ",", char *symtable[] = { " EXCEPT ", " ^ ", " | ", ",",
......
...@@ -507,8 +507,8 @@ INTEGER__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr, ...@@ -507,8 +507,8 @@ INTEGER__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
* to avoid rewriting all the tests at once. * to avoid rewriting all the tests at once.
*/ */
ASN_DEBUG("INTEGER exceeds long range"); ASN_DEBUG("INTEGER exceeds long range");
/* Fall through */
} }
/* Fall through */
case ASN_STRTOX_ERROR_RANGE: case ASN_STRTOX_ERROR_RANGE:
ASN_DEBUG("INTEGER decode %s hit range limit", td->name); ASN_DEBUG("INTEGER decode %s hit range limit", td->name);
return XPBD_DECODER_LIMIT; return XPBD_DECODER_LIMIT;
......
...@@ -443,6 +443,7 @@ SEQUENCE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, ...@@ -443,6 +443,7 @@ SEQUENCE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
phase3: phase3:
ctx->phase = 3; ctx->phase = 3;
/* Fall through */
case 3: /* 00 and other tags expected */ case 3: /* 00 and other tags expected */
case 4: /* only 00's expected */ case 4: /* only 00's expected */
......
...@@ -310,7 +310,7 @@ SET_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, ...@@ -310,7 +310,7 @@ SET_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
ADVANCE(rval.consumed); ADVANCE(rval.consumed);
RETURN(RC_WMORE); RETURN(RC_WMORE);
} }
/* Fail through */ /* Fall through */
case RC_FAIL: /* Fatal error */ case RC_FAIL: /* Fatal error */
RETURN(RC_FAIL); RETURN(RC_FAIL);
} /* switch(rval) */ } /* switch(rval) */
...@@ -381,6 +381,7 @@ SET_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, ...@@ -381,6 +381,7 @@ SET_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
} }
ctx->phase = 5; ctx->phase = 5;
/* Fall through */
case 5: case 5:
/* Check that all mandatory elements are present. */ /* Check that all mandatory elements are present. */
if(!_SET_is_populated(td, st)) if(!_SET_is_populated(td, st))
......
...@@ -320,13 +320,13 @@ check_ber_857_encoding(int base, int sign, int scaling_factor, int exponent, int ...@@ -320,13 +320,13 @@ check_ber_857_encoding(int base, int sign, int scaling_factor, int exponent, int
*b |= ((explen - 1) & 0x03); /* 8.5.7.4 */ *b |= ((explen - 1) & 0x03); /* 8.5.7.4 */
b++; b++;
switch(explen) { switch(explen) {
case 2: *b++ = (int8_t)(exponent >> 8); case 2: *b++ = (int8_t)(exponent >> 8); /* Fall through */
case 1: *b++ = (int8_t)exponent; case 1: *b++ = (int8_t)exponent; /* Fall through */
} }
switch(mantlen) { switch(mantlen) {
case 3: *b++ = (mantissa >> 16) & 0xff; case 3: *b++ = (mantissa >> 16) & 0xff; /* Fall through */
case 2: *b++ = (mantissa >> 8) & 0xff; case 2: *b++ = (mantissa >> 8) & 0xff; /* Fall through */
case 1: *b++ = (mantissa & 0xff); case 1: *b++ = (mantissa & 0xff); /* Fall through */
} }
verify = (sign ? -1.0 : 1.0) * ldexp(mantissa, exponent * baseF + scaling_factor); verify = (sign ? -1.0 : 1.0) * ldexp(mantissa, exponent * baseF + scaling_factor);
......
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