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

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 15 12:21:57 PST 2023


Anastasia added a comment.

In D141297#4047148 <https://reviews.llvm.org/D141297#4047148>, @svenvh wrote:

> 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.

Ok that would be better indeed. Btw I hope we won't have that many feature macros that it would be too long to parse those. :(


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