From 03ed9e4173131ac5e6157be500e3c50f7e0b0947 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Sun, 17 May 2020 04:31:19 -0400 Subject: [PATCH] Fix compilation with GCC 5 --- CMakeLists.txt | 5 ++++- src/util_base.hpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37dcd1ac0..97acd0c3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -329,7 +329,10 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") if(MSVC) set(EXE_CFLAGS "${EXE_CFLAGS} /w") else() - set(EXE_CFLAGS "${EXE_CFLAGS} -Werror -Wall -Werror=implicit-fallthrough") + set(EXE_CFLAGS "${EXE_CFLAGS} -Werror -Wall") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0) + set(EXE_CFLAGS "${EXE_CFLAGS} -Werror=implicit-fallthrough") + endif() endif() endif() diff --git a/src/util_base.hpp b/src/util_base.hpp index 1c665bf93..da1d3bf23 100644 --- a/src/util_base.hpp +++ b/src/util_base.hpp @@ -68,7 +68,7 @@ static inline void zig_assert(bool ok, const char *file, int line, const char *f #define ZIG_FALLTHROUGH #elif defined(__clang__) #define ZIG_FALLTHROUGH [[clang::fallthrough]] -#elif defined(__GNUC__) +#elif defined(__GNUC__) && __GNUC__ >= 7 #define ZIG_FALLTHROUGH __attribute__((fallthrough)) #else #define ZIG_FALLTHROUGH