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]

[CVS 980316]: Two fixincludes related patches


This patch is necessary at least on an m68k-motorola-sysv
system. Motorola failed to provide the file stdlib.h, hence the
fix-header process generates one on the fly, but this one doesn't
provide a definition for size_t. Later on in make check
I'm getting lots of failures in g++.*, due to size_t being undefined.
Looking at the various testcase sources shows, they all expect size_t
to be defined by #include <stdlib.h>. Though I believe, size_t should
be defined by <stddef.h> this patch shouldn't hurt anyway.

The other problem is also seen on this configuration; Motorola's
original assert.h is `fixed' in a way, which causes several testcases
to fail. Since gcc installs its own assert.h, I believe fixing a
probably broken one from /usr/include isn't actually necessary.

Tue Mar 17 09:28:40 1998  Manfred Hollstein  <manfred@s-direktnet.de>

	* fixincludes (assert.h): Don't even try to fix a system's
	probably broken assert.h - we provide our own.
	(stdlib.h): Create missing stdlib.h on m68k-motorola-sysv.

diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-980316.orig/gcc/fixincludes egcs-980316/gcc/fixincludes
--- egcs-980316.orig/gcc/fixincludes	Tue Jan 27 22:16:28 1998
+++ egcs-980316/gcc/fixincludes	Mon Mar 16 18:34:59 1998
@@ -354,6 +354,27 @@ done
 
 cd ${INPUT}
 
+# stdlib.h is missing on m68k-motorola-sysv. fix-header later adds one, but
+# that is missing definitions for at least size_t.
+file=stdlib.h
+if [ $target_canonical = m68k-motorola-sysv ]; then
+  if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
+    cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
+    chmod +w ${LIB}/$file 2>/dev/null
+    chmod a+r ${LIB}/$file 2>/dev/null
+  else
+    echo Creating missing stdlib.h
+    cat > ${LIB}/$file << EOF
+#ifndef stdlib_h
+# define stdlib_h
+
+# include <stddef.h>	/* Make sure we get all necessary type definitions.  */
+
+#endif /* stdlib_h */
+EOF
+  fi
+fi
+
 # Install the proper definition of the three standard types in header files
 # that they come from.
 for file in sys/types.h stdlib.h sys/stdtypes.h stddef.h memory.h unistd.h; do
@@ -2371,81 +2392,6 @@ struct exception;
   fi
 fi
 
-# assert.h and sys/mman.h on HP/UX are not C++ ready, even though
-# NO_IMPLICIT_EXTERN_C is defined on HP/UX.
-for file in assert.h sys/mman.h; do
-  if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
-    cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
-    chmod +w ${LIB}/$file 2>/dev/null
-    chmod a+r ${LIB}/$file 2>/dev/null
-  fi
-
-  if [ -r ${LIB}/$file ]; then
-    if egrep '"C"' ${LIB}/$file >/dev/null 2>&1 \
-       || egrep '__BEGIN_DECLS' ${LIB}/$file >/dev/null 2>&1; then
-      true
-    else
-      echo Fixing $file
-      echo '#ifdef __cplusplus
-extern "C" {
-#endif' > ${LIB}/${file}.sed
-      cat ${LIB}/${file} >> ${LIB}/${file}.sed
-      echo '#ifdef __cplusplus
-}
-#endif' >> ${LIB}/${file}.sed 
-      rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
-    fi
-    if cmp $file ${LIB}/$file >/dev/null 2>&1; then
-      rm -f ${LIB}/$file
-    else
-      # Find any include directives that use "file".
-      for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
-	dir=`echo $file | sed -e s'|/[^/]*$||'`
-	required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
-      done
-    fi
-  fi
-done
-
-# check for broken assert.h that needs stdio.h or stdlib.h
-file=assert.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
-  cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
-  chmod +w ${LIB}/$file 2>/dev/null
-  chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
-  if grep 'stderr' ${LIB}/$file >/dev/null 2>/dev/null; then
-    if grep 'include.*stdio.h' ${LIB}/$file >/dev/null 2>/dev/null; then
-      true
-    else
-      echo "Fixing $file (needs stdio.h)"
-      echo '#include <stdio.h>' >>${LIB}/$file
-    fi
-  fi
-  if grep 'exit *(' ${LIB}/$file >/dev/null 2>/dev/null || 
-     grep 'abort *(' ${LIB}/$file >/dev/null 2>/dev/null; then
-    if grep 'include.*stdlib.h' ${LIB}/$file >/dev/null 2>/dev/null; then
-      true
-    else
-      echo "Fixing $file (needs stdlib.h)"
-      echo '#ifdef __cplusplus
-#include <stdlib.h>
-#endif' >>${LIB}/$file
-    fi
-  fi
-  if cmp $file ${LIB}/$file >/dev/null 2>&1; then
-    rm -f ${LIB}/$file
-  else
-    # Find any include directives that use "file".
-    for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
-      dir=`echo $file | sed -e s'|/[^/]*$||'`
-      required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
-    done
-  fi
-fi
-
 # Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
 file=unistd.h
 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
@@ -2999,6 +2945,12 @@ if [ \! -z "$file_to_fix" ]; then
   rm -f /tmp/$base
 fi
 
+# As gcc provides its own assert.h don't even try to fix the system's one.
+file=assert.h
+if [ -r ${LIB}/$file ]; then
+  echo "Removing $file"
+  rm -f $file
+fi
 
 # This loop does not appear to do anything, because it uses file
 # rather than $file when setting target.  It also appears to be


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