Index: docs/UsersManual.rst =================================================================== --- docs/UsersManual.rst +++ docs/UsersManual.rst @@ -2734,6 +2734,14 @@ enqueue query functions from `section 6.13.17.5 `_. +Differences between various standard modes +------------------------------------------ + +All OpenCL standards: + +- Variadic macros are supported. + + .. _target_features: Target-Specific Features and Limitations Index: include/clang/Basic/DiagnosticLexKinds.td =================================================================== --- include/clang/Basic/DiagnosticLexKinds.td +++ include/clang/Basic/DiagnosticLexKinds.td @@ -393,9 +393,6 @@ def note_macro_here : Note<"macro %0 defined here">; def note_macro_expansion_here : Note<"expansion of macro %0 requested here">; -def err_pp_opencl_variadic_macros : - Error<"variadic macros not supported in OpenCL">; - def err_pp_invalid_directive : Error<"invalid preprocessing directive">; def err_pp_directive_required : Error< "%0 must be used within a preprocessing directive">; Index: lib/Lex/PPDirectives.cpp =================================================================== --- lib/Lex/PPDirectives.cpp +++ lib/Lex/PPDirectives.cpp @@ -2233,12 +2233,6 @@ diag::warn_cxx98_compat_variadic_macro : diag::ext_variadic_macro); - // OpenCL v1.2 s6.9.e: variadic macros are not supported. - if (LangOpts.OpenCL) { - Diag(Tok, diag::err_pp_opencl_variadic_macros); - return true; - } - // Lex the token after the identifier. LexUnexpandedToken(Tok); if (Tok.isNot(tok::r_paren)) { Index: test/Preprocessor/macro_variadic.cl =================================================================== --- test/Preprocessor/macro_variadic.cl +++ /dev/null @@ -1,3 +0,0 @@ -// RUN: %clang_cc1 -verify %s - -#define X(...) 1 // expected-error {{variadic macros not supported in OpenCL}} Index: test/SemaOpenCL/func.cl =================================================================== --- test/SemaOpenCL/func.cl +++ test/SemaOpenCL/func.cl @@ -1,5 +1,10 @@ // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -triple spir-unknown-unknown +//Variadic macro +#define NO_VAR_FUNC(...) 5 +#define VAR_FUNC(...) func(__VA_ARGS__); +#define VAR_PRINTF(str, ...) printf(str, __VA_ARGS__); + // Variadic functions void vararg_f(int, ...); // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}} void __vararg_f(int, ...); @@ -33,4 +38,8 @@ // just calling a function is correct foo(0); + + NO_VAR_FUNC(1, 2, 3); + VAR_FUNC(1, 2, 3); //expected-error{{implicit declaration of function 'func' is invalid in OpenCL}} + VAR_PRINTF("%i", 1); }