[rfc] gdb_stdint.h.

Daniel Jacobowitz
2006-05-05T17:27:21Z

You want uintptr_t? I got your uintptr_t right here.

This patch creates a header in the build directory named gdb_stdint.h.
It defines all of the things which a stdint.h ought to define. It uses
the system's stdint.h if there is one, and provides anything missing,
up to and including the whole file.

There is, of course, a huge hairy chunk of m4 and portability knowledge
that you don't see in this patch. That's because it's already in
config/ and was written for GCC. I'm OK with that :-) It means it's
quite well tested at this point.

This would be enough to allow us to start using uint64_t, uintptr_t,
et cetera in the common code of GDB. Which, in my opinion, would be a
good idea. They're nice to have around.

Any comments?

--
Daniel Jacobowitz
CodeSourcery

2006-05-05 Daniel Jacobowitz <dan@codesourcery.com>

* configure.ac: Use GCC_HEADER_STDINT.
* acinclude.m4: Include stdint.m4.
* Makefile.in (gdb_stdint_h): Define.
(distclean): Remove gdb_stdint.h.
(Makefile, stamp-h): Update rules to generate only the correct
files.
(gdb_stdint.h, stamp-int): New rules.
* config.in, configure: Regenerated.

Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.31
diff -u -p -r1.31 configure.ac
--- configure.ac 29 Mar 2006 22:58:54 -0000 1.31
+++ configure.ac 5 May 2006 17:23:04 -0000
@@ -422,6 +422,9 @@ AC_CHECK_HEADERS(term.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. #
# ------------------------- #
Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.13
diff -u -p -r1.13 acinclude.m4
--- acinclude.m4 17 Dec 2005 22:33:59 -0000 1.13
+++ acinclude.m4 5 May 2006 17:23:05 -0000
@@ -7,6 +7,9 @@ sinclude(../bfd/bfd.m4)
dnl This gets the standard macros, like the TCL, TK, etc ones.
sinclude(../config/acinclude.m4)

+dnl This gets GCC_HEADER_STDINT.
+sinclude(../config/stdint.m4)
+
sinclude(../gettext.m4)
dnl The lines below arrange for aclocal not to bring gettext.m4's
dnl CY_GNU_GETTEXT into aclocal.m4.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.811
diff -u -p -r1.811 Makefile.in
--- Makefile.in 23 Apr 2006 14:15:01 -0000 1.811
+++ Makefile.in 5 May 2006 17:23:05 -0000
@@ -613,6 +613,7 @@ hashtab_h = $(INCLUDE_DIR)/hashtab.h
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
@@ -1280,6 +1281,7 @@ distclean: clean
rm -f gdbserver/tm.h gdbserver/xm.h gdbserver/nm.h
rm -f gdbserver/Makefile gdbserver/config.cache
rm -f nm.h tm.h xm.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
@@ -1317,11 +1319,28 @@ subdir_do: force
done

Makefile: Makefile.in config.status @frags@
- $(SHELL) config.status
+ # Regenerate the Makefile and the tm.h / nm.h links.
+ CONFIG_FILES=Makefile \
+ CONFIG_COMMANDS= \
+ CONFIG_HEADERS= \
+ $(SHELL) config.status

config.h: stamp-h ; @true
stamp-h: config.in config.status
- CONFIG_HEADERS=config.h:config.in $(SHELL) config.status
+ CONFIG_HEADERS=config.h:config.in \
+ CONFIG_COMMANDS=default \
+ CONFIG_FILES= \
+ 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