From: Gisle Aas Date: Tue, 17 Jan 2006 11:37:54 +0000 (+0000) Subject: More readable MEM_WRAP_CHECK_1() macro. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bbbd43383bc4e5b5c9d9b30d4a2008afec8893d8;p=p5sagit%2Fp5-mst-13.2.git More readable MEM_WRAP_CHECK_1() macro. This form also avoids the "dead part of constant expression is nonconstant" warning from the Sun Studio 10 compiler. p4raw-id: //depot/perl@26871 --- diff --git a/README.solaris b/README.solaris index d3b541f..427e08d 100644 --- a/README.solaris +++ b/README.solaris @@ -508,19 +508,6 @@ make sure that it includes the directory with the 'ar' command. This is a common problem on Solaris, where 'ar' is in the /usr/ccs/bin/ directory. -=item warning: dead part of constant expression is nonconstant - -If you are using the Sun Studio 10 compilers ('cc -V' reports "Sun C 5.7") you -may see lots of these errors while building perl. This is an erroneous warning -from the compiler, if you are interested in the details the Sun bug id is -6344975. The warnings can safely be ignored, but if they bother you they may -be suppressed by adding "-Accflags=-erroff=E_DEAD_NONCONST" to your Configure -command-line. Note however that earlier versions of the compiler don't have the -ability to report this warning and will complain about a bad message tag if you -specify that you want the compiler to suppress the warning. Note also that the -erroff option embedded into Config.pm and will be used for building any XSUB -modules post-install. - =back =head1 MAKE TEST diff --git a/handy.h b/handy.h index ada3124..3f13a93 100644 --- a/handy.h +++ b/handy.h @@ -636,7 +636,7 @@ hopefully catches attempts to access uninitialized memory. #ifdef PERL_MALLOC_WRAP #define MEM_WRAP_CHECK(n,t) MEM_WRAP_CHECK_1(n,t,PL_memory_wrap) #define MEM_WRAP_CHECK_1(n,t,a) \ - (void)((sizeof(t)>1?(n):1)>((MEM_SIZE)~0)/sizeof(t)?(Perl_croak_nocontext(a),0):0) + (void)(sizeof(t) > 1 && (n) > ((MEM_SIZE)~0)/sizeof(t) && (Perl_croak_nocontext(a),0)) #define MEM_WRAP_CHECK_(n,t) MEM_WRAP_CHECK(n,t), #define PERL_STRLEN_ROUNDUP(n) ((void)(((n) > (MEM_SIZE)~0 - 2 * PERL_STRLEN_ROUNDUP_QUANTUM) ? (Perl_croak_nocontext(PL_memory_wrap),0):0),((n-1+PERL_STRLEN_ROUNDUP_QUANTUM)&~((MEM_SIZE)PERL_STRLEN_ROUNDUP_QUANTUM-1)))