This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[fixincludes] fixinc.svr4: Collapse repeated code.


More simple-minded cleanup for fixinc.svr4 for when I get back to it.

	* fixinc/fixinc.svr4: Collapse repeated clauses into for statment.

--- fixinc.svr4.beta	2003-07-27 20:32:29.000000000 -0400
+++ fixinc.svr4	2003-07-27 20:42:30.000000000 -0400
@@ -782,211 +782,17 @@
 fi
 
 # Conditionalize all of <fs/rfs/rf_cache.h> on _KERNEL being defined.
-
-file=fs/rfs/rf_cache.h
-base=`basename $file`.$$
-if [ -r ${LIB}/$file ]; then
-  file_to_fix=${LIB}/$file
-else
-  if [ -r ${INPUT}/$file ]; then
-    file_to_fix=${INPUT}/$file
-  else
-    file_to_fix=""
-  fi
-fi
-if [ \! -z "$file_to_fix" ]; then
-  echo Checking $file_to_fix
-  if grep _KERNEL $file_to_fix > /dev/null; then
-    true
-  else
-    echo '#ifdef _KERNEL' > /tmp/$base
-    cat $file_to_fix >> /tmp/$base
-    echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
-    echo Fixed $file_to_fix
-    rm -f ${LIB}/$file
-    cp /tmp/$base ${LIB}/$file
-    chmod a+r ${LIB}/$file
-    rm -f /tmp/$base
-  fi
-fi
-
 # Conditionalize all of <sys/erec.h> on _KERNEL being defined.
-
-file=sys/erec.h
-base=`basename $file`.$$
-if [ -r ${LIB}/$file ]; then
-  file_to_fix=${LIB}/$file
-else
-  if [ -r ${INPUT}/$file ]; then
-    file_to_fix=${INPUT}/$file
-  else
-    file_to_fix=""
-  fi
-fi
-if [ \! -z "$file_to_fix" ]; then
-  echo Checking $file_to_fix
-  if grep _KERNEL $file_to_fix > /dev/null; then
-    true
-  else
-    echo '#ifdef _KERNEL' > /tmp/$base
-    cat $file_to_fix >> /tmp/$base
-    echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
-    echo Fixed $file_to_fix
-    rm -f ${LIB}/$file
-    cp /tmp/$base ${LIB}/$file
-    chmod a+r ${LIB}/$file
-    rm -f /tmp/$base
-  fi
-fi
-
 # Conditionalize all of <sys/err.h> on _KERNEL being defined.
-
-file=sys/err.h
-base=`basename $file`.$$
-if [ -r ${LIB}/$file ]; then
-  file_to_fix=${LIB}/$file
-else
-  if [ -r ${INPUT}/$file ]; then
-    file_to_fix=${INPUT}/$file
-  else
-    file_to_fix=""
-  fi
-fi
-if [ \! -z "$file_to_fix" ]; then
-  echo Checking $file_to_fix
-  if grep _KERNEL $file_to_fix > /dev/null; then
-    true
-  else
-    echo '#ifdef _KERNEL' > /tmp/$base
-    cat $file_to_fix >> /tmp/$base
-    echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
-    echo Fixed $file_to_fix
-    rm -f ${LIB}/$file
-    cp /tmp/$base ${LIB}/$file
-    chmod a+r ${LIB}/$file
-    rm -f /tmp/$base
-  fi
-fi
-
 # Conditionalize all of <sys/char.h> on _KERNEL being defined.
-
-file=sys/char.h
-base=`basename $file`.$$
-if [ -r ${LIB}/$file ]; then
-  file_to_fix=${LIB}/$file
-else
-  if [ -r ${INPUT}/$file ]; then
-    file_to_fix=${INPUT}/$file
-  else
-    file_to_fix=""
-  fi
-fi
-if [ \! -z "$file_to_fix" ]; then
-  echo Checking $file_to_fix
-  if grep _KERNEL $file_to_fix > /dev/null; then
-    true
-  else
-    echo '#ifdef _KERNEL' > /tmp/$base
-    cat $file_to_fix >> /tmp/$base
-    echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
-    echo Fixed $file_to_fix
-    rm -f ${LIB}/$file
-    cp /tmp/$base ${LIB}/$file
-    chmod a+r ${LIB}/$file
-    rm -f /tmp/$base
-  fi
-fi
-
 # Conditionalize all of <sys/getpages.h> on _KERNEL being defined.
-
-file=sys/getpages.h
-base=`basename $file`.$$
-if [ -r ${LIB}/$file ]; then
-  file_to_fix=${LIB}/$file
-else
-  if [ -r ${INPUT}/$file ]; then
-    file_to_fix=${INPUT}/$file
-  else
-    file_to_fix=""
-  fi
-fi
-if [ \! -z "$file_to_fix" ]; then
-  echo Checking $file_to_fix
-  if grep _KERNEL $file_to_fix > /dev/null; then
-    true
-  else
-    echo '#ifdef _KERNEL' > /tmp/$base
-    cat $file_to_fix >> /tmp/$base
-    echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
-    echo Fixed $file_to_fix
-    rm -f ${LIB}/$file
-    cp /tmp/$base ${LIB}/$file
-    chmod a+r ${LIB}/$file
-    rm -f /tmp/$base
-  fi
-fi
-
 # Conditionalize all of <sys/map.h> on _KERNEL being defined.
-
-file=sys/map.h
-base=`basename $file`.$$
-if [ -r ${LIB}/$file ]; then
-  file_to_fix=${LIB}/$file
-else
-  if [ -r ${INPUT}/$file ]; then
-    file_to_fix=${INPUT}/$file
-  else
-    file_to_fix=""
-  fi
-fi
-if [ \! -z "$file_to_fix" ]; then
-  echo Checking $file_to_fix
-  if grep _KERNEL $file_to_fix > /dev/null; then
-    true
-  else
-    echo '#ifdef _KERNEL' > /tmp/$base
-    cat $file_to_fix >> /tmp/$base
-    echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
-    echo Fixed $file_to_fix
-    rm -f ${LIB}/$file
-    cp /tmp/$base ${LIB}/$file
-    chmod a+r ${LIB}/$file
-    rm -f /tmp/$base
-  fi
-fi
-
 # Conditionalize all of <sys/cmn_err.h> on _KERNEL being defined.
-
-file=sys/cmn_err.h
-base=`basename $file`.$$
-if [ -r ${LIB}/$file ]; then
-  file_to_fix=${LIB}/$file
-else
-  if [ -r ${INPUT}/$file ]; then
-    file_to_fix=${INPUT}/$file
-  else
-    file_to_fix=""
-  fi
-fi
-if [ \! -z "$file_to_fix" ]; then
-  echo Checking $file_to_fix
-  if grep _KERNEL $file_to_fix > /dev/null; then
-    true
-  else
-    echo '#ifdef _KERNEL' > /tmp/$base
-    cat $file_to_fix >> /tmp/$base
-    echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
-    echo Fixed $file_to_fix
-    rm -f ${LIB}/$file
-    cp /tmp/$base ${LIB}/$file
-    chmod a+r ${LIB}/$file
-    rm -f /tmp/$base
-  fi
-fi
-
 # Conditionalize all of <sys/kdebugger.h> on _KERNEL being defined.
 
-file=sys/kdebugger.h
+for file in fs/rfs/rf_cache.h sys/erec.h sys/err.h sys/char.h \
+            sys/getpages.h sys/map.h sys/cmn_err.h sys/kdebugger.h ; do
+
 base=`basename $file`.$$
 if [ -r ${LIB}/$file ]; then
   file_to_fix=${LIB}/$file
@@ -1013,6 +819,8 @@
   fi
 fi
 
+done
+
 # Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
 
 file=sys/endian.h

-- 
Nathanael Nerode  <neroden at gcc.gnu.org>
http://home.twcny.rr.com/nerode/neroden/fdl.html


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