From ee02aa04991ede6bb2e21da223aaf911f1217b0b Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 6 Aug 2021 23:49:04 -0700 Subject: [PATCH] Add fallthrough macro This macro needs to be used because Clang is stupid and doesn't let you use /* fallthrough */ comments like GCC does. However, if GCC is too old (as is the case on CentOS 7), then it won't recognize __has_attribute either. --- desktop_version/src/UtilityClass.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/desktop_version/src/UtilityClass.h b/desktop_version/src/UtilityClass.h index c810591e..01e8cd3c 100644 --- a/desktop_version/src/UtilityClass.h +++ b/desktop_version/src/UtilityClass.h @@ -68,6 +68,16 @@ void _VVV_between( sizeof(middle) \ ) +#ifndef __has_attribute +# define __has_attribute(x) 0 +#endif + +#if __has_attribute(__fallthrough__) +# define VVV_fallthrough __attribute__((__fallthrough__)) +#else +# define VVV_fallthrough do { } while (false) /* fallthrough */ +#endif + //helperClass class UtilityClass