This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Use gnulib's stdint.h.


As I was discussing with Joel a few weeks ago...

This patch drops gdb_stdint.h, along with any support for a missing
stdint.h.  Gnulib knows how to build one on all platforms and we can
include that one in defs.h to make the standard integer types
available to all of GDB.

Compile-tested on x86_64-linux.  Any objections to this patch?
Otherwise, I'll check it in in a few days (after properly testing it).

-- 
Daniel Jacobowitz
CodeSourcery

2008-06-05  Daniel Jacobowitz  <dan@codesourcery.com>

	* Makefile.in (GNULIB_H): Use GNULIB_STDINT_H.
	(gdb_stdint_h, gdb_stdint.h, stamp-int): Delete.  Remove
	all dependencies on $(gdb_stdint_h).
	(distclean): Do not delete gdb_stdint.h.
	* acinclude.m4: Do not use stdint.m4.
	* configure.ac: Set GNULIB_STDINT_H.  Remove tests for stdint.h,
	uintptr_t, and gdb_stdint.h.
	* defs.h: Include <stdint.h>.
	* gdb_thread_db.h: Assume stdint.h is already included.
	* breakpoint.c, findcmd.c, hppa-tdep.c, inf-ptrace.c, proc-service.c,
	rs6000-nat.c, spu-linux-nat.c, target.c, win32-nat.c: Do not
	include gdb_stdint.h.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1024
diff -u -p -r1.1024 Makefile.in
--- Makefile.in	24 May 2008 16:32:01 -0000	1.1024
+++ Makefile.in	5 Jun 2008 18:31:57 -0000
@@ -166,7 +166,7 @@ INCGNU = -I$(srcdir)/gnulib -Ignulib
 
 # Generated headers in the gnulib directory.  These must be listed
 # so that they are generated before other files are compiled.
-GNULIB_H = gnulib/string.h
+GNULIB_H = gnulib/string.h @GNULIB_STDINT_H@
 
 #
 # CLI sub directory definitons
@@ -707,7 +707,6 @@ decimal32_h = $(LIBDECNUMBER_DIR)/dpd/de
 config_h = config.h
 exc_request_U_h = exc_request_U.h
 exc_request_S_h = exc_request_S.h
-gdb_stdint_h = gdb_stdint.h
 msg_reply_S_h = msg_reply_S.h
 msg_U_h = msg_U.h
 notify_S_h = notify_S.h
@@ -1417,7 +1416,6 @@ distclean: clean
 	rm -f gdbserver/tm.h gdbserver/xm.h gdbserver/nm.h
 	rm -f gdbserver/Makefile gdbserver/config.cache
 	rm -f nm.h config.status config.h stamp-h .gdbinit
-	rm -f gdb_stdint.h
 	rm -f y.output yacc.acts yacc.tmp y.tab.h
 	rm -f config.log config.cache
 	rm -f Makefile
@@ -1476,15 +1474,6 @@ stamp-h: config.in config.status
 	  CONFIG_LINKS= \
 	  $(SHELL) config.status
 
-gdb_stdint.h: stamp-int ; @true
-stamp-int: config.status
-	CONFIG_COMMANDS=gdb_stdint.h \
-	  CONFIG_FILES= \
-	  CONFIG_HEADERS= \
-	  CONFIG_LINKS= \
-	  $(SHELL) config.status
-	echo stamp > stamp-int
-
 config.status: configure configure.tgt configure.host
 	$(SHELL) config.status --recheck
 
@@ -1984,8 +1973,7 @@ breakpoint.o: breakpoint.c $(defs_h) $(s
 	$(objfiles_h) $(source_h) $(linespec_h) $(completer_h) $(gdb_h) \
 	$(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) $(solib_h) \
 	$(solist_h) $(observer_h) $(exceptions_h) $(gdb_events_h) \
-	$(mi_common_h) $(memattr_h) $(ada_lang_h) $(top_h) $(hashtab_h) \
-	$(gdb_stdint_h)
+	$(mi_common_h) $(memattr_h) $(ada_lang_h) $(top_h) $(hashtab_h)
 bsd-kvm.o: bsd-kvm.c $(defs_h) $(cli_cmds_h) $(command_h) $(frame_h) \
 	$(regcache_h) $(target_h) $(value_h) $(gdbcore_h) $(gdb_assert_h) \
 	$(readline_h) $(bsd_kvm_h)
@@ -2136,7 +2124,7 @@ f-exp.o: f-exp.c $(defs_h) $(gdb_string_
 	$(parser_defs_h) $(language_h) $(f_lang_h) $(bfd_h) $(symfile_h) \
 	$(objfiles_h) $(block_h)
 findcmd.o: findcmd.c $(defs_h) $(gdb_string_h) $(gdbcmd_h) $(value_h) \
-	$(target_h) $(gdb_stdint_h)
+	$(target_h)
 findvar.o: findvar.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(frame_h) \
 	$(value_h) $(gdbcore_h) $(inferior_h) $(target_h) $(gdb_string_h) \
 	$(gdb_assert_h) $(floatformat_h) $(symfile_h) $(regcache_h) \
@@ -2232,7 +2220,7 @@ hppa-linux-tdep.o: hppa-linux-tdep.c $(d
 	$(frame_unwind_h) $(trad_frame_h) $(dwarf2_frame_h) $(value_h) \
 	$(hppa_tdep_h) $(elf_common_h) $(regset_h) $(regcache_h)
 hppa-tdep.o: hppa-tdep.c $(defs_h) $(bfd_h) $(inferior_h) $(regcache_h) \
-	$(completer_h) $(osabi_h) $(gdb_assert_h) $(gdb_stdint_h) \
+	$(completer_h) $(osabi_h) $(gdb_assert_h) \
 	$(arch_utils_h) $(symtab_h) $(dis_asm_h) $(trad_frame_h) \
 	$(frame_unwind_h) $(frame_base_h) $(gdbcore_h) $(gdbcmd_h) \
 	$(objfiles_h) $(hppa_tdep_h) $(gdbtypes_h)
@@ -2339,7 +2327,7 @@ inflow.o: inflow.c $(defs_h) $(frame_h) 
 	$(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h) \
 	$(inflow_h) $(gdb_select_h)
 inf-ptrace.o: inf-ptrace.c $(defs_h) $(command_h) $(inferior_h) $(inflow_h) \
-	$(gdbcore_h) $(regcache_h) $(gdb_stdint_h) $(gdb_assert_h) \
+	$(gdbcore_h) $(regcache_h) $(gdb_assert_h) \
 	$(gdb_string_h) $(gdb_ptrace_h) $(gdb_wait_h) $(inf_child_h)
 infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \
 	$(inferior_h) $(exceptions_h) $(breakpoint_h) $(gdb_wait_h) \
@@ -2644,8 +2632,7 @@ procfs.o: procfs.c $(defs_h) $(inferior_
 	$(gdb_string_h) $(gdb_assert_h) $(inflow_h) $(auxv_h) \
 	$(gdb_dirent_h) $(gdb_stat_h) $(proc_utils_h) $(gregset_h)
 proc-service.o: proc-service.c $(defs_h) $(gdb_proc_service_h) $(inferior_h) \
-	$(symtab_h) $(target_h) $(regcache_h) $(gregset_h) $(gdbcore_h) \
-	$(gdb_stdint_h)
+	$(symtab_h) $(target_h) $(regcache_h) $(gregset_h) $(gdbcore_h)
 proc-why.o: proc-why.c $(defs_h) $(proc_utils_h)
 prologue-value.o: prologue-value.c $(defs_h) $(gdb_string_h) $(gdb_assert_h) \
 	$(prologue_value_h) $(regcache_h)
@@ -2688,7 +2675,7 @@ rs6000-nat.o: rs6000-nat.c $(defs_h) $(i
 	$(xcoffsolib_h) $(symfile_h) $(objfiles_h) $(libbfd_h) $(bfd_h) \
 	$(exceptions_h) $(gdb_stabs_h) $(regcache_h) $(arch_utils_h) \
 	$(inf_ptrace_h) $(ppc_tdep_h) $(rs6000_tdep_h) $(exec_h) \
-	$(gdb_stdint_h) $(observer_h) $(gdb_stat_h)
+	$(observer_h) $(gdb_stat_h)
 rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
 	$(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) $(arch_utils_h) \
 	$(regcache_h) $(regset_h) $(doublest_h) $(value_h) $(parser_defs_h) \
@@ -2874,7 +2861,7 @@ sparc-tdep.o: sparc-tdep.c $(defs_h) $(a
 	$(value_h) $(gdb_assert_h) $(gdb_string_h) $(sparc_tdep_h)
 spu-linux-nat.o: spu-linux-nat.c $(defs_h) $(gdbcore_h) $(gdb_string_h) \
 	$(target_h) $(inferior_h) $(inf_ptrace_h) $(regcache_h) $(symfile_h) \
-	$(gdb_wait_h) $(gdb_stdint_h) $(spu_tdep_h)
+	$(gdb_wait_h) $(spu_tdep_h)
 spu-tdep.o: spu-tdep.c $(defs_h) $(arch_utils_h) $(gdbtypes_h) $(gdbcmd_h) \
 	$(gdbcore_h) $(gdb_string_h) $(gdb_assert_h) $(frame_h) \
 	$(frame_unwind_h) $(frame_base_h) $(trad_frame_h) $(symtab_h) \
@@ -2922,7 +2909,7 @@ symtab.o: symtab.c $(defs_h) $(symtab_h)
 target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
 	$(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
 	$(gdb_wait_h) $(dcache_h) $(regcache_h) $(gdb_assert_h) $(gdbcore_h) \
-	$(exceptions_h) $(target_descriptions_h) $(gdb_stdint_h)
+	$(exceptions_h) $(target_descriptions_h)
 target-descriptions.o: target-descriptions.c $(defs_h) $(arch_utils_h) \
 	$(target_h) $(target_descriptions_h) $(vec_h) $(xml_tdesc_h) \
 	$(gdbcmd_h) $(gdb_assert_h) $(gdbtypes_h) $(reggroups_h) \
@@ -3009,7 +2996,7 @@ win32-nat.o: win32-nat.c $(defs_h) $(fra
 	$(regcache_h) $(top_h) $(buildsym_h) $(symfile_h) $(objfiles_h) \
 	$(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) $(exec_h) $(solist_h) \
 	$(solib_h) $(i386_tdep_h) $(i387_tdep_h) $(gdb_obstack_h) \
-	$(xml_support_h) $(i386_cygwin_tdep_h) $(gdb_stdint_h)
+	$(xml_support_h) $(i386_cygwin_tdep_h)
 win32-termcap.o: win32-termcap.c
 wrapper.o: wrapper.c $(defs_h) $(value_h) $(exceptions_h) $(wrapper_h) \
 	$(ui_out_h)
Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.18
diff -u -p -r1.18 acinclude.m4
--- acinclude.m4	23 Apr 2008 12:21:47 -0000	1.18
+++ acinclude.m4	5 Jun 2008 18:31:57 -0000
@@ -10,9 +10,6 @@ sinclude(../config/acinclude.m4)
 dnl This gets autoconf bugfixes
 sinclude(../config/override.m4)
 
-dnl This gets GCC_HEADER_STDINT.
-sinclude(../config/stdint.m4)
-
 sinclude(../config/gettext-sister.m4)
 
 dnl For AC_LIB_HAVE_LINKFLAGS.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.322
diff -u -p -r1.322 breakpoint.c
--- breakpoint.c	28 May 2008 14:04:21 -0000	1.322
+++ breakpoint.c	5 Jun 2008 18:31:58 -0000
@@ -60,8 +60,6 @@
 #include "gdb-events.h"
 #include "mi/mi-common.h"
 
-#include "gdb_stdint.h"
-
 /* Prototypes for local functions. */
 
 static void until_break_command_continuation (struct continuation_arg *arg, 
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.68
diff -u -p -r1.68 configure.ac
--- configure.ac	19 Apr 2008 05:06:54 -0000	1.68
+++ configure.ac	5 Jun 2008 18:31:58 -0000
@@ -62,6 +62,13 @@ fi
 
 gl_INIT
 
+# For Makefile dependencies.
+GNULIB_STDINT_H=
+if test x"$STDINT_H" != x; then
+  GNULIB_STDINT_H=gnulib/$STDINT_H
+fi
+AC_SUBST(GNULIB_STDINT_H)
+
 PACKAGE=gdb
 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
 AC_SUBST(PACKAGE)
@@ -507,7 +514,6 @@ AC_CHECK_HEADERS(proc_service.h thread_d
 AC_CHECK_HEADERS(signal.h)
 AC_CHECK_HEADERS(stddef.h)
 AC_CHECK_HEADERS(stdlib.h)
-AC_CHECK_HEADERS(stdint.h)
 AC_CHECK_HEADERS(string.h memory.h strings.h)
 AC_CHECK_HEADERS(sys/fault.h)
 AC_CHECK_HEADERS(sys/file.h)
@@ -561,9 +567,6 @@ AC_CHECK_HEADERS(elf_hp.h)
 # unconditionally, so what's the point in checking these?
 AC_CHECK_HEADERS(ctype.h time.h)
 
-# Create a header we can use portably to get the standard integer types.
-GCC_HEADER_STDINT(gdb_stdint.h)
-
 # ------------------------- #
 # Checks for declarations.  #
 # ------------------------- #
@@ -588,7 +591,6 @@ AC_CHECK_TYPES(socklen_t, [], [],
 [#include <sys/types.h>
 #include <sys/socket.h>
 ])
-AC_CHECK_TYPES(uintptr_t, [], [], [#include <stdint.h>])
 
 # ------------------------------------- #
 # Checks for compiler characteristics.  #
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.225
diff -u -p -r1.225 defs.h
--- defs.h	24 May 2008 16:32:01 -0000	1.225
+++ defs.h	5 Jun 2008 18:31:58 -0000
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <errno.h>		/* System call error return status.  */
 #include <limits.h>
+#include <stdint.h>
 
 #ifdef HAVE_STDDEF_H
 #include <stddef.h>
Index: findcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/findcmd.c,v
retrieving revision 1.3
diff -u -p -r1.3 findcmd.c
--- findcmd.c	14 May 2008 04:23:02 -0000	1.3
+++ findcmd.c	5 Jun 2008 18:31:58 -0000
@@ -23,7 +23,6 @@
 #include "gdbcmd.h"
 #include "value.h"
 #include "target.h"
-#include "gdb_stdint.h"
 
 /* Copied from bfd_put_bits.  */
 
Index: gdb_thread_db.h
===================================================================
RCS file: /cvs/src/src/gdb/gdb_thread_db.h,v
retrieving revision 1.9
diff -u -p -r1.9 gdb_thread_db.h
--- gdb_thread_db.h	1 Jan 2008 22:53:09 -0000	1.9
+++ gdb_thread_db.h	5 Jun 2008 18:31:58 -0000
@@ -2,15 +2,6 @@
 #include <thread_db.h>
 #else
 
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-typedef uint32_t gdb_uint32_t;
-#define GDB_UINT32_C(c)	UINT32_C(c)
-#else
-typedef unsigned int gdb_uint32_t;
-#define GDB_UINT32_C(c)	c ## U
-#endif
-
 /* Copyright (C) 1999, 2000, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -119,14 +110,14 @@ typedef struct td_thrhandle
 /* Bitmask of enabled events. */
 typedef struct td_thr_events
 {
-  gdb_uint32_t event_bits[TD_EVENTSIZE];
+  uint32_t event_bits[TD_EVENTSIZE];
 } td_thr_events_t;
 
 /* Event set manipulation macros. */
 #define __td_eventmask(n) \
-  (GDB_UINT32_C (1) << (((n) - 1) & BT_UIMASK))
+  (UINT32_C (1) << (((n) - 1) & BT_UIMASK))
 #define __td_eventword(n) \
-  ((GDB_UINT32_C ((n) - 1)) >> BT_UISHIFT)
+  ((UINT32_C ((n) - 1)) >> BT_UISHIFT)
 
 #define td_event_emptyset(setp) \
   do {									      \
@@ -139,7 +130,7 @@ typedef struct td_thr_events
   do {									      \
     int __i;								      \
     for (__i = TD_EVENTSIZE; __i > 0; --__i)				      \
-      (setp)->event_bits[__i - 1] = GDB_UINT32_C (0xffffffff);		      \
+      (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff);		      \
   } while (0)
 
 #define td_event_addset(setp, n) \
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.251
diff -u -p -r1.251 hppa-tdep.c
--- hppa-tdep.c	16 May 2008 00:27:23 -0000	1.251
+++ hppa-tdep.c	5 Jun 2008 18:31:58 -0000
@@ -29,7 +29,6 @@
 #include "completer.h"
 #include "osabi.h"
 #include "gdb_assert.h"
-#include "gdb_stdint.h"
 #include "arch-utils.h"
 /* For argument passing to the inferior */
 #include "symtab.h"
Index: inf-ptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ptrace.c,v
retrieving revision 1.42
diff -u -p -r1.42 inf-ptrace.c
--- inf-ptrace.c	1 Jan 2008 22:53:11 -0000	1.42
+++ inf-ptrace.c	5 Jun 2008 18:31:58 -0000
@@ -26,7 +26,6 @@
 #include "gdbcore.h"
 #include "regcache.h"
 
-#include "gdb_stdint.h"
 #include "gdb_assert.h"
 #include "gdb_string.h"
 #include "gdb_ptrace.h"
Index: proc-service.c
===================================================================
RCS file: /cvs/src/src/gdb/proc-service.c,v
retrieving revision 1.16
diff -u -p -r1.16 proc-service.c
--- proc-service.c	1 Jan 2008 22:53:12 -0000	1.16
+++ proc-service.c	5 Jun 2008 18:31:59 -0000
@@ -26,7 +26,6 @@
 #include "regcache.h"
 
 #include "gdb_proc_service.h"
-#include "gdb_stdint.h"
 
 #include <sys/procfs.h>
 
Index: rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.79
diff -u -p -r1.79 rs6000-nat.c
--- rs6000-nat.c	3 May 2008 23:50:43 -0000	1.79
+++ rs6000-nat.c	5 Jun 2008 18:31:59 -0000
@@ -36,7 +36,6 @@
 #include "ppc-tdep.h"
 #include "rs6000-tdep.h"
 #include "exec.h"
-#include "gdb_stdint.h"
 #include "observer.h"
 
 #include <sys/ptrace.h>
Index: spu-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/spu-linux-nat.c,v
retrieving revision 1.11
diff -u -p -r1.11 spu-linux-nat.c
--- spu-linux-nat.c	1 Jan 2008 22:53:13 -0000	1.11
+++ spu-linux-nat.c	5 Jun 2008 18:31:59 -0000
@@ -27,7 +27,6 @@
 #include "regcache.h"
 #include "symfile.h"
 #include "gdb_wait.h"
-#include "gdb_stdint.h"
 
 #include <sys/ptrace.h>
 #include <asm/ptrace.h>
Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.163
diff -u -p -r1.163 target.c
--- target.c	9 May 2008 17:37:36 -0000	1.163
+++ target.c	5 Jun 2008 18:31:59 -0000
@@ -39,7 +39,6 @@
 #include "gdbcore.h"
 #include "exceptions.h"
 #include "target-descriptions.h"
-#include "gdb_stdint.h"
 
 static void target_info (char *, int);
 
Index: win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.152
diff -u -p -r1.152 win32-nat.c
--- win32-nat.c	20 May 2008 18:36:36 -0000	1.152
+++ win32-nat.c	5 Jun 2008 18:31:59 -0000
@@ -48,7 +48,6 @@
 #include "objfiles.h"
 #include "gdb_obstack.h"
 #include "gdb_string.h"
-#include "gdb_stdint.h"
 #include "gdbthread.h"
 #include "gdbcmd.h"
 #include <sys/param.h>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]