Skip to content

Commit

Permalink
attribs.h: add ATTR_FALLTHROUGH
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSomeMan committed Dec 8, 2021
1 parent 57c75ea commit 78f0a5e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/attribs.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ extern "C" {
#define ATTR_PRINTF(idx_fmt, idx_args) ATTRIBUTE((format(printf, idx_fmt, idx_args)))
#define ATTR_NONNULL(arg_idx, ...) ATTRIBUTE((nonnull(arg_idx, ##__VA_ARGS__)))

#if !defined(__clang__)
#if defined(__GNUC__) && (__GNUC__ >= 7)
#define ATTR_FALLTHROUGH __attribute__((fallthrough))
#else
#define ATTR_FALLTHROUGH (void)0
#endif
#else
#define ATTR_FALLTHROUGH (void)0
#endif

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 78f0a5e

Please sign in to comment.