* [RFC] Use gnulib's stdint.h.
@ 2008-06-05 18:41 Daniel Jacobowitz
2008-06-26 15:58 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2008-06-05 18:41 UTC (permalink / raw)
To: gdb-patches
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>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [RFC] Use gnulib's stdint.h.
2008-06-05 18:41 [RFC] Use gnulib's stdint.h Daniel Jacobowitz
@ 2008-06-26 15:58 ` Daniel Jacobowitz
2008-06-27 19:31 ` Joel Brobecker
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2008-06-26 15:58 UTC (permalink / raw)
To: gdb-patches
On Thu, Jun 05, 2008 at 02:40:41PM -0400, Daniel Jacobowitz wrote:
> 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).
Now tested and committed.
--
Daniel Jacobowitz
CodeSourcery
2008-06-26 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.
* configure, config.in: Regenerate.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1027
diff -u -p -r1.1027 Makefile.in
--- Makefile.in 10 Jun 2008 10:23:53 -0000 1.1027
+++ Makefile.in 26 Jun 2008 15:20:51 -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) \
@@ -2645,8 +2633,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)
@@ -2689,7 +2676,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) \
@@ -2875,7 +2862,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) \
@@ -2923,7 +2910,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) $(gdbthread_h)
+ $(exceptions_h) $(target_descriptions_h) $(gdbthread_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) \
@@ -3010,7 +2997,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.19
diff -u -p -r1.19 acinclude.m4
--- acinclude.m4 5 Jun 2008 22:36:56 -0000 1.19
+++ acinclude.m4 26 Jun 2008 15:20:51 -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.325
diff -u -p -r1.325 breakpoint.c
--- breakpoint.c 10 Jun 2008 09:29:15 -0000 1.325
+++ breakpoint.c 26 Jun 2008 15:20:52 -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.70
diff -u -p -r1.70 configure.ac
--- configure.ac 9 Jun 2008 15:03:59 -0000 1.70
+++ configure.ac 26 Jun 2008 15:20:52 -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)
@@ -512,7 +519,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)
@@ -566,9 +572,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. #
# ------------------------- #
@@ -593,7 +596,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.226
diff -u -p -r1.226 defs.h
--- defs.h 10 Jun 2008 09:29:15 -0000 1.226
+++ defs.h 26 Jun 2008 15:20:52 -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 26 Jun 2008 15:20:52 -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 26 Jun 2008 15:20:52 -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 26 Jun 2008 15:20:53 -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 26 Jun 2008 15:20:53 -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 26 Jun 2008 15:20:53 -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 26 Jun 2008 15:20:53 -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 26 Jun 2008 15:20:53 -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.164
diff -u -p -r1.164 target.c
--- target.c 10 Jun 2008 10:23:53 -0000 1.164
+++ target.c 26 Jun 2008 15:20:53 -0000
@@ -39,7 +39,6 @@
#include "gdbcore.h"
#include "exceptions.h"
#include "target-descriptions.h"
-#include "gdb_stdint.h"
#include "gdbthread.h"
static void target_info (char *, int);
Index: win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.155
diff -u -p -r1.155 win32-nat.c
--- win32-nat.c 24 Jun 2008 02:33:17 -0000 1.155
+++ win32-nat.c 26 Jun 2008 15:20:53 -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>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [RFC] Use gnulib's stdint.h.
2008-06-26 15:58 ` Daniel Jacobowitz
@ 2008-06-27 19:31 ` Joel Brobecker
2008-06-27 19:37 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Joel Brobecker @ 2008-06-27 19:31 UTC (permalink / raw)
To: gdb-patches
Hi Daniel,
> 2008-06-26 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.
> * configure, config.in: Regenerate.
Bad luck, I'm seeing a couple of issues on mips-irix, for instance.
There are two distinct issues that I have seen so far:
1. dfp.c includes libdecnumber/dpd/decimal128.h which ends up
including gstdint.h. But before we included decimal128.h, we
had already included defs.h which includes gnulib/stdint.h.
The two files end up colliding.
For instance, gstdint.h contains:
typedef int16_t int_least16_t;
But gnulib/stdint.h also contains:
#define int16_t short int
#define int_least16_t int16_t
So we end up with the above being rewritten to:
typedef short int short int;
2. ctype/safe-ctype conflict. For instance, cp-support.c includes
safe-ctype.h. But at the same time, we previously included
defs.h, which itself includes gnulib/stdint.h, which includes
<wchar.h> which includes <ctypes.h>.
I can see various ways how we could fix problem #1. The quick and
dirty way that I used to make quick progress was to move the include
for dpd/decimal128.h before the include for defs.h - but this isn't
right, because it's still a risk to have two different versions of
stdint.h included at the same time. Another way is to transition
libdecnumber to using gnulib/stdint.h, but I am not sure about how
to do that in practice, as I don't think we can make libdecnumber
use stuff from GDB.
Problem #2 is a lot more problematic, however. I might argue that
this is a actually bug inside gnulib and that gnulib/stdint.h
should be generated in a way that avoids including other standard
header files. Although this might be the case for the current
stdint.h files that exist, I don't think there is an explicit
rule against it. Even if not categorized as a bug, perhaps it
would be a worthwhile enhancement, as the documented reason for
including this file is to get a couple of macros:
#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
/* Get WCHAR_MIN, WCHAR_MAX. */
# if ! (defined WCHAR_MIN && defined WCHAR_MAX)
# include <wchar.h>
# endif
#endif
Perhaps we could somehow generate the macro definitions ourselves,
which would help avoiding the include. Ideally, gnulib would take
care of that and avoid the include, or we could compute the WCHAR_MIN
and WCHAR_MAX during the GDB configury and define the macros just
before including gnulib/stdint.h.
Does all the above sound pretty kludgy to you too? :-(
--
Joel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [RFC] Use gnulib's stdint.h.
2008-06-27 19:31 ` Joel Brobecker
@ 2008-06-27 19:37 ` Daniel Jacobowitz
2008-06-27 19:57 ` Joel Brobecker
2008-06-28 7:10 ` Bruno Haible
0 siblings, 2 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2008-06-27 19:37 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches, bug-gnulib
On Fri, Jun 27, 2008 at 02:59:07PM -0400, Joel Brobecker wrote:
> There are two distinct issues that I have seen so far:
>
> 1. dfp.c includes libdecnumber/dpd/decimal128.h which ends up
> including gstdint.h. But before we included decimal128.h, we
> had already included defs.h which includes gnulib/stdint.h.
> The two files end up colliding.
>
> For instance, gstdint.h contains:
> typedef int16_t int_least16_t;
>
> But gnulib/stdint.h also contains:
> #define int16_t short int
> #define int_least16_t int16_t
>
> So we end up with the above being rewritten to:
> typedef short int short int;
Boo. And if we change libdecnumber to use gnulib's version we'll
undoubtedly break gcc. If we provide gstdint.h in the gdb directory
which redirects to <stdint.h>, will libdecnumber pick it up at this
point? That relies on the types being in-practice compatible which
will be the case, rather than making the two headers compatible.
> 2. ctype/safe-ctype conflict. For instance, cp-support.c includes
> safe-ctype.h. But at the same time, we previously included
> defs.h, which itself includes gnulib/stdint.h, which includes
> <wchar.h> which includes <ctypes.h>.
> Problem #2 is a lot more problematic, however. I might argue that
> this is a actually bug inside gnulib and that gnulib/stdint.h
> should be generated in a way that avoids including other standard
> header files. Although this might be the case for the current
> stdint.h files that exist, I don't think there is an explicit
> rule against it. Even if not categorized as a bug, perhaps it
> would be a worthwhile enhancement, as the documented reason for
> including this file is to get a couple of macros:
>
> #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
>
> /* Get WCHAR_MIN, WCHAR_MAX. */
> # if ! (defined WCHAR_MIN && defined WCHAR_MAX)
> # include <wchar.h>
> # endif
>
> #endif
>
> Perhaps we could somehow generate the macro definitions ourselves,
> which would help avoiding the include. Ideally, gnulib would take
> care of that and avoid the include, or we could compute the WCHAR_MIN
> and WCHAR_MAX during the GDB configury and define the macros just
> before including gnulib/stdint.h.
I agree that having gnulib pull in wchar.h is very unfortunate. The
gnulib folks, CC'd, are very responsive - maybe someone on bug-gnulib
has an idea on how to fix this?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Use gnulib's stdint.h.
2008-06-27 19:37 ` Daniel Jacobowitz
@ 2008-06-27 19:57 ` Joel Brobecker
2008-07-04 17:59 ` Joel Brobecker
2008-06-28 7:10 ` Bruno Haible
1 sibling, 1 reply; 8+ messages in thread
From: Joel Brobecker @ 2008-06-27 19:57 UTC (permalink / raw)
To: gdb-patches, bug-gnulib
> Boo. And if we change libdecnumber to use gnulib's version we'll
> undoubtedly break gcc. If we provide gstdint.h in the gdb directory
> which redirects to <stdint.h>, will libdecnumber pick it up at this
> point?
That's pretty ingenious. Indeed, that works, since the include order
when compiling GDB files is the gdb directory, ahead of all other
dependencies. I'll send a patch shortly after having tested it.
> > #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
> >
> > /* Get WCHAR_MIN, WCHAR_MAX. */
> > # if ! (defined WCHAR_MIN && defined WCHAR_MAX)
> > # include <wchar.h>
> > # endif
> >
> > #endif
> >
> > Perhaps we could somehow generate the macro definitions ourselves,
> > which would help avoiding the include. Ideally, gnulib would take
> > care of that and avoid the include, or we could compute the WCHAR_MIN
> > and WCHAR_MAX during the GDB configury and define the macros just
> > before including gnulib/stdint.h.
>
> I agree that having gnulib pull in wchar.h is very unfortunate. The
> gnulib folks, CC'd, are very responsive - maybe someone on bug-gnulib
> has an idea on how to fix this?
That would be nice :-). I wanted to have a look, but m4/stdint.m4
needs a little bit of study time before I can understand it all...
--
Joel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Use gnulib's stdint.h.
2008-06-27 19:57 ` Joel Brobecker
@ 2008-07-04 17:59 ` Joel Brobecker
0 siblings, 0 replies; 8+ messages in thread
From: Joel Brobecker @ 2008-07-04 17:59 UTC (permalink / raw)
To: gdb-patches, bug-gnulib
Okidoke,
Here is a small status on this thread... Generally speaking, I expect
all issues to be officially resolved soon.
On Fri, Jun 27, 2008 at 03:31:39PM -0400, Joel Brobecker wrote:
> > Boo. And if we change libdecnumber to use gnulib's version we'll
> > undoubtedly break gcc. If we provide gstdint.h in the gdb directory
> > which redirects to <stdint.h>, will libdecnumber pick it up at this
> > point?
>
> That's pretty ingenious. Indeed, that works, since the include order
> when compiling GDB files is the gdb directory, ahead of all other
> dependencies. I'll send a patch shortly after having tested it.
Patch posted a few days ago, and waiting for comments. I'll commit
in a few days if there is no objection.
> > > #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
> > >
> > > /* Get WCHAR_MIN, WCHAR_MAX. */
> > > # if ! (defined WCHAR_MIN && defined WCHAR_MAX)
> > > # include <wchar.h>
> > > # endif
> > >
> > > #endif
Thanks to Ian's help, we removed the check against ctype.h, so this
issue should now be fixed.
--
Joel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Use gnulib's stdint.h.
2008-06-27 19:37 ` Daniel Jacobowitz
2008-06-27 19:57 ` Joel Brobecker
@ 2008-06-28 7:10 ` Bruno Haible
2008-07-01 0:28 ` Joel Brobecker
1 sibling, 1 reply; 8+ messages in thread
From: Bruno Haible @ 2008-06-28 7:10 UTC (permalink / raw)
To: Daniel Jacobowitz, Joel Brobecker; +Cc: bug-gnulib, gdb-patches
Hi,
For some context, the message you were replying to is
<http://sourceware.org/ml/gdb-patches/2008-06/msg00513.html>.
Generally the experience we've made with gnulib is:
* It's wise to include the system headers first, and the application
headers after that. This minimizes the risk that #defines in the
application headers make the system headers malfunction. (Examples:
'#define unused' on Windows, '#define PC' on SVR4 systems, many more ...)
* Never assume that a particular header has not been included. Assuming
that, say, <stdio.h> functions are not declared is
1. a portability problem, because <wchar.h> may need to include <stdio.h>,
or similar,
2. a maintainability problem, because when you want to use, say, perror()
in such a file, you are at a dead end.
Daniel Jacobowitz wrote:
> Joel Brobecker wrote:
> > There are two distinct issues that I have seen so far:
> >
> > 1. dfp.c includes libdecnumber/dpd/decimal128.h which ends up
> > including gstdint.h. But before we included decimal128.h, we
> > had already included defs.h which includes gnulib/stdint.h.
> > The two files end up colliding.
> >
> > For instance, gstdint.h contains:
> > typedef int16_t int_least16_t;
> >
> > But gnulib/stdint.h also contains:
> > #define int16_t short int
> > #define int_least16_t int16_t
> >
> > So we end up with the above being rewritten to:
> > typedef short int short int;
> And if we change libdecnumber to use gnulib's version we'll
> undoubtedly break gcc.
libdecnumber's gstdint.h appears to be generated by the autoconf macro
GCC_HEADER_STDINT - obviously in the hand of the GCC maintainers.
There are basically two ways out:
a) Make gstdint.h use the types from <stdint.h> if they are present.
Change
typedef int16_t int_least16_t;
to
#if !(defined INT_LEAST16_MIN && defined INT_LEAST16_MAX)
typedef int16_t int_least16_t;
#endif
b) Make gstdint.h override the types from <stdint.h> if they are present.
Change
typedef int16_t int_least16_t;
to
#undef int_least16_t
#define int_least16_t gcc_int_least16_t
typedef int16_t int_least16_t;
The first approach is likely to need some additional tweaks for various
platforms, whereas the second approach will work out-of-the-box. But if
the APIs of libdecnumber use the int_least16_t etc. types, the first
approach is better because it does not create two (possibly different)
types for the same thing.
> > 2. ctype/safe-ctype conflict. For instance, cp-support.c includes
> > safe-ctype.h. But at the same time, we previously included
> > defs.h, which itself includes gnulib/stdint.h, which includes
> > <wchar.h> which includes <ctypes.h>.
>
> > Problem #2 is a lot more problematic, however. I might argue that
> > this is a actually bug inside gnulib and that gnulib/stdint.h
> > should be generated in a way that avoids including other standard
> > header files.
No. gnulib makes no guarantee that particular headers or symbols are
not defined. For three reasons:
1. We cannot control the #includes inside system headers.
2. gnulib turns on _GNU_SOURCE on glibc systems and __EXTENSIONS__ on
Solaris.
3. In those places where gnulib could control these extra #includes,
the price would be sets of #ifdefs that would be too clumsy to be
maintainable.
The bug is in safe-ctype.h:
#ifdef isalpha
#error "safe-ctype.h and ctype.h may not be used simultaneously"
#endif
Actually I don't see the reason for this #error: safe-ctype.h defines only
uppercase-named macros, and <ctype.h> defines only lowercase-named or
underscore-prefixed macros.
> > ... help avoiding the include. Ideally, gnulib would take
> > care of that and avoid the include
No, gnulib will not make not-include guarantees. See above.
Bruno
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [RFC] Use gnulib's stdint.h.
2008-06-28 7:10 ` Bruno Haible
@ 2008-07-01 0:28 ` Joel Brobecker
0 siblings, 0 replies; 8+ messages in thread
From: Joel Brobecker @ 2008-07-01 0:28 UTC (permalink / raw)
To: Bruno Haible; +Cc: Daniel Jacobowitz, bug-gnulib, gdb-patches
Hi Bruno,
> > > 2. ctype/safe-ctype conflict. For instance, cp-support.c includes
> > > safe-ctype.h. But at the same time, we previously included
> > > defs.h, which itself includes gnulib/stdint.h, which includes
> > > <wchar.h> which includes <ctypes.h>.
> >
> > > Problem #2 is a lot more problematic, however. I might argue that
> > > this is a actually bug inside gnulib and that gnulib/stdint.h
> > > should be generated in a way that avoids including other standard
> > > header files.
>
> No. gnulib makes no guarantee that particular headers or symbols are
> not defined.
I wasn't really suggesting that gnulib should make a general guaranty,
but if the wchar.h include could easily be avoided, then it would have
made GDB's life a little easier. It was worth asking :)
> 3. In those places where gnulib could control these extra #includes,
> the price would be sets of #ifdefs that would be too clumsy to be
> maintainable.
I see your point.
> The bug is in safe-ctype.h:
>
> #ifdef isalpha
> #error "safe-ctype.h and ctype.h may not be used simultaneously"
> #endif
>
> Actually I don't see the reason for this #error: safe-ctype.h defines only
> uppercase-named macros, and <ctype.h> defines only lowercase-named or
> underscore-prefixed macros.
I will see with the GCC maintainers what they think. Maybe the check
made better sense at one point, but no longer makes sense today.
I checked the public history of that file and version 1 of that file
(dated circa 2000) already defines the macros in uppercase and
has the isalpha macro check.
--
Joel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-07-04 17:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-05 18:41 [RFC] Use gnulib's stdint.h Daniel Jacobowitz
2008-06-26 15:58 ` Daniel Jacobowitz
2008-06-27 19:31 ` Joel Brobecker
2008-06-27 19:37 ` Daniel Jacobowitz
2008-06-27 19:57 ` Joel Brobecker
2008-07-04 17:59 ` Joel Brobecker
2008-06-28 7:10 ` Bruno Haible
2008-07-01 0:28 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox