summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2015-04-23 16:12:42 +0000
committerAaron Ballman <aaron@aaronballman.com>2015-04-23 16:12:42 +0000
commit1710cc994ecd3b422a54a35117b089adff4d42c1 (patch)
tree89d35406a5d974dcd54d69e9dc2bc34439448d20 /clang/lib/Sema/SemaDecl.cpp
parentf4b0f0743000b9cab05461b950af6ec3ec3cfe29 (diff)
downloadbcm5719-llvm-1710cc994ecd3b422a54a35117b089adff4d42c1.tar.gz
bcm5719-llvm-1710cc994ecd3b422a54a35117b089adff4d42c1.zip
Diagnose variadic main() as an extension; addresses PR17905.
llvm-svn: 235605
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5bb39cbf147..6916710036c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -8252,6 +8252,12 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) {
bool HasExtraParameters = (nparams > 3);
+ if (FTP->isVariadic()) {
+ Diag(FD->getLocation(), diag::ext_variadic_main);
+ // FIXME: if we had information about the location of the ellipsis, we
+ // could add a FixIt hint to remove it as a parameter.
+ }
+
// Darwin passes an undocumented fourth argument of type char**. If
// other platforms start sprouting these, the logic below will start
// getting shifty.
OpenPOWER on IntegriCloud