mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
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:
1 parent
ea50956b5a
commit
3842c519c9
3 files changed
+6
-49
No files matched your search
@@ -29,37 +29,16 @@
|
||||
// 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) \
|
||||
|
||||
@@ -29,9 +29,8 @@ const BaseAllImplC = "" +
|
||||
""
|
||||
|
||||
const BaseFundamentalPrivateH = "" +
|
||||
"// ---------------- Fundamentals\n\n// WUFFS_BASE__MAGIC is a magic number to check that initializers are called.\n// It's not foolproof, given C doesn't automatically zero memory before use,\n// but it should catch 99.99% of cases.\n//\n// Its (non-zero) value is arbitrary, based on md5sum(\"wuffs\").\n#define WUFFS_BASE__MAGIC ((uint32_t)0x3CCB6C71)\n\n// WUFFS_BASE__DISABLED is a magic number to indicate that a non-recoverable\n// error was previously encountered.\n//\n// Its (non-zero) value is arbitrary, based on md5sum(\"disabled\").\n#define WUFFS_BASE__DISABLED ((uint32_t)0x075AE3D2)\n\n// Denote intentional fallthroughs for -Wimplicit-fallthrough.\n//\n// The next two #if lines are deliberately separate. Combining the two\n// conditions into a single \"#if foo && bar\" line would not be portable. See\n// https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html\n#if defined(__has_attribute)\n#if __has_attribute(fallthrough)\n#define WUFFS_BASE__FALLTHROUGH __attribute__((fallthrough))\n#endif\n#endif\n// Newer C/C++ comp" +
|
||||
"ilers are handled above. Other compilers are handled below.\n#if !defined(WUFFS_BASE__FALLTHROUGH)\n// Chromium's clang-based PNaCl compiler does define __has_attribute, but\n// \"__has_attribute(fallthrough)\" is false and \"__attribute__((fallthrough))\"\n// has no effect. Use the C++ style \"[[clang::fallthrough]]\" instead.\n#if defined(__clang__) && defined(__cplusplus) && (__cplusplus >= 201103L)\n#define WUFFS_BASE__FALLTHROUGH [[clang::fallthrough]]\n#else\n#define WUFFS_BASE__FALLTHROUGH\n#endif\n#endif\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// We use trivial macros instead of an explicit assignment and case statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0 case 0:;\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT(n) \\\n coro_susp_point = n; \\\n WUFFS_BASE__FALLTHROUGH; \\\n case n:;\n\n" +
|
||||
"#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \\\n if (!status.repr) { \\\n goto ok; \\\n } else if (*status.repr != '$') { \\\n goto exit; \\\n } \\\n coro_susp_point = n; \\\n goto suspend; \\\n case n:;\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define WUFFS_BASE__LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define WUFFS_BASE__UNLIKELY(expr) (__builtin_expect(!!(expr), 0))\n#else\n#define WUFFS_BASE__LIKELY(expr) (expr)\n#define WUFFS_BASE__UNLIKELY(expr) (expr)\n#endif\n\n" +
|
||||
"// ---------------- Fundamentals\n\n// WUFFS_BASE__MAGIC is a magic number to check that initializers are called.\n// It's not foolproof, given C doesn't automatically zero memory before use,\n// but it should catch 99.99% of cases.\n//\n// Its (non-zero) value is arbitrary, based on md5sum(\"wuffs\").\n#define WUFFS_BASE__MAGIC ((uint32_t)0x3CCB6C71)\n\n// WUFFS_BASE__DISABLED is a magic number to indicate that a non-recoverable\n// error was previously encountered.\n//\n// Its (non-zero) value is arbitrary, based on md5sum(\"disabled\").\n#define WUFFS_BASE__DISABLED ((uint32_t)0x075AE3D2)\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// The implicit fallthrough is intentional.\n//\n// We use trivial macros instead of an explicit assignment and case statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0 case 0:;\n#define WUFFS_BASE__COROUTINE_SUSPENSION_" +
|
||||
"POINT(n) \\\n coro_susp_point = n; \\\n case n:;\n\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \\\n if (!status.repr) { \\\n goto ok; \\\n } else if (*status.repr != '$') { \\\n goto exit; \\\n } \\\n coro_susp_point = n; \\\n goto suspend; \\\n case n:;\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define WUFFS_BASE__LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define WUFFS_BASE__UNLIKELY(expr) (__builtin_expect(!!(expr), 0))\n#else\n#define WUFFS_BASE__LIKELY(expr) (expr)\n#define WUFFS_BASE__UNLIKELY(expr) (expr)\n#endif\n\n" +
|
||||
"" +
|
||||
"// --------\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__ignore_status(wuffs_base__status z) {\n return wuffs_base__make_empty_struct();\n}\n\nstatic inline wuffs_base__status //\nwuffs_base__status__ensure_not_a_suspension(wuffs_base__status z) {\n if (z.repr && (*z.repr == '$')) {\n z.repr = wuffs_base__error__cannot_return_a_suspension;\n }\n return z;\n}\n\n" +
|
||||
"" +
|
||||
|
||||
@@ -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) \
|
||||
|
||||
Reference in new issue
Block a user