]> granicus.if.org Git - clang/commitdiff
Also don't warn about force_align_arg_pointer on function typedefs. (This will
authorCharles Davis <cdavis@mines.edu>
Thu, 18 Feb 2010 04:56:59 +0000 (04:56 +0000)
committerCharles Davis <cdavis@mines.edu>
Thu, 18 Feb 2010 04:56:59 +0000 (04:56 +0000)
break if you declare an actual function using that typedef. Come to think of it,
maybe I should make this part of the type.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96570 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/TargetAttributesSema.cpp
test/Sema/x86-attr-force-align-arg-pointer.c

index 1ea0299103457569e1c1b08f44883a11d920d17a..35e42fb696b7aecfe72111a3854e28fd40f2cd1b 100644 (file)
@@ -87,7 +87,8 @@ static void HandleX86ForceAlignArgPointerAttr(Decl *D,
     return;
   // Also don't warn on function pointer typedefs.
   TypedefDecl *TD = dyn_cast<TypedefDecl>(D);
-  if (TD && TD->getUnderlyingType()->isFunctionPointerType())
+  if (TD && (TD->getUnderlyingType()->isFunctionPointerType() ||
+             TD->getUnderlyingType()->isFunctionType()))
     return;
   // Attribute can only be applied to function types.
   if (!isa<FunctionDecl>(D)) {
index 5c7582fe0fac9ab3c5a8087979c388eb361c8265..b406a77e044c055de6ab2fb5c52d0951e94c3bc2 100644 (file)
@@ -16,4 +16,6 @@ void __attribute__((force_align_arg_pointer)) d(void) {}
 // Attribute is ignored on function pointer types.
 void (__attribute__((force_align_arg_pointer)) *p)();
 typedef void (__attribute__((__force_align_arg_pointer__)) *p2)();
+// Attribute is also ignored on function typedefs.
+typedef void __attribute__((force_align_arg_pointer)) e(void);