This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3.3/3.4]: Several new include hacks for PA HP-UX


The enclosed patch addresses three issues:

1) Bootstrap failure trunk.
2) PRs 9275 and 8694.
3) Incorrect long double declarations causing bash build error.

The bootstrap failure is caused by a signed unsigned warning from the
ctype macros.  This is corrected by the hpux10_ctype_macros and
hpux11_ctype_macros hacks.

PR9275 and PR8694 are problems arising from missing declarations for
the functions used in the ctype macros under HP-UX 10.X.  This is
addressed by the hpux10_ctype_declarations[1-2] hacks.

The final hack, hpux_long_double, corrects HP's somewhat strange
idea of a long double.  GCC's alignment for long doubles is more
stringent than the struct.  The passing conventions for long doubles
and 16-byte struct's are the same on both the 32 and 64-bit ports.
Thus, the change doesn't impact any of the called functions or values
returned.

Ok for main and 3.3?  Tested on hppa64-hp-hpux11.X, hppa2.0-hp-hpux11.X,
hppa1.1-hp-hpux10.20, and hppa-unknown-linux-gnu.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2003-02-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	* inclhack.def (hpux_long_double, hpux10_ctype_declarations1,
	hpux10_ctype_declarations2, hpux10_ctype_macros, hpux11_ctype_macros):
	New hacks.
	* fixincl.x: Rebuilt.

Index: fixinc/inclhack.def
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.141
diff -u -3 -p -r1.141 inclhack.def
--- fixinc/inclhack.def	17 Jan 2003 02:07:45 -0000	1.141
+++ fixinc/inclhack.def	6 Feb 2003 18:58:51 -0000
@@ -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.
  */
@@ -1079,6 +1099,97 @@ 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]*\\(int\\);";
+    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]*\\(int\\);";
+    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 10.X broken ctype macros
+ */
+fix = {
+    hackname = hpux10_ctype_macros;
+    files    = ctype.h;
+    select   = "([ \t]*: __SB_masks \\? )(__SB_masks\\[__alnum\\] & _IS)";
+    c_fix     = format;
+    c_fix_arg = "%1(int)%2";
+
+    test_text = ': __SB_masks ? __SB_masks[__alnum] & _ISCNTRL';
+};
+
+
+/*
+ *  Fix hpux 11.X broken ctype macros
+ */
+fix = {
+    hackname = hpux11_ctype_macros;
+    files    = ctype.h;
+    select   = "(^#[ \t]*define.*__SB_masks \\? )(__SB_masks\\[__c\\] & _IS)";
+    c_fix     = format;
+    c_fix_arg = "%1(int)%2";
+
+    test_text = '# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS';
 };
 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]