about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartin Nowack <martin.nowack@gmail.com>2013-08-27 22:03:50 +0200
committerMartin Nowack <martin.nowack@gmail.com>2013-08-28 08:54:50 +0200
commit1f0255ab650b59ef8acafb57b23900f7d89046f7 (patch)
tree9a20cdde76bc3f2fe93cc145c999600ab92b2786
parent45fa391391b57beecefd2cbcf3ce243d8aaea4f7 (diff)
downloadklee-1f0255ab650b59ef8acafb57b23900f7d89046f7.tar.gz
Fix constness warnings issued by gcc 4.7
-rw-r--r--include/klee/Expr.h2
-rw-r--r--lib/Core/Executor.cpp6
-rw-r--r--lib/Expr/Expr.cpp2
-rw-r--r--lib/Expr/Lexer.cpp2
-rw-r--r--lib/Solver/STPBuilder.cpp2
-rw-r--r--tools/klee/main.cpp2
6 files changed, 8 insertions, 8 deletions
diff --git a/include/klee/Expr.h b/include/klee/Expr.h
index 9d170dc5..4bebd521 100644
--- a/include/klee/Expr.h
+++ b/include/klee/Expr.h
@@ -364,7 +364,7 @@ public:
 
   virtual ref<Expr> rebuild(ref<Expr> kids[]) const { 
     assert(0 && "rebuild() on ConstantExpr"); 
-    return (Expr*) this;
+    return const_cast<ConstantExpr*>(this);
   }
 
   virtual unsigned computeHash();
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 184b0983..ba9db804 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -425,17 +425,17 @@ void Executor::initializeGlobals(ExecutionState &state) {
        char' value [0,255]; by EOF (-1); or by any `signed char' value
        [-128,-1).  ISO C requires that the ctype functions work for `unsigned */
   const uint16_t **addr = __ctype_b_loc();
-  addExternalObject(state, (void *)(*addr-128), 
+  addExternalObject(state, const_cast<uint16_t*>(*addr-128),
                     384 * sizeof **addr, true);
   addExternalObject(state, addr, sizeof(*addr), true);
     
   const int32_t **lower_addr = __ctype_tolower_loc();
-  addExternalObject(state, (void *)(*lower_addr-128), 
+  addExternalObject(state, const_cast<int32_t*>(*lower_addr-128),
                     384 * sizeof **lower_addr, true);
   addExternalObject(state, lower_addr, sizeof(*lower_addr), true);
   
   const int32_t **upper_addr = __ctype_toupper_loc();
-  addExternalObject(state, (void *)(*upper_addr-128), 
+  addExternalObject(state, const_cast<int32_t*>(*upper_addr-128),
                     384 * sizeof **upper_addr, true);
   addExternalObject(state, upper_addr, sizeof(*upper_addr), true);
 #endif
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index 1187573b..a28ad907 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -342,7 +342,7 @@ void ConstantExpr::toMemory(void *address) {
   case Expr::Int64: *((uint64_t*) address) = getZExtValue(64); break;
   // FIXME: what about machines without x87 support?
   case Expr::Fl80:
-    *((long double*) address) = *(long double*) value.getRawData();
+    *((long double*) address) = *(const long double*) value.getRawData();
     break;
   }
 }
diff --git a/lib/Expr/Lexer.cpp b/lib/Expr/Lexer.cpp
index 95d6072b..9859ff36 100644
--- a/lib/Expr/Lexer.cpp
+++ b/lib/Expr/Lexer.cpp
@@ -54,7 +54,7 @@ const char *Token::getKindName() const {
 
 void Token::dump() {
   llvm::errs() << "(Token \"" << getKindName() << "\" "
-               << (void*) start << " " << length << " "
+               << (const void*) start << " " << length << " "
                << line << " " << column << ")";
 }
 
diff --git a/lib/Solver/STPBuilder.cpp b/lib/Solver/STPBuilder.cpp
index 789eb244..90252656 100644
--- a/lib/Solver/STPBuilder.cpp
+++ b/lib/Solver/STPBuilder.cpp
@@ -435,7 +435,7 @@ ExprHandle STPBuilder::constructSDivByConstant(ExprHandle expr_n, unsigned width
     // STP uniques arrays by name, so we make sure the name is unique by
     // including the address.
     char buf[32];
-    unsigned const addrlen = sprintf(buf, "_%p", (void*)root) + 1; // +1 for null-termination
+    unsigned const addrlen = sprintf(buf, "_%p", (const void*)root) + 1; // +1 for null-termination
     unsigned const space = (root->name.length() > 32 - addrlen)?(32 - addrlen):root->name.length();
     memmove(buf + space, buf, addrlen); // moving the address part to the end
     memcpy(buf, root->name.c_str(), space); // filling out the name part
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index e4de4769..0d899ae9 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -604,7 +604,7 @@ static void parseArguments(int argc, char **argv) {
     argArray[i] = arguments[i-1].c_str();
   }
 
-  cl::ParseCommandLineOptions(numArgs, (char**) argArray, " klee\n");
+  cl::ParseCommandLineOptions(numArgs, (const char**) argArray, " klee\n");
   delete[] argArray;
 }