HP-UX header file patch

Steve Ellcey sje@cup.hp.com
Tue Mar 6 01:06:00 GMT 2007


A recent change in libstdc++ caused problems (a bootstrap failure) on
HP-UX because the ctype.h header on HP-UX was defining isalpha, isalnum,
etc.  macros in C++ mode.

I plan on checking in this HP-UX specific patch to ifdef these macros so
they are not seen when compiling C++.  HP C++ handles this by letting
/usr/include/ctype.h define them and then have a C++ specific ctype.h
header file undef them.

Tested on IA64 and PA HP-UX 11.11 and 11.23 systems with no regressions.

Steve Ellcey
sje@cup.hp.com

2007-03-05  Steve Ellcey  <sje@cup.hp.com>

	* inclhack.def (hpux_cxx_ctype_macros):  New.
	* fixincl.x: Regenerated.
	* tests/base/ctype.h: Update for new rule.

Index: inclhack.def
===================================================================
--- inclhack.def	(revision 122539)
+++ inclhack.def	(working copy)
@@ -1945,6 +1945,21 @@ fix = {
 };
 
 /*
+ * Ifdef the is* macros in ctype.h so they do not show up in C++.
+ */
+fix = {
+    hackname  = hpux_cxx_ctype_macros;
+    mach      = "*-*-hpux*";
+    files     = ctype.h;
+    select    = "^[ \t]*#[ \t]*define[ \t]*is.*\\\n[ \t]*: _is.*$";
+    c_fix     = format;
+    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
+    test_text =
+	"# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _ISALPHA \\"
+	"                                   : _isalpha(__c))";
+};
+
+/*
  *  Fix glibc definition of HUGE_VAL in terms of hex floating point constant
  */
 fix = {
Index: tests/base/ctype.h
===================================================================
--- tests/base/ctype.h	(revision 122539)
+++ tests/base/ctype.h	(working copy)
@@ -63,3 +63,8 @@ extern int __toupper();
 # define isalpha(__c) (__SB_masks ? (int)__SB_masks[__c] & _IS
 
 #endif  /* HPUX_CTYPE_MACROS_CHECK */
+
+
+#if defined( HPUX_CXX_CTYPE_MACROS_CHECK )
+# define isalpha(__c) (__SB_masks ? (int)__SB_masks[__c] & _ISALPHA \                                   : _isalpha(__c))
+#endif  /* HPUX_CXX_CTYPE_MACROS_CHECK */



More information about the Gcc-patches mailing list