This is the mail archive of the gcc@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: pointer <-> integer conversion warnings (bogus -Wall warnings )


> -----Original Message-----
> From: dewar@gnat.com [mailto:dewar@gnat.com]
> Sent: Friday, March 15, 2002 1:50 PM
> To: Dautrevaux@microprocess.com; fjh@cs.mu.OZ.AU; lord@emf.net
> Cc: gcc@gcc.gnu.org
> Subject: RE: pointer <-> integer conversion warnings (bogus -Wall
> warnings )
> 
> 
> <<PS: and no, I'm not affiliated with any of the companies 
> that may be "over"
> represented in the SC, but just like th eidea that whenever I 
> code something
> potentially dangerous, I get warned by the compiler; as long 
> as I can silent
> that I'm happy, and like the idea the silenting is not a 
> "once and forever"
> but may be breaked if the architecture I compile for is a bit 
> more exotic
> than I have expected...
> >>
> 
> One thing to perhaps mention again is that we really find the Warnings
> pragma in Ada to be very useful, ultimately we always have 
> the following
> nicely local approach to dealing with "wrong" warnings:
> 
>   pragma Warnings (Off);
>   -- comment on why warnings are being turned off
>   ... dubious code that is in fact OK
>   pragma Warnings (On);
> 
> that's much more useful in some cases than switches which
> 
> a) complicate the make files (or in the case of GNAT, project files)
> b) are too heavy handed, since they apply to an entire unit
> 
> (this is by the way not an Ada pragma really, but a GNAT pragma)
> 

Waowww... I'm not the only one! In fact I've based a cross-development
environment on GCC, and added an "options" pragma to GCC, just to be able to
turn on/off specialized warnings for some code that would otherwise emit
warnings but I *know* there is not, and will never be, any problem...

I refrained to submit it for two reasons: 
	1) it's for old gcc versions (I still use a 2.8.1 based compiler)
	2) It's *very* ugly, copying manually part of the option parser 8-0

	Bernard

PS: the warning I need to silent is not a standard one and is one for which
I want that there is NO simple and obvious way to turn it off. Namely I've
twisted GCC code generation in such a way that function pointers are
different from data pointers. So there is a warning when changing the type
of pointer from a pointer to data to a pointer to function (which is in fact
a pointer to a function descriptor). Silenting should only be done in very
rare case, that are totally non-portable code, so the "explicit cast" trick
can't be used.

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux@microprocess.com
		b.dautrevaux@usa.net
-------------------------------------------- 


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