aboutsummaryrefslogtreecommitdiff
path: root/gcc/fixinc
diff options
context:
space:
mode:
authorJohn David Anglin <danglin@gcc.gnu.org>2003-02-11 20:43:41 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2003-02-11 20:43:41 +0000
commit2026dcf90abe91054e63d3556e0f33e098e08324 (patch)
treed97c9190e1ce019f9425f945169b3fc28892990f /gcc/fixinc
parent22fd5743d9a6c0e283a69250011685e58dcc2993 (diff)
downloadgcc-2026dcf90abe91054e63d3556e0f33e098e08324.zip
gcc-2026dcf90abe91054e63d3556e0f33e098e08324.tar.gz
gcc-2026dcf90abe91054e63d3556e0f33e098e08324.tar.bz2
inclhack.def (hpux_long_double, [...]): New hacks.
* inclhack.def (hpux_long_double, hpux10_ctype_declarations1, hpux10_ctype_declarations2, hpux_ctype_macros): New hacks. * fixincl.x: Rebuilt. * tests/base/stdlib.h: Update. * tests/base/ctype.h: New file. From-SVN: r62718
Diffstat (limited to 'gcc/fixinc')
-rw-r--r--gcc/fixinc/fixincl.x216
-rw-r--r--gcc/fixinc/inclhack.def99
-rw-r--r--gcc/fixinc/tests/base/ctype.h65
-rw-r--r--gcc/fixinc/tests/base/stdlib.h6
4 files changed, 383 insertions, 3 deletions
diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x
index 4f159e1..6c59b58 100644
--- a/gcc/fixinc/fixincl.x
+++ b/gcc/fixinc/fixincl.x
@@ -5,7 +5,7 @@
* files which are fixed to work correctly with ANSI C and placed in a
* directory that GNU C will search.
*
- * This file contains 138 fixup descriptions.
+ * This file contains 142 fixup descriptions.
*
* See README for more information.
*
@@ -1697,6 +1697,41 @@ static const char* apzHpux11_AbsPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Hpux_Long_Double fix
+ */
+tSCC zHpux_Long_DoubleName[] =
+ "hpux_long_double";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_Long_DoubleList[] =
+ "|stdlib.h|";
+/*
+ * Machine/OS name selection pattern
+ */
+#define apzHpux_Long_DoubleMachs (const char**)NULL
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zHpux_Long_DoubleSelect0[] =
+ "long_double";
+
+#define HPUX_LONG_DOUBLE_TEST_CT 1
+static tTestDesc aHpux_Long_DoubleTests[] = {
+ { TT_EGREP, zHpux_Long_DoubleSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Hpux_Long_Double
+ */
+static const char* apzHpux_Long_DoublePatch[] = { "sed",
+ "-e", "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D",
+ "-e", "s/long_double/long double/g",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Hpux11_Fabsf fix
*/
tSCC zHpux11_FabsfName[] =
@@ -1812,6 +1847,157 @@ static const char* apzHpux11_Uint32_CPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Hpux10_Ctype_Declarations1 fix
+ */
+tSCC zHpux10_Ctype_Declarations1Name[] =
+ "hpux10_ctype_declarations1";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux10_Ctype_Declarations1List[] =
+ "|ctype.h|";
+/*
+ * Machine/OS name selection pattern
+ */
+#define apzHpux10_Ctype_Declarations1Machs (const char**)NULL
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zHpux10_Ctype_Declarations1Select0[] =
+ "^#[ \t]*define _toupper\\(__c\\)[ \t]*__toupper\\(__c\\)";
+
+/*
+ * content bypass pattern - skip fix if pattern found
+ */
+tSCC zHpux10_Ctype_Declarations1Bypass0[] =
+ "^[ \t]*extern[ \t]*int[ \t]*__tolower[ \t]*\\(";
+
+#define HPUX10_CTYPE_DECLARATIONS1_TEST_CT 2
+static tTestDesc aHpux10_Ctype_Declarations1Tests[] = {
+ { TT_NEGREP, zHpux10_Ctype_Declarations1Bypass0, (regex_t*)NULL },
+ { TT_EGREP, zHpux10_Ctype_Declarations1Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Hpux10_Ctype_Declarations1
+ */
+static const char* apzHpux10_Ctype_Declarations1Patch[] = {
+ "format",
+ "#ifdef _PROTOTYPES\n\
+extern int __tolower(int);\n\
+extern int __toupper(int);\n\
+#else /* NOT _PROTOTYPES */\n\
+extern int __tolower();\n\
+extern int __toupper();\n\
+#endif /* _PROTOTYPES */\n\n\
+%0\n",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Hpux10_Ctype_Declarations2 fix
+ */
+tSCC zHpux10_Ctype_Declarations2Name[] =
+ "hpux10_ctype_declarations2";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux10_Ctype_Declarations2List[] =
+ "|ctype.h|";
+/*
+ * Machine/OS name selection pattern
+ */
+#define apzHpux10_Ctype_Declarations2Machs (const char**)NULL
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zHpux10_Ctype_Declarations2Select0[] =
+ "^# if defined\\(_SB_CTYPE_MACROS\\) && \\!defined\\(__lint\\)";
+
+/*
+ * content bypass pattern - skip fix if pattern found
+ */
+tSCC zHpux10_Ctype_Declarations2Bypass0[] =
+ "^[ \t]*extern[ \t]*int[ \t]*_isalnum[ \t]*\\(";
+
+#define HPUX10_CTYPE_DECLARATIONS2_TEST_CT 2
+static tTestDesc aHpux10_Ctype_Declarations2Tests[] = {
+ { TT_NEGREP, zHpux10_Ctype_Declarations2Bypass0, (regex_t*)NULL },
+ { TT_EGREP, zHpux10_Ctype_Declarations2Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Hpux10_Ctype_Declarations2
+ */
+static const char* apzHpux10_Ctype_Declarations2Patch[] = {
+ "format",
+ "%0\n\n\
+#ifdef _PROTOTYPES\n\
+ extern int _isalnum(int);\n\
+ extern int _isalpha(int);\n\
+ extern int _iscntrl(int);\n\
+ extern int _isdigit(int);\n\
+ extern int _isgraph(int);\n\
+ extern int _islower(int);\n\
+ extern int _isprint(int);\n\
+ extern int _ispunct(int);\n\
+ extern int _isspace(int);\n\
+ extern int _isupper(int);\n\
+ extern int _isxdigit(int);\n\
+# else /* not _PROTOTYPES */\n\
+ extern int _isalnum();\n\
+ extern int _isalpha();\n\
+ extern int _iscntrl();\n\
+ extern int _isdigit();\n\
+ extern int _isgraph();\n\
+ extern int _islower();\n\
+ extern int _isprint();\n\
+ extern int _ispunct();\n\
+ extern int _isspace();\n\
+ extern int _isupper();\n\
+ extern int _isxdigit();\n\
+#endif /* _PROTOTYPES */\n",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Hpux_Ctype_Macros fix
+ */
+tSCC zHpux_Ctype_MacrosName[] =
+ "hpux_ctype_macros";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_Ctype_MacrosList[] =
+ "|ctype.h|";
+/*
+ * Machine/OS name selection pattern
+ */
+#define apzHpux_Ctype_MacrosMachs (const char**)NULL
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zHpux_Ctype_MacrosSelect0[] =
+ "((: |\\()__SB_masks \\? )(__SB_masks\\[__(alnum|c)\\] & _IS)";
+
+#define HPUX_CTYPE_MACROS_TEST_CT 1
+static tTestDesc aHpux_Ctype_MacrosTests[] = {
+ { TT_EGREP, zHpux_Ctype_MacrosSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Hpux_Ctype_Macros
+ */
+static const char* apzHpux_Ctype_MacrosPatch[] = {
+ "format",
+ "%1(int)%3",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Hpux11_Vsnprintf fix
*/
tSCC zHpux11_VsnprintfName[] =
@@ -5415,9 +5601,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
-#define REGEX_COUNT 147
+#define REGEX_COUNT 153
#define MACH_LIST_SIZE_LIMIT 261
-#define FIX_COUNT 138
+#define FIX_COUNT 142
/*
* Enumerate the fixes
@@ -5463,9 +5649,13 @@ typedef enum {
HPUX10_CPP_POW_INLINE_FIXIDX,
HPUX11_CPP_POW_INLINE_FIXIDX,
HPUX11_ABS_FIXIDX,
+ HPUX_LONG_DOUBLE_FIXIDX,
HPUX11_FABSF_FIXIDX,
HPUX11_SIZE_T_FIXIDX,
HPUX11_UINT32_C_FIXIDX,
+ HPUX10_CTYPE_DECLARATIONS1_FIXIDX,
+ HPUX10_CTYPE_DECLARATIONS2_FIXIDX,
+ HPUX_CTYPE_MACROS_FIXIDX,
HPUX11_VSNPRINTF_FIXIDX,
HPUX8_BOGUS_INLINES_FIXIDX,
HPUX_MAXINT_FIXIDX,
@@ -5764,6 +5954,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
HPUX11_ABS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aHpux11_AbsTests, apzHpux11_AbsPatch, 0 },
+ { zHpux_Long_DoubleName, zHpux_Long_DoubleList,
+ apzHpux_Long_DoubleMachs,
+ HPUX_LONG_DOUBLE_TEST_CT, FD_MACH_ONLY,
+ aHpux_Long_DoubleTests, apzHpux_Long_DoublePatch, 0 },
+
{ zHpux11_FabsfName, zHpux11_FabsfList,
apzHpux11_FabsfMachs,
HPUX11_FABSF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
@@ -5779,6 +5974,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
HPUX11_UINT32_C_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aHpux11_Uint32_CTests, apzHpux11_Uint32_CPatch, 0 },
+ { zHpux10_Ctype_Declarations1Name, zHpux10_Ctype_Declarations1List,
+ apzHpux10_Ctype_Declarations1Machs,
+ HPUX10_CTYPE_DECLARATIONS1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aHpux10_Ctype_Declarations1Tests, apzHpux10_Ctype_Declarations1Patch, 0 },
+
+ { zHpux10_Ctype_Declarations2Name, zHpux10_Ctype_Declarations2List,
+ apzHpux10_Ctype_Declarations2Machs,
+ HPUX10_CTYPE_DECLARATIONS2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aHpux10_Ctype_Declarations2Tests, apzHpux10_Ctype_Declarations2Patch, 0 },
+
+ { zHpux_Ctype_MacrosName, zHpux_Ctype_MacrosList,
+ apzHpux_Ctype_MacrosMachs,
+ HPUX_CTYPE_MACROS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aHpux_Ctype_MacrosTests, apzHpux_Ctype_MacrosPatch, 0 },
+
{ zHpux11_VsnprintfName, zHpux11_VsnprintfList,
apzHpux11_VsnprintfMachs,
HPUX11_VSNPRINTF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def
index fc39fbb..62b1284 100644
--- a/gcc/fixinc/inclhack.def
+++ b/gcc/fixinc/inclhack.def
@@ -1017,6 +1017,26 @@ fix = {
/*
+ * HP-UX long_double
+ */
+fix = {
+ hackname = hpux_long_double;
+ files = stdlib.h;
+ select = "long_double";
+ sed = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D";
+ sed = "s/long_double/long double/g";
+
+ test_text = "# ifndef _LONG_DOUBLE\n"
+ "# define _LONG_DOUBLE\n"
+ " typedef struct {\n"
+ " unsigned int word1, word2, word3, word4;\n"
+ " } long_double;\n"
+ "# endif /* _LONG_DOUBLE */\n"
+ "extern long_double strtold(const char *, char **);\n";
+};
+
+
+/*
* Keep HP-UX 11 from stomping on C++ math namespace
* with defines for fabsf.
*/
@@ -1083,6 +1103,85 @@ fix = {
/*
+ * Fix hpux 10.X missing ctype declarations 1
+ */
+fix = {
+ hackname = hpux10_ctype_declarations1;
+ files = ctype.h;
+ select = "^#[ \t]*define _toupper\\(__c\\)[ \t]*__toupper\\(__c\\)";
+ bypass = "^[ \t]*extern[ \t]*int[ \t]*__tolower[ \t]*\\(";
+ c_fix = format;
+ c_fix_arg = "#ifdef _PROTOTYPES\n"
+ "extern int __tolower(int);\n"
+ "extern int __toupper(int);\n"
+ "#else /* NOT _PROTOTYPES */\n"
+ "extern int __tolower();\n"
+ "extern int __toupper();\n"
+ "#endif /* _PROTOTYPES */\n\n"
+ "%0\n";
+
+ test_text = "# define _toupper(__c) __toupper(__c)\n";
+};
+
+
+/*
+ * Fix hpux 10.X missing ctype declarations 2
+ */
+fix = {
+ hackname = hpux10_ctype_declarations2;
+ files = ctype.h;
+ select = "^# if defined\\(_SB_CTYPE_MACROS\\) && \\!defined\\(__lint\\)";
+ bypass = "^[ \t]*extern[ \t]*int[ \t]*_isalnum[ \t]*\\(";
+ c_fix = format;
+ c_fix_arg = "%0\n\n"
+ "#ifdef _PROTOTYPES\n"
+ " extern int _isalnum(int);\n"
+ " extern int _isalpha(int);\n"
+ " extern int _iscntrl(int);\n"
+ " extern int _isdigit(int);\n"
+ " extern int _isgraph(int);\n"
+ " extern int _islower(int);\n"
+ " extern int _isprint(int);\n"
+ " extern int _ispunct(int);\n"
+ " extern int _isspace(int);\n"
+ " extern int _isupper(int);\n"
+ " extern int _isxdigit(int);\n"
+ "# else /* not _PROTOTYPES */\n"
+ " extern int _isalnum();\n"
+ " extern int _isalpha();\n"
+ " extern int _iscntrl();\n"
+ " extern int _isdigit();\n"
+ " extern int _isgraph();\n"
+ " extern int _islower();\n"
+ " extern int _isprint();\n"
+ " extern int _ispunct();\n"
+ " extern int _isspace();\n"
+ " extern int _isupper();\n"
+ " extern int _isxdigit();\n"
+ "#endif /* _PROTOTYPES */\n";
+
+ test_text = "# if defined(_SB_CTYPE_MACROS) && !defined(__lint)\n"
+ " extern unsigned int *__SB_masks;\n";
+};
+
+
+/*
+ * Fix hpux broken ctype macros
+ */
+fix = {
+ hackname = hpux_ctype_macros;
+ files = ctype.h;
+ select = '((: |\()__SB_masks \? )'
+ '(__SB_masks\[__(alnum|c)\] & _IS)';
+ c_fix = format;
+ c_fix_arg = "%1(int)%3";
+
+ test_text = ": __SB_masks ? __SB_masks[__alnum] & _ISCNTRL\n"
+ "# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS\n";
+};
+
+
+/*
* Fix hpux 11.00 broken vsnprintf declaration
*/
fix = {
diff --git a/gcc/fixinc/tests/base/ctype.h b/gcc/fixinc/tests/base/ctype.h
new file mode 100644
index 0000000..deabd5e
--- /dev/null
+++ b/gcc/fixinc/tests/base/ctype.h
@@ -0,0 +1,65 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/ctype.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( HPUX10_CTYPE_DECLARATIONS1_CHECK )
+#ifdef _PROTOTYPES
+extern int __tolower(int);
+extern int __toupper(int);
+#else /* NOT _PROTOTYPES */
+extern int __tolower();
+extern int __toupper();
+#endif /* _PROTOTYPES */
+
+# define _toupper(__c) __toupper(__c)
+
+
+#endif /* HPUX10_CTYPE_DECLARATIONS1_CHECK */
+
+
+#if defined( HPUX10_CTYPE_DECLARATIONS2_CHECK )
+# if defined(_SB_CTYPE_MACROS) && !defined(__lint)
+
+#ifdef _PROTOTYPES
+ extern int _isalnum(int);
+ extern int _isalpha(int);
+ extern int _iscntrl(int);
+ extern int _isdigit(int);
+ extern int _isgraph(int);
+ extern int _islower(int);
+ extern int _isprint(int);
+ extern int _ispunct(int);
+ extern int _isspace(int);
+ extern int _isupper(int);
+ extern int _isxdigit(int);
+# else /* not _PROTOTYPES */
+ extern int _isalnum();
+ extern int _isalpha();
+ extern int _iscntrl();
+ extern int _isdigit();
+ extern int _isgraph();
+ extern int _islower();
+ extern int _isprint();
+ extern int _ispunct();
+ extern int _isspace();
+ extern int _isupper();
+ extern int _isxdigit();
+#endif /* _PROTOTYPES */
+
+ extern unsigned int *__SB_masks;
+
+#endif /* HPUX10_CTYPE_DECLARATIONS2_CHECK */
+
+
+#if defined( HPUX_CTYPE_MACROS_CHECK )
+: __SB_masks ? (int)__SB_masks[__alnum] & _ISCNTRL
+# define isalpha(__c) (__SB_masks ? (int)__SB_masks[__c] & _IS
+
+#endif /* HPUX_CTYPE_MACROS_CHECK */
diff --git a/gcc/fixinc/tests/base/stdlib.h b/gcc/fixinc/tests/base/stdlib.h
index 48f0043..7297a3a 100644
--- a/gcc/fixinc/tests/base/stdlib.h
+++ b/gcc/fixinc/tests/base/stdlib.h
@@ -14,6 +14,12 @@
#endif /* HPUX11_ABS_CHECK */
+#if defined( HPUX_LONG_DOUBLE_CHECK )
+extern long double strtold(const char *, char **);
+
+#endif /* HPUX_LONG_DOUBLE_CHECK */
+
+
#if defined( INT_ABORT_FREE_AND_EXIT_CHECK )
extern void abort(int);
extern void free(void*);