diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2018-11-02 14:25:27 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-11-02 17:13:03 -0400 |
commit | 6bb8aaa3b4fcebf8f0de2f81f00dcc20b857c4f5 (patch) | |
tree | 09eaa82c607421240ba01ff0b312b804f44bab5e /includes | |
parent | 5f81952e230fef1f65ae473e09d44101c489c483 (diff) | |
download | haskell-6bb8aaa3b4fcebf8f0de2f81f00dcc20b857c4f5.tar.gz |
rts: Add FALLTHROUGH macro
Instead of using the GCC `/* fallthrough */` syntax we now use the
`__attribute__((fallthrough))`, which Phyx says should be more portable
than the former.
Also adds a missing fallthrough annotation in the MachO linker,
fixing #14613.
Reviewers: erikd, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, carter
GHC Trac Issues: #14613
Differential Revision: https://phabricator.haskell.org/D5292
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Stg.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/includes/Stg.h b/includes/Stg.h index 3a11af1e5e..9b54526342 100644 --- a/includes/Stg.h +++ b/includes/Stg.h @@ -196,6 +196,13 @@ #define GNUC3_ATTRIBUTE(at) #endif +/* Used to mark a switch case that falls-through */ +#if (defined(__GNUC__) && __GNUC__ >= 7) || defined(__clang__) +#define FALLTHROUGH GNU_ATTRIBUTE(fallthrough) +#else +#define FALLTHROUGH ((void)0) +#endif /* __GNUC__ >= 7 */ + #if !defined(DEBUG) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define GNUC_ATTR_HOT __attribute__((hot)) #else |