OSDN Git Service

Don't put #ifndefs in limits.h if they are already there
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Apr 1993 19:12:20 +0000 (19:12 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Apr 1993 19:12:20 +0000 (19:12 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@4053 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fixincludes

index 52ecb0a..8de7a60 100755 (executable)
@@ -959,6 +959,11 @@ fi
 
 # In limits.h, put #ifndefs around things that are supposed to be defined
 # in float.h to avoid redefinition errors if float.h is included first.
+# On HP/UX this patch does not work, because on HP/UX limits.h uses
+# multi line comments and the inserted #endif winds up inside the
+# comment.  Fortunately, HP/UX already uses #ifndefs in limits.h; if
+# we find a #ifndef FLT_MIN we assume that all the required #ifndefs
+# are there, and we do not add them ourselves.
 file=limits.h
 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
   cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
@@ -967,33 +972,37 @@ if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
 fi
 
 if [ -r ${LIB}/$file ]; then
-  echo Fixing $file
-  sed -e '/[   ]FLT_MIN[       ]/i\
+  if egrep 'ifndef[    ]+FLT_MIN' ${LIB}/$file >/dev/null; then
+    true
+  else
+    echo Fixing $file
+    sed -e '/[         ]FLT_MIN[       ]/i\
 #ifndef FLT_MIN'\
-      -e '/[   ]FLT_MIN[       ]/a\
+        -e '/[         ]FLT_MIN[       ]/a\
 #endif'\
-      -e '/[   ]FLT_MAX[       ]/i\
+        -e '/[         ]FLT_MAX[       ]/i\
 #ifndef FLT_MAX'\
-      -e '/[   ]FLT_MAX[       ]/a\
+        -e '/[         ]FLT_MAX[       ]/a\
 #endif'\
-      -e '/[   ]FLT_DIG[       ]/i\
+        -e '/[         ]FLT_DIG[       ]/i\
 #ifndef FLT_DIG'\
-      -e '/[   ]FLT_DIG[       ]/a\
+        -e '/[         ]FLT_DIG[       ]/a\
 #endif'\
-      -e '/[   ]DBL_MIN[       ]/i\
+        -e '/[         ]DBL_MIN[       ]/i\
 #ifndef DBL_MIN'\
-      -e '/[   ]DBL_MIN[       ]/a\
+        -e '/[         ]DBL_MIN[       ]/a\
 #endif'\
-      -e '/[   ]DBL_MAX[       ]/i\
+        -e '/[         ]DBL_MAX[       ]/i\
 #ifndef DBL_MAX'\
-      -e '/[   ]DBL_MAX[       ]/a\
+        -e '/[         ]DBL_MAX[       ]/a\
 #endif'\
-      -e '/[   ]DBL_DIG[       ]/i\
+        -e '/[         ]DBL_DIG[       ]/i\
 #ifndef DBL_DIG'\
-      -e '/[   ]DBL_DIG[       ]/a\
+        -e '/[         ]DBL_DIG[       ]/a\
 #endif'\
-    ${LIB}/$file > ${LIB}/${file}.sed
-  rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+      ${LIB}/$file > ${LIB}/${file}.sed
+    rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+  fi
   if cmp $file ${LIB}/$file >/dev/null 2>&1; then
     echo Deleting ${LIB}/$file\; no fixes were needed.
     rm -f ${LIB}/$file