Skip to content

Commit

Permalink
Make ATTRIBUTE_FALLTHROUGH work cross-compiler (#836)
Browse files Browse the repository at this point in the history
* Make ATTRIBUTE_FALLTHROUGH work cross-compiler

Current code doesn't work on LLVM. This should fix it so it works on gcc and llvm.

* Update internal.h
  • Loading branch information
r-barnes authored Aug 13, 2024
1 parent 6ed6a28 commit 8018934
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,12 @@
/* Allow falling through in switch statements for the few cases where that
is needed */
#ifndef ATTRIBUTE_FALLTHROUGH
# if __GNUC_PREREQ (7, 0)
# define ATTRIBUTE_FALLTHROUGH __attribute__ ((fallthrough))
# if defined __has_attribute
# if __has_attribute (fallthrough)
# define ATTRIBUTE_FALLTHROUGH __attribute__ ((fallthrough))
# else
# define ATTRIBUTE_FALLTHROUGH
# endif
# else
# define ATTRIBUTE_FALLTHROUGH
# endif
Expand Down

0 comments on commit 8018934

Please sign in to comment.