From: Jérémie Galarneau Date: Wed, 15 Jun 2022 19:00:35 +0000 (-0400) Subject: Build fix: unknown warning -Wduplicated-branches X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=efc2642c22639e9af4bd01953bfd4453f6218f61;p=lttng-tools.git Build fix: unknown warning -Wduplicated-branches -Wduplicated-branches was introduced in GCC 7. Only define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES for those more recent versions. Signed-off-by: Jérémie Galarneau Change-Id: I3b50a671867a74629519375801bf2b4f3c597cd8 --- diff --git a/src/common/macros.hpp b/src/common/macros.hpp index 37e6cabcf..cfe6eb528 100644 --- a/src/common/macros.hpp +++ b/src/common/macros.hpp @@ -276,9 +276,13 @@ void *memmove(T *d, const U *s, size_t n) = delete; _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") # define DIAGNOSTIC_IGNORE_LOGICAL_OP \ _Pragma("GCC diagnostic ignored \"-Wlogical-op\"") -# define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES \ +#if __GNUG__ && __GNUC__ >= 7 +# define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES \ _Pragma("GCC diagnostic ignored \"-Wduplicated-branches\"") -# define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF \ +#else +# define DIAGNOSTIC_IGNORE_DUPLICATED_BRANCHES +#endif /* __GNUG__ && __GNUC__ >= 7 */ +# define DIAGNOSTIC_IGNORE_INVALID_OFFSETOF \ _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") #endif