Fix compilation with GCC 5

master
Noam Preil 2020-05-17 04:31:19 -04:00 committed by Andrew Kelley
parent 241984987b
commit 03ed9e4173
2 changed files with 5 additions and 2 deletions

View File

@ -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()

View File

@ -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