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

Re: #include <new.h> now causes a warning


> gcc version 3.1 20010808 (experimental)
> 
> The problem is solved, but elsewhere, I am getting
> the following warning:

> ###########################################################################
> g++ -W -Wall -Wpointer-arith -pipe -O3 -g -Wno-uninitialized -fno-implicit-templates   -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -DACE_HAS_AIO_CALLS  -I/opt2/home/craigr/ACE_wrappers -DACE_HAS_RAPI -I/usr/include/rsvp -DACE_HAS_EXCEPTIONS  -c -fPIC -o .shobj/OS.o OS.cpp
> 
> In file included from /usr/local/include/g++-v3/backward/new.h:33,
>                  from /opt2/home/craigr/ACE_wrappers/ace/OS.h:2950,
>                  from OS.cpp:3:
> /usr/local/include/g++-v3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please use the <X> header instead of <X.h> header for 'C++' includes and use the <cX> header instead of <X.h> header for 'C' includes. To disable this warning use -Wno-deprecated.
> 
> ###########################################################################

I think that -Wdeprecated should not be implied by -Wall, but should be
asked for explicitly.  Otherwise there is way too much perfectly valid,
standards-conformant code out there that will now issue a sea of warnings,
and since compilers that don't include all of the new headers are still
common, what this warning does is ask people to write less portable code
(that is, code that won't compile with compilers such as gcc-2.95.x, as
well as many proprietary compilers, that are still in wide use).

For example, it will tell people to turn <math.h> into <cmath>, resulting
in a program that won't compile with the current default compiler on any
GNU/Linux platform.

It will be safe to put -Wdeprecated into -Wall only when gcc 3.x has
almost completely displaced 2.95.x and egcs.

> This warning is caused because my code does:
> #include <new.h>
> 
> 
> Does this same warning occur on the 3.0.1 branch, or just the 3.1
> branch?

It's not in the 3.0.1 branch or in the released 3.0.




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