r196415 - This attribute somehow remained nameless in the attribute tablegen, until now.
Alexander Potapenko
glider at google.com
Thu Dec 5 07:37:53 PST 2013
Hi Aaron,
Clang now reports an unknown attribute for the following code (a
slightly modified excerpt from Mozilla QCMS):
$ bin/clang++ -c t.cc
t.cc:14:16: warning: unknown attribute '__force_align_arg_pointer__'
ignored [-Wattributes]
__attribute__((__force_align_arg_pointer__))
^
==============================================================
$ cat t.cc
/* __force_align_arg_pointer__ is an x86-only attribute, and gcc/clang
warns on unused
* attributes. Don't use this on ARM or AMD64. __has_attribute can
detect the presence
* of the attribute but is currently only supported by clang */
#if defined(__has_attribute)
#define HAS_FORCE_ALIGN_ARG_POINTER __has_attribute(__force_align_arg_pointer__)
#elif defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
&& !defined(__arm__) && !defined(__mips__)
#define HAS_FORCE_ALIGN_ARG_POINTER 1
#else
#define HAS_FORCE_ALIGN_ARG_POINTER 0
#endif
#if HAS_FORCE_ALIGN_ARG_POINTER
/* we need this to avoid crashes when gcc assumes the stack is 128bit aligned */
__attribute__((__force_align_arg_pointer__))
#endif
int foo() {
return 0;
}
==============================================================
On Thu, Dec 5, 2013 at 1:43 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> Author: aaronballman
> Date: Wed Dec 4 15:43:30 2013
> New Revision: 196415
>
> URL: http://llvm.org/viewvc/llvm-project?rev=196415&view=rev
> Log:
> This attribute somehow remained nameless in the attribute tablegen, until now.
>
> Modified:
> cfe/trunk/include/clang/Basic/Attr.td
> cfe/trunk/lib/Sema/TargetAttributesSema.cpp
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=196415&r1=196414&r2=196415&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Wed Dec 4 15:43:30 2013
> @@ -916,7 +916,10 @@ def WeakRef : InheritableAttr {
> }
>
> def X86ForceAlignArgPointer : InheritableAttr, TargetSpecificAttr {
> - let Spellings = [];
> + let Spellings = [GNU<"force_align_arg_pointer">];
> + // Technically, this appertains to a FunctionDecl, but the target-specific
> + // code silently allows anything function-like (such as typedefs or function
> + // pointers), but does not apply the attribute to them.
> }
>
> // Attribute to disable AddressSanitizer (or equivalent) checks.
>
> Modified: cfe/trunk/lib/Sema/TargetAttributesSema.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TargetAttributesSema.cpp?rev=196415&r1=196414&r2=196415&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/TargetAttributesSema.cpp (original)
> +++ cfe/trunk/lib/Sema/TargetAttributesSema.cpp Wed Dec 4 15:43:30 2013
> @@ -267,8 +267,7 @@ namespace {
> }
> }
> if (Triple.getArch() != llvm::Triple::x86_64 &&
> - (Attr.getName()->getName() == "force_align_arg_pointer" ||
> - Attr.getName()->getName() == "__force_align_arg_pointer__")) {
> + Attr.getKind() == AttributeList::AT_X86ForceAlignArgPointer) {
> HandleX86ForceAlignArgPointerAttr(D, Attr, S);
> return true;
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
--
Alexander Potapenko
Software Engineer
Google Moscow
More information about the cfe-commits
mailing list