Skip to content
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

Open
travisg opened this issue Apr 26, 2022 · 5 comments
Open

Add -fcheck-new to c++ flags #326

travisg opened this issue Apr 26, 2022 · 5 comments

Comments

@travisg
Copy link
Member

travisg commented Apr 26, 2022

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.

@heatd
Copy link
Contributor

heatd commented May 4, 2022

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.

@travisg
Copy link
Member Author

travisg commented May 6, 2022

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.

@heatd
Copy link
Contributor

heatd commented Nov 26, 2023

Supported since LLVM 17 (llvm/llvm-project@52c8f0b)

@travisg
Copy link
Member Author

travisg commented Mar 10, 2024

Probably worth conditionally adding, now that somewhere along the line some build system support was added for checking an individual flag.

@heatd
Copy link
Contributor

heatd commented Mar 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants