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]

dummy operator new() warnings



In Mozilla, there are a number of classes that have dummy operator new
functions.  Prior to the gcc 2.95 release, they seemed to compile fine if
we just returned 0.  With gcc 2.95.1, we now get this warning if we try
to return 0 from a operator new() (regardless of what -W options are
given):
 warning: operator new should throw an exception, not return NULL

The warning is fairly straight forward but we have another problem.  For
portability reasons, Mozilla doesn't use exceptions (or at least, that's
what their guidelines say).  Would it be possible to turn off that warning
if the code is being compiled with -fno-exceptions (as Mozilla usually
is)?  Or have a switch -Wno-new-exceptions or something?

The other option would be to be not to return anything which generates a
warning when compiled with -Wall (-Wreturn-type actually) under gcc
2.95+ but compiles cleanly without it.  I'm not sure what gcc < 2.95 does
in this scenario.

- cls


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