[PATCH] D105988: [OpenCL] NULL introduced prior to v2.0
Justas Janickas via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 14 08:57:51 PDT 2021
Topotuna updated this revision to Diff 358625.
Topotuna added a comment.
Added compile time flags
-finclude-default-header -fdeclare-opencl-builtins
instead of
#define NULL ((void*)0)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105988/new/
https://reviews.llvm.org/D105988
Files:
clang/lib/Headers/opencl-c-base.h
clang/test/SemaOpenCL/null_literal.cl
Index: clang/test/SemaOpenCL/null_literal.cl
===================================================================
--- clang/test/SemaOpenCL/null_literal.cl
+++ clang/test/SemaOpenCL/null_literal.cl
@@ -1,8 +1,7 @@
-// RUN: %clang_cc1 -fdeclare-opencl-builtins -finclude-default-header -verify %s
-// RUN: %clang_cc1 -cl-std=CL1.0 -fdeclare-opencl-builtins -finclude-default-header -verify %s
-// RUN: %clang_cc1 -cl-std=CL1.1 -fdeclare-opencl-builtins -finclude-default-header -verify %s
-// RUN: %clang_cc1 -cl-std=CL1.2 -fdeclare-opencl-builtins -finclude-default-header -verify %s
-// RUN: %clang_cc1 -cl-std=CL2.0 -DCL20 -fdeclare-opencl-builtins -finclude-default-header -verify %s
+// RUN: %clang_cc1 -verify %s
+// RUN: %clang_cc1 -cl-std=CL2.0 -DCL20 -verify %s
+
+#define NULL ((void*)0)
void foo(){
Index: clang/lib/Headers/opencl-c-base.h
===================================================================
--- clang/lib/Headers/opencl-c-base.h
+++ clang/lib/Headers/opencl-c-base.h
@@ -164,7 +164,7 @@
typedef double double16 __attribute__((ext_vector_type(16)));
#endif
-#if defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
#define NULL ((void*)0)
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105988.358625.patch
Type: text/x-patch
Size: 1277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210714/16fc59d7/attachment-0001.bin>
More information about the cfe-commits
mailing list