From a90f7ca591f922471386d3dbbbe7b8e7818fbe0a Mon Sep 17 00:00:00 2001 From: Charles Davis Date: Thu, 11 Feb 2010 23:57:08 +0000 Subject: Warn about using the new force_align_arg_pointer attribute on a function pointer. If you don't like the new warning, you can turn it off with -Wno-force-align-arg-pointer. llvm-svn: 95939 --- clang/lib/Sema/TargetAttributesSema.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'clang/lib/Sema/TargetAttributesSema.cpp') diff --git a/clang/lib/Sema/TargetAttributesSema.cpp b/clang/lib/Sema/TargetAttributesSema.cpp index 9062d368cad..d45d0106ffe 100644 --- a/clang/lib/Sema/TargetAttributesSema.cpp +++ b/clang/lib/Sema/TargetAttributesSema.cpp @@ -79,12 +79,14 @@ static void HandleX86ForceAlignArgPointerAttr(Decl *D, return; } - // If we try to apply it to a function pointer, don't warn, but don't - // do anything, either. It doesn't matter anyway, because there's nothing - // special about calling a force_align_arg_pointer function. + // If we try to apply it to a function pointer, warn. This is a special + // instance of the warn_attribute_ignored warning that can be turned + // off with -Wno-force-align-arg-pointer. ValueDecl* VD = dyn_cast(D); - if (VD && VD->getType()->isFunctionPointerType()) + if (VD && VD->getType()->isFunctionPointerType()) { + S.Diag(Attr.getLoc(), diag::warn_faap_attribute_ignored); return; + } // Attribute can only be applied to function types. if (!isa(D)) { S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) -- cgit v1.2.3