This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Silence many "statement not reached" on Solaris
authorKarl Williamson <khw@cpan.org>
Mon, 20 Mar 2017 23:17:39 +0000 (17:17 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 1 Jun 2017 12:33:17 +0000 (06:33 -0600)
It turns out that the NOT_REACHED macro that is used to make sure a
statement really isn't reachable, causes the Solaris compiler to emit
such warnings.  It expands to ASSUME(0), and Solaris will flag that.
This commit just changes NOT_REACHED to expand to nothing on Solaris.

perl.h

diff --git a/perl.h b/perl.h
index 70e12bd..979e213 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -3756,7 +3756,11 @@ EXTERN_C int perl_tsa_mutex_unlock(perl_mutex* mutex)
 #  define ASSUME(x) assert(x)
 #endif
 
-#define NOT_REACHED ASSUME(0)
+#if defined(__sun)      /* ASSUME() generates warnings on Solaris */
+#  define NOT_REACHED
+#else
+#  define NOT_REACHED ASSUME(0)
+#endif
 
 /* Some unistd.h's give a prototype for pause() even though
    HAS_PAUSE ends up undefined.  This causes the #define