summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog46
-rw-r--r--libiberty/concat.c16
-rwxr-xr-xlibiberty/configure6
-rw-r--r--libiberty/configure.ac6
-rw-r--r--libiberty/cp-demangle.c133
-rw-r--r--libiberty/testsuite/demangle-expected6
-rw-r--r--libiberty/testsuite/test-demangle.c3
-rw-r--r--libiberty/testsuite/test-expandargv.c3
8 files changed, 199 insertions, 20 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 89e108a8da6..cda181e1066 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,43 @@
+2013-10-29 Marc Glisse <marc.glisse@inria.fr>
+
+ PR tree-optimization/58689
+ * concat.c: Remove note about xmalloc.
+
+2013-10-27 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * testsuite/test-demangle.c: Include unistd.h.
+
+2013-10-25 Gary Benson <gbenson@redhat.com>
+
+ * cp-demangle.c (struct d_saved_scope): New structure.
+ (struct d_print_info): New fields saved_scopes and
+ num_saved_scopes.
+ (d_print_init): Initialize the above.
+ (d_print_free): New function.
+ (cplus_demangle_print_callback): Call the above.
+ (d_copy_templates): New function.
+ (d_print_comp): New variables saved_templates and
+ need_template_restore.
+ [DEMANGLE_COMPONENT_REFERENCE,
+ DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
+ time the component is traversed, and use the captured scope for
+ subsequent traversals.
+ * testsuite/demangle-expected: Add regression test.
+
+2013-10-23 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * testsuite/test-expandargv.c: Include unistd.h.
+
+2013-10-15 David Malcolm <dmalcolm@redhat.com>
+
+ * configure.ac: If --enable-host-shared, use -fPIC.
+ * configure: Regenerate.
+
+2013-10-11 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * cp-demangle.c (d_name): Demangle local-source-names.
+ * testsuite/demangle-expected: New test.
+
2013-09-10 Paolo Carlini <paolo.carlini@oracle.com>
PR bootstrap/58386
@@ -73,7 +113,7 @@
* hashtab.c (hash_pointer): Remove conditional and avoid
unexecuted shift equal to wordsize.
-2013-04-22 Andi Kleen <ak@linux.intel.com>
+2013-04-22 Andi Kleen <ak@linux.intel.com>
* hashtab.c (hash_pointer): Move to end of file and reimplement.
@@ -647,12 +687,12 @@
* aclocal.m4 (AC_LANG_FUNC_LINK_TRY(C)): Delete.
* configure: Regenerate.
-2010-10-07 Andi Kleen <ak@linux.intel.com>
+2010-10-07 Andi Kleen <ak@linux.intel.com>
* configure: Regenerate.
* configure.ac: Turn PR_SET_NAME check into link check.
-2010-10-06 Andi Kleen <ak@linux.intel.com>
+2010-10-06 Andi Kleen <ak@linux.intel.com>
* Makefile.in (CFILES): Add setproctitle.
(CONFIGURED_OFILES): Add setproctitle.
diff --git a/libiberty/concat.c b/libiberty/concat.c
index 9779d5663b6..4144d8305cc 100644
--- a/libiberty/concat.c
+++ b/libiberty/concat.c
@@ -25,23 +25,11 @@ Boston, MA 02110-1301, USA. */
@dots{}, @code{NULL})
Concatenate zero or more of strings and return the result in freshly
-@code{xmalloc}ed memory. Returns @code{NULL} if insufficient memory is
-available. The argument list is terminated by the first @code{NULL}
-pointer encountered. Pointers to empty strings are ignored.
+@code{xmalloc}ed memory. The argument list is terminated by the first
+@code{NULL} pointer encountered. Pointers to empty strings are ignored.
@end deftypefn
-NOTES
-
- This function uses xmalloc() which is expected to be a front end
- function to malloc() that deals with low memory situations. In
- typical use, if malloc() returns NULL then xmalloc() diverts to an
- error handler routine which never returns, and thus xmalloc will
- never return a NULL pointer. If the client application wishes to
- deal with low memory situations itself, it should supply an xmalloc
- that just directly invokes malloc and blindly returns whatever
- malloc returns.
-
*/
diff --git a/libiberty/configure b/libiberty/configure
index e601ccd99f4..b71141a98b0 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -4963,6 +4963,12 @@ case "${enable_shared}" in
"") shared=no ;;
*) shared=yes ;;
esac
+
+# ...unless --enable-host-shared was passed from top-level config:
+if [ "${enable_host_shared}" = "yes" ]; then
+ shared=yes
+fi
+
if [ "${shared}" != "yes" ]; then
PICFLAG=
fi
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index fcea46f6c7b..4ad88a984d7 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -225,6 +225,12 @@ case "${enable_shared}" in
"") shared=no ;;
*) shared=yes ;;
esac
+
+# ...unless --enable-host-shared was passed from top-level config:
+if [[ "${enable_host_shared}" = "yes" ]]; then
+ shared=yes
+fi
+
if [[ "${shared}" != "yes" ]]; then
PICFLAG=
fi
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 70f54389c89..7be98048565 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -275,6 +275,18 @@ struct d_growable_string
int allocation_failure;
};
+/* A demangle component and some scope captured when it was first
+ traversed. */
+
+struct d_saved_scope
+{
+ /* The component whose scope this is. */
+ const struct demangle_component *container;
+ /* The list of templates, if any, that was current when this
+ scope was captured. */
+ struct d_print_template *templates;
+};
+
enum { D_PRINT_BUFFER_LENGTH = 256 };
struct d_print_info
{
@@ -302,6 +314,10 @@ struct d_print_info
int pack_index;
/* Number of d_print_flush calls so far. */
unsigned long int flush_count;
+ /* Array of saved scopes for evaluating substitutions. */
+ struct d_saved_scope *saved_scopes;
+ /* Number of saved scopes in the above array. */
+ int num_saved_scopes;
};
#ifdef CP_DEMANGLE_DEBUG
@@ -1276,7 +1292,6 @@ d_name (struct d_info *di)
case 'Z':
return d_local_name (di);
- case 'L':
case 'U':
return d_unqualified_name (di);
@@ -1323,6 +1338,7 @@ d_name (struct d_info *di)
return dc;
}
+ case 'L':
default:
dc = d_unqualified_name (di);
if (d_peek_char (di) == 'I')
@@ -3665,6 +3681,30 @@ d_print_init (struct d_print_info *dpi, demangle_callbackref callback,
dpi->opaque = opaque;
dpi->demangle_failure = 0;
+
+ dpi->saved_scopes = NULL;
+ dpi->num_saved_scopes = 0;
+}
+
+/* Free a print information structure. */
+
+static void
+d_print_free (struct d_print_info *dpi)
+{
+ int i;
+
+ for (i = 0; i < dpi->num_saved_scopes; i++)
+ {
+ struct d_print_template *ts, *tn;
+
+ for (ts = dpi->saved_scopes[i].templates; ts != NULL; ts = tn)
+ {
+ tn = ts->next;
+ free (ts);
+ }
+ }
+
+ free (dpi->saved_scopes);
}
/* Indicate that an error occurred during printing, and test for error. */
@@ -3749,6 +3789,7 @@ cplus_demangle_print_callback (int options,
demangle_callbackref callback, void *opaque)
{
struct d_print_info dpi;
+ int success;
d_print_init (&dpi, callback, opaque);
@@ -3756,7 +3797,9 @@ cplus_demangle_print_callback (int options,
d_print_flush (&dpi);
- return ! d_print_saw_error (&dpi);
+ success = ! d_print_saw_error (&dpi);
+ d_print_free (&dpi);
+ return success;
}
/* Turn components into a human readable string. OPTIONS is the
@@ -3913,6 +3956,36 @@ d_print_subexpr (struct d_print_info *dpi, int options,
d_append_char (dpi, ')');
}
+/* Return a shallow copy of the current list of templates.
+ On error d_print_error is called and a partial list may
+ be returned. Whatever is returned must be freed. */
+
+static struct d_print_template *
+d_copy_templates (struct d_print_info *dpi)
+{
+ struct d_print_template *src, *result, **link = &result;
+
+ for (src = dpi->templates; src != NULL; src = src->next)
+ {
+ struct d_print_template *dst =
+ malloc (sizeof (struct d_print_template));
+
+ if (dst == NULL)
+ {
+ d_print_error (dpi);
+ break;
+ }
+
+ dst->template_decl = src->template_decl;
+ *link = dst;
+ link = &dst->next;
+ }
+
+ *link = NULL;
+
+ return result;
+}
+
/* Subroutine to handle components. */
static void
@@ -3923,6 +3996,13 @@ d_print_comp (struct d_print_info *dpi, int options,
without needing to modify *dc. */
const struct demangle_component *mod_inner = NULL;
+ /* Variable used to store the current templates while a previously
+ captured scope is used. */
+ struct d_print_template *saved_templates;
+
+ /* Nonzero if templates have been stored in the above variable. */
+ int need_template_restore = 0;
+
if (dc == NULL)
{
d_print_error (dpi);
@@ -4291,12 +4371,56 @@ d_print_comp (struct d_print_info *dpi, int options,
const struct demangle_component *sub = d_left (dc);
if (sub->type == DEMANGLE_COMPONENT_TEMPLATE_PARAM)
{
- struct demangle_component *a = d_lookup_template_argument (dpi, sub);
+ struct demangle_component *a;
+ struct d_saved_scope *scope = NULL, *scopes;
+ int i;
+
+ for (i = 0; i < dpi->num_saved_scopes; i++)
+ if (dpi->saved_scopes[i].container == sub)
+ scope = &dpi->saved_scopes[i];
+
+ if (scope == NULL)
+ {
+ /* This is the first time SUB has been traversed.
+ We need to capture the current templates so
+ they can be restored if SUB is reentered as a
+ substitution. */
+ ++dpi->num_saved_scopes;
+ scopes = realloc (dpi->saved_scopes,
+ sizeof (struct d_saved_scope)
+ * dpi->num_saved_scopes);
+ if (scopes == NULL)
+ {
+ d_print_error (dpi);
+ return;
+ }
+
+ dpi->saved_scopes = scopes;
+ scope = dpi->saved_scopes + (dpi->num_saved_scopes - 1);
+
+ scope->container = sub;
+ scope->templates = d_copy_templates (dpi);
+ if (d_print_saw_error (dpi))
+ return;
+ }
+ else
+ {
+ /* This traversal is reentering SUB as a substition.
+ Restore the original templates temporarily. */
+ saved_templates = dpi->templates;
+ dpi->templates = scope->templates;
+ need_template_restore = 1;
+ }
+
+ a = d_lookup_template_argument (dpi, sub);
if (a && a->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST)
a = d_index_template_argument (a, dpi->pack_index);
if (a == NULL)
{
+ if (need_template_restore)
+ dpi->templates = saved_templates;
+
d_print_error (dpi);
return;
}
@@ -4344,6 +4468,9 @@ d_print_comp (struct d_print_info *dpi, int options,
dpi->modifiers = dpm.next;
+ if (need_template_restore)
+ dpi->templates = saved_templates;
+
return;
}
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 1259e4a9f49..ae872078d91 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -4291,3 +4291,9 @@ void m<void () &&>(void (A::*)() &&)
--format=gnu-v3
_Z1nIM1AKFvvREEvT_
void n<void (A::*)() const &>(void (A::*)() const &)
+--format=gnu-v3
+_ZL1fIiEvv
+void f<int>()
+--format=gnu-v3
+_ZSt7forwardIRN1x14refobjiteratorINS0_3refINS0_4mime30multipart_section_processorObjIZ15get_body_parserIZZN14mime_processor21make_section_iteratorERKNS2_INS3_10sectionObjENS0_10ptrrefBaseEEEbENKUlvE_clEvEUlSB_bE_ZZNS6_21make_section_iteratorESB_bENKSC_clEvEUlSB_E0_ENS1_INS2_INS0_20outputrefiteratorObjIiEES8_EEEERKSsSB_OT_OT0_EUlmE_NS3_32make_multipart_default_discarderISP_EEEES8_EEEEEOT_RNSt16remove_referenceISW_E4typeE
+x::refobjiterator<x::ref<x::mime::multipart_section_processorObj<x::refobjiterator<x::ref<x::outputrefiteratorObj<int>, x::ptrrefBase> > get_body_parser<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}>(std::string const&, x::ref<x::mime::sectionObj, x::ptrrefBase> const&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}&&)::{lambda(unsigned long)#1}, x::mime::make_multipart_default_discarder<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&> >, x::ptrrefBase> >& std::forward<x::refobjiterator<x::ref<x::mime::multipart_section_processorObj<x::refobjiterator<x::ref<x::outputrefiteratorObj<int>, x::ptrrefBase> > get_body_parser<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}>(std::string const&, x::ref<x::mime::sectionObj, x::ptrrefBase> const&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}&&)::{lambda(unsigned long)#1}, x::mime::make_multipart_default_discarder<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&> >, x::ptrrefBase> >&>(std::remove_reference<x::mime::multipart_section_processorObj<x::refobjiterator<x::ref<x::outputrefiteratorObj<int>, x::ptrrefBase> > get_body_parser<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}>(std::string const&, x::ref<x::mime::sectionObj, x::ptrrefBase> const&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&, mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&)#2}&&)::{lambda(unsigned long)#1}, x::mime::make_multipart_default_discarder<mime_processor::make_section_iterator(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)::{lambda()#1}::operator()() const::{lambda(x::ref<x::mime::sectionObj, x::ptrrefBase> const&, bool)#1}&&> > >::type&)
diff --git a/libiberty/testsuite/test-demangle.c b/libiberty/testsuite/test-demangle.c
index 11d9729999b..44062478c09 100644
--- a/libiberty/testsuite/test-demangle.c
+++ b/libiberty/testsuite/test-demangle.c
@@ -32,6 +32,9 @@
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
struct line
{
diff --git a/libiberty/testsuite/test-expandargv.c b/libiberty/testsuite/test-expandargv.c
index dff20d41daf..0edd751722b 100644
--- a/libiberty/testsuite/test-expandargv.c
+++ b/libiberty/testsuite/test-expandargv.c
@@ -40,6 +40,9 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0