From: H.J. Lu Date: Tue, 15 Mar 2022 15:49:01 +0000 (-0700) Subject: gprofng: Define ATTRIBUTE_FALLTHROUGH X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c5edd3b8847f118bd022c473b126695fb39f6412;p=binutils-gdb.git 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. --- 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 a40cf8fb9be..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; - /* FALLTHROUGH */ + ATTRIBUTE_FALLTHROUGH case 'o': if (precheck == 1) {