-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -fcheck-new to c++ flags #326
Comments
FWIW the latest LLVM release, 14.0.0, does not support it. Although someone should really add it to clang so that standard new could be easier used in embedded programming. |
Agreed. Bummer they don't. As it is, there are a handful of places in LK that use new and then test for null and indeed it does not actually result in any real test. Probably worth adding even if it's not properly supported in clang. |
Supported since LLVM 17 (llvm/llvm-project@52c8f0b) |
Probably worth conditionally adding, now that somewhere along the line some build system support was added for checking an individual flag. |
FWIW, conditionally adding this is tricky (and not really needed?). clang "supported" this flag for ages (aka -fcheck-new was silently ignored, as are a bunch of other GCC-specific flags). You should be able to just add -fcheck-new and hope the compiler does implement it |
Depending on when it was added to gcc and/or if clang supports it, should add this to the c++ flags since its more realistic that heap allocations can fail in an embedded environment.
The text was updated successfully, but these errors were encountered: