removed gcc-7 warnings
diff --git a/asn1c/asn1c.c b/asn1c/asn1c.c
index aecf111..b3fc220 100644
--- a/asn1c/asn1c.c
+++ b/asn1c/asn1c.c
@@ -328,10 +328,13 @@
ret = asn1f_process(asn, asn1_fixer_flags,
NULL /* default fprintf(stderr) */);
switch(ret) {
- case 1:
- if(!warnings_as_errors) /* Fall through */
- case 0:
+ case 0:
break; /* All clear */
+ case 1:
+ if(!warnings_as_errors) {
+ break;
+ }
+ /* Fall through */
case -1:
exit_code = EX_DATAERR; /* Fatal failure */
goto cleanup;
@@ -467,7 +470,7 @@
/*
* Print the usage screen and exit(EX_USAGE).
*/
-static void
+static void __attribute__((noreturn))
usage(const char *av0) {
/* clang-format off */
fprintf(stderr,
diff --git a/asn1c/enber.c b/asn1c/enber.c
index ec06b5c..3aeab6c 100644
--- a/asn1c/enber.c
+++ b/asn1c/enber.c
@@ -173,7 +173,6 @@
ber_tlv_len_t tlv_len;
ber_tlv_len_t opt_tl_len; /* optional TL length */
ssize_t ret;
- (void)fname;
/* Skip the whitespace */
for(; *line == ' ' || *line == '\t'; line++)
@@ -184,11 +183,15 @@
switch(*op) {
case '<': /* That's what we want! A tag opening */
break;
- case '-': /* This is a comment (dash-dash) */
- if(op[1] == *op) case '\r':
+ case '\r':
case '\n':
case '#': /* This is a comment */
return 0;
+ case '-': /* This is a comment (dash-dash) */
+ if(op[1] == '-') {
+ return 0;
+ }
+ /* Fall through */
default:
fprintf(stderr, "%s: Missing '<' after whitespace at line %d\n", fname,
lineno);
diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c
index be04e9f..bebd413 100644
--- a/libasn1compiler/asn1c_C.c
+++ b/libasn1compiler/asn1c_C.c
@@ -2333,6 +2333,7 @@
switch(etype) {
case ASN_BASIC_BOOLEAN:
fits_long = 1;
+ /* Fall through */
case ASN_BASIC_INTEGER:
case ASN_BASIC_ENUMERATED:
if(expr->marker.default_value == NULL
@@ -3439,13 +3440,15 @@
&atag, AFT_IMAGINARY_ANY | AFT_CANON_CHOICE)))
return 1;
- if(WITH_MODULE_NAMESPACE(b->expr->module, expr_ns,
- asn1f_fetch_outmost_tag(
- arg->asn, expr_ns, b->expr->module, b->expr,
- &btag, AFT_IMAGINARY_ANY | AFT_CANON_CHOICE)))
+ if(WITH_MODULE_NAMESPACE(
+ b->expr->module, expr_ns,
+ asn1f_fetch_outmost_tag(arg->asn, expr_ns, b->expr->module, b->expr,
+ &btag,
+ AFT_IMAGINARY_ANY | AFT_CANON_CHOICE))) {
return -1;
+ }
- if(atag.tag_class < btag.tag_class)
+ if(atag.tag_class < btag.tag_class)
return -1;
if(atag.tag_class > btag.tag_class)
return 1;
diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c
index c36f96f..8cfafc0 100644
--- a/libasn1compiler/asn1c_misc.c
+++ b/libasn1compiler/asn1c_misc.c
@@ -463,9 +463,11 @@
/* Special case for unsigned */
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;
- if(left.type == ARE_VALUE
+ }
+ if(left.type == ARE_VALUE
&& left.value >= 0
&& right.type == ARE_VALUE
&& right.value > 2147483647
diff --git a/libasn1compiler/asn1c_save.c b/libasn1compiler/asn1c_save.c
index 4bb192e..5fe1b37 100644
--- a/libasn1compiler/asn1c_save.c
+++ b/libasn1compiler/asn1c_save.c
@@ -711,8 +711,9 @@
return 0;
/* Parameterized types can't serve as PDU's without instantiation. */
- if(arg->expr->lhs_params)
+ if(arg->expr->lhs_params) {
return 0;
+ }
if((arg->flags & A1C_PDU_ALL)
|| ((arg->flags & A1C_PDU_AUTO) && !arg->expr->_type_referenced)
diff --git a/libasn1fix/asn1fix_bitstring.c b/libasn1fix/asn1fix_bitstring.c
index 007c6a5..e5f80cd 100644
--- a/libasn1fix/asn1fix_bitstring.c
+++ b/libasn1fix/asn1fix_bitstring.c
@@ -112,6 +112,7 @@
break;
}
/* Fall through: remove trailing zero bits */
+ /* Fall through */
case ATV_BITVECTOR:
asn1f_BS_remove_trailing_zero_bits(expr->value);
break;
diff --git a/libasn1fix/asn1fix_constr.c b/libasn1fix/asn1fix_constr.c
index 19e8bad..8f4331c 100644
--- a/libasn1fix/asn1fix_constr.c
+++ b/libasn1fix/asn1fix_constr.c
@@ -135,6 +135,7 @@
case 3:
FATAL("Third extension marker "
"is not allowed at line %d", v->_lineno);
+ /* Fall through */
default:
r_value = -1;
}
diff --git a/libasn1fix/asn1fix_crange.c b/libasn1fix/asn1fix_crange.c
index b983e49..4c9345d 100644
--- a/libasn1fix/asn1fix_crange.c
+++ b/libasn1fix/asn1fix_crange.c
@@ -1040,8 +1040,9 @@
range->not_OER_visible = 1;
if(!ct
- || (range->not_OER_visible && (cpr_flags & CPR_strict_OER_visibility)))
+ || (range->not_OER_visible && (cpr_flags & CPR_strict_OER_visibility))) {
return range;
+ }
switch(ct->type) {
case ACT_EL_VALUE:
diff --git a/libasn1fix/asn1fix_cws.c b/libasn1fix/asn1fix_cws.c
index 035ccf7..d2be70d 100644
--- a/libasn1fix/asn1fix_cws.c
+++ b/libasn1fix/asn1fix_cws.c
@@ -125,10 +125,9 @@
ret = _asn1f_parse_class_object_data(arg, eclass, row, eclass->with_syntax,
buf, buf + size, 0, 0, key->sequence);
if(ret) {
- LOG((int)(ret < 0),
- "Cannot parse %s of CLASS %s found at line %d",
- expr->Identifier, eclass->Identifier, expr->_lineno);
- asn1p_ioc_row_delete(row);
+ LOG(ret, "Cannot parse %s of CLASS %s found at line %d",
+ expr->Identifier, eclass->Identifier, expr->_lineno);
+ asn1p_ioc_row_delete(row);
return ret;
}
diff --git a/libasn1fix/asn1fix_internal.h b/libasn1fix/asn1fix_internal.h
index 4e13293..5fd7e76 100644
--- a/libasn1fix/asn1fix_internal.h
+++ b/libasn1fix/asn1fix_internal.h
@@ -83,17 +83,23 @@
* Merge the return value of the called function with the already
* partially computed return value of the current function.
*/
-#define RET2RVAL(ret,rv) do { \
- int __ret = ret; \
- switch(__ret) { \
- case 0: break; \
- case 1: if(rv) break; \
- case -1: rv = __ret; break; \
- default: \
- assert(__ret >= -1 && __ret <= 1); \
- rv = -1; \
- } \
- } while(0)
+#define RET2RVAL(ret, rv) \
+ do { \
+ int __ret = ret; \
+ switch(__ret) { \
+ case 0: \
+ break; \
+ case 1: \
+ if(rv) break; \
+ /* Fall through */ \
+ case -1: \
+ rv = __ret; \
+ break; \
+ default: \
+ assert(__ret >= -1 && __ret <= 1); \
+ rv = -1; \
+ } \
+ } while(0)
/*
* Temporary substitute module for the purposes of evaluating expression.
diff --git a/libasn1parser/asn1p_value.c b/libasn1parser/asn1p_value.c
index 9bd7563..957b9e4 100644
--- a/libasn1parser/asn1p_value.c
+++ b/libasn1parser/asn1p_value.c
@@ -66,6 +66,7 @@
!= 0) {
return -1;
}
+ return 0;
case ATV_VALUESET:
return asn1p_constraint_compare(a->value.constraint,
b->value.constraint);
diff --git a/libasn1print/asn1print.c b/libasn1print/asn1print.c
index e1e3e48..61b9528 100644
--- a/libasn1print/asn1print.c
+++ b/libasn1print/asn1print.c
@@ -417,11 +417,11 @@
safe_printf("PATTERN ");
asn1print_value(ct->value, flags);
break;
- case ACT_CA_SET: symno++;
- case ACT_CA_CRC: symno++;
- case ACT_CA_CSV: symno++;
- case ACT_CA_UNI: symno++;
- case ACT_CA_INT: symno++;
+ case ACT_CA_SET: symno++; /* Fall through */
+ case ACT_CA_CRC: symno++; /* Fall through */
+ case ACT_CA_CSV: symno++; /* Fall through */
+ case ACT_CA_UNI: symno++; /* Fall through */
+ case ACT_CA_INT: symno++; /* Fall through */
case ACT_CA_EXC:
{
char *symtable[] = { " EXCEPT ", " ^ ", " | ", ",",
diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c
index 165f440..6a914ea 100644
--- a/skeletons/INTEGER.c
+++ b/skeletons/INTEGER.c
@@ -497,21 +497,21 @@
/* FALL THROUGH */
case ST_DIGITS_TRAILSPACE:
/* The last symbol encountered was a digit. */
- switch(asn_strtoimax_lim(dec_value_start, &dec_value_end, &dec_value)) {
- case ASN_STRTOX_OK:
- if(dec_value >= LONG_MIN && dec_value <= LONG_MAX) {
- break;
- } else {
- /*
- * We model INTEGER on long for XER,
- * to avoid rewriting all the tests at once.
- */
- ASN_DEBUG("INTEGER exceeds long range");
- /* Fall through */
- }
- case ASN_STRTOX_ERROR_RANGE:
- ASN_DEBUG("INTEGER decode %s hit range limit", td->name);
- return XPBD_DECODER_LIMIT;
+ switch(asn_strtoimax_lim(dec_value_start, &dec_value_end, &dec_value)) {
+ case ASN_STRTOX_OK:
+ if(dec_value >= LONG_MIN && dec_value <= LONG_MAX) {
+ break;
+ } else {
+ /*
+ * We model INTEGER on long for XER,
+ * to avoid rewriting all the tests at once.
+ */
+ ASN_DEBUG("INTEGER exceeds long range");
+ }
+ /* Fall through */
+ case ASN_STRTOX_ERROR_RANGE:
+ ASN_DEBUG("INTEGER decode %s hit range limit", td->name);
+ return XPBD_DECODER_LIMIT;
case ASN_STRTOX_ERROR_INVAL:
case ASN_STRTOX_EXPECT_MORE:
case ASN_STRTOX_EXTRA_DATA:
diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c
index fb4d1ba..85df7a6 100644
--- a/skeletons/constr_SEQUENCE.c
+++ b/skeletons/constr_SEQUENCE.c
@@ -443,6 +443,7 @@
phase3:
ctx->phase = 3;
+ /* Fall through */
case 3: /* 00 and other tags expected */
case 4: /* only 00's expected */
diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c
index 4f0230c..994abb7 100644
--- a/skeletons/constr_SET.c
+++ b/skeletons/constr_SET.c
@@ -310,7 +310,7 @@
ADVANCE(rval.consumed);
RETURN(RC_WMORE);
}
- /* Fail through */
+ /* Fall through */
case RC_FAIL: /* Fatal error */
RETURN(RC_FAIL);
} /* switch(rval) */
@@ -381,6 +381,7 @@
}
ctx->phase = 5;
+ /* Fall through */
case 5:
/* Check that all mandatory elements are present. */
if(!_SET_is_populated(td, st))
diff --git a/tests/tests-skeletons/check-REAL.c b/tests/tests-skeletons/check-REAL.c
index 2e78063..e98684e 100644
--- a/tests/tests-skeletons/check-REAL.c
+++ b/tests/tests-skeletons/check-REAL.c
@@ -320,13 +320,13 @@
*b |= ((explen - 1) & 0x03); /* 8.5.7.4 */
b++;
switch(explen) {
- case 2: *b++ = (int8_t)(exponent >> 8);
- case 1: *b++ = (int8_t)exponent;
+ case 2: *b++ = (int8_t)(exponent >> 8); /* Fall through */
+ case 1: *b++ = (int8_t)exponent; /* Fall through */
}
switch(mantlen) {
- case 3: *b++ = (mantissa >> 16) & 0xff;
- case 2: *b++ = (mantissa >> 8) & 0xff;
- case 1: *b++ = (mantissa & 0xff);
+ case 3: *b++ = (mantissa >> 16) & 0xff; /* Fall through */
+ case 2: *b++ = (mantissa >> 8) & 0xff; /* Fall through */
+ case 1: *b++ = (mantissa & 0xff); /* Fall through */
}
verify = (sign ? -1.0 : 1.0) * ldexp(mantissa, exponent * baseF + scaling_factor);