diff options
author | Volodymyr Sapsai <vsapsai@apple.com> | 2018-01-02 18:02:19 +0000 |
---|---|---|
committer | Volodymyr Sapsai <vsapsai@apple.com> | 2018-01-02 18:02:19 +0000 |
commit | 9ca0826f25d52d34be422969e20456acbbf7d402 (patch) | |
tree | dd9c99bd945d90f702c000b22bddc4c64ee35067 | |
parent | 1a835b5d57da69d0b8a94fbfd631a4c5b6aa0fbe (diff) | |
download | clang-9ca0826f25d52d34be422969e20456acbbf7d402.tar.gz |
[Sema] Don't emit the -Wstrict-prototypes warning for variadic functions.
rdar://problem/33251668
Reviewers: arphaman, ahatanak
Reviewed By: arphaman
Subscribers: ptitei, cfe-commits
Differential Revision: https://reviews.llvm.org/D41528
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321660 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaType.cpp | 2 | ||||
-rw-r--r-- | test/Sema/warn-strict-prototypes.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 4dab52a9f5..af060cf21b 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -4767,7 +4767,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, break; case DeclaratorChunk::Function: { const DeclaratorChunk::FunctionTypeInfo &FTI = DeclType.Fun; - if (FTI.NumParams == 0) + if (FTI.NumParams == 0 && !FTI.isVariadic) S.Diag(DeclType.Loc, diag::warn_strict_prototypes) << IsBlock << FixItHint::CreateInsertion(FTI.getRParenLoc(), "void"); diff --git a/test/Sema/warn-strict-prototypes.c b/test/Sema/warn-strict-prototypes.c index a28f57d48c..0c23b3b2c2 100644 --- a/test/Sema/warn-strict-prototypes.c +++ b/test/Sema/warn-strict-prototypes.c @@ -65,3 +65,9 @@ void foo11(p, p2) int p; int p2; {} void __attribute__((cdecl)) foo12(d) // expected-warning {{this old-style function definition is not preceded by a prototype}} short d; {} + +// No warnings for variadic functions. Overloadable attribute is required +// to avoid err_ellipsis_first_param error. +// rdar://problem/33251668 +void foo13(...) __attribute__((overloadable)); +void foo13(...) __attribute__((overloadable)) {} |