This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Allow 64bit warnings on 32bit targets


On Fri, 19 Dec 2003, Andi Kleen wrote:

> If there are test cases for the existing warnings the patch uses they
> will cover that already. (remember the patch does not add any new
> warnings) If not I guess these test cases for all warnings are not
> that important, otherwise they would exist already? 

I mean testcases that -W64bit does what it's meant to - warns
(independently of host and target) for the combinations that it's meant to
warn for, and doesn't warn for those it isn't meant to.  This is
independent of tests that the existing warning happens under the present
conditions.  Without testcases, -W64bit could be a null option, or could
break without anyone noticing.  All reasonably testable new features
require testcases that thoroughly exercise them.  (Adding testcases for
warnings that were added before this was policy is encouraged as well.)

> Valid point. I guess it would be better if it checked for the target
> type not being long (I think that would cover it). I will submit a new
> patch with that change.

That doesn't work, as e.g. glibc makes intptr_t int on 32-bit systems, but
casting to intptr_t (with an include of <stdint.h>) is always safe (if
that type exists at all) since the typedef becomes a long on 64-bit
systems.  To be useful you need to distinguish use of such typedefs (safe)  
from hardcoded int (definitely unsafe), while hardcoded long is probably
safe for most systems but maybe not in general.

-- 
Joseph S. Myers
jsm@polyomino.org.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]