[cfe-commits] r172761 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/TokenKinds.def include/clang/Sema/DeclSpec.h lib/Headers/CMakeLists.txt lib/Headers/stdnoreturn.h lib/Parse/ParseDecl.cpp lib/Sema/DeclSpec.cpp lib/Sema/SemaDecl.cpp test/Headers/c11.c test/Parser/c11-noreturn.c test/Sema/return-noreturn.c
Jean-Daniel Dupas
devlists at shadowlab.org
Fri Jan 18 05:18:36 PST 2013
Le 18 janv. 2013 à 14:16, Jean-Daniel Dupas <devlists at shadowlab.org> a écrit :
>
> Le 17 janv. 2013 à 23:16, Richard Smith <richard-llvm at metafoo.co.uk> a écrit :
>
>> NamedDecl*
>> @@ -6429,9 +6433,10 @@
>> void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) {
>> // C++11 [basic.start.main]p3: A program that declares main to be inline,
>> // static or constexpr is ill-formed.
>> - // C99 6.7.4p4: In a hosted environment, the inline function specifier
>> - // shall not appear in a declaration of main.
>> + // C11 6.7.4p4: In a hosted environment, no function specifier(s) shall
>> + // appear in a declaration of main.
>> // static main is not an error under C99, but we should warn about it.
>> + // We accept _Noreturn main as an extension.
>> if (FD->getStorageClass() == SC_Static)
>> Diag(DS.getStorageClassSpecLoc(), getLangOpts().CPlusPlus
>> ? diag::err_static_main : diag::warn_static_main)
>> @@ -6439,6 +6444,8 @@
>> if (FD->isInlineSpecified())
>> Diag(DS.getInlineSpecLoc(), diag::err_inline_main)
>> << FixItHint::CreateRemoval(DS.getInlineSpecLoc());
>> + if (DS.isNoreturnSpecified())
>> + Diag(DS.getNoreturnSpecLoc(), diag::ext_noreturn_main);
>> if (FD->isConstexpr()) {
>> Diag(DS.getConstexprSpecLoc(), diag::err_constexpr_main)
>> << FixItHint::CreateRemoval(DS.getConstexprSpecLoc());
>
>
> Should _Noreturn get a fixit too ?
>
Forget it, I didn't see we accept it as an extension, and don't emit an error.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130118/57914ace/attachment.html>
More information about the cfe-commits
mailing list