OpenCL: disallow '#pragma OPENCL EXTENSION all : enable', per OpenCL 1.1 9.1

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141270 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Peter Collingbourne 2011-10-06 03:00:50 +00:00
Родитель 08f35a79f7
Коммит 41c8d6fe09
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -451,8 +451,11 @@ PragmaOpenCLExtensionHandler::HandlePragma(Preprocessor &PP,
}
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; }

Просмотреть файл

@ -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