mknumeric_limits: Output to temporary files, and rename them at the end.
authorAlexandre Oliva <aoliva@redhat.com>
Fri, 22 Dec 2000 08:00:00 +0000 (08:00 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Fri, 22 Dec 2000 08:00:00 +0000 (08:00 +0000)
* mknumeric_limits: Output to temporary files, and rename them at
the end.

From-SVN: r38443

libstdc++-v3/ChangeLog
libstdc++-v3/mknumeric_limits

index 98c031ade58e7b9d0b7fddce3bbf5f3087ddddde..acda82529d9b8f7ae2f57d09cf7cf9ea262b8050 100644 (file)
@@ -1,3 +1,8 @@
+2000-12-22  Alexandre Oliva  <aoliva@redhat.com>
+
+       * mknumeric_limits: Output to temporary files, and rename them at
+       the end.
+
 2000-12-21  Benjamin Kosnik  <bkoz@redhat.com>
 
        * configure.in: Change GLIBCPP_ENABLE_SHADOW to
index 600d6f1662a4f65136c5e04e7f9010d1f74214bf..25d8a27f71865b82a41fab7add63ee61942462b1 100755 (executable)
@@ -45,7 +45,7 @@ OUT_H="$BUILD_DIR/include/bits/std_limits.h"
 OUT_C="$BUILD_DIR/src/limitsMEMBERS.cc"
 
 if [ -f $OUT_C ]; then
-    rm -f $OUT_H OUT_C
+    rm -f $OUT_H $OUT_C $OUT_H-t $OUT_C-t
 fi
 
 SRC_DIR=$2
@@ -64,7 +64,9 @@ fi
 
 : ${CXX:="$BUILD_DIR/../../gcc/g++ -B$BUILD_DIR/../../gcc/"}
 
-cat <<EOF > $OUT_H
+# We output to a temporary file, so that we don't appear to have
+# succeeded unless we actually do.
+cat <<EOF > $OUT_H-t
 // The template and inlines for the -*- C++ -*- numeric_limits classes.
 
 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
@@ -189,9 +191,9 @@ if [ ! -f "$BUILD_DIR/src/gen-num-limits" ]; then
   exit 1
 fi
 
-"$BUILD_DIR/src/gen-num-limits" >> $OUT_H
+"$BUILD_DIR/src/gen-num-limits" >> $OUT_H-t
 
-cat <<EOF >> $OUT_H
+cat <<EOF >> $OUT_H-t
 } // namespace std
 
 #endif // _CPP_NUMERIC_LIMITS
@@ -245,8 +247,8 @@ for type_name in bool char 'signed char' 'unsigned char' \
            long 'unsigned long' 'long long' 'unsigned long long' \
            float double 'long double'
     do
-     grep "<$type_name>" $OUT_H >/dev/null 2>&1 || continue
-     cat <<EOF >> $OUT_C
+     grep "<$type_name>" $OUT_H-t >/dev/null 2>&1 || continue
+     cat <<EOF >> $OUT_C-t
 
     const bool $trait_name<$type_name>::is_specialized;
     const int  $trait_name<$type_name>::digits;
@@ -274,8 +276,11 @@ EOF
 
 done
 
-cat <<EOF >> $OUT_C
+cat <<EOF >> $OUT_C-t
 } // namespace std
 
 
 EOF
+
+mv $OUT_C-t $OUT_C
+mv $OUT_H-t $OUT_H