diff mbox

[Libiberty,-,V2] : Handle VMS as a LLP64 platform in splay-tree.h

Message ID 3D7B738C-1084-471F-99FD-18D2C0A8F7E9@adacore.com
State New
Headers show

Commit Message

Tristan Gingold April 5, 2012, 3 p.m. UTC
On Apr 4, 2012, at 5:07 PM, Ian Lance Taylor wrote:

> Tristan Gingold <gingold@adacore.com> writes:
> 
>> Would something like that be acceptable ?
>> I have just checked that I can still build gcc with that patch.  If you like this approach I will properly submit a patch.
> 
> Thanks.
> 
> You should also test that gdb continues to build with this patch.
> 
> I guess the question here is portability.  Do we still care about
> portability to systems that have neither inttypes.h nor stdint.h?  I'm
> willing to try this and see if anybody complains.
> 
> Ian

Hi,

here is my formal patch submission.  I am not concerned by portability as
configure will define uintptr_t if not found in inttypes.h or stdint.h
(both in libiberty and gcc.  gdb indeed uses stdint.h from gnulib).

Tested by bootstrapping gcc for c,c++ and fortran on x86_64-darwin,
and by building gdb on x86_64-darwin.

Ok for trunk ?

Tristan.

gcc/
2012-04-05  Tristan Gingold  <gingold@adacore.com>

	* gengtype.c (main): Make uintptr_t a known type.

include/
2012-04-05  Tristan Gingold  <gingold@adacore.com>

	* splay-tree.h: Conditionnaly includes stdint.h and inttypes.h
	(libi_uhostptr_t, libi_shostptr_t): Remove, replaced by uintptr_t.

Comments

Ian Lance Taylor April 5, 2012, 10:26 p.m. UTC | #1
Tristan Gingold <gingold@adacore.com> writes:

> gcc/
> 2012-04-05  Tristan Gingold  <gingold@adacore.com>
>
> 	* gengtype.c (main): Make uintptr_t a known type.
>
> include/
> 2012-04-05  Tristan Gingold  <gingold@adacore.com>
>
> 	* splay-tree.h: Conditionnaly includes stdint.h and inttypes.h
> 	(libi_uhostptr_t, libi_shostptr_t): Remove, replaced by uintptr_t.

This is OK.

Thanks.

Ian
Tristan Gingold April 10, 2012, 10:46 a.m. UTC | #2
On Apr 6, 2012, at 12:26 AM, Ian Lance Taylor wrote:

> Tristan Gingold <gingold@adacore.com> writes:
> 
>> gcc/
>> 2012-04-05  Tristan Gingold  <gingold@adacore.com>
>> 
>> 	* gengtype.c (main): Make uintptr_t a known type.
>> 
>> include/
>> 2012-04-05  Tristan Gingold  <gingold@adacore.com>
>> 
>> 	* splay-tree.h: Conditionnaly includes stdint.h and inttypes.h
>> 	(libi_uhostptr_t, libi_shostptr_t): Remove, replaced by uintptr_t.
> 
> This is OK.

Thanks, committed.

Tristan.
diff mbox

Patch

diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 7450eeb..fa45392 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -4976,6 +4976,7 @@  main (int argc, char **argv)
       POS_HERE (do_scalar_typedef ("double_int", &pos));
       POS_HERE (do_scalar_typedef ("uint64_t", &pos));
       POS_HERE (do_scalar_typedef ("uint8", &pos));
+      POS_HERE (do_scalar_typedef ("uintptr_t", &pos));
       POS_HERE (do_scalar_typedef ("jword", &pos));
       POS_HERE (do_scalar_typedef ("JCF_u2", &pos));
       POS_HERE (do_scalar_typedef ("void", &pos));


diff --git a/include/splay-tree.h b/include/splay-tree.h
index 480b2c4..a26135a 100644
--- a/include/splay-tree.h
+++ b/include/splay-tree.h
@@ -37,18 +37,11 @@  extern "C" {
 
 #include "ansidecl.h"
 
-#ifndef _WIN64
-  typedef unsigned long int libi_uhostptr_t;
-  typedef long int libi_shostptr_t;
-#else
-#ifdef __GNUC__
-  __extension__
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
 #endif
-  typedef unsigned long long libi_uhostptr_t;
-#ifdef __GNUC__
-  __extension__
-#endif
-  typedef long long libi_shostptr_t;
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
 #endif
 
 #ifndef GTY
@@ -59,8 +52,8 @@  extern "C" {
    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;
+typedef uintptr_t splay_tree_key;
+typedef uintptr_t splay_tree_value;
 
 /* Forward declaration for a node in the tree.  */
 typedef struct splay_tree_node_s *splay_tree_node;