summaryrefslogtreecommitdiff
path: root/test/SemaOpenCL
diff options
context:
space:
mode:
authorAlexey Bader <alexey.bader@intel.com>2017-10-11 11:16:31 +0000
committerAlexey Bader <alexey.bader@intel.com>2017-10-11 11:16:31 +0000
commitcaaaf1b95ed9e016f314b61bf74453da91dda1ce (patch)
tree7509e1e361f018b01aa07b1123d18ef73b89489d /test/SemaOpenCL
parent41ca94e92225baa5370fcbdb414d3999ef4eabbe (diff)
[OpenCL] Allow function declaration with empty argument list.
Treat 'f()' as 'f(void)' rather than a function w/o a prototype. Reviewers: Anastasia, yaxunl Reviewed By: Anastasia, yaxunl Subscribers: cfe-commits, echuraev, chapuni Differential Revision: https://reviews.llvm.org/D33681 Re-apply revision 306653. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315453 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaOpenCL')
-rw-r--r--test/SemaOpenCL/func.cl5
-rw-r--r--test/SemaOpenCL/invalid-pipes-cl2.0.cl2
2 files changed, 5 insertions, 2 deletions
diff --git a/test/SemaOpenCL/func.cl b/test/SemaOpenCL/func.cl
index dc5b44057b..83c3b4a6bc 100644
--- a/test/SemaOpenCL/func.cl
+++ b/test/SemaOpenCL/func.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -triple spir-unknown-unknown
// Variadic functions
void vararg_f(int, ...); // expected-error {{invalid prototype, variadic arguments are not allowed in OpenCL}}
@@ -16,6 +16,9 @@ typedef struct s
//Function pointer
void foo(void*);
+// Expect no diagnostics for an empty parameter list.
+void bar();
+
void bar()
{
// declaring a function pointer is an error
diff --git a/test/SemaOpenCL/invalid-pipes-cl2.0.cl b/test/SemaOpenCL/invalid-pipes-cl2.0.cl
index a50811650d..463fd3d0da 100644
--- a/test/SemaOpenCL/invalid-pipes-cl2.0.cl
+++ b/test/SemaOpenCL/invalid-pipes-cl2.0.cl
@@ -3,7 +3,7 @@
global pipe int gp; // expected-error {{type '__global read_only pipe int' can only be used as a function parameter in OpenCL}}
global reserve_id_t rid; // expected-error {{the '__global reserve_id_t' type cannot be used to declare a program scope variable}}
-extern pipe write_only int get_pipe(); // expected-error {{type '__global write_only pipe int ()' can only be used as a function parameter in OpenCL}}
+extern pipe write_only int get_pipe(); // expected-error {{type '__global write_only pipe int (void)' can only be used as a function parameter in OpenCL}}
kernel void test_invalid_reserved_id(reserve_id_t ID) { // expected-error {{'reserve_id_t' cannot be used as the type of a kernel parameter}}
}