[cfe-commits] r167783 - in /cfe/trunk: include/clang/Basic/Attr.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclAttr.cpp test/SemaCXX/warn-unused-result.cpp

Michael Han Michael.Han at autodesk.com
Mon Nov 12 16:23:12 PST 2012


Hi Richard,

Shall we use CXX11<"gnu", "warn_unused_result"> instead? It seems to me that this attribute is not a clang only language extension (e.g. [[clang::fallthrough]]), but a GNU function attribute, and I believe what we plan to do in terms of migrating existing GNU attributes to C++11 syntax is to put them under "gnu" namespace..

Michael

-----Original Message-----
From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of Richard Smith
Sent: Monday, November 12, 2012 3:56 PM
To: Kaelyn Uhrain
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [cfe-commits] r167783 - in /cfe/trunk: include/clang/Basic/Attr.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclAttr.cpp test/SemaCXX/warn-unused-result.cpp

On Mon, Nov 12, 2012 at 3:48 PM, Kaelyn Uhrain <rikka at google.com> wrote:
> Author: rikka
> Date: Mon Nov 12 17:48:05 2012
> New Revision: 167783
>
> URL: http://llvm.org/viewvc/llvm-project?rev=167783&view=rev
> Log:
> Enable C++11 attribute syntax for warn_unused_result and allow it to 
> be applied to CXXRecordDecls, where functions with that return type 
> will inherit the warn_unused_result attribute.
>
> Also includes a tiny fix (with no discernable behavior change for 
> existing code) to re-sync AttributeDeclKind enum and 
> err_attribute_wrong_decl_type with warn_attribute_wrong_decl_type 
> since the enum is used with both diagnostic messages to chose the 
> correct description.
>
> Modified:
>     cfe/trunk/include/clang/Basic/Attr.td
>     cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>     cfe/trunk/lib/Sema/SemaDecl.cpp
>     cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>     cfe/trunk/test/SemaCXX/warn-unused-result.cpp
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr
> .td?rev=167783&r1=167782&r2=167783&view=diff
> ======================================================================
> ========
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Mon Nov 12 17:48:05 2012
> @@ -699,7 +699,7 @@
>  }
>
>  def WarnUnusedResult : InheritableAttr {
> -  let Spellings = [GNU<"warn_unused_result">];
> +  let Spellings = [GNU<"warn_unused_result">, 
> + CXX11<"","warn_unused_result">];

Please use CXX11<"clang", "warn_unused_result">.

_______________________________________________
cfe-commits mailing list
cfe-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list