diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-01 22:22:57 +0000 |
---|---|---|
committer | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-01 22:22:57 +0000 |
commit | 9e169c4bf36a38689550c059570c57efbf00a6fb (patch) | |
tree | 95e6800f7ac2a49ff7f799d96f04172320e70ac0 /libiberty | |
parent | 6170dfb6edfb7b19f8ae5209b8f948fe0076a4ad (diff) | |
download | gcc-9e169c4bf36a38689550c059570c57efbf00a6fb.tar.gz |
Merged trunk at revision 161680 into branch.vect256
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/vect256@161681 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 38 | ||||
-rwxr-xr-x | libiberty/configure | 22 | ||||
-rw-r--r-- | libiberty/configure.ac | 4 | ||||
-rw-r--r-- | libiberty/cp-demangle.c | 12 | ||||
-rw-r--r-- | libiberty/functions.texi | 39 | ||||
-rw-r--r-- | libiberty/hashtab.c | 67 | ||||
-rw-r--r-- | libiberty/libiberty.texi | 18 | ||||
-rw-r--r-- | libiberty/splay-tree.c | 55 | ||||
-rw-r--r-- | libiberty/testsuite/demangle-expected | 3 |
9 files changed, 208 insertions, 50 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 520d5dc4a7b..a16e393d027 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,4 +1,40 @@ -2ß1ß-05-26 Kai Tietz <kai.tietz@onevision.com> +2010-06-14 Gerald Pfeifer <gerald@pfeifer.com> + + * libiberty.texi: Remove reference to GCC 3 and 2001 (thrice). + Update copyright years. + Move to GFDL 1.3. + +2010-06-10 Jakub Jelinek <jakub@redhat.com> + + PR other/43838 + * cp-demangle.c (struct d_print_info): Add flush_count field. + (d_print_init): Initialize it to 0. + (d_print_flush): Increment it. + (d_print_comp): If needed flush before appending ", ". Only + decrement dpi->len if no flushes happened during the recursive + call. + * testsuite/demangle-expected: Add a test for this. + +2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> + + * splay-tree.c: Update copyright years. + (splay_tree_new_typed_alloc): New. + (splay_tree_new_with_allocator): Use it. + + * hashtab.c: Update copyright years. + (htab_create_typed_alloc): New. + (htab_create_alloc): Use it. + + * functions.texi: Regenerate. + +2010-06-03 Joern Rennecke <joern.rennecke@embecosm.com> + Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + PR bootstrap/42798 + * configure.ac: Check for declaration of 'basename(char *)'. + * configure: Regenerate. + +2010-05-26 Kai Tietz <kai.tietz@onevision.com> * testsuite/demangle-expected: Add tests for __int128 and unsigned __int128 types. diff --git a/libiberty/configure b/libiberty/configure index 77aeb56c707..b47bc94248d 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -1904,8 +1904,10 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5 -$as_echo_n "checking whether $2 is declared... " >&6; } + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else @@ -1915,8 +1917,12 @@ $4 int main () { -#ifndef $2 - (void) $2; +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif #endif ; @@ -5310,8 +5316,8 @@ _ACEOF fi done - ac_fn_c_check_decl "$LINENO" "basename" "ac_cv_have_decl_basename" "$ac_includes_default" -if test "x$ac_cv_have_decl_basename" = x""yes; then : + ac_fn_c_check_decl "$LINENO" "basename(char *)" "ac_cv_have_decl_basename_char_p_" "$ac_includes_default" +if test "x$ac_cv_have_decl_basename_char_p_" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 @@ -6349,8 +6355,8 @@ _ACEOF fi done - ac_fn_c_check_decl "$LINENO" "basename" "ac_cv_have_decl_basename" "$ac_includes_default" -if test "x$ac_cv_have_decl_basename" = x""yes; then : + ac_fn_c_check_decl "$LINENO" "basename(char *)" "ac_cv_have_decl_basename_char_p_" "$ac_includes_default" +if test "x$ac_cv_have_decl_basename_char_p_" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 515bb338441..32ec8d9c095 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -379,7 +379,7 @@ if test "x" = "y"; then table times tmpnam \ vasprintf vfprintf vprintf vsprintf \ wait3 wait4 waitpid) - AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf]) + AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf]) AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) @@ -663,7 +663,7 @@ if test -z "${setobjs}"; then [AC_MSG_RESULT([no])]) AC_CHECK_FUNCS($checkfuncs) - AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf]) + AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf]) AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk]) AC_CHECK_DECLS([strverscmp]) libiberty_NEED_DECLARATION(canonicalize_file_name) diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 6db1f78be3c..d2d15e9b91a 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -302,6 +302,8 @@ struct d_print_info /* The current index into any template argument packs we are using for printing. */ int pack_index; + /* Number of d_print_flush calls so far. */ + unsigned long int flush_count; }; #ifdef CP_DEMANGLE_DEBUG @@ -3285,6 +3287,7 @@ d_print_init (struct d_print_info *dpi, int options, dpi->last_char = '\0'; dpi->templates = NULL; dpi->modifiers = NULL; + dpi->flush_count = 0; dpi->callback = callback; dpi->opaque = opaque; @@ -3314,6 +3317,7 @@ d_print_flush (struct d_print_info *dpi) dpi->buf[dpi->len] = '\0'; dpi->callback (dpi->buf, dpi->len, dpi->opaque); dpi->len = 0; + dpi->flush_count++; } /* Append characters and buffers for printing. */ @@ -4047,12 +4051,18 @@ d_print_comp (struct d_print_info *dpi, if (d_right (dc) != NULL) { size_t len; + unsigned long int flush_count; + /* Make sure ", " isn't flushed by d_append_string, otherwise + dpi->len -= 2 wouldn't work. */ + if (dpi->len >= sizeof (dpi->buf) - 2) + d_print_flush (dpi); d_append_string (dpi, ", "); len = dpi->len; + flush_count = dpi->flush_count; d_print_comp (dpi, d_right (dc)); /* If that didn't print anything (which can happen with empty template argument packs), remove the comma and space. */ - if (dpi->len == len) + if (dpi->flush_count == flush_count && dpi->len == len) dpi->len -= 2; } return; diff --git a/libiberty/functions.texi b/libiberty/functions.texi index 72ca56cbd44..d9fef8cb7b3 100644 --- a/libiberty/functions.texi +++ b/libiberty/functions.texi @@ -3,7 +3,7 @@ @c Edit the *.c files, configure with --enable-maintainer-mode, @c run 'make stamp-functions' and gather-docs will build a new copy. -@c safe-ctype.c:25 +@c splay-tree.c:277 @defvr Extension HOST_CHARSET This macro indicates the basic character set and encoding used by the host: more precisely, the encoding used for character constants in @@ -24,6 +24,25 @@ The host character set is some variant of EBCDIC. (Only one of the nineteen EBCDIC varying characters is tested; exercise caution.) @end ftable @end defvr +@deftypefn Supplemental splay_tree splay_tree_new_with_typed_alloc +(splay_tree_compare_fn @var{compare_fn}, +splay_tree_delete_key_fn @var{delete_key_fn}, +splay_tree_delete_value_fn @var{delete_value_fn}, +splay_tree_allocate_fn @var{tree_allocate_fn}, +splay_tree_allocate_fn @var{node_allocate_fn}, +splay_tree_deallocate_fn @var{deallocate_fn}, +void * @var{allocate_data}) + +This function creates a splay tree that uses two different allocators +@var{tree_allocate_fn} and @var{node_allocate_fn} to use for allocating the +tree itself and its nodes respectively. This is useful when variables of +different types need to be allocated with different allocators. + +The splay tree will use @var{compare_fn} to compare nodes, +@var{delete_key_fn} to deallocate keys, and @var{delete_value_fn} to +deallocate values. + +@end deftypefn @c alloca.c:26 @deftypefn Replacement void* alloca (size_t @var{size}) @@ -477,6 +496,24 @@ systems. @end deftypefn +@c hashtab.c:336 +@deftypefn Supplemental htab_t htab_create_typed_alloc (size_t @var{size}, +htab_hash @var{hash_f}, htab_eq @var{eq_f}, htab_del @var{del_f}, +htab_alloc @var{alloc_tab_f}, htab_alloc @var{alloc_f}, +htab_free @var{free_f}) + +This function creates a hash table that uses two different allocators +@var{alloc_tab_f} and @var{alloc_f} to use for allocating the table itself +and its entries respectively. This is useful when variables of different +types need to be allocated with different allocators. + +The created hash table is slightly larger than @var{size} and it is +initially empty (all the hash table entries are @code{HTAB_EMPTY_ENTRY}). +The function returns the created hash table, or @code{NULL} if memory +allocation fails. + +@end deftypefn + @c index.c:5 @deftypefn Supplemental char* index (char *@var{s}, int @var{c}) diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index 8c89bfcd839..359e3ea569e 100644 --- a/libiberty/hashtab.c +++ b/libiberty/hashtab.c @@ -1,5 +1,5 @@ /* An expandable hash tables datatype. - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009 + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010 Free Software Foundation, Inc. Contributed by Vladimir Makarov (vmakarov@cygnus.com). @@ -291,20 +291,33 @@ htab_t htab_create_alloc (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f, htab_alloc alloc_f, htab_free free_f) { + return htab_create_typed_alloc (size, hash_f, eq_f, del_f, alloc_f, alloc_f, + free_f); +} + +/* As above, but uses the variants of ALLOC_F and FREE_F which accept + an extra argument. */ + +htab_t +htab_create_alloc_ex (size_t size, htab_hash hash_f, htab_eq eq_f, + htab_del del_f, void *alloc_arg, + htab_alloc_with_arg alloc_f, + htab_free_with_arg free_f) +{ htab_t result; unsigned int size_prime_index; size_prime_index = higher_prime_index (size); size = prime_tab[size_prime_index].prime; - result = (htab_t) (*alloc_f) (1, sizeof (struct htab)); + result = (htab_t) (*alloc_f) (alloc_arg, 1, sizeof (struct htab)); if (result == NULL) return NULL; - result->entries = (PTR *) (*alloc_f) (size, sizeof (PTR)); + result->entries = (PTR *) (*alloc_f) (alloc_arg, size, sizeof (PTR)); if (result->entries == NULL) { if (free_f != NULL) - (*free_f) (result); + (*free_f) (alloc_arg, result); return NULL; } result->size = size; @@ -312,19 +325,37 @@ htab_create_alloc (size_t size, htab_hash hash_f, htab_eq eq_f, result->hash_f = hash_f; result->eq_f = eq_f; result->del_f = del_f; - result->alloc_f = alloc_f; - result->free_f = free_f; + result->alloc_arg = alloc_arg; + result->alloc_with_arg_f = alloc_f; + result->free_with_arg_f = free_f; return result; } -/* As above, but use the variants of alloc_f and free_f which accept - an extra argument. */ +/* + +@deftypefn Supplemental htab_t htab_create_typed_alloc (size_t @var{size}, +htab_hash @var{hash_f}, htab_eq @var{eq_f}, htab_del @var{del_f}, +htab_alloc @var{alloc_tab_f}, htab_alloc @var{alloc_f}, +htab_free @var{free_f}) + +This function creates a hash table that uses two different allocators +@var{alloc_tab_f} and @var{alloc_f} to use for allocating the table itself +and its entries respectively. This is useful when variables of different +types need to be allocated with different allocators. + +The created hash table is slightly larger than @var{size} and it is +initially empty (all the hash table entries are @code{HTAB_EMPTY_ENTRY}). +The function returns the created hash table, or @code{NULL} if memory +allocation fails. + +@end deftypefn + +*/ htab_t -htab_create_alloc_ex (size_t size, htab_hash hash_f, htab_eq eq_f, - htab_del del_f, void *alloc_arg, - htab_alloc_with_arg alloc_f, - htab_free_with_arg free_f) +htab_create_typed_alloc (size_t size, htab_hash hash_f, htab_eq eq_f, + htab_del del_f, htab_alloc alloc_tab_f, + htab_alloc alloc_f, htab_free free_f) { htab_t result; unsigned int size_prime_index; @@ -332,14 +363,14 @@ htab_create_alloc_ex (size_t size, htab_hash hash_f, htab_eq eq_f, size_prime_index = higher_prime_index (size); size = prime_tab[size_prime_index].prime; - result = (htab_t) (*alloc_f) (alloc_arg, 1, sizeof (struct htab)); + result = (htab_t) (*alloc_tab_f) (1, sizeof (struct htab)); if (result == NULL) return NULL; - result->entries = (PTR *) (*alloc_f) (alloc_arg, size, sizeof (PTR)); + result->entries = (PTR *) (*alloc_f) (size, sizeof (PTR)); if (result->entries == NULL) { if (free_f != NULL) - (*free_f) (alloc_arg, result); + (*free_f) (result); return NULL; } result->size = size; @@ -347,12 +378,12 @@ htab_create_alloc_ex (size_t size, htab_hash hash_f, htab_eq eq_f, result->hash_f = hash_f; result->eq_f = eq_f; result->del_f = del_f; - result->alloc_arg = alloc_arg; - result->alloc_with_arg_f = alloc_f; - result->free_with_arg_f = free_f; + result->alloc_f = alloc_f; + result->free_f = free_f; return result; } + /* Update the function pointers and allocation parameter in the htab_t. */ void diff --git a/libiberty/libiberty.texi b/libiberty/libiberty.texi index 9fd6f786b48..74f70d2bd5a 100644 --- a/libiberty/libiberty.texi +++ b/libiberty/libiberty.texi @@ -21,15 +21,14 @@ @code{libiberty} @end macro -@c The edition date is written in three locations. Search for 'thedate'. @ifinfo This manual describes the GNU @libib library of utility subroutines. -This edition accompanies GCC 3, September 2001. -Copyright @copyright{} 2001 Free Software Foundation, Inc. +Copyright @copyright{} 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +2009, 2010 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.2 + under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the @@ -45,20 +44,18 @@ notice identical to this one except for the removal of this paragraph @end ifinfo -@c The edition date is written in three locations. Search for 'thedate'. @titlepage @title @sc{gnu} libiberty -@subtitle September 2001 -@subtitle for GCC 3 @author Phil Edwards et al. @page @vskip 0pt plus 1filll -Copyright @copyright{} 2001 Free Software Foundation, Inc. +Copyright @copyright{} 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +2009, 2010 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.2 + under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the @@ -76,9 +73,6 @@ The @libib{} library is a collection of subroutines used by various GNU programs. It is available under the Library General Public License; for more information, see @ref{Library Copying}. -@c The edition date is written in three locations. Search for 'thedate'. -This edition accompanies GCC 3, September 2001. - @end ifnottex @menu diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c index d7ed86813dc..bf1a0f3f151 100644 --- a/libiberty/splay-tree.c +++ b/libiberty/splay-tree.c @@ -1,5 +1,6 @@ /* A splay-tree datatype. - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2009, + 2010 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GNU CC. @@ -265,13 +266,53 @@ splay_tree_new_with_allocator (splay_tree_compare_fn compare_fn, splay_tree_deallocate_fn deallocate_fn, void *allocate_data) { - splay_tree sp = (splay_tree) (*allocate_fn) (sizeof (struct splay_tree_s), - allocate_data); + return + splay_tree_new_typed_alloc (compare_fn, delete_key_fn, delete_value_fn, + allocate_fn, allocate_fn, deallocate_fn, + allocate_data); +} + +/* + +@deftypefn Supplemental splay_tree splay_tree_new_with_typed_alloc +(splay_tree_compare_fn @var{compare_fn}, +splay_tree_delete_key_fn @var{delete_key_fn}, +splay_tree_delete_value_fn @var{delete_value_fn}, +splay_tree_allocate_fn @var{tree_allocate_fn}, +splay_tree_allocate_fn @var{node_allocate_fn}, +splay_tree_deallocate_fn @var{deallocate_fn}, +void * @var{allocate_data}) + +This function creates a splay tree that uses two different allocators +@var{tree_allocate_fn} and @var{node_allocate_fn} to use for allocating the +tree itself and its nodes respectively. This is useful when variables of +different types need to be allocated with different allocators. + +The splay tree will use @var{compare_fn} to compare nodes, +@var{delete_key_fn} to deallocate keys, and @var{delete_value_fn} to +deallocate values. + +@end deftypefn + +*/ + +splay_tree +splay_tree_new_typed_alloc (splay_tree_compare_fn compare_fn, + splay_tree_delete_key_fn delete_key_fn, + splay_tree_delete_value_fn delete_value_fn, + splay_tree_allocate_fn tree_allocate_fn, + splay_tree_allocate_fn node_allocate_fn, + splay_tree_deallocate_fn deallocate_fn, + void * allocate_data) +{ + splay_tree sp = (splay_tree) (*tree_allocate_fn) + (sizeof (struct splay_tree_s), allocate_data); + sp->root = 0; sp->comp = compare_fn; sp->delete_key = delete_key_fn; sp->delete_value = delete_value_fn; - sp->allocate = allocate_fn; + sp->allocate = node_allocate_fn; sp->deallocate = deallocate_fn; sp->allocate_data = allocate_data; @@ -313,10 +354,10 @@ splay_tree_insert (splay_tree sp, splay_tree_key key, splay_tree_value value) { /* Create a new node, and insert it at the root. */ splay_tree_node node; - + node = ((splay_tree_node) - (*sp->allocate) (sizeof (struct splay_tree_node_s), - sp->allocate_data)); + (*sp->allocate) (sizeof (struct splay_tree_node_s), + sp->allocate_data)); node->key = key; node->value = value; diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index ef84bc113a8..15a0fe75509 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -3951,6 +3951,9 @@ decltype (({parm#1}.(operator-))()) h<A>(A) --format=gnu-v3 _Z1fDn f(decltype(nullptr)) +--format=gnu-v3 +_ZN5aaaaa6bbbbbb5cccccIN23ddddddddddddddddddddddd3eeeENS2_4ffff16ggggggggggggggggENS0_9hhhhhhhhhES6_S6_S6_S6_S6_S6_S6_EE +aaaaa::bbbbbb::ccccc<ddddddddddddddddddddddd::eee, ddddddddddddddddddddddd::ffff::gggggggggggggggg, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh> # # Ada (GNAT) tests. # |