aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaDecl.cpp4
-rw-r--r--test/SemaOpenCL/warn-missing-prototypes.cl6
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 12444e5559..7233fc7c13 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -7509,6 +7509,10 @@ static bool ShouldWarnAboutMissingPrototype(const FunctionDecl *FD) {
if (FD->isFunctionTemplateSpecialization())
return false;
+ // Don't warn for OpenCL kernels.
+ if (FD->hasAttr<OpenCLKernelAttr>())
+ return false;
+
bool MissingPrototype = true;
for (const FunctionDecl *Prev = FD->getPreviousDecl();
Prev; Prev = Prev->getPreviousDecl()) {
diff --git a/test/SemaOpenCL/warn-missing-prototypes.cl b/test/SemaOpenCL/warn-missing-prototypes.cl
new file mode 100644
index 0000000000..487cb28399
--- /dev/null
+++ b/test/SemaOpenCL/warn-missing-prototypes.cl
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-prototypes %s
+
+void f() { } // expected-warning {{no previous prototype for function 'f'}}
+
+// Don't warn about kernel functions.
+kernel void g() { }