diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2006-07-28 12:00:28 +0300 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-08-01 00:17:19 +0000 |
commit | 2720f793e70a96650f551fd35d72212404ba79d8 (patch) | |
tree | 361d39266805c7050071ed57cd238eff4e5f99b6 /handy.h | |
parent | ebbde8c5834d0c479e4dadc7a405c3590c51f880 (diff) | |
download | perl-2720f793e70a96650f551fd35d72212404ba79d8.tar.gz |
solution(?) to the "warning: comparison is always false dueto limited range of data type" with New*()
Message-ID: <44C9A7FC.1060801@iki.fi>
p4raw-id: //depot/perl@28634
Diffstat (limited to 'handy.h')
-rw-r--r-- | handy.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -681,10 +681,13 @@ PoisonWith(0xEF) for catching access to freed memory. #define NEWSV(x,len) newSV(len) #endif +/* The +0.0 in MEM_WRAP_CHECK_ is an attempt to foil + * overly eager compilers that will bleat about e.g. + * (U16)n > (size_t)~0/sizeof(U16) always being false. */ #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 && (MEM_SIZE)(n) > ((MEM_SIZE)~0)/sizeof(t) && (Perl_croak_nocontext(a),0)) + (void)(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > ((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))) |