This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ -Wshadow emitting a warning from libstdc++
- To: gcc bug reports <gcc-bugs at gcc dot gnu dot org>
- Subject: g++ -Wshadow emitting a warning from libstdc++
- From: Martin Sebor <sebor at roguewave dot com>
- Date: Sat, 19 Aug 2000 18:27:44 -0600
- Organization: Rogue Wave Software, Inc.
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)'