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] Fix mainline bootstrap on Solaris 2.5.1


Hi,

Mainline can't currently bootstrap on Solaris 2.5.1 because of a warning for 
an undefined function, getpagesize() from <unistd.h>, used in ggc-common.c.

Solaris 2.5.1 has getpagesize() and the manual says that it is defined in 
<unistd.h>, but it is neither there nor in any other header file. Therefore 
I instructed the fixincludes machinery to add the missing bits. Is that the 
way to go? I guess that I could use the fixproto machinery too and request 
that getpagesize be defined as a XOPEN_EXTENDED_SYMBOL in <unistd.h>.

And I found a minor nit in the fixincludes machinery: it uses 'diff -u' that 
is not portable on Solaris, except the newest versions.

Bootstrapped on sparc-sun-solaris2.5.1 (c;c++,objc,f77 mainline).

-- 
Eric Botcazou


2003-05-24  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* fixinc/inclhack.def: Add missing declaration of getpagesize()
	to <unistd.h> on Solaris 2.5.1.
	* fixinc/tests/base/unistd.h: Add solaris_unistd fix test.
	* fixinc/check.tpl: Use 'diff -c', not 'diff -u'.
Index: fixinc/check.tpl
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/check.tpl,v
retrieving revision 1.18
diff -u -r1.18 check.tpl
--- fixinc/check.tpl	19 Apr 2003 21:10:07 -0000	1.18
+++ fixinc/check.tpl	24 May 2003 13:57:57 -0000
@@ -135,7 +135,7 @@
     :
 
   else
-    ${DIFF:-diff} -u $f ${TESTBASE}/$f >&2 || :
+    ${DIFF:-diff} -c $f ${TESTBASE}/$f >&2 || :
     exitok=false
   fi
 done
Index: fixinc/inclhack.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.155
diff -u -r1.155 inclhack.def
--- fixinc/inclhack.def	7 May 2003 01:29:58 -0000	1.155
+++ fixinc/inclhack.def	24 May 2003 13:58:12 -0000
@@ -2222,6 +2223,25 @@
     c_fix     = format;
     c_fix_arg = "%0\n#include <wchar.h>";
     test_text = "#include <euc.h>";
+};
+
+
+/*
+ * Sun Solaris 2.5.1 doesn't define 'getpagesize' in <unistd.h>, as is done
+ * on Solaris 2.6 and up.
+ */
+fix = {
+    hackname  = solaris_unistd;
+    files = unistd.h;
+    select = '@\(#\)unistd.h' "[ \t]+1.3[0-9][ \t]+9[567]/[0-9/]+ SMI";
+    bypass = "getpagesize";
+    sed = "/^extern pid_t getpgid(pid_t);/i\\\n"
+          "extern int getpagesize(void);\n";
+    sed = "/^extern int getpgid();/i\\\n"
+          "extern int getpagesize();\n";
+    test_text = '#ident "@(#)unistd.h   1.33    95/08/28 SMI"'"\n"
+                "extern int getpagesize(void);\n"
+                "extern int getpagesize();";
 };
 
 
Index: fixinc/tests/base/unistd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/tests/base/unistd.h,v
retrieving revision 1.2
diff -u -r1.2 unistd.h
--- fixinc/tests/base/unistd.h	19 Jul 2000 14:18:30 -0000	1.2
+++ fixinc/tests/base/unistd.h	24 May 2003 13:58:12 -0000
@@ -12,3 +12,10 @@
 #if defined( ALPHA_SBRK_CHECK )
 extern void *sbrk(ptrdiff_t increment);
 #endif  /* ALPHA_SBRK_CHECK */
+
+
+#if defined( SOLARIS_UNISTD_CHECK )
+#ident "@(#)unistd.h   1.33    95/08/28 SMI"
+extern int getpagesize(void);
+extern int getpagesize();
+#endif  /* SOLARIS_UNISTD_CHECK */

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