This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix __builtin_unreachable
authorKarl Williamson <khw@cpan.org>
Fri, 16 Oct 2020 03:25:32 +0000 (21:25 -0600)
committerKarl Williamson <khw@cpan.org>
Fri, 16 Oct 2020 03:40:52 +0000 (21:40 -0600)
Tomasz Konojacki pointed out on #irc that the formulation in
5d5b9c460e2a06563d2b5e35a1a79991460696eb was wrong, and the correction
here is the right way of doing it.

perl.h

diff --git a/perl.h b/perl.h
index 4e252d4..fc39d48 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -3817,7 +3817,7 @@ intrinsic function, see its documents for more details.
 
 #ifdef DEBUGGING
 #  define ASSUME(x) assert(x)
-#  ifdef __builtin_unreachable
+#  if __has_builtin(__builtin_unreachable)
 #    define HAS_BUILTIN_UNREACHABLE_
 #  elif (defined(__GNUC__) && (   __GNUC__ > 4                              \
                                || __GNUC__ == 4 && __GNUC_MINOR__ >= 5))