[cfe-commits] r141270 - in /cfe/trunk: lib/Parse/ParsePragma.cpp test/Parser/opencl-pragma.cl
Peter Collingbourne
peter at pcc.me.uk
Wed Oct 5 20:00:51 PDT 2011
Author: pcc
Date: Wed Oct 5 22:00:50 2011
New Revision: 141270
URL: http://llvm.org/viewvc/llvm-project?rev=141270&view=rev
Log:
OpenCL: disallow '#pragma OPENCL EXTENSION all : enable', per OpenCL 1.1 9.1
Modified:
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/test/Parser/opencl-pragma.cl
Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=141270&r1=141269&r2=141270&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Wed Oct 5 22:00:50 2011
@@ -451,8 +451,11 @@
}
OpenCLOptions &f = Actions.getOpenCLOptions();
- if (ename->isStr("all")) {
-#define OPENCLEXT(nm) f.nm = state;
+ // OpenCL 1.1 9.1: "The all variant sets the behavior for all extensions,
+ // overriding all previously issued extension directives, but only if the
+ // behavior is set to disable."
+ if (state == 0 && ename->isStr("all")) {
+#define OPENCLEXT(nm) f.nm = 0;
#include "clang/Basic/OpenCLExtensions.def"
}
#define OPENCLEXT(nm) else if (ename->isStr(#nm)) { f.nm = state; }
Modified: cfe/trunk/test/Parser/opencl-pragma.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/opencl-pragma.cl?rev=141270&r1=141269&r2=141270&view=diff
==============================================================================
--- cfe/trunk/test/Parser/opencl-pragma.cl (original)
+++ cfe/trunk/test/Parser/opencl-pragma.cl Wed Oct 5 22:00:50 2011
@@ -4,6 +4,9 @@
#pragma OPENCL EXTENSION cl_no_such_extension : disable /* expected-warning {{unknown OpenCL extension 'cl_no_such_extension' - ignoring}} */
+#pragma OPENCL EXTENSION all : disable
+#pragma OPENCL EXTENSION all : enable /* expected-warning {{unknown OpenCL extension 'all' - ignoring}} */
+
#pragma OPENCL EXTENSION cl_khr_fp64 : on /* expected-warning {{expected 'enable' or 'disable' - ignoring}} */
#pragma OPENCL FP_CONTRACT ON
More information about the cfe-commits
mailing list