Skip to content

Commit

Permalink
Change methods to use const char *
Browse files Browse the repository at this point in the history
Fixes many warnings when passing in string literal

Signed-off-by: Matthew Hall <[email protected]>
  • Loading branch information
matthewhall2 committed Aug 22, 2024
1 parent 32daf17 commit 6656659
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions compiler/codegen/OMRCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions compiler/codegen/OMRCodeGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);}
Expand Down
2 changes: 1 addition & 1 deletion compiler/compile/CompilationTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ typedef CS2::LexicalBlockTimer<TR::Allocator> LexicalTimer;
// for TR_Debug usage
typedef CS2::HashTable<void*, intptr_t, TR::Allocator> ToNumberMap;
typedef CS2::HashTable<void*, char*, TR::Allocator> ToStringMap;
typedef CS2::HashTable<void*, List<char>*, TR::Allocator> ToCommentMap;
typedef CS2::HashTable<void*, List<const char>*, TR::Allocator> ToCommentMap;



Expand Down
6 changes: 3 additions & 3 deletions compiler/ras/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -389,12 +389,12 @@ TR_Debug::addInstructionComment(TR::Instruction *instr, char * comment, ...)
CS2::HashIndex hashIndex;
if (_comp->getToCommentMap().Locate(instr, hashIndex))
{
List<char> *comments = _comp->getToCommentMap().DataAt(hashIndex);
List<const char> *comments = _comp->getToCommentMap().DataAt(hashIndex);
comments->add(comment);
}
else
{
List<char> *comments = new (_comp->trHeapMemory()) List<char>(_comp->trMemory());
List<const char> *comments = new (_comp->trHeapMemory()) List<const char>(_comp->trMemory());
comments->add(comment);
_comp->getToCommentMap().Add(instr, comments);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/ras/Debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions compiler/z/codegen/BinaryCommutativeAnalyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/z/codegen/BinaryEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions compiler/z/codegen/OMRMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 6656659

Please sign in to comment.