[PATCH] D125259: [C11] Diagnose unreachable generic selection associations

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 18 04:46:27 PDT 2022


aaron.ballman added a comment.

In D125259#3520544 <https://reviews.llvm.org/D125259#3520544>, @tahonermann wrote:

>> I'm questioning the benefit to supporting _Generic in C++ and starting to wonder if perhaps we should pull this extension back.
>
> I imagine it may be used in shared system headers. E.g., implementations of `tgmath.h` that don't use the builtins.

That's a good thought! I'm not seeing much evidence of that, at least from my code searches: https://sourcegraph.com/search?q=context:global+file:tgmath%5C.h+_Generic+AND+%28%23ifdef+__cplusplus+OR+%23if+defined%5C%28__cplusplus%5C%29%29&patternType=literal&case=yes

You can definitely find cases of `#ifndef __cplusplus` in the same code search though (which I've seen protecting uses of `_Generic` in the file). Also, our own tgmath.h implementation is not using `_Generic` (we use `__attribute__((overloadable))` instead).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125259



More information about the cfe-commits mailing list