In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/5b48e25f83f62f48ea280c49b00302e063384348?hp=bcd2c0efd9224fe75a0bb40ebb907817ba1713c4>
- Log ----------------------------------------------------------------- commit 5b48e25f83f62f48ea280c49b00302e063384348 Author: Lukas Mai <[email protected]> Date: Sat Feb 13 22:11:59 2016 +0100 tweak NOT_REACHED in DEBUGGING builds Previously, NOT_REACHED was defined as ASSUME(0), which is assert(0) in DEBUGGING builds. On some platforms (HP-UX/IA64, others?) gcc doesn't know that assert(0) never returns. We have some code of the form (simplified): int x; switch (A) { case B: x = 0; break; case C: x = 1; break; default: NOT_REACHED; } return x; Now gcc thinks control can pass through the default branch and hit the 'return'. This triggers a warning of the form warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized] This commit defines NOT_REACHED as abort() in DEBUGGING builds. Hopefully every compiler knows that abort() can't return, thus getting rid of the bogus warnings. ----------------------------------------------------------------------- Summary of changes: perl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/perl.h b/perl.h index c60aeef..a2ba5cd 100644 --- a/perl.h +++ b/perl.h @@ -3744,11 +3744,12 @@ int perl_tsa_mutex_unlock(perl_mutex* mutex) so pass it through to C lib as a last resort */ # define ASSUME(x) assert(x) # endif +# define NOT_REACHED ASSUME(0) #else # define ASSUME(x) assert(x) +# define NOT_REACHED abort() #endif -#define NOT_REACHED ASSUME(0) /* Some unistd.h's give a prototype for pause() even though HAS_PAUSE ends up undefined. This causes the #define -- Perl5 Master Repository
