aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-11-02 14:48:37 +0000
committerJakub Jelinek <jakub@redhat.com>2009-11-02 14:48:37 +0000
commitec681396423d48f418edb5139f40a0b488243297 (patch)
tree315a856edf8e26a1c71c2c921797f9249dfd89f5
parentb36b563f1576b67a25b26bef40a77121895faa8c (diff)
svn merge -r153804:153806 svn+ssh://gcc.gnu.org/svn/gcc/trunk
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_4-branch@153812 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog19
-rw-r--r--gcc/c-pragma.c40
-rw-r--r--gcc/c-pragma.h4
-rw-r--r--gcc/cfgexpand.c3
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/name-lookup.c2
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/cp/rtti.c4
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/namespace3.C6
-rw-r--r--gcc/testsuite/gcc.dg/debug/pr41893-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/debug/pr41893-2.c10
12 files changed, 99 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f4b71981591..8b44d02a19d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,22 @@
+2009-11-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/41893
+ * cfgexpand.c (expand_debug_expr): Don't attempt to create DECL_RTL
+ for a VOIDmode variable.
+
+ PR c++/41774
+ * c-pragma.c (visstack): Change into vector of ints rather than
+ enum symbol_visibility.
+ (push_visibility): Add kind argument, push default_visibility together
+ with kind.
+ (pop_visibility): Add kind argument, return true if successful, fail
+ if visibility stack is empty or if stack top is of different kind.
+ (handle_pragma_visibility): Don't check length of visstack, instead
+ call pop_visibility and issue diagnostics if it failed. Pass 0
+ as last argument to push_visibility and pop_visibility.
+ * c-pragma.h (push_visibility): Add kind argument.
+ (pop_visibility): Likewise. Return bool instead of void.
+
2009-10-28 Jakub Jelinek <jakub@redhat.com>
PR target/41762
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index 2f2095ec81a..159b14a2842 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -733,19 +733,20 @@ maybe_apply_renaming_pragma (tree decl, tree asmname)
#ifdef HANDLE_PRAGMA_VISIBILITY
static void handle_pragma_visibility (cpp_reader *);
-typedef enum symbol_visibility visibility;
-DEF_VEC_I (visibility);
-DEF_VEC_ALLOC_I (visibility, heap);
-static VEC (visibility, heap) *visstack;
+static VEC (int, heap) *visstack;
/* Push the visibility indicated by STR onto the top of the #pragma
- visibility stack. */
+ visibility stack. KIND is 0 for #pragma GCC visibility, 1 for
+ C++ namespace with visibility attribute and 2 for C++ builtin
+ ABI namespace. push_visibility/pop_visibility calls must have
+ matching KIND, it is not allowed to push visibility using one
+ KIND and pop using a different one. */
void
-push_visibility (const char *str)
+push_visibility (const char *str, int kind)
{
- VEC_safe_push (visibility, heap, visstack,
- default_visibility);
+ VEC_safe_push (int, heap, visstack,
+ ((int) default_visibility) | (kind << 8));
if (!strcmp (str, "default"))
default_visibility = VISIBILITY_DEFAULT;
else if (!strcmp (str, "internal"))
@@ -759,14 +760,21 @@ push_visibility (const char *str)
visibility_options.inpragma = 1;
}
-/* Pop a level of the #pragma visibility stack. */
+/* Pop a level of the #pragma visibility stack. Return true if
+ successful. */
-void
-pop_visibility (void)
+bool
+pop_visibility (int kind)
{
- default_visibility = VEC_pop (visibility, visstack);
+ if (!VEC_length (int, visstack))
+ return false;
+ if ((VEC_last (int, visstack) >> 8) != kind)
+ return false;
+ default_visibility
+ = (enum symbol_visibility) (VEC_pop (int, visstack) & 0xff);
visibility_options.inpragma
- = VEC_length (visibility, visstack) != 0;
+ = VEC_length (int, visstack) != 0;
+ return true;
}
/* Sets the default visibility for symbols to something other than that
@@ -795,10 +803,8 @@ handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED)
{
if (pop == action)
{
- if (!VEC_length (visibility, visstack))
+ if (! pop_visibility (0))
GCC_BAD ("no matching push for %<#pragma GCC visibility pop%>");
- else
- pop_visibility ();
}
else
{
@@ -808,7 +814,7 @@ handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED)
if (token != CPP_NAME)
GCC_BAD ("malformed #pragma GCC visibility push");
else
- push_visibility (IDENTIFIER_POINTER (x));
+ push_visibility (IDENTIFIER_POINTER (x), 0);
if (pragma_lex (&x) != CPP_CLOSE_PAREN)
GCC_BAD ("missing %<(%> after %<#pragma GCC visibility push%> - ignored");
}
diff --git a/gcc/c-pragma.h b/gcc/c-pragma.h
index be085ee1115..eab23db6cd9 100644
--- a/gcc/c-pragma.h
+++ b/gcc/c-pragma.h
@@ -95,8 +95,8 @@ extern struct cpp_reader* parse_in;
visibility is not supported on the host OS platform the
statements are ignored. */
#define HANDLE_PRAGMA_VISIBILITY 1
-extern void push_visibility (const char *);
-extern void pop_visibility (void);
+extern void push_visibility (const char *, int);
+extern bool pop_visibility (int);
extern void init_pragma (void);
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 63f87419cd6..9807c0ae07b 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2132,7 +2132,8 @@ expand_debug_expr (tree exp)
|| DECL_EXTERNAL (exp)
|| !TREE_STATIC (exp)
|| !DECL_NAME (exp)
- || DECL_HARD_REGISTER (exp))
+ || DECL_HARD_REGISTER (exp)
+ || mode == VOIDmode)
return NULL;
op0 = DECL_RTL (exp);
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9fcbdc6ecf9..48090a3ed49 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,14 @@
+2009-11-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/41774
+ * name-lookup.c (handle_namespace_attrs): Pass 1 as last argument to
+ push_visibility.
+ * parser.c (cp_parser_namespace_definition): Pass 1 as argument to
+ pop_visibility.
+ * rtti.c (push_abi_namespace): Pass 2 as last argument to
+ push_visibility.
+ (pop_abi_namespace): Pass 2 as argument to pop_visibility.
+
2009-10-31 Jason Merrill <jason@redhat.com>
PR c++/41754
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index a1a9c327fe9..4688f508526 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3159,7 +3159,7 @@ handle_namespace_attrs (tree ns, tree attributes)
"%qD attribute is meaningless since members of the "
"anonymous namespace get local symbols", name);
- push_visibility (TREE_STRING_POINTER (x));
+ push_visibility (TREE_STRING_POINTER (x), 1);
saw_vis = true;
}
else
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d59764da220..97e1168beab 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -12199,7 +12199,7 @@ cp_parser_namespace_definition (cp_parser* parser)
#ifdef HANDLE_PRAGMA_VISIBILITY
if (has_visibility)
- pop_visibility ();
+ pop_visibility (1);
#endif
/* Finish the namespace. */
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 6d75772a1e2..21e5adcee83 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -129,13 +129,13 @@ static void
push_abi_namespace (void)
{
push_nested_namespace (abi_node);
- push_visibility ("default");
+ push_visibility ("default", 2);
}
static void
pop_abi_namespace (void)
{
- pop_visibility ();
+ pop_visibility (2);
pop_nested_namespace (abi_node);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index be15117ce75..9e75d3521a1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2009-11-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/41893
+ * gcc.dg/debug/pr41893-1.c: New test.
+ * gcc.dg/debug/pr41893-2.c: New file.
+
+ PR c++/41774
+ * g++.dg/ext/visibility/namespace3.C: New test.
+
2009-11-01 Tobias Burnus <burnus@net-b.de>
PR fortran/41850
diff --git a/gcc/testsuite/g++.dg/ext/visibility/namespace3.C b/gcc/testsuite/g++.dg/ext/visibility/namespace3.C
new file mode 100644
index 00000000000..a07abdcd89a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility/namespace3.C
@@ -0,0 +1,6 @@
+// PR c++/41774
+// { dg-do compile }
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+#pragma GCC visibility pop // { dg-warning "no matching push for" }
+}
diff --git a/gcc/testsuite/gcc.dg/debug/pr41893-1.c b/gcc/testsuite/gcc.dg/debug/pr41893-1.c
new file mode 100644
index 00000000000..54a31fb6f2f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/pr41893-1.c
@@ -0,0 +1,13 @@
+/* PR debug/41893 */
+/* { dg-do compile } */
+/* { dg-options "-combine -fwhole-program -O" } */
+/* { dg-additional-sources "pr41893-2.c" } */
+
+struct S { int v; };
+struct S s;
+
+void __attribute__((externally_visible))
+func1 (void)
+{
+ struct S *p = &s;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/pr41893-2.c b/gcc/testsuite/gcc.dg/debug/pr41893-2.c
new file mode 100644
index 00000000000..f967875f198
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/pr41893-2.c
@@ -0,0 +1,10 @@
+/* PR debug/41893 */
+/* { dg-do compile } */
+
+extern struct S s;
+
+void
+func2 (void)
+{
+ &s;
+}