This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 3.3/3.4]: Several new include hacks for PA HP-UX -- take 2
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: bkorb at veritas dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 10 Feb 2003 23:25:00 -0500 (EST)
- Subject: Re: [PATCH 3.3/3.4]: Several new include hacks for PA HP-UX -- take 2
> > I only updated the files that this patch affects.
>
> OK. I just didn't see them in the patch.
No, I didn't attempt to fix them. Most appear to be hack name
changes. They are in files other than stdlib.h and ctype.h.
I simplified the select in hpux_ctype_macros as per your
suggestion.
Ok?
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2003-02-10 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* 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.
Index: fixinc/inclhack.def
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.139
diff -u -3 -p -r1.139 inclhack.def
--- fixinc/inclhack.def 27 Oct 2002 17:58:36 -0000 1.139
+++ fixinc/inclhack.def 11 Feb 2003 03:38:57 -0000
@@ -1157,6 +1157,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.
*/
@@ -1219,6 +1239,85 @@ fix = {
test_text =
"#define CONCAT_U__(__c)\t__CONCAT__(__c,u)\n"
"#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
+};
+
+
+/*
+ * 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";
};
Index: fixinc/tests/base/stdlib.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fixinc/tests/base/stdlib.h,v
retrieving revision 1.4
diff -u -3 -p -r1.4 stdlib.h
--- fixinc/tests/base/stdlib.h 5 Oct 2002 18:21:59 -0000 1.4
+++ fixinc/tests/base/stdlib.h 11 Feb 2003 03:38:57 -0000
@@ -21,6 +21,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*);
--- /dev/null Mon Feb 10 15:51:57 2003
+++ fixinc/tests/base/ctype.h Mon Feb 10 15:50:11 2003
@@ -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 */