include/ 2007-11-13 H.J. Lu PR ld/5303 * splay-tree-default.h: New file. * splay-tree.h (libi_uhostptr_t): Removed. (libi_shostptr_t): Likewise. (splay_tree_uhostptr_t): New. Provide long and long long interfaces. Include splay-tree-default.h. libiberty/ 2007-11-13 H.J. Lu PR ld/5303 * Makefile.in (CFILES): Add splay-tree-long.c and splay-tree-long-long.c. (REQUIRED_OFILES): Replace ./splay-tree.o with ./splay-tree-long.o and ./splay-tree-long-long.o. (./splay-tree-long.o): New dependency. (./splay-tree-long-long.o): Likewise. * configure.ac: Check size of long, void * and long, long. * config.in: Regenerated. * configure: Likewise. * splay-tree-long-long.c: New file. * splay-tree-long.c: Likewise. * splay-tree.c: Don't include config.h. (splay_tree_delete_helper): Add cast to splay_tree_uhostptr_t. (splay_tree_compare_pointers): Likewise. --- gcc/include/splay-tree-default.h.ll 2007-11-13 13:52:25.000000000 -0800 +++ gcc/include/splay-tree-default.h 2007-11-13 13:54:27.000000000 -0800 @@ -0,0 +1,92 @@ +/* Default splay-tree interface + Copyright 2007 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to + the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ + +#ifndef splay_tree_key + +/* Use long long if size of pointer is the same as long long. */ +# ifndef USE_SPLAY_TREE_LONG_LONG +# if defined HAVE_LONG_LONG && defined SIZEOF_VOID_P \ + && defined SIZEOF_LONG_LONG && SIZEOF_VOID_P == SIZEOF_LONG_LONG +# define USE_SPLAY_TREE_LONG_LONG +# endif +# endif + +/* Use long if size of long long is the same as long. */ +# ifdef USE_SPLAY_TREE_LONG_LONG +# if defined SIZEOF_LONG && defined SIZEOF_LONG_LONG \ + && SIZEOF_LONG == SIZEOF_LONG_LONG +# undef USE_SPLAY_TREE_LONG_LONG +# endif +# endif + +# ifdef USE_SPLAY_TREE_LONG_LONG +# define splay_tree_key splay_tree_long_long_key +# define splay_tree_value splay_tree_long_long_value +# define splay_tree_node_s splay_tree_long_long_node_s +# define splay_tree_node splay_tree_long_long_node +# define splay_tree_compare_fn splay_tree_long_long_compare_fn +# define splay_tree_delete_key_fn splay_tree_long_long_delete_key_fn +# define splay_tree_delete_value_fn splay_tree_long_long_delete_key_fn +# define splay_tree_foreach_fn splay_tree_long_long_foreach_fn +# define splay_tree_allocate_fn splay_tree_long_long_allocate_fn +# define splay_tree_deallocate_fn splay_tree_long_long_deallocate_fn +# define splay_tree_s splay_tree_long_long_s +# define splay_tree splay_tree_long_long +# define splay_tree_new splay_tree_long_long_new +# define splay_tree_new_with_allocator splay_tree_long_long_new_with_allocator +# define splay_tree_delete splay_tree_long_long_delete +# define splay_tree_insert splay_tree_long_long_insert +# define splay_tree_remove splay_tree_long_long_remove +# define splay_tree_lookup splay_tree_long_long_lookup +# define splay_tree_predecessor splay_tree_long_long_predecessor +# define splay_tree_successor splay_tree_long_long_successor +# define splay_tree_max splay_tree_long_long_max +# define splay_tree_min splay_tree_long_long_min +# define splay_tree_foreach splay_tree_long_long_foreach +# define splay_tree_compare_ints splay_tree_long_long_compare_ints +# define splay_tree_compare_pointers splay_tree_long_long_compare_pointers +# else +# define splay_tree_key splay_tree_long_key +# define splay_tree_value splay_tree_long_value +# define splay_tree_node_s splay_tree_long_node_s +# define splay_tree_node splay_tree_long_node +# define splay_tree_compare_fn splay_tree_long_compare_fn +# define splay_tree_delete_key_fn splay_tree_long_delete_key_fn +# define splay_tree_delete_value_fn splay_tree_long_delete_value_fn +# define splay_tree_foreach_fn splay_tree_long_foreach_fn +# define splay_tree_allocate_fn splay_tree_long_allocate_fn +# define splay_tree_deallocate_fn splay_tree_long_deallocate_fn +# define splay_tree_s splay_tree_long_s +# define splay_tree splay_tree_long +# define splay_tree_new splay_tree_long_new +# define splay_tree_new_with_allocator splay_tree_long_new_with_allocator +# define splay_tree_delete splay_tree_long_delete +# define splay_tree_insert splay_tree_long_insert +# define splay_tree_remove splay_tree_long_remove +# define splay_tree_lookup splay_tree_long_lookup +# define splay_tree_predecessor splay_tree_long_predecessor +# define splay_tree_successor splay_tree_long_successor +# define splay_tree_max splay_tree_long_max +# define splay_tree_min splay_tree_long_min +# define splay_tree_foreach splay_tree_long_foreach +# define splay_tree_compare_ints splay_tree_long_compare_ints +# define splay_tree_compare_pointers splay_tree_long_compare_pointers +# endif +#endif /* splay_tree_key */ --- gcc/include/splay-tree.h.ll 2007-07-26 09:21:25.000000000 -0700 +++ gcc/include/splay-tree.h 2007-11-13 13:54:05.000000000 -0800 @@ -36,114 +36,243 @@ extern "C" { #include "ansidecl.h" -#ifndef _WIN64 - typedef unsigned long int libi_uhostptr_t; - typedef long int libi_shostptr_t; -#else - typedef unsigned long long libi_uhostptr_t; - typedef long long libi_shostptr_t; -#endif - #ifndef GTY #define GTY(X) #endif +/* The key and data types should be be sufficiently wide that any + pointer or scalar can be cast to these types, and then cast back, + without loss of precision. There is a version for long. If size of + long long is different from long, there is a version for long long. + + We need to map the default version to long or long long: + 1. The one asked by user. Or + 2. The one which can hold pointers. Or + 3. The long version. + */ + +#if defined SIZEOF_LONG && SIZEOF_VOID_P == SIZEOF_LONG +typedef unsigned long splay_tree_uhostptr_t; +#elif defined HAVE_LONG_LONG && defined SIZEOF_LONG_LONG \ + && SIZEOF_VOID_P == SIZEOF_LONG_LONG +typedef unsigned long long splay_tree_uhostptr_t; +#endif + /* Use typedefs for the key and data types to facilitate changing - these types, if necessary. These types should be sufficiently wide - that any pointer or scalar can be cast to these types, and then - cast back, without loss of precision. */ -typedef libi_uhostptr_t splay_tree_key; -typedef libi_uhostptr_t splay_tree_value; + these types, if necessary. */ +typedef unsigned long int splay_tree_long_key; +typedef unsigned long int splay_tree_long_value; + +/* Forward declaration for a node in the tree. */ +typedef struct splay_tree_long_node_s *splay_tree_long_node; + +/* The type of a function which compares two splay-tree keys. The + function should return values as for qsort. */ +typedef int (*splay_tree_long_compare_fn) + (splay_tree_long_key, splay_tree_long_key); + +/* The type of a function used to deallocate any resources associated + with the key. */ +typedef void (*splay_tree_long_delete_key_fn) (splay_tree_long_key); + +/* The type of a function used to deallocate any resources associated + with the value. */ +typedef void (*splay_tree_long_delete_value_fn) (splay_tree_long_value); + +/* The type of a function used to iterate over the tree. */ +typedef int (*splay_tree_long_foreach_fn) (splay_tree_long_node, void*); + +/* The type of a function used to allocate memory for tree root and + node structures. The first argument is the number of bytes needed; + the second is a data pointer the splay tree functions pass through + to the allocator. This function must never return zero. */ +typedef void *(*splay_tree_long_allocate_fn) (int, void *); + +/* The type of a function used to free memory allocated using the + corresponding splay_tree_long_allocate_fn. The first argument is the + memory to be freed; the latter is a data pointer the splay tree + functions pass through to the freer. */ +typedef void (*splay_tree_long_deallocate_fn) (void *, void *); + +/* The nodes in the splay tree. */ +struct splay_tree_long_node_s GTY(()) +{ + /* The key. */ + splay_tree_long_key GTY ((use_param1)) key; + + /* The value. */ + splay_tree_long_value GTY ((use_param2)) value; + + /* The left and right children, respectively. */ + splay_tree_long_node GTY ((use_params)) left; + splay_tree_long_node GTY ((use_params)) right; +}; + +/* The splay tree itself. */ +struct splay_tree_long_s GTY(()) +{ + /* The root of the tree. */ + splay_tree_long_node GTY ((use_params)) root; + + /* The comparision function. */ + splay_tree_long_compare_fn comp; + + /* The deallocate-key function. NULL if no cleanup is necessary. */ + splay_tree_long_delete_key_fn delete_key; + + /* The deallocate-value function. NULL if no cleanup is necessary. */ + splay_tree_long_delete_value_fn delete_value; + + /* Allocate/free functions, and a data pointer to pass to them. */ + splay_tree_long_allocate_fn allocate; + splay_tree_long_deallocate_fn deallocate; + void * GTY((skip)) allocate_data; +}; + +typedef struct splay_tree_long_s *splay_tree_long; + +extern splay_tree_long splay_tree_long_new + (splay_tree_long_compare_fn, splay_tree_long_delete_key_fn, + splay_tree_long_delete_value_fn); +extern splay_tree_long splay_tree_long_new_with_allocator + (splay_tree_long_compare_fn, splay_tree_long_delete_key_fn, + splay_tree_long_delete_value_fn, splay_tree_long_allocate_fn, + splay_tree_long_deallocate_fn, void *); +extern void splay_tree_long_delete (splay_tree_long); +extern splay_tree_long_node splay_tree_long_insert + (splay_tree_long, splay_tree_long_key, splay_tree_long_value); +extern void splay_tree_long_remove (splay_tree_long, splay_tree_long_key); +extern splay_tree_long_node splay_tree_long_lookup + (splay_tree_long, splay_tree_long_key); +extern splay_tree_long_node splay_tree_long_predecessor + (splay_tree_long, splay_tree_long_key); +extern splay_tree_long_node splay_tree_long_successor + (splay_tree_long, splay_tree_long_key); +extern splay_tree_long_node splay_tree_long_max (splay_tree_long); +extern splay_tree_long_node splay_tree_long_min (splay_tree_long); +extern int splay_tree_long_foreach (splay_tree_long, + splay_tree_long_foreach_fn, void*); +extern int splay_tree_long_compare_ints (splay_tree_long_key, + splay_tree_long_key); +extern int splay_tree_long_compare_pointers (splay_tree_long_key, + splay_tree_long_key); + +/* Don't declare the long long version if the size of long log is the + the same as long. */ +#if defined HAVE_LONG_LONG && defined SIZEOF_LONG_LONG \ + && defined SIZEOF_LONG && SIZEOF_LONG != SIZEOF_LONG_LONG +typedef unsigned long long int splay_tree_long_long_key; +typedef unsigned long long int splay_tree_long_long_value; /* Forward declaration for a node in the tree. */ -typedef struct splay_tree_node_s *splay_tree_node; +typedef struct splay_tree_long_long_node_s *splay_tree_long_long_node; /* The type of a function which compares two splay-tree keys. The function should return values as for qsort. */ -typedef int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key); +typedef int (*splay_tree_long_long_compare_fn) + (splay_tree_long_long_key, splay_tree_long_long_key); /* The type of a function used to deallocate any resources associated with the key. */ -typedef void (*splay_tree_delete_key_fn) (splay_tree_key); +typedef void (*splay_tree_long_long_delete_key_fn) + (splay_tree_long_long_key); /* The type of a function used to deallocate any resources associated with the value. */ -typedef void (*splay_tree_delete_value_fn) (splay_tree_value); +typedef void (*splay_tree_long_long_delete_value_fn) + (splay_tree_long_long_value); /* The type of a function used to iterate over the tree. */ -typedef int (*splay_tree_foreach_fn) (splay_tree_node, void*); +typedef int (*splay_tree_long_long_foreach_fn) + (splay_tree_long_long_node, void*); /* The type of a function used to allocate memory for tree root and node structures. The first argument is the number of bytes needed; the second is a data pointer the splay tree functions pass through to the allocator. This function must never return zero. */ -typedef void *(*splay_tree_allocate_fn) (int, void *); +typedef void *(*splay_tree_long_long_allocate_fn) + (int, void *); /* The type of a function used to free memory allocated using the - corresponding splay_tree_allocate_fn. The first argument is the + corresponding splay_tree_long_long_allocate_fn. The first argument is the memory to be freed; the latter is a data pointer the splay tree functions pass through to the freer. */ -typedef void (*splay_tree_deallocate_fn) (void *, void *); +typedef void (*splay_tree_long_long_deallocate_fn) + (void *, void *); /* The nodes in the splay tree. */ -struct splay_tree_node_s GTY(()) +struct splay_tree_long_long_node_s GTY(()) { /* The key. */ - splay_tree_key GTY ((use_param1)) key; + splay_tree_long_long_key GTY ((use_param1)) key; /* The value. */ - splay_tree_value GTY ((use_param2)) value; + splay_tree_long_long_value GTY ((use_param2)) value; /* The left and right children, respectively. */ - splay_tree_node GTY ((use_params)) left; - splay_tree_node GTY ((use_params)) right; + splay_tree_long_long_node GTY ((use_params)) left; + splay_tree_long_long_node GTY ((use_params)) right; }; /* The splay tree itself. */ -struct splay_tree_s GTY(()) +struct splay_tree_long_long_s GTY(()) { /* The root of the tree. */ - splay_tree_node GTY ((use_params)) root; + splay_tree_long_long_node GTY ((use_params)) root; /* The comparision function. */ - splay_tree_compare_fn comp; + splay_tree_long_long_compare_fn comp; /* The deallocate-key function. NULL if no cleanup is necessary. */ - splay_tree_delete_key_fn delete_key; + splay_tree_long_long_delete_key_fn delete_key; /* The deallocate-value function. NULL if no cleanup is necessary. */ - splay_tree_delete_value_fn delete_value; + splay_tree_long_long_delete_value_fn delete_value; /* Allocate/free functions, and a data pointer to pass to them. */ - splay_tree_allocate_fn allocate; - splay_tree_deallocate_fn deallocate; + splay_tree_long_long_allocate_fn allocate; + splay_tree_long_long_deallocate_fn deallocate; void * GTY((skip)) allocate_data; }; -typedef struct splay_tree_s *splay_tree; +typedef struct splay_tree_long_long_s *splay_tree_long_long; + +extern splay_tree_long_long splay_tree_long_long_new + (splay_tree_long_long_compare_fn, splay_tree_long_long_delete_key_fn, + splay_tree_long_long_delete_value_fn); +extern splay_tree_long_long splay_tree_long_long_new_with_allocator + (splay_tree_long_long_compare_fn, splay_tree_long_long_delete_key_fn, + splay_tree_long_long_delete_value_fn, splay_tree_long_long_allocate_fn, + splay_tree_long_long_deallocate_fn, void *); +extern void splay_tree_long_long_delete + (splay_tree_long_long); +extern splay_tree_long_long_node splay_tree_long_long_insert + (splay_tree_long_long, splay_tree_long_long_key, + splay_tree_long_long_value); +extern void splay_tree_long_long_remove + (splay_tree_long_long, splay_tree_long_long_key); +extern splay_tree_long_long_node splay_tree_long_long_lookup + (splay_tree_long_long, splay_tree_long_long_key); +extern splay_tree_long_long_node splay_tree_long_long_predecessor + (splay_tree_long_long, splay_tree_long_long_key); +extern splay_tree_long_long_node splay_tree_long_long_successor + (splay_tree_long_long, splay_tree_long_long_key); +extern splay_tree_long_long_node splay_tree_long_long_max + (splay_tree_long_long); +extern splay_tree_long_long_node splay_tree_long_long_min + (splay_tree_long_long); +extern int splay_tree_long_long_foreach + (splay_tree_long_long, splay_tree_long_long_foreach_fn, void*); +extern int splay_tree_long_long_compare_ints + (splay_tree_long_long_key, splay_tree_long_long_key); +extern int splay_tree_long_long_compare_pointers + (splay_tree_long_long_key, splay_tree_long_long_key); +#endif + +/* We put the default interface in splay-tree-default.h so that gcc + can provide its own to work with gengtype. */ -extern splay_tree splay_tree_new (splay_tree_compare_fn, - splay_tree_delete_key_fn, - splay_tree_delete_value_fn); -extern splay_tree splay_tree_new_with_allocator (splay_tree_compare_fn, - splay_tree_delete_key_fn, - splay_tree_delete_value_fn, - splay_tree_allocate_fn, - splay_tree_deallocate_fn, - void *); -extern void splay_tree_delete (splay_tree); -extern splay_tree_node splay_tree_insert (splay_tree, - splay_tree_key, - splay_tree_value); -extern void splay_tree_remove (splay_tree, splay_tree_key); -extern splay_tree_node splay_tree_lookup (splay_tree, splay_tree_key); -extern splay_tree_node splay_tree_predecessor (splay_tree, splay_tree_key); -extern splay_tree_node splay_tree_successor (splay_tree, splay_tree_key); -extern splay_tree_node splay_tree_max (splay_tree); -extern splay_tree_node splay_tree_min (splay_tree); -extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*); -extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key); -extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key); +#include "splay-tree-default.h" #ifdef __cplusplus } --- gcc/libiberty/Makefile.in.ll 2007-07-26 09:21:25.000000000 -0700 +++ gcc/libiberty/Makefile.in 2007-11-13 14:28:56.000000000 -0800 @@ -144,7 +144,8 @@ CFILES = alloca.c argv.c asprintf.c atex physmem.c putenv.c \ random.c regex.c rename.c rindex.c \ safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c \ - splay-tree.c stpcpy.c stpncpy.c strcasecmp.c strchr.c strdup.c \ + splay-tree.c splay-tree-long.c splay-tree-long-long.c \ + stpcpy.c stpncpy.c strcasecmp.c strchr.c strdup.c \ strerror.c strncasecmp.c strncmp.c strrchr.c strsignal.c \ strstr.c strtod.c strtol.c strtoul.c strndup.c strverscmp.c \ tmpnam.c \ @@ -169,8 +170,9 @@ REQUIRED_OFILES = ./regex.o ./cplus-dem. ./objalloc.o ./obstack.o \ ./partition.o ./pexecute.o ./physmem.o \ ./pex-common.o ./pex-one.o @pexecute@ \ - ./safe-ctype.o ./sort.o ./spaces.o ./splay-tree.o ./strerror.o \ - ./strsignal.o \ + ./safe-ctype.o ./sort.o ./spaces.o \ + ./splay-tree-long.o ./splay-tree-long-long.o \ + ./strerror.o ./strsignal.o \ ./unlink-if-ordinary.o \ ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o \ ./xstrerror.o ./xstrndup.o @@ -493,6 +495,16 @@ $(CONFIGURED_OFILES): stamp-picdir # configure. .NOEXPORT: +# "make maint-deps" doesn't work properly on splay-tree-long.c and +# splay-tree-long-long.c. Add their dependencies by hand. +./splay-tree-long.o: $(srcdir)/splay-tree.c $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h \ + $(INCDIR)/splay-tree-default.h + +./splay-tree-long-long.o: $(srcdir)/splay-tree.c $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h \ + $(INCDIR)/splay-tree-default.h + # The dependencies in the remainder of this file are automatically # generated by "make maint-deps". Manual edits will be lost. @@ -969,8 +981,20 @@ $(CONFIGURED_OFILES): stamp-picdir else true; fi $(COMPILE.c) $(srcdir)/spaces.c $(OUTPUT_OPTION) -./splay-tree.o: $(srcdir)/splay-tree.c stamp-h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h +./splay-tree-long-long.o: $(srcdir)/splay-tree-long-long.c stamp-h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/splay-tree-long-long.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/splay-tree-long-long.c $(OUTPUT_OPTION) + +./splay-tree-long.o: $(srcdir)/splay-tree-long.c stamp-h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/splay-tree-long.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/splay-tree-long.c $(OUTPUT_OPTION) + +./splay-tree.o: $(srcdir)/splay-tree.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/splay-tree.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/splay-tree.c -o pic/$@; \ else true; fi --- gcc/libiberty/config.in.ll 2005-11-04 14:15:48.000000000 -0800 +++ gcc/libiberty/config.in 2007-11-13 10:09:21.000000000 -0800 @@ -124,6 +124,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H +/* Define to 1 if the system has the type `long long'. */ +#undef HAVE_LONG_LONG + /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_HAL_SYSINFO_H @@ -406,6 +409,15 @@ /* The size of a `int', as computed by sizeof. */ #undef SIZEOF_INT +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of a `void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + /* Define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses --- gcc/libiberty/configure.ac.ll 2007-07-26 09:21:25.000000000 -0700 +++ gcc/libiberty/configure.ac 2007-11-13 10:09:21.000000000 -0800 @@ -253,8 +253,11 @@ libiberty_AC_DECLARE_ERRNO # Determine the size of an int for struct fibnode. AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([long]) +AC_CHECK_SIZEOF([void *]) AC_CHECK_TYPE(uintptr_t, unsigned long) +AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)]) # Look for a 64-bit type. AC_MSG_CHECKING([for a 64-bit type]) --- gcc/libiberty/splay-tree-long-long.c.ll 2007-11-13 10:09:21.000000000 -0800 +++ gcc/libiberty/splay-tree-long-long.c 2007-11-13 10:09:21.000000000 -0800 @@ -0,0 +1,54 @@ +/* Copyright 2007 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to + the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined HAVE_LONG_LONG && defined SIZEOF_LONG_LONG \ + && defined SIZEOF_LONG && SIZEOF_LONG != SIZEOF_LONG_LONG +#define splay_tree_key splay_tree_long_long_key +#define splay_tree_value splay_tree_long_long_value +#define splay_tree_node_s splay_tree_long_long_node_s +#define splay_tree_node splay_tree_long_long_node +#define splay_tree_compare_fn splay_tree_long_long_compare_fn +#define splay_tree_delete_key_fn splay_tree_long_long_delete_key_fn +#define splay_tree_delete_value_fn splay_tree_long_long_delete_key_fn +#define splay_tree_foreach_fn splay_tree_long_long_foreach_fn +#define splay_tree_allocate_fn splay_tree_long_long_allocate_fn +#define splay_tree_deallocate_fn splay_tree_long_long_deallocate_fn +#define splay_tree_s splay_tree_long_long_s +#define splay_tree splay_tree_long_long +#define splay_tree_new splay_tree_long_long_new +#define splay_tree_new_with_allocator splay_tree_long_long_new_with_allocator +#define splay_tree_delete splay_tree_long_long_delete +#define splay_tree_insert splay_tree_long_long_insert +#define splay_tree_remove splay_tree_long_long_remove +#define splay_tree_lookup splay_tree_long_long_lookup +#define splay_tree_predecessor splay_tree_long_long_predecessor +#define splay_tree_successor splay_tree_long_long_successor +#define splay_tree_max splay_tree_long_long_max +#define splay_tree_min splay_tree_long_long_min +#define splay_tree_foreach splay_tree_long_long_foreach +#define splay_tree_compare_ints splay_tree_long_long_compare_ints +#define splay_tree_compare_pointers splay_tree_long_long_compare_pointers + +#include "splay-tree.c" + +#endif --- gcc/libiberty/splay-tree-long.c.ll 2007-11-13 10:09:21.000000000 -0800 +++ gcc/libiberty/splay-tree-long.c 2007-11-13 10:09:21.000000000 -0800 @@ -0,0 +1,50 @@ +/* Copyright 2007 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to + the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define splay_tree_key splay_tree_long_key +#define splay_tree_value splay_tree_long_value +#define splay_tree_node_s splay_tree_long_node_s +#define splay_tree_node splay_tree_long_node +#define splay_tree_compare_fn splay_tree_long_compare_fn +#define splay_tree_delete_key_fn splay_tree_long_delete_key_fn +#define splay_tree_delete_value_fn splay_tree_long_delete_key_fn +#define splay_tree_foreach_fn splay_tree_long_foreach_fn +#define splay_tree_allocate_fn splay_tree_long_allocate_fn +#define splay_tree_deallocate_fn splay_tree_long_deallocate_fn +#define splay_tree_s splay_tree_long_s +#define splay_tree splay_tree_long +#define splay_tree_new splay_tree_long_new +#define splay_tree_new_with_allocator splay_tree_long_new_with_allocator +#define splay_tree_delete splay_tree_long_delete +#define splay_tree_insert splay_tree_long_insert +#define splay_tree_remove splay_tree_long_remove +#define splay_tree_lookup splay_tree_long_lookup +#define splay_tree_predecessor splay_tree_long_predecessor +#define splay_tree_successor splay_tree_long_successor +#define splay_tree_max splay_tree_long_max +#define splay_tree_min splay_tree_long_min +#define splay_tree_foreach splay_tree_long_foreach +#define splay_tree_compare_ints splay_tree_long_compare_ints +#define splay_tree_compare_pointers splay_tree_long_compare_pointers + +#include "splay-tree.c" --- gcc/libiberty/splay-tree.c.ll 2005-11-09 09:52:30.000000000 -0800 +++ gcc/libiberty/splay-tree.c 2007-11-13 10:09:21.000000000 -0800 @@ -24,10 +24,6 @@ Boston, MA 02110-1301, USA. */ Lewis, Harry R. and Denenberg, Larry. Data Structures and Their Algorithms. Harper-Collins, Inc. 1991. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifdef HAVE_STDLIB_H #include #endif @@ -64,7 +60,7 @@ splay_tree_delete_helper (splay_tree sp, VDEL (node->value); /* We use the "key" field to hold the "next" pointer. */ - node->key = (splay_tree_key)pending; + node->key = (splay_tree_key) (splay_tree_uhostptr_t)pending; pending = (splay_tree_node)node; /* Now, keep processing the pending list until there aren't any @@ -86,19 +82,21 @@ splay_tree_delete_helper (splay_tree sp, { KDEL (active->left->key); VDEL (active->left->value); - active->left->key = (splay_tree_key)pending; + active->left->key + = (splay_tree_key) (splay_tree_uhostptr_t)pending; pending = (splay_tree_node)(active->left); } if (active->right) { KDEL (active->right->key); VDEL (active->right->value); - active->right->key = (splay_tree_key)pending; + active->right->key + = (splay_tree_key) (splay_tree_uhostptr_t)pending; pending = (splay_tree_node)(active->right); } temp = active; - active = (splay_tree_node)(temp->key); + active = (splay_tree_node) (splay_tree_uhostptr_t)(temp->key); (*sp->deallocate) ((char*) temp, sp->allocate_data); } } @@ -517,9 +515,9 @@ splay_tree_compare_ints (splay_tree_key int splay_tree_compare_pointers (splay_tree_key k1, splay_tree_key k2) { - if ((char*) k1 < (char*) k2) + if ((splay_tree_uhostptr_t) k1 < (splay_tree_uhostptr_t) k2) return -1; - else if ((char*) k1 > (char*) k2) + else if ((splay_tree_uhostptr_t) k1 > (splay_tree_uhostptr_t) k2) return 1; else return 0;