[PATCH] D95776: [OpenCL] Add macro definitions of OpenCL C 3.0 features

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 2 04:31:49 PST 2021


Anastasia added a subscriber: svenvh.
Anastasia added inline comments.


================
Comment at: clang/lib/Basic/Targets.cpp:743
+  // Assume compiling for FULL profile
+  Builder.defineMacro("__opencl_c_int64");
 }
----------------
Btw we could add the other feature macros for earlier versions too but I guess it makes code more complicated?


================
Comment at: clang/lib/Headers/opencl-c.h:17161
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ == 200)
+#undef __opencl_c_pipes
+#undef __opencl_c_generic_address_space
----------------
Looping in @svenvh  - I don't mind if we define those macros in headers for OpenCL 2.0. The only concern is that if we `undef` them here we will end up with different behavior between `-finclude-default-header` and `-fdeclare-opencl-builtins`. I would suggest not to `undef` them because it is better if we have coherency. Alternatively we could also add a third header with undefs that can be included at the end for both but it seems to make things even more complicated.

FYI `__opencl_c_int64` is already added for all OpenCL versions.


================
Comment at: clang/test/SemaOpenCL/features.cl:19
+#ifdef PIPES
+ #ifndef __opencl_c_pipes
+  #pragma error "Macro __opencl_c_pipes should be defined"
----------------
I think we should test all the macros that are being added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95776



More information about the cfe-commits mailing list