diff options
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -42,6 +42,12 @@ # define BFS_HAS_INCLUDE(header, fallback) fallback #endif +#ifdef __has_c_attribute +# define BFS_HAS_C_ATTRIBUTE(attr) __has_c_attribute(attr) +#else +# define BFS_HAS_C_ATTRIBUTE(attr) false +#endif + #ifndef BFS_HAS_MNTENT # define BFS_HAS_MNTENT BFS_HAS_INCLUDE(<mntent.h>, __GLIBC__) #endif @@ -86,6 +92,14 @@ # define O_DIRECTORY 0 #endif +#if BFS_HAS_C_ATTRIBUTE(fallthrough) +# define fallthrough [[fallthrough]] +#elif __GNUC__ +# define fallthrough __attribute__((fallthrough)) +#else +# define fallthrough +#endif + /** * Adds compiler warnings for bad printf()-style function calls, if supported. */ |