[clang] [Clang] Add __datasizeof (PR #67805)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 13 13:08:00 PDT 2023


================
@@ -236,6 +236,7 @@ FEATURE(shadow_call_stack,
 FEATURE(tls, PP.getTargetInfo().isTLSSupported())
 FEATURE(underlying_type, LangOpts.CPlusPlus)
 FEATURE(experimental_library, LangOpts.ExperimentalLibrary)
+FEATURE(datasizeof, LangOpts.CPlusPlus)
----------------
philnik777 wrote:

Yeah, that's what we'd have to fall back to - or just live with using the fallback when changing warning flags (!?).

Not really relevant for this patch, but I'm not sure the behaviour actually makes that much sense. There are a few things that make it somewhat weird IMO.
1) `-pedantic-errors` disables `__has_extension`, but `-Werror=pedantic` doesn't. These are clearly distinct flags, but for a user they look like aliases, since they interact with warnings identically (AFAIK).
2) If you use `__has_extension` you almost always want to know whether the compiler accepts some code, and if not you generate an error that you don't support the compiler or use some fallback implementation. (At least that's my interpretation)
3) Changing diagnostic flags shouldn't influence anything other than the behaviour of the diagnostics engine. The code shouldn't compile differently, you should just get different diagnostics.


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


More information about the cfe-commits mailing list