This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Remove various _G_*_t type names
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Tue, 25 Sep 2012 00:26:56 +0000
- Subject: Remove various _G_*_t type names
_G_config.h defines various _G_*_t type names in terms of glibc's
usual *_t types. libio.h in turn uses those to define _IO_*_t type
names.
Both levels of indirection are of doubtful use - now libio is used
only in glibc rather than also in libstdc++ (since at least GCC 3.4),
it would seem to me to make sense for glibc's usual type names to be
used everywhere in libio and its headers rather than having _IO_*
names for types that have standard names elsewhere in glibc. However,
this patch just does a basic cleanup of one of the levels of
unnecessary indirection: removing _G_* names from _G_config.h for
types where all versions of _G_config.h use exactly the same type
definition. For six of these types, the users of these types (_IO_*
definitions, plus direct uses of _G_size_t in defining a structure)
are changed to use the type names to which the _G_* types were
defined. In the case of _G_wchar_t, even that was not needed, since
nothing in glibc uses the _G_wchar_t name at all (libio just directly
uses the name wchar_t).
Tested x86_64 that the code generated for glibc's shared libraries is
the same before and after this patch.
2012-09-25 Joseph Myers <joseph@codesourcery.com>
* libio/libio.h (_IO_size_t): Define to size_t, not _G_size_t.
(_IO_ssize_t): Define to __ssize_t, not _G_ssize_t.
(_IO_off_t): Define to __off_t, not _G_off_t.
(_IO_pid_t): Define to __pid_t, not _G_pid_t.
(_IO_uid_t): Define to __uid_t, not _G_uid_t.
(_IO_wint_t): Define to wint_t, not _G_wint_t.
* libio/libioP.h (struct _IO_jump_t): Use size_t not _G_size_t as
type of __dummy and __dummy2 fields.
* sysdeps/generic/_G_config.h (_G_size_t): Remove.
(_G_ssize_t): Likewise.
(_G_off_t): Likewise.
(_G_pid_t): Likewise.
(_G_uid_t): Likewise.
(_G_wchar_t): Likewise.
(_G_wint_t): Likewise.
* sysdeps/gnu/_G_config.h (_G_size_t): Remove.
(_G_ssize_t): Likewise.
(_G_off_t): Likewise.
(_G_pid_t): Likewise.
(_G_uid_t): Likewise.
(_G_wchar_t): Likewise.
(_G_wint_t): Likewise.
* sysdeps/mach/hurd/_G_config.h (_G_size_t): Remove.
(_G_ssize_t): Likewise.
(_G_off_t): Likewise.
(_G_pid_t): Likewise.
(_G_uid_t): Likewise.
(_G_wchar_t): Likewise.
(_G_wint_t): Likewise.
diff --git a/libio/libio.h b/libio/libio.h
index b737cec..f093a93 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -34,17 +34,17 @@
#define _IO_pos_t _G_fpos_t /* obsolete */
#define _IO_fpos_t _G_fpos_t
#define _IO_fpos64_t _G_fpos64_t
-#define _IO_size_t _G_size_t
-#define _IO_ssize_t _G_ssize_t
-#define _IO_off_t _G_off_t
+#define _IO_size_t size_t
+#define _IO_ssize_t __ssize_t
+#define _IO_off_t __off_t
#define _IO_off64_t _G_off64_t
-#define _IO_pid_t _G_pid_t
-#define _IO_uid_t _G_uid_t
+#define _IO_pid_t __pid_t
+#define _IO_uid_t __uid_t
#define _IO_iconv_t _G_iconv_t
#define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
#define _IO_BUFSIZ _G_BUFSIZ
#define _IO_va_list _G_va_list
-#define _IO_wint_t _G_wint_t
+#define _IO_wint_t wint_t
/* This define avoids name pollution if we're using GNU stdarg.h */
#define __need___va_list
diff --git a/libio/libioP.h b/libio/libioP.h
index 01e8bf8..a280052 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -282,8 +282,8 @@ typedef void (*_IO_imbue_t) (_IO_FILE *, void *);
struct _IO_jump_t
{
- JUMP_FIELD(_G_size_t, __dummy);
- JUMP_FIELD(_G_size_t, __dummy2);
+ JUMP_FIELD(size_t, __dummy);
+ JUMP_FIELD(size_t, __dummy2);
JUMP_FIELD(_IO_finish_t, __finish);
JUMP_FIELD(_IO_overflow_t, __overflow);
JUMP_FIELD(_IO_underflow_t, __underflow);
diff --git a/sysdeps/generic/_G_config.h b/sysdeps/generic/_G_config.h
index 4c6552f..fc83565 100644
--- a/sysdeps/generic/_G_config.h
+++ b/sysdeps/generic/_G_config.h
@@ -18,7 +18,6 @@
# define __need_wint_t
#endif
#include <wchar.h>
-#define _G_size_t size_t
typedef struct
{
__off_t __pos;
@@ -29,13 +28,7 @@ typedef struct
__off64_t __pos;
__mbstate_t __state;
} _G_fpos64_t;
-#define _G_ssize_t __ssize_t
-#define _G_off_t __off_t
#define _G_off64_t __off_t
-#define _G_pid_t __pid_t
-#define _G_uid_t __uid_t
-#define _G_wchar_t wchar_t
-#define _G_wint_t wint_t
#define _G_stat64 stat
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# include <gconv.h>
diff --git a/sysdeps/gnu/_G_config.h b/sysdeps/gnu/_G_config.h
index 54f5e55..4d3ae36 100644
--- a/sysdeps/gnu/_G_config.h
+++ b/sysdeps/gnu/_G_config.h
@@ -18,7 +18,6 @@
# define __need_wint_t
#endif
#include <wchar.h>
-#define _G_size_t size_t
typedef struct
{
__off_t __pos;
@@ -29,13 +28,7 @@ typedef struct
__off64_t __pos;
__mbstate_t __state;
} _G_fpos64_t;
-#define _G_ssize_t __ssize_t
-#define _G_off_t __off_t
#define _G_off64_t __off64_t
-#define _G_pid_t __pid_t
-#define _G_uid_t __uid_t
-#define _G_wchar_t wchar_t
-#define _G_wint_t wint_t
#define _G_stat64 stat64
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# include <gconv.h>
diff --git a/sysdeps/mach/hurd/_G_config.h b/sysdeps/mach/hurd/_G_config.h
index c7bd8b1..b3a7db7 100644
--- a/sysdeps/mach/hurd/_G_config.h
+++ b/sysdeps/mach/hurd/_G_config.h
@@ -18,7 +18,6 @@
# define __need_wint_t
#endif
#include <wchar.h>
-#define _G_size_t size_t
typedef struct
{
__off_t __pos;
@@ -29,13 +28,7 @@ typedef struct
__off64_t __pos;
__mbstate_t __state;
} _G_fpos64_t;
-#define _G_ssize_t __ssize_t
-#define _G_off_t __off_t
#define _G_off64_t __off64_t
-#define _G_pid_t __pid_t
-#define _G_uid_t __uid_t
-#define _G_wchar_t wchar_t
-#define _G_wint_t wint_t
#define _G_stat64 stat64
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
# include <gconv.h>
--
Joseph S. Myers
joseph@codesourcery.com