Re: C compiler warnings when bootstrapping

Eric Bezault <[email protected]>
Newsgroups gmane.comp.lang.eiffel.gobo.devel
Message-ID <[email protected]>
Berend de Boer wrote:
> Hi All,
> 
> Upgraded to the latest version last night and got this:
> 
> # ./bootstrap.sh gcc ge
> geant4.c: In function 'T55f41':
> geant4.c:6703: warning: passing argument 1 of 'GE_check_void' discards qualifiers from pointer target type
> geant4.c:6710: warning: passing argument 2 of 'T55f60' discards qualifiers from pointer target type
> geant4.c:6714: warning: passing argument 2 of 'T17f17' discards qualifiers from pointer target type
> geant4.c:6714: warning: passing argument 2 of 'T204f13' discards qualifiers from pointer target type
> geant4.c:6719: warning: assignment discards qualifiers from pointer target type
> geant4.c:6721: warning: assignment discards qualifiers from pointer target type
> geant4.c:6743: warning: passing argument 2 of 'T76f1' discards qualifiers from pointer target type
> geant4.c:6743: warning: passing argument 3 of 'T76f1' discards qualifiers from pointer target type
> ...
> 
> It builds the executables though (they are only warnings), but in case
> someone is interested. I'm using gcc 4.1.1.

The problem seems to be as follows. I have a local variable which
needs to be declared as volatile (because of the use of setjmp/longjmp):

   volatile T0* l1 = 0;

And then I call:

   f(l1);

where `f' is declared as follows:

   void f(T0* a1);

with no volatile qualifier. I think that this is what gcc is
complaining about. Anyone knows how to make gcc happy?
Should I declare my local variable as:

   T0 volatile *l1 = 0;

instead of:

   volatile T0* l1 = 0;

Or should I explicitly cast it as follows:

   f((T0*)l1);

-- 
Eric Bezault
mailto:[email protected]
http://www.gobosoft.com

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.