r190303 - Removing the endian attribute and updating associated test cases. This functionality was never completely implemented, and this is an improvement over silently eating the attribute.

Aaron Ballman aaron at aaronballman.com
Mon Sep 9 05:57:20 PDT 2013


Author: aaronballman
Date: Mon Sep  9 07:57:20 2013
New Revision: 190303

URL: http://llvm.org/viewvc/llvm-project?rev=190303&view=rev
Log:
Removing the endian attribute and updating associated test cases.  This functionality was never completely implemented, and this is an improvement over silently eating the attribute.

Modified:
    cfe/trunk/include/clang/Basic/Attr.td
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/test/Sema/attr-endian.c
    cfe/trunk/test/SemaOpenCL/endian-attr.cl

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=190303&r1=190302&r2=190303&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Mon Sep  9 07:57:20 2013
@@ -631,11 +631,6 @@ def ReqdWorkGroupSize : InheritableAttr
               UnsignedArgument<"ZDim">];
 }
 
-def Endian : InheritableAttr {
-  let Spellings = [GNU<"endian">];
-  let Args = [IdentifierArgument<"platform">];
-}
-
 def WorkGroupSizeHint :  InheritableAttr {
   let Spellings = [GNU<"work_group_size_hint">];
   let Args = [UnsignedArgument<"XDim">, 

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=190303&r1=190302&r2=190303&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Sep  9 07:57:20 2013
@@ -2902,24 +2902,6 @@ static void handleVecTypeHint(Sema &S, D
                                                ParmType, Attr.getLoc()));
 }
 
-static void handleEndianAttr(Sema &S, Decl *D, const AttributeList &Attr) {
-  if (!Attr.isArgIdent(0)) {
-    S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
-     << Attr.getName() << 1 << AANT_ArgumentIdentifier;
-    return;
-  }
-  
-  if (!checkAttributeNumArgs(S, Attr, 1))
-    return;
-
-  if (!dyn_cast<VarDecl>(D))
-    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
-      << Attr.getName() << ExpectedVariable;
-  StringRef EndianType = Attr.getArgAsIdent(0)->Ident->getName();
-  if (EndianType != "host" && EndianType != "device")
-    S.Diag(Attr.getLoc(), diag::warn_attribute_unknown_endian) << EndianType;
-}
-
 SectionAttr *Sema::mergeSectionAttr(Decl *D, SourceRange Range,
                                     StringRef Name,
                                     unsigned AttrSpellingListIndex) {
@@ -4917,10 +4899,6 @@ static void ProcessDeclAttribute(Sema &S
   case AttributeList::AT_VecTypeHint:
     handleVecTypeHint(S, D, Attr); break;
 
-  case AttributeList::AT_Endian:
-    handleEndianAttr(S, D, Attr);
-    break;
-
   case AttributeList::AT_InitPriority: 
       handleInitPriorityAttr(S, D, Attr); break;
       

Modified: cfe/trunk/test/Sema/attr-endian.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-endian.c?rev=190303&r1=190302&r2=190303&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-endian.c (original)
+++ cfe/trunk/test/Sema/attr-endian.c Mon Sep  9 07:57:20 2013
@@ -1,11 +1,3 @@
 // RUN: %clang_cc1 %s -verify -fsyntax-only
 
-int p1 __attribute__((endian(host)));
-int p2 __attribute__((endian(device)));
-
-int p3 __attribute__((endian));	// expected-error {{'endian' attribute requires parameter 1 to be an identifier}}
-int p4 __attribute__((endian("host")));	// expected-error {{'endian' attribute requires parameter 1 to be an identifier}}
-int p5 __attribute__((endian(host, 15)));	// expected-error {{'endian' attribute takes one argument}}
-int p6 __attribute__((endian(strange)));	// expected-warning {{unknown endian 'strange'}}
-
-void func(void) __attribute__((endian(host))); // expected-warning {{'endian' attribute only applies to variables}}
+int p1 __attribute__((endian(host)));	// expected-warning {{unknown attribute 'endian' ignored}}

Modified: cfe/trunk/test/SemaOpenCL/endian-attr.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/endian-attr.cl?rev=190303&r1=190302&r2=190303&view=diff
==============================================================================
--- cfe/trunk/test/SemaOpenCL/endian-attr.cl (original)
+++ cfe/trunk/test/SemaOpenCL/endian-attr.cl Mon Sep  9 07:57:20 2013
@@ -1,9 +1,3 @@
 // RUN: %clang_cc1 -verify %s
 
-constant long a __attribute__((endian(host))) = 100;
-
-constant long b __attribute__((endian(device))) = 100;
-
-constant long c __attribute__((endian(none))) = 100; // expected-warning {{unknown endian 'none'}}
-
-void func() __attribute__((endian(host))); // expected-warning {{'endian' attribute only applies to variables}}
+constant long a __attribute__((endian(host))) = 100;	// expected-warning {{unknown attribute 'endian' ignored}}





More information about the cfe-commits mailing list