diff options
author | Werner Lemberg <wl@gnu.org> | 2023-02-08 19:36:10 +0100 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2023-02-08 21:09:32 +0100 |
commit | ac5babe87629107c43f627e2cd17c6cf4f2ecd43 (patch) | |
tree | 1d44cc939839be7839237e18cd06f92d16f3da20 /include | |
parent | be724c8142a3f5381fac436becb842f808f82259 (diff) | |
download | freetype2-ac5babe87629107c43f627e2cd17c6cf4f2ecd43.tar.gz |
Fix 'fall-through' warning messages.
Modern compilers get more insistent on that...
* include/freetype/internal/compiler-macros.h (FALL_THROUGH): Define.
* src/*: Use it instead of `/* fall through */` comments.
Diffstat (limited to 'include')
-rw-r--r-- | include/freetype/internal/compiler-macros.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/freetype/internal/compiler-macros.h b/include/freetype/internal/compiler-macros.h index c5de88580..9848174a7 100644 --- a/include/freetype/internal/compiler-macros.h +++ b/include/freetype/internal/compiler-macros.h @@ -36,6 +36,19 @@ FT_BEGIN_HEADER # endif #endif + /* Newer compilers warn for fall-through case statements. */ +#ifndef FALL_THROUGH +# if ( defined( __STDC_VERSION__ ) && __STDC_VERSION__ > 201710L ) || \ + ( defined( __cplusplus ) && __cplusplus > 201402L ) +# define FALL_THROUGH [[__fallthrough__]] +# elif ( defined( __GNUC__ ) && __GNUC__ >= 7 ) || \ + ( defined( __clang__ ) && __clang_major__ >= 10 ) +# define FALL_THROUGH __attribute__(( __fallthrough__ )) +# else +# define FALL_THROUGH ( (void)0 ) +# endif +#endif + /* * When defining a macro that expands to a non-trivial C statement, use * FT_BEGIN_STMNT and FT_END_STMNT to enclose the macro's body. This |