From 2026dcf90abe91054e63d3556e0f33e098e08324 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Tue, 11 Feb 2003 20:43:41 +0000 Subject: [PATCH] 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 --- gcc/fixinc/fixincl.x | 216 ++++++++++++++++++++++++++++++++- gcc/fixinc/inclhack.def | 99 +++++++++++++++ gcc/fixinc/tests/base/ctype.h | 65 ++++++++++ gcc/fixinc/tests/base/stdlib.h | 6 + 4 files changed, 383 insertions(+), 3 deletions(-) create mode 100644 gcc/fixinc/tests/base/ctype.h diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x index 4f159e1fea5..6c59b58e92c 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. * @@ -1695,6 +1695,41 @@ static const char* apzHpux11_AbsPatch[] = { "if !defined(_MATH_INCLUDED) || defined(__GNUG__)", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * 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 @@ -1810,6 +1845,157 @@ static const char* apzHpux11_Uint32_CPatch[] = { "#define UINT32_C(__c) __CONCAT__(__c,ul)", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * 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 @@ -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 fc39fbbd2b8..62b1284e0c9 100644 --- a/gcc/fixinc/inclhack.def +++ b/gcc/fixinc/inclhack.def @@ -1016,6 +1016,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. @@ -1082,6 +1102,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 */ diff --git a/gcc/fixinc/tests/base/ctype.h b/gcc/fixinc/tests/base/ctype.h new file mode 100644 index 00000000000..deabd5e4473 --- /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 48f0043debe..7297a3ab282 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*); -- 2.30.2