Delete the WUFFS_BASE__FALLTHROUGH macro

Getting it to work on various compilers has been more trouble than it's
worth. The previous commit ignores "-Wimplicit-fallthrough" instead.
This commit is contained in:
Nigel Tao committed 2021-07-05 21:40:25 +10:00
1 parent ea50956b5a
commit 3842c519c9
3 files changed
+6 -49

No files matched your search

+2 -23
View File
@@ -10111,37 +10111,16 @@ extern "C" {
// Its (non-zero) value is arbitrary, based on md5sum("disabled").
#define WUFFS_BASE__DISABLED ((uint32_t)0x075AE3D2)
// Denote intentional fallthroughs for -Wimplicit-fallthrough.
//
// The next two #if lines are deliberately separate. Combining the two
// conditions into a single "#if foo && bar" line would not be portable. See
// https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html
#if defined(__has_attribute)
#if __has_attribute(fallthrough)
#define WUFFS_BASE__FALLTHROUGH __attribute__((fallthrough))
#endif
#endif
// Newer C/C++ compilers are handled above. Other compilers are handled below.
#if !defined(WUFFS_BASE__FALLTHROUGH)
// Chromium's clang-based PNaCl compiler does define __has_attribute, but
// "__has_attribute(fallthrough)" is false and "__attribute__((fallthrough))"
// has no effect. Use the C++ style "[[clang::fallthrough]]" instead.
#if defined(__clang__) && defined(__cplusplus) && (__cplusplus >= 201103L)
#define WUFFS_BASE__FALLTHROUGH [[clang::fallthrough]]
#else
#define WUFFS_BASE__FALLTHROUGH
#endif
#endif
// Use switch cases for coroutine suspension points, similar to the technique
// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
//
// The implicit fallthrough is intentional.
//
// We use trivial macros instead of an explicit assignment and case statement
// so that clang-format doesn't get confused by the unusual "case"s.
#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0 case 0:;
#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT(n) \
coro_susp_point = n; \
WUFFS_BASE__FALLTHROUGH; \
case n:;
#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \