Append "#include <stdlib.h>" to assert.h if it uses exit or abort.

From-SVN: r6507
This commit is contained in:
Richard Kenner 1994-02-08 19:21:44 -05:00
parent 442e881d89
commit 2628709d5a

View File

@ -4,7 +4,7 @@
# fixproto TARGET-DIR SOURCE-DIR-ALL SOURCE-DIR-STD
#
# COPYRIGHT
# Copyright (C) 1993 Free Software Foundation, Inc.
# Copyright (C) 1993, 1994 Free Software Foundation, Inc.
# This file is part of GNU CC.
#
# GNU CC is free software; you can redistribute it and/or modify
@ -329,15 +329,27 @@ for code in ALL STD ; do
rm -f fixtmp.c fixtmp.i
done
# check for broken assert.h that needs stdio.h
if test -f $abs_source_dir/assert.h -a \! -f $abs_target_dir/assert.h \
&& grep 'stderr' $abs_source_dir/assert.h >/dev/null
then
if grep 'include.*stdio.h' $abs_source_dir/assert.h >/dev/null
then true
else
echo 'Fixing broken assert.h (needs stdio.h)'
cat $abs_source_dir/assert.h >$abs_target_dir/assert.h
echo '#include <stdio.h>' >>$abs_target_dir/assert.h
if test -f $abs_source_dir/assert.h -a \! -f $abs_target_dir/assert.h; then
if grep 'stderr' $abs_source_dir/assert.h >/dev/null ; then
if grep 'include.*stdio.h' $abs_source_dir/assert.h >/dev/null ; then
true
else
echo 'Fixing broken assert.h (needs stdio.h)'
cat $abs_source_dir/assert.h >$abs_target_dir/assert.h
echo '#include <stdio.h>' >>$abs_target_dir/assert.h
fi
fi
if grep 'exit *(' $abs_source_dir/assert.h >/dev/null ||
grep 'abort *(' $abs_source_dir/assert.h >/dev/null ; then
if grep 'include.*stdlib.h' $abs_source_dir/assert.h >/dev/null ; then
true
else
echo 'Fixing broken assert.h (needs stdlib.h)'
if test ! -f $abs_target_dir/assert.h ; then
cat $abs_source_dir/assert.h >$abs_target_dir/assert.h
fi
echo '#include <stdlib.h>' >>$abs_target_dir/assert.h
fi
fi
fi
done_dirs="$done_dir $rel_source_dir"