diff options
author | Tanya Lattner <tonic@nondot.org> | 2012-07-26 00:08:28 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2012-07-26 00:08:28 +0000 |
commit | a95b4f73c4a2c7ab31f0dc4c8c74d041d1504939 (patch) | |
tree | e5a7e2a72d21572d1b4acb5bd56ae942e26262c6 | |
parent | a2ad394dad8c90fb0374756a331d4a141f4a227d (diff) |
Disable the warning for missing prototypes for OpenCL kernels. Includes testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160766 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 4 | ||||
-rw-r--r-- | test/SemaOpenCL/warn-missing-prototypes.cl | 6 |
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() { } |