From e8233ac225ad6b380cdca254e7646cb5b9f917e2 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Mon, 29 Nov 2004 23:11:30 +0000 Subject: [PATCH] re PR c/18479 (__attribute__ ((visibility("default"))) in C causes internal compiler error) 2004-11-29 Andrew Pinski PR c/18479 * gcc.dg/pr18479.c: New test. 2004-11-29 Andrew Pinski 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 | 6 ++++++ gcc/c-common.c | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr18479.c | 3 +++ 4 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr18479.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87a928f8d44..932e09de7c0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-11-29 Andrew Pinski + + 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 * tree-cfg.c (tree_node_can_be_shared): Fix typo'd error_mark_node. diff --git a/gcc/c-common.c b/gcc/c-common.c index bfefeb231dc..62aaa27b16b 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9856c5434f9..885b98019cb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-11-29 Andrew Pinski + + PR c/18479 + * gcc.dg/pr18479.c: New test. + 2004-11-29 Hans-Peter Nilsson PR target/18490 diff --git a/gcc/testsuite/gcc.dg/pr18479.c b/gcc/testsuite/gcc.dg/pr18479.c new file mode 100644 index 00000000000..493574e8a9f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr18479.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ +struct __attribute__ ((visibility("default"))) Foo { int foo; }; /* { dg-warning "attribute ignored on types" } */ -- 2.30.2