KhronosGroup / SPIRV-Reflect

SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications.
Apache License 2.0
672 stars 147 forks source link

FALLTHROUGH macro not compiled with GCC < 7.0 #255

Closed vcoda closed 5 months ago

vcoda commented 5 months ago

attribute((fallthrough)) not supported by GCC 6.8, so this check works only for newer compilers:

#if defined(__clang__) || defined(__GNUC__) || defined(__APPLE_CC__)
#define FALLTHROUGH __attribute__((fallthrough))
#else
#define FALLTHROUGH
#endif

Better to improve check as the following: #if defined(__GNUC__) && __GNUC__ >= 7

vcoda commented 5 months ago

https://stackoverflow.com/questions/45349079/how-to-use-attribute-fallthrough-correctly-in-gcc

spencer-lunarg commented 5 months ago

@vcoda I agree this should work for older gcc versions, my only concern is I don't have an immediate way to test it

If you are willing to make a PR with the macro #if change and confirm it works, would be happy to take it

spencer-lunarg commented 5 months ago

closed with https://github.com/KhronosGroup/SPIRV-Reflect/pull/258

(thanks for making the PR)