]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: fix warnings about invalid [[fallthrough]] usage
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 30 Nov 2023 20:59:16 +0000 (15:59 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 1 Dec 2023 04:16:39 +0000 (23:16 -0500)
Fix these two warnings, when building on macos:

      CXX    cp-name-parser.o
    /Users/smarchi/src/binutils-gdb/gdb/cp-name-parser.y:1644:7: error: fallthrough annotation does not directly precede switch label
          [[fallthrough]];
          ^

      CXX    dbxread.o
    /Users/smarchi/src/binutils-gdb/gdb/dbxread.c:2809:7: error: fallthrough annotation does not directly precede switch label
          [[fallthrough]];
          ^

In these two cases, we [[fallthrough]], followed by a regular label,
followed by a case label.  Move the [[fallthrough]] below the regular
label.

Change-Id: If4a3145139e050bdb6950c7f239badd5778e6f64
Approved-By: Tom Tromey <tom@tromey.com>
gdb/cp-name-parser.y
gdb/dbxread.c

index 9a359d47b65c11fa6a9e78ad99ed13f97aa966fc..6f9305e15df73c2d3156baab7082ee0d67d2312a 100644 (file)
@@ -1641,9 +1641,9 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
          state->lexptr++;
          return '-';
        }
-      [[fallthrough]];
 
     try_number:
+      [[fallthrough]];
     case '0':
     case '1':
     case '2':
index 99d9fba96ea981243beab092c8a1b9960065c232..ebfd48e29cd91ad889a96fda4f138cca11b110da 100644 (file)
@@ -2806,9 +2806,9 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
     case N_NBSTS:
     case N_NBLCS:
       unknown_symtype_complaint (hex_string (type));
-      [[fallthrough]];
 
     define_a_symbol:
+      [[fallthrough]];
       /* These symbol types don't need the address field relocated,
         since it is either unused, or is absolute.  */
     case N_GSYM:               /* Global variable.  */