From: John David Anglin Date: Thu, 13 Feb 2003 00:04:34 +0000 (+0000) Subject: PR9275 and PR8694 X-Git-Tag: releases/gcc-3.2.3~206 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0562f79eb07c3f5988eb1568bdab11f160a087d3;p=thirdparty%2Fgcc.git PR9275 and PR8694 PR9275 and PR8694 * 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: r62800 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e3d7ac9786ea..321867c047dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2003-02-12 John David Anglin + + PR9275 and PR8694 + * 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. + 2003-02-12 Kaveh R. Ghazi * mips.h (FP_INC): Define. diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x index 68de2fda9732..785b5a890e77 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 142 fixup descriptions. + * This file contains 146 fixup descriptions. * * See README for more information. * @@ -1866,6 +1866,41 @@ static const char* apzHpux11_Cpp_Pow_InlinePatch[] = { "", (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 @@ -1981,6 +2016,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 @@ -5581,9 +5767,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 151 +#define REGEX_COUNT 157 #define MACH_LIST_SIZE_LIMIT 279 -#define FIX_COUNT 142 +#define FIX_COUNT 146 /* * Enumerate the fixes @@ -5634,9 +5820,13 @@ typedef enum { HP_SYSFILE_FIXIDX, HPUX10_CPP_POW_INLINE_FIXIDX, HPUX11_CPP_POW_INLINE_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, @@ -5959,6 +6149,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { HPUX11_CPP_POW_INLINE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aHpux11_Cpp_Pow_InlineTests, apzHpux11_Cpp_Pow_InlinePatch, 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, @@ -5974,6 +6169,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 764f621f8858..d52bd9014c1d 100644 --- a/gcc/fixinc/inclhack.def +++ b/gcc/fixinc/inclhack.def @@ -1145,6 +1145,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. @@ -1211,6 +1231,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/stdlib.h b/gcc/fixinc/tests/base/stdlib.h index 9e43d13270fc..1f6dca57db94 100644 --- a/gcc/fixinc/tests/base/stdlib.h +++ b/gcc/fixinc/tests/base/stdlib.h @@ -16,6 +16,12 @@ #endif /* ARM_WCHAR_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*);