]> granicus.if.org Git - clang/commitdiff
Hack in a workaround for PR11082 until we have a proper fix. This
authorChandler Carruth <chandlerc@gmail.com>
Fri, 7 Oct 2011 18:40:27 +0000 (18:40 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 7 Oct 2011 18:40:27 +0000 (18:40 +0000)
un-breaks every glib-dependent compile with Clang.

I'm not sure this is even the best workaround, so suggestions welcome.

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

lib/Sema/SemaType.cpp
test/Sema/types.c

index 2b863a735a48bf8e73752c4658d1f2554eb96a85..1e0c2d60c4a3122b533fb99e8d8026fbaa99b3ce 100644 (file)
@@ -3779,6 +3779,11 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type,
     switch (attr.getKind()) {
     default: break;
 
+    case AttributeList::AT_may_alias:
+      // FIXME: This attribute needs to actually be handled, but if we ignore
+      // it it breaks large amounts of Linux software.
+      attr.setUsedAsTypeAttr();
+      break;
     case AttributeList::AT_address_space:
       HandleAddressSpaceTypeAttribute(type, attr, state.getSema());
       attr.setUsedAsTypeAttr();
index 33305abe020f28591d7c30cad2010737878c3a39..332b525e33a84483f0bd89ee59cbf7894d5c1609 100644 (file)
@@ -41,3 +41,12 @@ int __attribute__ ((vector_size (8), vector_size (8))) v;  // expected-error {{i
 void test(int i) {
   char c = (char __attribute__((align(8)))) i; // expected-error {{'align' attribute ignored when parsing type}}
 }
+
+// http://llvm.org/PR11082
+//
+// FIXME: This may or may not be the correct approach (no warning or error),
+// but large amounts of Linux and FreeBSD code need this attribute to not be
+// a hard error in order to work correctly.
+void test2(int i) {
+  char c = (char __attribute__((may_alias))) i;
+}