Commit 29421402 by Ian Lance Taylor

Various changes to avoid clobbering glibc header files

From-SVN: r7854
parent 8e0ac43b
...@@ -317,7 +317,8 @@ while [ $# != 0 ]; do ...@@ -317,7 +317,8 @@ while [ $# != 0 ]; do
#undef NULL #undef NULL
' $2/$file > $2/$file. ' $2/$file > $2/$file.
mv $2/$file. $2/$file mv $2/$file. $2/$file
if cmp $file $2/$file >/dev/null 2>&1; then if cmp $file $2/$file >/dev/null 2>&1 \
|| egrep 'This file is part of the GNU C Library' $2/$file >/dev/null 2>&1; then
rm $2/$file rm $2/$file
else else
echo Fixed $file echo Fixed $file
...@@ -1191,8 +1192,12 @@ fi ...@@ -1191,8 +1192,12 @@ fi
if [ -r ${LIB}/$file ]; then if [ -r ${LIB}/$file ]; then
echo Fixing $file, use of va_list echo Fixing $file, use of va_list
# Arrange for stdio.h to use stdarg.h to define __gnuc_va_list # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
(echo "#define __need___va_list" if egrep "__need___va_list" ${LIB}/$file >/dev/null 2>&1; then
echo "#include <stdarg.h>") > ${LIB}/${file}.sed touch ${LIB}/${file}.sed
else
(echo "#define __need___va_list"
echo "#include <stdarg.h>") > ${LIB}/${file}.sed
fi
# Use __gnuc_va_list in arg types in place of va_list. # Use __gnuc_va_list in arg types in place of va_list.
# On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
# trailing parentheses and semicolon save all other systems from this. # trailing parentheses and semicolon save all other systems from this.
...@@ -1204,9 +1209,10 @@ if [ -r ${LIB}/$file ]; then ...@@ -1204,9 +1209,10 @@ if [ -r ${LIB}/$file ]; then
-e 's@ va_list@ __va_list__@' \ -e 's@ va_list@ __va_list__@' \
-e 's@\*va_list@*__va_list__@' \ -e 's@\*va_list@*__va_list__@' \
-e 's@ __va_list)@ __gnuc_va_list)@' \ -e 's@ __va_list)@ __gnuc_va_list)@' \
-e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
-e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \ -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
-e 's@VA_LIST@DUMMY_VA_LIST@' \ -e 's@VA_LIST@DUMMY_VA_LIST@' \
-e 's@_NEED___Va_LIST@_NEED___VA_LIST@' \ -e 's@_Va_LIST@_VA_LIST@' \
${LIB}/$file >> ${LIB}/${file}.sed ${LIB}/$file >> ${LIB}/${file}.sed
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
...@@ -1633,7 +1639,8 @@ if [ -r $file ] && [ ! -r ${LIB}/$file ]; then ...@@ -1633,7 +1639,8 @@ if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
fi fi
if [ -r ${LIB}/$file ]; then if [ -r ${LIB}/$file ]; then
if egrep '"C"' ${LIB}/$file >/dev/null 2>/dev/null; then if egrep '"C"' ${LIB}/$file >/dev/null 2>&1 \
|| egrep '__BEGIN_DECLS' ${LIB}/$file >/dev/null 2>&1; then
true true
else else
echo Fixing $file echo Fixing $file
...@@ -1713,18 +1720,22 @@ fi ...@@ -1713,18 +1720,22 @@ fi
# Put cpp wrappers around these include files to avoid redeclaration # Put cpp wrappers around these include files to avoid redeclaration
# errors during multiple inclusion on m88k-tektronix-sysv3. # errors during multiple inclusion on m88k-tektronix-sysv3.
for file in time.h sys/time.h ; do for file in time.h sys/time.h ; do
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then if egrep '#ifndef' $file >/dev/null 2>&1; then
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" true
chmod +w ${LIB}/$file 2>/dev/null else
fi if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
if [ -r ${LIB}/$file ]; then cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
echo Fixing $file, to protect against multiple inclusion. chmod +w ${LIB}/$file 2>/dev/null
cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'` fi
(echo "#ifndef __GCC_GOT_${cpp_wrapper}_" if [ -r ${LIB}/$file ]; then
echo "#define __GCC_GOT_${cpp_wrapper}_" echo Fixing $file, to protect against multiple inclusion.
cat ${LIB}/${file} cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
echo '#endif /* !_GCC_GOT_'${cpp_wrapper}_' */') > ${LIB}/${file}.new (echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
rm -f ${LIB}/$file; mv ${LIB}/${file}.new ${LIB}/$file echo "#define __GCC_GOT_${cpp_wrapper}_"
cat ${LIB}/${file}
echo '#endif /* !_GCC_GOT_'${cpp_wrapper}_' */') > ${LIB}/${file}.new
rm -f ${LIB}/$file; mv ${LIB}/${file}.new ${LIB}/$file
fi
fi fi
done done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment