[cfe-dev] -fcheck-new not supported by LLVM/clang

Beinan Li li.beinan at gmail.com
Tue Nov 6 13:22:44 PST 2012

Hello LLVM/Clang,

With Xcode4.5, llvm/clang:
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

we use -fcheck-new in our compiler settings which has been triggering this
clang warning:

clang: warning: argument unused during compilation: '-fcheck-new'

We wonder if this gcc setting is not supported by clang.
gcc spec seems to say that without this the only mechanism against heap
allocation returning null pointers
is through exceptions. However,  we disabled exceptions for performance
requirements. So this setting
is important to us.

Currently we have to use -Qunused-arguments to suppress the warnings, but
the real question is whether or not it is safe to work without -fcheck-new
if it's not supported by clang.

>From web search, we also found the following links which implies that it
could be a bug in LLVM/clang:



    If -fcheck-new is an important feature for you (and not a
workaround for an old gcc
   problem), please feel free to file a bug at http://llvm.org/bugs/


   - Except for the -fcheck-new option, Clang seems to understand all the
   other compiler options used during the HotSpot build process. For
   -fcheck-new a warning is issued advertising that the option will be
   ignored. So I just removed it frommake/linux/makefiles/clang.make. I
   have also removed obvious workarounds for some older GCC versions in the
   new Clang files which were derived from their corresponding GCC



   There was a longer discussion around the fix for the CHECK macros
   about one and a half years ago. I started a patch that time but than
   somehow forgot about it. Now with the new compiler (and the old
   warnings) I remembered about it. I hope to get it done this time and
   to send it out for review soon. Thank you for the offer to take care
   about it.

Anybody has any comments?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121106/e98864f0/attachment.html>

More information about the cfe-dev mailing list