This is the mail archive of the gcc-bugs@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]

[PATCH, approved]: Fixes HPUX 11 "size_t" compile problems with binutils, etc.


This patch addresses a problem on HP-UX 11.00 when compiling packages such as 
GNU binutils, or Sleepycat Berkeley DB. Some of the HP header files (such as 
ctype.h) were defining __size_t as size_t (or std::size_t). When these files 
were included before stddef.h they were causing size_t to be left undefined, 
generating compiler errors. This patch changes these HP header files to use 
_hpux_size_t instead of __size_t, thereby bypassing the problem. This patch has 
bootstrapped successfully with gcc 3.0.1 on an hppa2.0n-hp-hpux11.00 system with 
no new regressions. The ChangeLog and then patch are as follows:


2001-09-11  Josh Martin  <josh.martin@abq.sc.philips.com>

	* fixinc/inclhack.def(hpux11_size_t): Keep HP-UX headers from
	defining __size_t and leaving size_t undefined.
	

--- /usr/local/build/gcc-3.0.1/gcc/fixinc/inclhack.def	Tue Sep 11 14:02:48 2001
+++ inclhack.def	Tue Sep 11 14:03:41 2001
@@ -1195,6 +1195,7 @@ fix = {
             "   }\n";
 };
 
+
 /*
  *  Keep HP-UX 11 from stomping on C++ math namespace
  *  with defines for fabsf.
@@ -1212,6 +1213,25 @@ fix = {
     "#ifdef _PA_RISC\n"
     "#  define fabsf(x) ((float)fabs((double)(float)(x)))\n"
     "#endif";
+};
+
+
+/*
+ * Prevent HP-UX 11 from defining __size_t and preventing size_t from
+ * being defined by having it define _hpux_size_t instead.
+ */
+fix = {
+    hackname  = hpux11_size_t;
+    mach      = "*-hp-hpux*";
+    select    = "^#define __size_t size_t";
+
+    c_fix     = format;
+    c_fix_arg = "_hpux_size_t";
+    c_fix_arg = "__size_t";
+
+    test_text =
+    "#define __size_t size_t\n"
+    "       extern int getpwuid_r(uid_t, struct passwd *, char *, __size_t, 
struct passwd **);\n";
 };
 


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