[PATCH] D141297: [OpenCL] Allow undefining header-only features

Sven van Haastregt via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 04:44:48 PST 2023


svenvh added a comment.

In D141297#4043122 <https://reviews.llvm.org/D141297#4043122>, @Anastasia wrote:

> Btw I wonder if in the future we could add some error or warning in case someone uses the same approach for frontend specific features, i.e.
>
>   #ifdef __undef___opencl_c_generic_address_space
>   #error "Feature __opencl_c_generic_address_space can only be disabled via -cl-ext flag"
>   #endif

Interesting idea, but I'm a bit hesitant of doing so:
It increases the size of `opencl-c-base.h` so it will take longer to parse, which will affect every OpenCL compilation. Luckily we can avoid that cost if we keep the `__undef_` mechanism an internal solution, which it will be once we let `-cl-ext=-feature` generate `__undef_` macros for extensions that are not in `OpenCLExtensions.def`. So longer term users will never have to pass `__undef_` macros.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141297



More information about the cfe-commits mailing list