[CVS 980326]: 2nd PATCH for fixincludes hackery (was: ...assert.h...)
Manfred Hollstein
manfred@s-direktnet.de
Fri Mar 27 13:49:00 GMT 1998
On Thu, 19 March 1998, 15:33:54, wilson@cygnus.com wrote:
> * Makefile.in (stmp-fixinc): Copy our own assert.h into the
> fixed include directory.
>
> I think this should only be done if FIXINCLUDES != Makefile.in as I
> explained in my previous message.
I changed my patch accordingly.
>
> (stdlib.h): Create missing stdlib.h on m68k-motorola-sysv.
>
> In answer to your earlier question, ISO C says that both stdlib.h and
> stddef.h must define size_t. There are a number of macros and types that
> are defined in more than one place.
>
> Rather than just include stddef.h in stdlib.h though, we could avoid possible
> namespace problems by just including the parts that we need. If you something
> like this
> #define __need_size_t
> #include <stddef.h>
> They we just get the size_t definition that we need and nothing else.
>
> If fix-header is creating the stdlib.h file, perhaps we should patch fix-header
> so that it creates the file correctly?
OK, I fixed the fixproto script which actually creates the file (if
missing) and then calls fix-header.
>
> * fixincludes (assert.h): Don't even try to fix a system's
> probably broken assert.h - we provide our own.
>
> One of the rules that you are deleting affects two files: assert.h and
> sys/mman.h. Are you sure that the sys/mman.h change is no longer needed?
> I suspect that you should leave the rule in, and just delete the assert.h
> file from the list of filenames for that rule.
Yep, just overlooked that.
Thu Mar 26 13:24:04 1998 Manfred Hollstein <manfred@s-direktnet.de>
* Makefile.in (stmp-fixinc): If we're actually fixing include
files, copy gcc's assert.h into the fixed include dir.
* fixincludes (assert.h): Avoid any attempts to fix a probably
broken system specific assert.h file.
* fixproto (stdlib.h): Make sure, it'll contain a definition of
size_t.
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-980326.orig/gcc/Makefile.in egcs-980326/gcc/Makefile.in
--- egcs-980326.orig/gcc/Makefile.in Wed Mar 25 18:47:37 1998
+++ egcs-980326/gcc/Makefile.in Thu Mar 26 07:34:31 1998
@@ -1924,6 +1924,9 @@ stmp-fixinc: $(FIXINCLUDES) gsyslimits.h
$(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
else true; fi; \
done; \
+ rm -f include/assert.h; \
+ cp $(srcdir)/assert.h include/assert.h; \
+ chmod a+r include/assert.h; \
else true; \
fi
rm -f include/syslimits.h
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-980326.orig/gcc/fixincludes egcs-980326/gcc/fixincludes
--- egcs-980326.orig/gcc/fixincludes Tue Jan 27 22:16:28 1998
+++ egcs-980326/gcc/fixincludes Thu Mar 26 07:35:50 1998
@@ -2371,9 +2371,9 @@ struct exception;
fi
fi
-# assert.h and sys/mman.h on HP/UX are not C++ ready, even though
+# sys/mman.h on HP/UX is not C++ ready, even though
# NO_IMPLICIT_EXTERN_C is defined on HP/UX.
-for file in assert.h sys/mman.h; do
+for file in 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
@@ -2406,45 +2406,6 @@ extern "C" {
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
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-980326.orig/gcc/fixproto egcs-980326/gcc/fixproto
--- egcs-980326.orig/gcc/fixproto Sun Nov 2 09:39:54 1997
+++ egcs-980326/gcc/fixproto Thu Mar 26 07:44:28 1998
@@ -269,7 +269,19 @@ do
cat >tmp.h <<EOF
#ifndef ${rel_source_ident}
#define ${rel_source_ident}
-#endif
+EOF
+ if test $rel_source_file = stdlib.h
+ then
+ # Make sure it contains a definition of size_t.
+ cat >>tmp.h <<EOF
+
+#define __need_size_t
+#include <stddef.h>
+EOF
+ fi
+ cat >>tmp.h <<EOF
+
+#endif /* ${rel_source_ident} */
EOF
${FIX_HEADER} $rel_source_file tmp.h $abs_target_dir/$rel_source_file ${DEFINES} $include_path
rm tmp.h
More information about the Gcc-bugs
mailing list