diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2022-03-15 08:49:01 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2022-03-16 06:42:51 -0700 |
commit | c5edd3b8847f118bd022c473b126695fb39f6412 (patch) | |
tree | 40ee1593194f4c62617fd949adee751ff5cd83dc /gprofng | |
parent | 0c857ef4dfc083b6f5ef2d32182b8db24c5f8d55 (diff) | |
download | gdb-c5edd3b8847f118bd022c473b126695fb39f6412.zip gdb-c5edd3b8847f118bd022c473b126695fb39f6412.tar.gz gdb-c5edd3b8847f118bd022c473b126695fb39f6412.tar.bz2 |
gprofng: Define ATTRIBUTE_FALLTHROUGH
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.
Diffstat (limited to 'gprofng')
-rw-r--r-- | gprofng/common/gp-defs.h | 8 | ||||
-rw-r--r-- | gprofng/src/gp-collect-app.cc | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gprofng/common/gp-defs.h b/gprofng/common/gp-defs.h index 440bfb1..e92c33e 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 a40cf8f..34874b8 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; - /* FALLTHROUGH */ + ATTRIBUTE_FALLTHROUGH case 'o': if (precheck == 1) { |