[PATCH] D58666: [OpenCL] Undefine cl_intel_planar_yuv extension

Dmitry Sidorov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 26 03:28:38 PST 2019


sidorovd created this revision.
sidorovd added reviewers: Anastasia, yaxunl.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Consider the code:

  #pragma OPENCL EXTENSION cl_intel_planar_yuv : begin
  // some declarations
  #pragma OPENCL EXTENSION cl_intel_planar_yuv : end

is enough for extension to become known for clang.

Remove unnecessary definition (otherwise the extension will be define where it's not supposed to be defined).


Repository:
  rC Clang

https://reviews.llvm.org/D58666

Files:
  lib/Headers/opencl-c-common.h
  test/Headers/opencl-c-header.cl
  test/SemaOpenCL/extension-begin.cl


Index: test/SemaOpenCL/extension-begin.cl
===================================================================
--- test/SemaOpenCL/extension-begin.cl
+++ test/SemaOpenCL/extension-begin.cl
@@ -16,6 +16,13 @@
 //
 // RUN: %clang_cc1 -cl-std=CL2.0 -DIMPLICIT_INCLUDE -include %S/extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.modules %s -verify -pedantic
 
+#pragma OPENCL EXTENSION my_ext : enable
+#ifndef IMPLICIT_INCLUDE
+// expected-warning at -2 {{unknown OpenCL extension 'my_ext' - ignoring}}
+// expected-warning at +2 {{unknown OpenCL extension 'my_ext' - ignoring}}
+#endif // IMPLICIT_INCLUDE
+#pragma OPENCL EXTENSION my_ext : disable
+
 #ifndef IMPLICIT_INCLUDE
 #include "extension-begin.h"
 #endif // IMPLICIT_INCLUDE
@@ -31,8 +38,8 @@
   f();
   g(0);
 }
+#pragma OPENCL EXTENSION my_ext : disable
 
-#pragma OPENCL EXTENSION my_ext : disable 
 void test_f2(void) {
   struct A test_A2; // expected-error {{use of type 'struct A' requires my_ext extension to be enabled}}
   const struct A test_A_local; // expected-error {{use of type 'struct A' requires my_ext extension to be enabled}}
@@ -43,4 +50,3 @@
         // expected-note at extension-begin.h:18 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be enabled}}
         // expected-note at extension-begin.h:23 {{candidate function not viable: requires 0 arguments, but 1 was provided}}
 }
-
Index: test/Headers/opencl-c-header.cl
===================================================================
--- test/Headers/opencl-c-header.cl
+++ test/Headers/opencl-c-header.cl
@@ -77,9 +77,6 @@
 // OpenCL 1.2 onwards.
 #if (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
 // expected-no-diagnostics
-#ifndef cl_intel_planar_yuv
-#error "Missing cl_intel_planar_yuv define"
-#endif
 #else //__OPENCL_C_VERSION__
 // expected-warning at +2{{unknown OpenCL extension 'cl_intel_planar_yuv' - ignoring}}
 #endif //__OPENCL_C_VERSION__
Index: lib/Headers/opencl-c-common.h
===================================================================
--- lib/Headers/opencl-c-common.h
+++ lib/Headers/opencl-c-common.h
@@ -21,9 +21,6 @@
 #endif //__OPENCL_C_VERSION__ < CL_VERSION_2_0
 
 #if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
-#ifndef cl_intel_planar_yuv
-#define cl_intel_planar_yuv
-#endif // cl_intel_planar_yuv
 #pragma OPENCL EXTENSION cl_intel_planar_yuv : begin
 #pragma OPENCL EXTENSION cl_intel_planar_yuv : end
 #endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58666.188332.patch
Type: text/x-patch
Size: 2501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190226/905d14b8/attachment.bin>


More information about the cfe-commits mailing list