[llvm-commits] fix cases of assert("foo")

Dan Gohman djg at cray.com
Tue Feb 13 07:40:53 PST 2007


While preparing http://llvm.org/PR1198 I noticed several asserts
protecting unprepared code from i128 types that weren't actually failing
when they should because they were written as assert("foo") instead of
something like assert(0 && "foo"). This patch fixes all the cases that a
quick grep found.

Dan

-- 
Dan Gohman, Cray Inc. <djg at cray.com>
-------------- next part --------------
Index: lib/Bytecode/Reader/Reader.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm/lib/Bytecode/Reader/Reader.cpp,v
retrieving revision 1.238
diff -u -r1.238 Reader.cpp
--- lib/Bytecode/Reader/Reader.cpp
+++ lib/Bytecode/Reader/Reader.cpp
@@ -1265,7 +1265,7 @@
       Result = ConstantInt::get(IT, Val);
       if (Handler) Handler->handleConstantValue(Result);
     } else 
-      assert("Integer types > 64 bits not supported");
+      assert(0 && "Integer types > 64 bits not supported");
     break;
   }
   case Type::FloatTyID: {
Index: lib/Bytecode/Writer/Writer.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm/lib/Bytecode/Writer/Writer.cpp,v
retrieving revision 1.166
diff -u -r1.166 Writer.cpp
--- lib/Bytecode/Writer/Writer.cpp
+++ lib/Bytecode/Writer/Writer.cpp
@@ -313,7 +313,7 @@
     else if (NumBits <= 64)
       output_vbr(uint64_t(cast<ConstantInt>(CPV)->getZExtValue()));
     else 
-      assert("Integer types > 64 bits not supported.");
+      assert(0 && "Integer types > 64 bits not supported.");
     break;
   }
 
Index: lib/ExecutionEngine/ExecutionEngine.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm/lib/ExecutionEngine/ExecutionEngine.cpp,v
retrieving revision 1.105
diff -u -r1.105 ExecutionEngine.cpp
--- lib/ExecutionEngine/ExecutionEngine.cpp
+++ lib/ExecutionEngine/ExecutionEngine.cpp
@@ -292,7 +292,7 @@
           const_cast<GlobalVariable *>(dyn_cast<GlobalVariable>(GV)))
     EmitGlobalVariable(GVar);
   else
-    assert("Global hasn't had an address allocated yet!");
+    assert(0 && "Global hasn't had an address allocated yet!");
   return state.getGlobalAddressMap(locked)[GV];
 }
 
@@ -425,7 +425,7 @@
     else if (BitWidth <= 64)
       Result.Int64Val = (uint64_t )cast<ConstantInt>(C)->getZExtValue();
     else
-      assert("Integers with > 64-bits not implemented");
+      assert(0 && "Integers with > 64-bits not implemented");
     break;
   }
 
Index: lib/ExecutionEngine/Interpreter/Execution.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp,v
retrieving revision 1.169
diff -u -r1.169 Execution.cpp
--- lib/ExecutionEngine/Interpreter/Execution.cpp
+++ lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -1690,7 +1690,7 @@
       else if (BitWidth <= 64)
         Dest.Int64Val = Src.Int64Val;
       else
-        assert("Integer types > 64 bits not supported");
+        assert(0 && "Integer types > 64 bits not supported");
       maskToBitWidth(Dest, BitWidth);
     }
     IMPLEMENT_VAARG(Pointer);


More information about the llvm-commits mailing list