This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Fix older glibc stdint.h


This patch adds a fix to fixincludes for a problem with older versions
of glibc's stdint.h (also used in uClibc).  I've also submitted a
merge of the glibc fix from 2006 to uClibc so that can get fixed
upstream; I've verified that this patch does cause the present uClibc
header to get fixed.  OK to commit?

I hope this will fix the c99-stdint-1.c failures seen in some results
on gcc-testresults for *-linux* systems, if the systems on which those
results were generated are ones using glibc 2.4 or earlier (e.g. RHEL
4).

2009-04-25  Joseph Myers  <joseph@codesourcery.com>

	* inclhack.def (glibc_stdint): New fix.
	* fixincl.x: Regenerate.
	* tests/base/stdint.h: Update.

Index: fixincludes/tests/base/stdint.h
===================================================================
--- fixincludes/tests/base/stdint.h	(revision 146774)
+++ fixincludes/tests/base/stdint.h	(working copy)
@@ -9,6 +9,13 @@
 
 
 
+#if defined( GLIBC_STDINT_CHECK )
+/* This file is part of the GNU C Library.  */
+# define UINT8_C(c)	c
+# define UINT16_C(c)	c
+#endif  /* GLIBC_STDINT_CHECK */
+
+
 #if defined( IRIX_STDINT_C99_CHECK )
 #if 0
 #error This header file is to be used only for c99 mode compilations
Index: fixincludes/inclhack.def
===================================================================
--- fixincludes/inclhack.def	(revision 146774)
+++ fixincludes/inclhack.def	(working copy)
@@ -1265,6 +1265,20 @@
 };
 
 
+/* glibc versions before 2.5 have a version of stdint.h that defines
+   UINT8_C and UINT16_C to produce unsigned constants, as do uClibc
+   versions with stdint.h based on those glibc versions.  */
+fix = {
+    hackname  = glibc_stdint;
+    files     = stdint.h;
+    select    = "GNU C Library";
+    c_fix     = format;
+    c_fix_arg = "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
+    c_fix_arg = "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
+    test_text = "/* This file is part of the GNU C Library.  */\n# define UINT8_C(c)\tc ## U\n# define UINT16_C(c)\tc ## U";
+};
+
+
 /* glibc's tgmath.h relies on an expression that is not an integer
    constant expression being treated as it was by GCC 4.4 and
    earlier.  */

-- 
Joseph S. Myers
joseph@codesourcery.com


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