[clang] Add option -fstdlib-hardening= (PR #78763)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 08:52:35 PST 2024


AaronBallman wrote:

> Setting macros that are reserved names is really unappealing for people.

I think that may depend on your background. For example, in the C standard library, there's a whole pile of `WANT` macros that users are expected to define before including a header file to opt in to extra behavior (e.g., `__STDC_WANT_IEC_60559_EXT__`), `_POSIX_C_SOURCE` or `_GNU_SOURCE` behave similarly, `_CRT_SECURE_NO_WARNINGS` and friends in MSVC, etc. There's quite a bit of precedence for expecting users to define macros with reserved identifiers.

> Finally, in the future this flag could potentially include more than just the macro. For example, it could potentially include a few additional warnings.

This is a more compelling reason to consider adding a flag, but we could still add the flag in the future when it actually does more than define a single macro.

https://github.com/llvm/llvm-project/pull/78763


More information about the cfe-commits mailing list