[PATCH] D137652: Remove mandatory define of optional features macros for OpenCL C 3.0

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 2 14:53:48 PST 2022


Anastasia added a comment.

In D137652#3957519 <https://reviews.llvm.org/D137652#3957519>, @svenvh wrote:

>> @svenvh I remember that we have also discussed the addition of a vendor specific header where such feature/extension macro definition can be added to avoid the macro pollution but I feel this is somewhat orthogonal i.e. the fine grained control of macro defines is still needed?
>
> Unfortunately I don't remember the details of that discussion, but I agree that it's worth looking into a solution for issue #55674, using e.g. `__undef` macros as you described above.

I assume we could start from something simple i.e. without the need to amend `-cl-ext`. So let's say we could add the following guards in the header:

  #ifndef __undef_feature1
  #define feature1 1
  #endif

Then we can pass `-D__undef_feature1` instead of  `-cl-std=-feature1` and `-Dfeature1=1` instead of `-cl-std=+feature1`.

Then later if needed we could extend `-cl-ext` to set those  `__undef_<feature name>` instead.

We could also add a macro that corresponds to `-cl-ext=-all` and etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137652



More information about the cfe-commits mailing list