aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libiberty/ChangeLog15
-rw-r--r--libiberty/cp-demangle.c2
-rw-r--r--libiberty/cp-demangle.h20
-rw-r--r--libiberty/testsuite/demangle-expected5
4 files changed, 37 insertions, 5 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 599fab3..6458c2a 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,16 @@
+2004-06-28 Zack Weinberg <zack@codesourcery.com>
+
+ * cp-demangle.h: Declare cplus_demangle_operators,
+ cplus_demangle_builtin_types, cplus_demangle_mangled_name, and
+ cplus_demangle_type as static if IN_GLIBCPP_V3.
+
+2004-06-28 Ian Lance Taylor <ian@wasabisystems.com>
+
+ PR other/16240
+ * cp-demangle.c (d_expr_primary): Check for a failure return from
+ cplus_demangle_type.
+ * testsuite/demangle-expected: Add test case.
+
2004-05-31 Danny Smith <dannysmith@users.sourceforge.net>
* pex-win32.c (fix_argv): Expand comment.
@@ -597,7 +610,7 @@
2003-08-12 Nathanael Nerode <neroden@gcc.gnu.org>
- * cp-demangle.c: Clarify what package(s) this is part of.
+ * cp-demangle.c: Clarify what package(s) this is part of.
2003-07-05 Danny Smith <dannysmith@users.sourceforge.net>
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index fe4b367..8608bc8 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -2398,6 +2398,8 @@ d_expr_primary (di)
const char *s;
type = cplus_demangle_type (di);
+ if (type == NULL)
+ return NULL;
/* If we have a type we know how to print, we aren't going to
print the type name itself. */
diff --git a/libiberty/cp-demangle.h b/libiberty/cp-demangle.h
index eea0868..02e74ec 100644
--- a/libiberty/cp-demangle.h
+++ b/libiberty/cp-demangle.h
@@ -131,19 +131,31 @@ struct d_info
/* Functions and arrays in cp-demangle.c which are referenced by
functions in cp-demint.c. */
+#ifdef IN_GLIBCPP_V3
+#define CP_STATIC_IF_GLIBCPP_V3 static
+#else
+#define CP_STATIC_IF_GLIBCPP_V3 extern
+#endif
-extern const struct demangle_operator_info cplus_demangle_operators[];
+CP_STATIC_IF_GLIBCPP_V3
+const struct demangle_operator_info cplus_demangle_operators[];
#define D_BUILTIN_TYPE_COUNT (26)
-extern const struct demangle_builtin_type_info
+CP_STATIC_IF_GLIBCPP_V3
+const struct demangle_builtin_type_info
cplus_demangle_builtin_types[D_BUILTIN_TYPE_COUNT];
-extern struct demangle_component *
+CP_STATIC_IF_GLIBCPP_V3
+struct demangle_component *
cplus_demangle_mangled_name PARAMS ((struct d_info *, int));
-extern struct demangle_component *
+CP_STATIC_IF_GLIBCPP_V3
+struct demangle_component *
cplus_demangle_type PARAMS ((struct d_info *));
extern void
cplus_demangle_init_info PARAMS ((const char *, int, size_t, struct d_info *));
+
+/* cp-demangle.c needs to define this a little differently */
+#undef CP_STATIC_IF_GLIBCPP_V3
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 9a3f0b9..d38ce33 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -3699,6 +3699,11 @@ _Z3fooIPA3_iEvRKT_
void foo<int (*) [3]>(int (* const&) [3])
foo<int (*) [3]>
#
+# This used to crash the demangler--PR 16240
+--format=gnu-v3 --no-params
+_ZN13PatternDriver23StringScalarDeleteValueC1ERKNS_25ConflateStringScalarValueERKNS_25AbstractStringScalarValueERKNS_12TemplateEnumINS_12pdcomplementELZNS_16complement_namesEELZNS_14COMPLEMENTENUMEEEE
+_ZN13PatternDriver23StringScalarDeleteValueC1ERKNS_25ConflateStringScalarValueERKNS_25AbstractStringScalarValueERKNS_12TemplateEnumINS_12pdcomplementELZNS_16complement_namesEELZNS_14COMPLEMENTENUMEEEE
+PatternDriver::StringScalarDeleteValue::StringScalarDeleteValue
# Test GNU V3 constructor and destructor identification.
# 0 means it is not a constructor/destructor.
# Other integers correspond to enum gnu_v3_{c,d}tor_kinds in demangle.h.