From 418280f66986f4c0e3b0fc5e40af7e1bd232d34f Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Wed, 21 Aug 2024 15:46:34 -0400 Subject: [PATCH] Change methods to use const char * Fixes many warnings when passing in string literal Signed-off-by: Matthew Hall --- compiler/codegen/OMRCodeGenerator.cpp | 4 ++-- compiler/codegen/OMRCodeGenerator.hpp | 4 ++-- compiler/ras/Debug.cpp | 6 +++--- compiler/ras/Debug.hpp | 2 +- compiler/z/codegen/BinaryCommutativeAnalyser.cpp | 4 ++-- compiler/z/codegen/BinaryEvaluator.cpp | 2 +- compiler/z/codegen/OMRMachine.cpp | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/compiler/codegen/OMRCodeGenerator.cpp b/compiler/codegen/OMRCodeGenerator.cpp index e4fc9bf385a..0304aee166c 100644 --- a/compiler/codegen/OMRCodeGenerator.cpp +++ b/compiler/codegen/OMRCodeGenerator.cpp @@ -1242,13 +1242,13 @@ bool OMR::CodeGenerator::traceBCDCodeGen() return self()->comp()->getOption(TR_TraceCG); } -void OMR::CodeGenerator::traceBCDEntry(char *str, TR::Node *node) +void OMR::CodeGenerator::traceBCDEntry(const char *str, TR::Node *node) { if (self()->traceBCDCodeGen()) traceMsg(self()->comp(),"EVAL: %s 0x%p - start\n",str,node); } -void OMR::CodeGenerator::traceBCDExit(char *str, TR::Node *node) +void OMR::CodeGenerator::traceBCDExit(const char *str, TR::Node *node) { if (self()->traceBCDCodeGen()) traceMsg(self()->comp(),"EVAL: %s 0x%p - end\n",str,node); diff --git a/compiler/codegen/OMRCodeGenerator.hpp b/compiler/codegen/OMRCodeGenerator.hpp index bbf9a27ff34..5c3fb60f6c5 100644 --- a/compiler/codegen/OMRCodeGenerator.hpp +++ b/compiler/codegen/OMRCodeGenerator.hpp @@ -1407,8 +1407,8 @@ class OMR_EXTENSIBLE CodeGenerator //Rather confusingly not used -only- in BCD related codegen. //... has leaked into non-BCD code. bool traceBCDCodeGen(); - void traceBCDEntry(char *str, TR::Node *node); - void traceBCDExit(char *str, TR::Node *node); + void traceBCDEntry(const char *str, TR::Node *node); + void traceBCDExit(const char *str, TR::Node *node); TR_BitVector *getLiveButMaybeUnreferencedLocals() {return _liveButMaybeUnreferencedLocals;} TR_BitVector *setLiveButMaybeUnreferencedLocals(TR_BitVector *v) {return (_liveButMaybeUnreferencedLocals = v);} diff --git a/compiler/ras/Debug.cpp b/compiler/ras/Debug.cpp index 935642f74c7..bc712d52eec 100644 --- a/compiler/ras/Debug.cpp +++ b/compiler/ras/Debug.cpp @@ -379,7 +379,7 @@ TR_Debug::newVariableSizeSymbol(TR::AutomaticSymbol *sym) } void -TR_Debug::addInstructionComment(TR::Instruction *instr, char * comment, ...) +TR_Debug::addInstructionComment(TR::Instruction *instr, const char * comment, ...) { TR_ASSERT(_comp, "Required compilation object is NULL.\n"); @@ -389,12 +389,12 @@ TR_Debug::addInstructionComment(TR::Instruction *instr, char * comment, ...) CS2::HashIndex hashIndex; if (_comp->getToCommentMap().Locate(instr, hashIndex)) { - List *comments = _comp->getToCommentMap().DataAt(hashIndex); + List *comments = _comp->getToCommentMap().DataAt(hashIndex); comments->add(comment); } else { - List *comments = new (_comp->trHeapMemory()) List(_comp->trMemory()); + List *comments = new (_comp->trHeapMemory()) List(_comp->trMemory()); comments->add(comment); _comp->getToCommentMap().Add(instr, comments); } diff --git a/compiler/ras/Debug.hpp b/compiler/ras/Debug.hpp index bf474d2f45a..3eea2a5fb29 100644 --- a/compiler/ras/Debug.hpp +++ b/compiler/ras/Debug.hpp @@ -422,7 +422,7 @@ class TR_Debug virtual void newRegister(TR::Register *); virtual void newVariableSizeSymbol(TR::AutomaticSymbol *sym); virtual void newInstruction(TR::Instruction *); - virtual void addInstructionComment(TR::Instruction *, char*, ...); + virtual void addInstructionComment(TR::Instruction *, const char*, ...); /** * @brief Check whether to trigger debugger breakpoint or launch debugger diff --git a/compiler/z/codegen/BinaryCommutativeAnalyser.cpp b/compiler/z/codegen/BinaryCommutativeAnalyser.cpp index 9114474fee1..7b1e819aca2 100644 --- a/compiler/z/codegen/BinaryCommutativeAnalyser.cpp +++ b/compiler/z/codegen/BinaryCommutativeAnalyser.cpp @@ -153,7 +153,7 @@ TR_S390BinaryCommutativeAnalyser::genericAnalyser(TR::Node * root, TR::InstOpCod TR::Register * nodeReg = NULL; TR::Instruction * finalInstr = NULL; TR::Compilation *comp = cg()->comp(); - char * CLOBBER_EVAL = "LR=Clobber_eval"; + const char * CLOBBER_EVAL = "LR=Clobber_eval"; TR_Debug * debugObj = cg()->getDebug(); if (cg()->whichChildToEvaluate(root) == 0) { @@ -701,7 +701,7 @@ TR_S390BinaryCommutativeAnalyser::integerAddAnalyser(TR::Node * root, TR::InstOp // which do not produce a carry. The flag would be used to prevent such optimizations when the carry is needed. /* bool setsOrReadsCC = NEED_CC(node) || (node->getOpCodeValue() == TR::luaddc) || (node->getOpCodeValue() == TR::iuaddc); */ - char * CLOBBER_EVAL = "LR=Clobber_eval"; + const char * CLOBBER_EVAL = "LR=Clobber_eval"; TR_Debug * debugObj = cg()->getDebug(); if (cg()->whichChildToEvaluate(root) == 0) { diff --git a/compiler/z/codegen/BinaryEvaluator.cpp b/compiler/z/codegen/BinaryEvaluator.cpp index 33aec66ebf4..66ecd2e7a41 100644 --- a/compiler/z/codegen/BinaryEvaluator.cpp +++ b/compiler/z/codegen/BinaryEvaluator.cpp @@ -1021,7 +1021,7 @@ iDivRemGenericEvaluator(TR::Node * node, TR::CodeGenerator * cg, bool isDivision TR::Node * secondChild = node->getSecondChild(); TR::Instruction * cursor = NULL; - char * REG_USER_DEF = "LR=Reg_user_def"; + const char * REG_USER_DEF = "LR=Reg_user_def"; TR_Debug * debugObj = cg->getDebug(); // A/A, return 1 (div) or 0 (rem). diff --git a/compiler/z/codegen/OMRMachine.cpp b/compiler/z/codegen/OMRMachine.cpp index 5f3d07253a2..758b6254ed9 100644 --- a/compiler/z/codegen/OMRMachine.cpp +++ b/compiler/z/codegen/OMRMachine.cpp @@ -186,8 +186,8 @@ OMR::Z::Machine::registerExchange(TR::CodeGenerator* cg, TR::Compilation *comp = cg->comp(); TR::Node * currentNode = precedingInstruction->getNode(); TR::Instruction * currentInstruction = NULL; - char * REG_EXCHANGE = "LR=Reg_exchg"; - char * REG_PAIR = "LR=Reg_pair"; + const char * REG_EXCHANGE = "LR=Reg_exchg"; + const char * REG_PAIR = "LR=Reg_pair"; TR_Debug * debugObj = cg->getDebug(); TR::Machine *machine = cg->machine();