[libcxx-commits] [PATCH] D153902: [libc++][hardening][NFC] Add macros to enable hardened mode.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 29 10:45:02 PDT 2023


var-const added inline comments.


================
Comment at: libcxx/include/__config:194
 
+// HARDENING {
+
----------------
ldionne wrote:
> We don't have a good story for splitting up the whole `__config` header, however we could pretty easily add all the hardening configuration macros to something like `__hardening` or `__config_dir/hardening.h`. IMO it would make sure that this configuration is nicely contained in a single place.
> 
> You'll want to make sure to include `__config` in that header since that includes `__config_site`, and that's where you get some of the defaults from.
I think the original idea for the split was that `__config` will include everything from `__config_dir`, so that other files can simply include `__config` and get everything. If that's the case, `__config_dir/hardening.h` cannot include `__config`. It could include `__config_site` directly, but I'm concerned it will need other includes in the future (for other macros it might rely upon), necessitating more granularization, and I'm not sure we want to go that way right now.

OTOH, it's straightforward to include `__config` from `__config_dir/hardening.h`, but then all the other files that use assertions would need to include `__config_dir/hardening.h` (or I guess we could include it in `__assert` and then those files would just include `__assert`?). What do you think?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153902/new/

https://reviews.llvm.org/D153902



More information about the libcxx-commits mailing list