c++/8549: --pedantic-errors problems on RedHat 6.1

bangerth@dealii.org bangerth@dealii.org
Tue Nov 19 18:37:00 GMT 2002


Synopsis: --pedantic-errors problems on RedHat 6.1

State-Changed-From-To: feedback->analyzed
State-Changed-By: bangerth
State-Changed-When: Wed Nov 13 09:29:30 2002
State-Changed-Why:
    The problem boils down to the following: in cmath, the
    isgreaterequal (and other) macros are used, of which the
    definition has changed between kernels 2.2 and 2.4. They are
    defined in /usr/include/bits/mathinline.h. The
    following snippet shows that:
    --------------------------------------
    // code from /usr/include/bits/mathinline.h 
    #if 1   // from kernel 2.2
    #  define isgreaterequal(x, y) \
         ({ register char __result;						      \
    	__asm__ ("fucomip %%st(1), %%st; setae %%al"			      \
    		 : "=a" (__result) : "u" (y), "t" (x) : "cc", "st");	      \
    	__result; })
    #else     // from kernel 2.4
    #  define isgreaterequal(x, y) __builtin_isgreaterequal (x, y)
    #endif
    
    int main () 
    {
      isgreaterequal(1.,2.);
    };
    ---------------------------------------
    If compiled as is, I get
    tmp/g> /home/bangerth/bin/gcc-3.2.1-pre/bin/c++ -c -O2 --pedantic-errors foo2.cc
    foo2.cc: In function `int main()':
    foo2.cc:14: ISO C++ forbids braced-groups within expressions
    
    If I change the #if 1 to #if 0 to enable the code that
    is in the 2.4 kernel series, I get no errors. This is
    the behavior of all gccs since 3.0, but also with 2.95!
    
    So I think, the whole thing is attributable to the following:
    Somewhen an extension in gcc was deprecated and the kernel
    folks changed their header files accordingly.I think the
    only way to make newer gccs work on these old systems
    would be to fixinclude the respective header files, but I
    doubt someone would like to put much energy in backporting
    gcc to such old systems.
    
    What do we do with this report then?
    
    Regards
      Wolfgang

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8549



More information about the Gcc-prs mailing list