This is the mail archive of the gcc-bugs@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]

g++ -Wshadow emitting a warning from libstdc++


Hi,

the definition of ::abs() in <cmath> is causing a warning with g++
-Wshadow. The warning disappears with -fno-builtin but there doesn't
appear to be a way to test for this flag at compile time (i.e., there's
no macro that one could check to see whether abs should be defined or
not). It would be useful if like edg, g++ also #defined corresponding
macros for such flags (e.g., _GCC_NO_BUILTIN, _GCC_NO_HONOR_STD, etc.).
Just a suggestion...

Regards
Martin

$ cat test.cpp

#include <cmath.h>


$ g++ -Wshadow test.cpp
In file included from test.cpp:3:
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/cmath:
In function `float abs(float)':
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/cmath:40:
warning: shadowing built-in function `int abs(int)'

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