mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 00:47:56 +01:00
Denote intentional fallthroughs
This commit is contained in:
1 parent
98ccfedc96
commit
fdceee4bd0
5 files changed
+59
-10
No files matched your search
@@ -391,6 +391,17 @@ typedef struct {
|
||||
// Its (non-zero) value is arbitrary, based on md5sum("zeroed").
|
||||
#define WUFFS_BASE__ALREADY_ZEROED (0x68602EF1U)
|
||||
|
||||
// Denote intentional fallthroughs for -Wimplicit-fallthrough.
|
||||
//
|
||||
// The order matters here. Clang also defines "__GNUC__".
|
||||
#if defined(__clang__) && __cplusplus >= 201103L
|
||||
#define WUFFS_BASE__FALLTHROUGH [[clang::fallthrough]]
|
||||
#elif !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
#define WUFFS_BASE__FALLTHROUGH __attribute__((fallthrough))
|
||||
#else
|
||||
#define WUFFS_BASE__FALLTHROUGH
|
||||
#endif
|
||||
|
||||
// Use switch cases for coroutine suspension points, similar to the technique
|
||||
// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
|
||||
//
|
||||
@@ -399,6 +410,7 @@ typedef struct {
|
||||
#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) \
|
||||
|
||||
@@ -409,6 +409,17 @@ typedef struct {
|
||||
// Its (non-zero) value is arbitrary, based on md5sum("zeroed").
|
||||
#define WUFFS_BASE__ALREADY_ZEROED (0x68602EF1U)
|
||||
|
||||
// Denote intentional fallthroughs for -Wimplicit-fallthrough.
|
||||
//
|
||||
// The order matters here. Clang also defines "__GNUC__".
|
||||
#if defined(__clang__) && __cplusplus >= 201103L
|
||||
#define WUFFS_BASE__FALLTHROUGH [[clang::fallthrough]]
|
||||
#elif !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
#define WUFFS_BASE__FALLTHROUGH __attribute__((fallthrough))
|
||||
#else
|
||||
#define WUFFS_BASE__FALLTHROUGH
|
||||
#endif
|
||||
|
||||
// Use switch cases for coroutine suspension points, similar to the technique
|
||||
// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
|
||||
//
|
||||
@@ -417,6 +428,7 @@ typedef struct {
|
||||
#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) \
|
||||
|
||||
@@ -516,6 +516,17 @@ typedef struct {
|
||||
// Its (non-zero) value is arbitrary, based on md5sum("zeroed").
|
||||
#define WUFFS_BASE__ALREADY_ZEROED (0x68602EF1U)
|
||||
|
||||
// Denote intentional fallthroughs for -Wimplicit-fallthrough.
|
||||
//
|
||||
// The order matters here. Clang also defines "__GNUC__".
|
||||
#if defined(__clang__) && __cplusplus >= 201103L
|
||||
#define WUFFS_BASE__FALLTHROUGH [[clang::fallthrough]]
|
||||
#elif !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
#define WUFFS_BASE__FALLTHROUGH __attribute__((fallthrough))
|
||||
#else
|
||||
#define WUFFS_BASE__FALLTHROUGH
|
||||
#endif
|
||||
|
||||
// Use switch cases for coroutine suspension points, similar to the technique
|
||||
// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
|
||||
//
|
||||
@@ -524,6 +535,7 @@ typedef struct {
|
||||
#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