GCC versions lower than 7 don't support __attribute__((fallthrough)).
Use gcc_fallthrough() from system.h.
gcc/cobol/ChangeLog:
* cdf-copy.cc (esc): Use gcc_fallthrough() instead of
__attribute__((fallthrough)).
* lexio.cc (cdftext::free_form_reference_format): Likewise.
* parse.y: Likewise.
* scan_ante.h (typed_name): Likewise.
* util.cc (symbol_field_type_update): Likewise.
Signed-off-by: Pietro Monteiro <[email protected]>
---
gcc/cobol/cdf-copy.cc | 2 +-
gcc/cobol/lexio.cc | 2 +-
gcc/cobol/parse.y | 10 +++++-----
gcc/cobol/scan_ante.h | 6 +++---
gcc/cobol/util.cc | 4 ++--
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/gcc/cobol/cdf-copy.cc b/gcc/cobol/cdf-copy.cc
index 304360d5257..73b9a8d39e4 100644
--- a/gcc/cobol/cdf-copy.cc
+++ b/gcc/cobol/cdf-copy.cc
@@ -157,7 +157,7 @@ esc( size_t len, const char input[] ) {
*p++ = *s;
break;
}
- __attribute__((fallthrough));
+ gcc_fallthrough();
case 0x20: case '\n':
verify_bounds( (p + sizeof(spacex)) - buffer, sizeof(buffer), buffer );
p = stpcpy( p, spacex );
diff --git a/gcc/cobol/lexio.cc b/gcc/cobol/lexio.cc
index 8a914ae86a9..12d938d3500 100644
--- a/gcc/cobol/lexio.cc
+++ b/gcc/cobol/lexio.cc
@@ -1830,7 +1830,7 @@ cdftext::free_form_reference_format( int input ) {
if( lexio_dialect_mf() ) {
break;
}
- __attribute__ ((fallthrough));
+ gcc_fallthrough();
default: // flag other characters in indicator area
if( ! ISSPACE(indcol[0]) ) {
yyerrorvl( mfile.lineno(), cobol_filename(),
diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
index dc2ac9765cd..526376ac216 100644
--- a/gcc/cobol/parse.y
+++ b/gcc/cobol/parse.y
@@ -1997,7 +1997,7 @@ select: SELECT optional NAME[name]
select_clauses[clauses] '.'
break;
case file_disorganized_e:
file->org = file_sequential_e;
- __attribute__((fallthrough));
+ gcc_fallthrough();
default:
if( ($clauses.clauses & record_key_clause_e) != 0 ) {
assert(file->keys);
@@ -4411,7 +4411,7 @@ data_clause: any_length { $$ = any_length_e; }
switch( field->level ) {
case 1:
if( dialect_ok(@$, MfLevel_1_Occurs, "LEVEL 01 for OCCURS")
) break;
- __attribute__((fallthrough));
+ gcc_fallthrough();
case 77:
case 88:
error_msg(@$, "%s %s: invalid LEVEL for OCCURS",
@@ -9099,7 +9099,7 @@ set: SET set_tgts[tgts] TO set_operand[src]
YYERROR;
break;
}
- __attribute__((fallthrough));
+ gcc_fallthrough();
case FldPointer:
if( !valid_set_targets(*$tgts, true) ) {
YYERROR;
@@ -14261,7 +14261,7 @@ eval_subject_t::compare( int token ) {
break;
case TRUE_kw:
tf = very_true_register();
- __attribute__((fallthrough));
+ gcc_fallthrough();
case FALSE_kw:
assert( is_conditional(pcol->field) );
parser_logop(this->result, pcol->field, xnor_op, field_at(tf));
@@ -14356,7 +14356,7 @@ field_binary_usage( YYLTYPE loc, cbl_field_t *field,
// COMPUTATIONAL and COMP-5 rely on PICTURE.
case FldNumericBinary:
field->attr |= big_endian_e;
- __attribute__((fallthrough));
+ gcc_fallthrough();
case FldNumericBin5:
// If no capacity yet, then no picture, infer $comp.capacity.
// If field has capacity, ensure USAGE is compatible.
diff --git a/gcc/cobol/scan_ante.h b/gcc/cobol/scan_ante.h
index 20fdf77470c..c6f8a1a1bb8 100644
--- a/gcc/cobol/scan_ante.h
+++ b/gcc/cobol/scan_ante.h
@@ -1169,7 +1169,7 @@ typed_name( const char name[] ) {
break;
case FUNCTION_UDF_0:
yylval.number = symbol_function_token(name);
- __attribute__((fallthrough));
+ gcc_fallthrough();
default:
return token;
}
@@ -1199,7 +1199,7 @@ typed_name( const char name[] ) {
}
}
}
- __attribute__((fallthrough));
+ gcc_fallthrough();
case FldLiteralN:
{
const auto f = cbl_field_of(e);
@@ -1215,7 +1215,7 @@ typed_name( const char name[] ) {
return LITERAL;
}
}
- __attribute__((fallthrough));
+ gcc_fallthrough();
case FldInvalid:
case FldGroup:
case FldForward:
diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index 554c4fc5702..648a2cf77b9 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -942,7 +942,7 @@ symbol_field_type_update( cbl_field_t *field,
if( is_numeric(candidate) ) {
return false;
}
- __attribute__((fallthrough));
+ gcc_fallthrough();
case FldInvalid:
case FldGroup:
case FldNumericDisplay:
@@ -960,7 +960,7 @@ symbol_field_type_update( cbl_field_t *field,
// MF and GNU allow pic x usage comp-5.
// Dialect enforcement in that case is in field_binary_usage.
if( candidate != FldNumericBin5 ) return false;
- __attribute__((fallthrough));
+ gcc_fallthrough();
case FldFloat:
case FldNumericBin5:
case FldNumericBinary:
--
2.43.0