#22 type qualifier mismatch in rescue clause

trunk
closed
Eric Bezault
gec (14)
5
2008-05-17
2008-05-10
Eric Bezault
No

Berend de Boer wrote in the gobo-eiffel-develop mailing list on April 7th 2008:

[gobo-eiffel-develop] C compiler warnings when bootstrapping

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.

Discussion

  • Eric Bezault
    Eric Bezault
    2008-05-10

    Logged In: YES
    user_id=13278
    Originator: YES

    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
    Eric Bezault
    2008-05-17

    Logged In: YES
    user_id=13278
    Originator: YES

    Got rid of these warnings using explicit type casts.

     
  • Eric Bezault
    Eric Bezault
    2008-05-17

    • status: open --> closed