gprofng: Define ATTRIBUTE_FALLTHROUGH
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 15 Mar 2022 15:49:01 +0000 (08:49 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 16 Mar 2022 13:42:51 +0000 (06:42 -0700)
Define ATTRIBUTE_FALLTHROUGH to __attribute__ ((fallthrough)) only for
GCC 7 or above.

PR gprof/28969
* common/gp-defs.h (ATTRIBUTE_FALLTHROUGH): New.
* src/gp-collect-app.cc (collect::check_args): Replace
/* FALLTHROUGH */ with ATTRIBUTE_FALLTHROUGH.

gprofng/common/gp-defs.h
gprofng/src/gp-collect-app.cc

index 440bfb1c5e278362d6cd2e0eaed148fdb50231cb..e92c33e101b8489ec684f6af7a701e39f051fc17 100644 (file)
 #define WSIZE_32            1
 #endif
 
+#ifndef ATTRIBUTE_FALLTHROUGH
+# if (GCC_VERSION >= 7000)
+#  define ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
+# else
+#  define ATTRIBUTE_FALLTHROUGH        /* Fall through */
+# endif
+#endif
+
 #endif
index a40cf8fb9bea5306ab40523f63fb02df33ca1f5a..34874b8c2965f7f7bd5ebf23769656cdc8487846 100644 (file)
@@ -848,7 +848,7 @@ collect::check_args (int argc, char *argv[])
          }
        case 'O':
          overwriteExp = true;
-          /* FALLTHROUGH */
+         ATTRIBUTE_FALLTHROUGH
        case 'o':
          if (precheck == 1)
            {