Patch installed to fix malloc etc declaration detection

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Tue Mar 13 12:04:00 GMT 2001


The problem reported by Neil here:
http://gcc.gnu.org/ml/gcc/2001-03/msg00415.html

is fixed by the patch below.  I tested it by configuring on solaris2.7
with cc and gcc-3.x both with and without the patch.  I checked that
the declarations are correctly found when the patch is installed.  I
also received private confirmation from Neil that the patch solved his
problem.

I installed the fix as an obvious fix to my last system.h patch.


Analysis:

The declaration checks in autoconf include system.h so that the
headers they search are the same ones we include at compile time.  The
checks for malloc etc delcarations were failing because system.h
poisons those tokens (as shown in the URL above.)  Note this only
shows up if you use gcc-3.x for stage1.

This patch ensures that we only poison them if we are compiling gcc
itself, not during the autoconf configure run.


Installed.



2001-03-13  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* system.h (malloc, realloc, calloc, strdup): Only poison these
	tokens when IN_GCC is defined.

diff -rup orig/egcs-CVS20010312/gcc/system.h egcs-CVS20010312/gcc/system.h
--- orig/egcs-CVS20010312/gcc/system.h	Mon Mar 12 07:43:42 2001
+++ egcs-CVS20010312/gcc/system.h	Tue Mar 13 08:07:57 2001
@@ -584,11 +584,17 @@ typedef char _Bool;
 
 #if (GCC_VERSION >= 3000)
 
+/* Note autoconf checks for prototype declarations and includes
+   system.h while doing so.  Only poison these tokens if actually
+   compiling gcc, so that the autoconf declaration tests for malloc
+   etc don't spuriously fail.  */
+#ifdef IN_GCC
 #undef malloc
 #undef realloc
 #undef calloc
 #undef strdup
  #pragma GCC poison malloc realloc calloc strdup
+#endif /* IN_GCC */
 
 /* Note: not all uses of `bcopy' and `index' (esp. variable names)
    have been eliminated.  */



More information about the Gcc-patches mailing list