Le 17 janv. 2013 à 23:16, Richard Smith <[email protected]> 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 ? 


-- Jean-Daniel




_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to