This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix Solaris 10 stdint.h
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: bkorb at gnu dot org
- Date: Sun, 26 Apr 2009 19:46:13 +0200
- Subject: [PATCH] Fix Solaris 10 stdint.h
Hi,
this patch fixes the stdint.h implementation on Solaris 10, as per Joseph's
recommendations: http://gcc.gnu.org/ml/gcc-patches/2009-04/msg02030.html
Tested on sparc-sun-solaris2.10, OK for mainline?
2009-04-26 Eric Botcazou <ebotcazou@adacore.com>
* inclhack.def (solaris_int_const): New fix.
(solaris_int_limits_1): Likewise.
(solaris_int_limits_2): Likewise.
* fixincl.x: Regenerate.
* tests/base/sys/int_const.h: New file.
* tests/base/sys/int_limits.h: Likewise.
--
Eric Botcazou
Index: tests/base/sys/int_const.h
===================================================================
--- tests/base/sys/int_const.h (revision 0)
+++ tests/base/sys/int_const.h (revision 0)
@@ -0,0 +1,17 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/sys/int_const.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( SOLARIS_INT_CONST_CHECK )
+#pragma ident "@(#)int_const.h 1.5 04/09/28 SMI"
+#define UINT8_C(c) (c)
+/* CSTYLED */
+#define UINT16_C(c) (c)
+#endif /* SOLARIS_INT_CONST_CHECK */
Index: tests/base/sys/int_limits.h
===================================================================
--- tests/base/sys/int_limits.h (revision 0)
+++ tests/base/sys/int_limits.h (revision 0)
@@ -0,0 +1,24 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/sys/int_limits.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( SOLARIS_INT_LIMITS_1_CHECK )
+#pragma ident "@(#)int_limits.h 1.9 04/09/28 SMI"
+#define UINT8_MAX (255)
+#define UINT16_MAX (65535)
+#endif /* SOLARIS_INT_LIMITS_1_CHECK */
+
+
+#if defined( SOLARIS_INT_LIMITS_2_CHECK )
+#pragma ident "@(#)int_limits.h 1.9 04/09/28 SMI"
+#define INT_FAST16_MAX INT32_MAX
+#define UINT_FAST16_MAX UINT32_MAX
+#define INT_FAST16_MIN INT32_MIN
+#endif /* SOLARIS_INT_LIMITS_2_CHECK */
Index: inclhack.def
===================================================================
--- inclhack.def (revision 146679)
+++ inclhack.def (working copy)
@@ -3075,6 +3075,68 @@ fix = {
/*
+ * Sun Solaris 10 has a version of sys/int_const.h that defines
+ * UINT8_C and UINT16_C to unsigned constants.
+ */
+fix = {
+ hackname = solaris_int_const;
+ select = '@\(#\)int_const.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = sys/int_const.h;
+ c_fix = format;
+ c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
+ "%1\n"
+ "#define\tUINT16_C(c)\t(c)";
+ c_fix_arg = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
+ "(/\*.*\*/)\n"
+ "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
+ test_text =
+ '#pragma ident "@(#)int_const.h 1.5 04/09/28 SMI"'"\n"
+ "#define UINT8_C(c) __CONCAT__(c,u)\n"
+ "/* CSTYLED */\n"
+ "#define UINT16_C(c) __CONCAT__(c,u)";
+};
+
+
+/*
+ * Sun Solaris 10 has a version of sys/int_limits.h that defines
+ * UINT8_MAX and UINT16_MAX to unsigned constants.
+ */
+fix = {
+ hackname = solaris_int_limits_1;
+ select = '@\(#\)int_limits.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = sys/int_limits.h;
+ c_fix = format;
+ c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
+ "#define\tUINT16_MAX\t(65535)";
+ c_fix_arg = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
+ "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
+ test_text =
+ '#pragma ident "@(#)int_limits.h 1.9 04/09/28 SMI"'"\n"
+ "#define UINT8_MAX (255U)\n"
+ "#define UINT16_MAX (65535U)";
+};
+
+
+/*
+ * Sun Solaris 10 has a version of sys/int_limits.h that defines
+ * INT_FAST16 limits to wrong values for sys/int_types.h.
+ */
+fix = {
+ hackname = solaris_int_limits_2;
+ select = '@\(#\)int_limits.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = sys/int_limits.h;
+ c_fix = format;
+ c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
+ c_fix_arg = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
+ test_text =
+ '#pragma ident "@(#)int_limits.h 1.9 04/09/28 SMI"'"\n"
+ "#define INT_FAST16_MAX INT16_MAX\n"
+ "#define UINT_FAST16_MAX UINT16_MAX\n"
+ "#define INT_FAST16_MIN INT16_MIN";
+};
+
+
+/*
* Solaris 2.8 has what appears to be some gross workaround for
* some old version of their c++ compiler. G++ doesn't want it
* either, but doesn't want to be tied to SunPRO version numbers.