Fix writeable string warnings. Closes #139
authorKasper F. Brandt <poizan@poizan.dk>
Sun, 8 Feb 2015 02:39:59 +0000 (03:39 +0100)
committerKasper F. Brandt <poizan@poizan.dk>
Sun, 8 Feb 2015 02:39:59 +0000 (03:39 +0100)
src/jit/gentree.cpp
src/jit/jiteh.cpp
src/jit/lsra.cpp
src/jit/lsra.h
src/jit/phase.h
src/jit/rangecheck.h
src/vm/exceptionhandling.cpp
src/vm/exceptionhandling.h
src/vm/threadsuspend.cpp
src/vm/threadsuspend.h

index 64bb747..dac1ad0 100644 (file)
@@ -8454,7 +8454,7 @@ GenTreePtr          Compiler::gtDispLinearTree(GenTreeStmt* curStmt,
         }
 
         unsigned listElemNum = 0;
-        char* childMsg = nullptr;
+        const char* childMsg = nullptr;
         if (tree->IsCall())
         {
             if (child == tree->gtCall.gtCallObjp)
index 0d8016d..94555b9 100644 (file)
@@ -2468,7 +2468,7 @@ bool Compiler::fgNormalizeEHCase3()
             EHblkDsc* ehOuter = ehGetDsc(ehOuterIndex);
 
             // Debugging: say what type of block we're updating.
-            INDEBUG(char* outerType = ""; char* innerType = "";)
+            INDEBUG(const char* outerType = ""; const char* innerType = "";)
 
             // 'insertAfterBlk' is the place we will insert new "normalization" blocks. We don't know yet if we will
             // insert them after the innermost 'try' or handler's "last" block, so we set it to nullptr. Once we determine
index 778c644..0db1ab0 100644 (file)
@@ -7426,7 +7426,7 @@ LinearScan::insertSwap(BasicBlock* block,
 #ifdef DEBUG
     if (VERBOSE)
     {
-        char * insertionPointString = "top";
+        const char * insertionPointString = "top";
         if (insertionPoint == nullptr)
         {
             insertionPointString = "bottom";
@@ -7595,7 +7595,7 @@ LinearScan::addResolution(BasicBlock* block,
                           regNumber   fromReg)
 {
 #ifdef DEBUG
-    char * insertionPointString = "top";
+    const char * insertionPointString = "top";
 #endif // DEBUG
     if (insertionPoint == nullptr)
     {
@@ -8590,7 +8590,7 @@ LinearScan::lsraDumpIntervals(const char* msg)
 void 
 LinearScan::lsraGetOperandString(GenTreePtr tree, LsraTupleDumpMode mode, char *operandString, unsigned operandStringLength)
 {
-    char* lastUseChar = "";
+    const char* lastUseChar = "";
     if ((tree->gtFlags & GTF_VAR_DEATH) != 0) lastUseChar = "*";
     switch (mode)
     {
@@ -8625,7 +8625,7 @@ LinearScan::lsraDispNode(GenTreePtr tree, LsraTupleDumpMode mode, bool hasDest)
     Compiler*         compiler = GetTlsCompiler();
     const unsigned    operandStringLength = 16;
     char              operandString[operandStringLength];
-    char*             emptyDestOperand = "               ";
+    const char*       emptyDestOperand = "               ";
     char              spillChar = ' ';
 
     if (mode == LinearScan::LSRA_DUMP_POST)
@@ -8683,7 +8683,7 @@ LinearScan::lsraDispNode(GenTreePtr tree, LsraTupleDumpMode mode, bool hasDest)
     else if (tree->OperIsAssignment())
     {
         assert(!tree->gtHasReg());
-        char * isRev = "";
+        const char * isRev = "";
         if ((tree->gtFlags & GTF_REVERSE_OPS) != 0) isRev = "(Rev)";
         printf("  asg%s%s  ", GenTree::NodeName(tree->OperGet()), isRev);
     }
index 295d202..4119a21 100644 (file)
@@ -789,11 +789,11 @@ private:
     int regColumnWidth;
     int regTableIndent;
 
-    char* columnSeparator;
-    char* line;
-    char* leftBox;
-    char* middleBox;
-    char* rightBox;
+    const char* columnSeparator;
+    const char* line;
+    const char* leftBox;
+    const char* middleBox;
+    const char* rightBox;
 
     static const int MAX_FORMAT_CHARS = 12;
     char intervalNameFormat[MAX_FORMAT_CHARS];
index 2ba0dac..ac074c8 100644 (file)
@@ -11,7 +11,7 @@ class Phase
 {
 public:
     Phase(Compiler *_comp, 
-          char *_name, 
+          const char *_name, 
           Phases _phase=PHASE_NUMBER_OF) 
         : comp(_comp), name(_name), phase(_phase) {}
     virtual void Run();
@@ -21,7 +21,7 @@ public:
 
 protected:
     Compiler *comp;
-    char *name;
+    const char *name;
     Phases phase;
 };
 
index 5521a46..aa479e5 100644 (file)
@@ -217,7 +217,7 @@ struct Limit
         return false;
     }
 #ifdef DEBUG
-    char* ToString(IAllocator* alloc)
+    const char* ToString(IAllocator* alloc)
     {
         unsigned size = 64;
         char* buf = (char*) alloc->Alloc(size);
index 36dca5e..853e605 100644 (file)
@@ -71,7 +71,7 @@
 //
 #ifdef _DEBUG
 void DumpClauses(IJitManager* pJitMan, const METHODTOKEN& MethToken, UINT_PTR uMethodStartPC, UINT_PTR dwControlPc);
-static void DoEHLog(DWORD lvl, __in_z char *fmt, ...);
+static void DoEHLog(DWORD lvl, __in_z const char *fmt, ...);
 #define EH_LOG(expr)  { DoEHLog expr ; }
 #else
 #define EH_LOG(expr)
@@ -1881,7 +1881,7 @@ lExit:
 }
 
 // static
-void ExceptionTracker::DebugLogTrackerRanges(__in_z char *pszTag)
+void ExceptionTracker::DebugLogTrackerRanges(__in_z const char *pszTag)
 {
 #ifdef _DEBUG
     CONTRACTL
@@ -4186,7 +4186,7 @@ void DumpClauses(IJitManager* pJitMan, const METHODTOKEN& MethToken, UINT_PTR uM
 
 static void DoEHLog(
     DWORD lvl,
-    __in_z char *fmt,
+    __in_z const char *fmt,
     ...
     )
 {
index 639f47c..5b2568a 100644 (file)
@@ -366,7 +366,7 @@ public:
     void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
 #endif // DACCESS_COMPILE
 
-    static void DebugLogTrackerRanges(__in_z char *pszTag);
+    static void DebugLogTrackerRanges(__in_z const char *pszTag);
 
     bool IsStackOverflowException();
 
index 98800f6..5c110d8 100644 (file)
@@ -1,4 +1,4 @@
-//
+
 // Copyright (c) Microsoft. All rights reserved.
 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
 //
@@ -8480,7 +8480,7 @@ void SuspendStatistics::DisplayAndUpdate()
 const char* const str_timeUnit[]   = { "usec", "msec", "sec" };
 const int         timeUnitFactor[] = { 1, 1000, 1000000 };
 
-void MinMaxTot::DisplayAndUpdate(FILE* logFile, __in_z char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit unit /* = usec */)
+void MinMaxTot::DisplayAndUpdate(FILE* logFile, __in_z const char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit unit /* = usec */)
 {
     LIMITED_METHOD_CONTRACT;
 
index 5725841..73f2b8b 100644 (file)
@@ -38,7 +38,7 @@ struct MinMaxTot
         minVal = maxVal = 0;
     }
 
-    void DisplayAndUpdate(FILE* logFile, __in_z char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit=usec);
+    void DisplayAndUpdate(FILE* logFile, __in_z const char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit=usec);
 };
 
 // A note about timings.  We use QueryPerformanceCounter to measure all timings in units.  During