[PATCH 1/3] gprofng: Define ATTRIBUTE_FALLTHROUGH
H.J. Lu
hjl.tools@gmail.com
Tue Mar 15 16:22:02 GMT 2022
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
__attribute__ ((fallthrough)) with ATTRIBUTE_FALLTHROUGH.
---
gprofng/common/gp-defs.h | 8 ++++++++
gprofng/src/gp-collect-app.cc | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/gprofng/common/gp-defs.h b/gprofng/common/gp-defs.h
index 440bfb1c5e2..e92c33e101b 100644
--- a/gprofng/common/gp-defs.h
+++ b/gprofng/common/gp-defs.h
@@ -55,4 +55,12 @@
#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
diff --git a/gprofng/src/gp-collect-app.cc b/gprofng/src/gp-collect-app.cc
index afaae70bc2b..34874b8c296 100644
--- a/gprofng/src/gp-collect-app.cc
+++ b/gprofng/src/gp-collect-app.cc
@@ -848,7 +848,7 @@ collect::check_args (int argc, char *argv[])
}
case 'O':
overwriteExp = true;
- __attribute__ ((fallthrough));
+ ATTRIBUTE_FALLTHROUGH
case 'o':
if (precheck == 1)
{
--
2.35.1
More information about the Binutils
mailing list