Skip to content

Commit

Permalink
fix: __has_builtin macro check
Browse files Browse the repository at this point in the history
  • Loading branch information
hikarin522 authored and Naios committed Nov 2, 2020
1 parent 477159e commit 2d15aef
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions include/function2/function2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@
#elif defined(__GNUC__)
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define FU2_DETAIL_UNREACHABLE_INTRINSIC() __builtin_unreachable()
#elif defined(__has_builtin) && __has_builtin(__builtin_unreachable)
#elif defined(__has_builtin)
#if __has_builtin(__builtin_unreachable)
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define FU2_DETAIL_UNREACHABLE_INTRINSIC() __builtin_unreachable()
#else
#endif
#endif
#ifndef FU2_DETAIL_UNREACHABLE_INTRINSIC
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define FU2_DETAIL_UNREACHABLE_INTRINSIC() abort()
#endif
Expand All @@ -102,10 +105,13 @@
#elif defined(__GNUC__)
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define FU2_DETAIL_TRAP() __builtin_trap()
#elif defined(__has_builtin) && __has_builtin(__builtin_trap)
#elif defined(__has_builtin)
#if __has_builtin(__builtin_trap)
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define FU2_DETAIL_TRAP() __builtin_trap()
#else
#endif
#endif
#ifndef FU2_DETAIL_TRAP
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define FU2_DETAIL_TRAP() *(volatile int*)0x11 = 0
#endif
Expand Down

0 comments on commit 2d15aef

Please sign in to comment.