re PR c/18479 (__attribute__ ((visibility("default"))) in C causes internal compiler...
authorAndrew Pinski <pinskia@physics.uc.edu>
Mon, 29 Nov 2004 23:11:30 +0000 (23:11 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Mon, 29 Nov 2004 23:11:30 +0000 (15:11 -0800)
2004-11-29  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c/18479
        * gcc.dg/pr18479.c: New test.

2004-11-29  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c/18479
        * c-common.c (handle_visibility_attribute): When the type decl
        is really a identifier node, warn about being ignored and return.

From-SVN: r91492

gcc/ChangeLog
gcc/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr18479.c [new file with mode: 0644]

index 87a928f8d447d9ca400833902f25b91d54844d3d..932e09de7c01733c1b53801d4466e35c0577567e 100644 (file)
@@ -1,3 +1,9 @@
+2004-11-29  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR c/18479
+       * c-common.c (handle_visibility_attribute): When the type decl
+       is really a identifier node, warn about being ignored and return.
+
 2004-11-29  Richard Henderson  <rth@redhat.com>
 
        * tree-cfg.c (tree_node_can_be_shared): Fix typo'd error_mark_node.
index bfefeb231dcb24fd6f7df9122d4e6ef27d81fd25..62aaa27b16b5243788b52a143e92af69e9a448f4 100644 (file)
@@ -4571,6 +4571,12 @@ handle_visibility_attribute (tree *node, tree name, tree args,
       decl = TYPE_NAME (decl);
       if (!decl)
         return NULL_TREE;
+      if (TREE_CODE (decl) == IDENTIFIER_NODE)
+       {
+          warning ("%qE attribute ignored on types",
+                   name);
+          return NULL_TREE;
+       }
     }
 
   if (strcmp (TREE_STRING_POINTER (id), "default") == 0)
index 9856c5434f9768c7477d3609f3f3bf7e2edaa4c9..885b98019cb0f706210352af6e969b3d4d27761d 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-29  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR c/18479
+       * gcc.dg/pr18479.c: New test.
+
 2004-11-29  Hans-Peter Nilsson  <hp@bitrange.com>
 
        PR target/18490
diff --git a/gcc/testsuite/gcc.dg/pr18479.c b/gcc/testsuite/gcc.dg/pr18479.c
new file mode 100644 (file)
index 0000000..493574e
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+struct __attribute__ ((visibility("default"))) Foo { int foo; }; /* { dg-warning "attribute ignored on types" } */