Skip to content

Commit

Permalink
Fix string literal conversion warnings in compiler/ras
Browse files Browse the repository at this point in the history
Fix string literal conversion warnings in compiler/ras

Signed-off-by: Dylan Tuttle <[email protected]>
  • Loading branch information
dylanjtuttle committed Nov 27, 2023
1 parent 391591a commit c134038
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 45 deletions.
18 changes: 9 additions & 9 deletions compiler/ras/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ TR_Debug::printPrefix(TR::FILE *pOutFile, TR::Instruction *instr, uint8_t *curso
}
else if (_registerAssignmentTraceFlags & TRACERA_IN_PROGRESS)
{
char *spaces = " ";
const char *spaces = " ";
int16_t padding = 30 - _registerAssignmentTraceCursor;

if (padding < 0)
Expand Down Expand Up @@ -1803,7 +1803,7 @@ TR_Debug::getAutoName(TR::SymbolReference * symRef)
else if (slot < getOwningMethodSymbol(symRef)->getFirstJitTempIndex())
{
int debugNameLen;
char *debugName = getOwningMethod(symRef)->localName(slot, 0, debugNameLen, comp()->trMemory()); // TODO: Proper bcIndex somehow; TODO: proper length
const char *debugName = getOwningMethod(symRef)->localName(slot, 0, debugNameLen, comp()->trMemory()); // TODO: Proper bcIndex somehow; TODO: proper length
if (!debugName)
{
debugName = "";
Expand Down Expand Up @@ -1850,8 +1850,8 @@ TR_Debug::getParmName(TR::SymbolReference * symRef)
int32_t debugNameLen, signatureLen;
int32_t slot = symRef->getCPIndex();
const char * s = symRef->getSymbol()->castToParmSymbol()->getTypeSignature(signatureLen);
char *debugName = getOwningMethod(symRef)->localName(slot, 0, debugNameLen, comp()->trMemory()); // TODO: Proper bcIndex somehow; TODO: proper length
char * buf;
const char *debugName = getOwningMethod(symRef)->localName(slot, 0, debugNameLen, comp()->trMemory()); // TODO: Proper bcIndex somehow; TODO: proper length
char *buf;

if (!debugName)
{
Expand Down Expand Up @@ -1937,7 +1937,7 @@ TR_Debug::getStaticName(TR::SymbolReference * symRef)
TR::StackMemoryRegion stackMemoryRegion(*comp()->trMemory());
char *contents = NULL;
intptr_t length = 0, prefixLength = 0, suffixOffset = 0;
char *etc = "";
const char *etc = "";
const intptr_t LENGTH_LIMIT=80;
const intptr_t PIECE_LIMIT=20;

Expand Down Expand Up @@ -4949,18 +4949,18 @@ void TR_Debug::setupDebugger(void *addr)
char cfname[20];
FILE *cf;
char pp[20];
char * Argv[20];
char *Argv[20];

yield();
sprintf(cfname, "_%" OMR_PRId64 "_", (int64_t)getpid());
sprintf(pp, "%" OMR_PRId64, (int64_t)ppid);
Argv[1] = "-a";
Argv[1] = (char *)"-a";
Argv[2] = pp;
Argv[3] = NULL;

if ((Argv[0] = ::feGetEnv("TR_DEBUGGER")) == NULL)
{
Argv[0] = "/usr/bin/dbx";
Argv[0] = (char *)"/usr/bin/dbx";
if ((cf = fopen(cfname, "wb+")) == 0)
cfname[0] = '\0';
else
Expand All @@ -4972,7 +4972,7 @@ void TR_Debug::setupDebugger(void *addr)
fprintf(cf, "cont SIGCONT\n");
fclose(cf);

Argv[3] = "-c";
Argv[3] = (char *)"-c";
Argv[4] = cfname;
Argv[5] = NULL;
}
Expand Down
10 changes: 5 additions & 5 deletions compiler/ras/Debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,11 @@ class TR_Debug
virtual int32_t findLogFile(const char *logFileName, TR::Options *aotCmdLineOptions, TR::Options *jitCmdLineOptions, TR::Options **optionsArray, int32_t arraySize);
virtual void dumpOptionHelp(TR::OptionTable *jitOptions, TR::OptionTable *feOptions, TR::SimpleRegex *nameFilter);

static void dumpOptions(char *optionsType, char *options, char *envOptions, TR::Options *cmdLineOptions, TR::OptionTable *jitOptions, TR::OptionTable *feOptions, void *, TR_FrontEnd *);
virtual char * limitfileOption(char *, void *, TR::OptionTable *, TR::Options *, bool loadLimit, TR_PseudoRandomNumbersListElement **pseudoRandomListHeadPtr = 0);
virtual char * inlinefileOption(char *, void *, TR::OptionTable *, TR::Options *);
virtual char * limitOption(char *, void *, TR::OptionTable *, TR::Options *, bool loadLimit);
char * limitOption(char *, void *, TR::OptionTable *, TR::Options *, TR::CompilationFilters * &);
static void dumpOptions(const char *optionsType, const char *options, const char *envOptions, TR::Options *cmdLineOptions, TR::OptionTable *jitOptions, TR::OptionTable *feOptions, void *, TR_FrontEnd *);
virtual const char * limitfileOption(const char *, void *, TR::OptionTable *, TR::Options *, bool loadLimit, TR_PseudoRandomNumbersListElement **pseudoRandomListHeadPtr = 0);
virtual const char * inlinefileOption(const char *, void *, TR::OptionTable *, TR::Options *);
virtual const char * limitOption(const char *, void *, TR::OptionTable *, TR::Options *, bool loadLimit);
const char * limitOption(const char *, void *, TR::OptionTable *, TR::Options *, TR::CompilationFilters * &);
virtual int32_t * loadCustomStrategy(char *optFileName);
virtual bool methodCanBeCompiled(TR_Memory *mem, TR_ResolvedMethod *, TR_FilterBST * &);
virtual bool methodCanBeRelocated(TR_Memory *mem, TR_ResolvedMethod *, TR_FilterBST * &);
Expand Down
2 changes: 1 addition & 1 deletion compiler/ras/ILValidationRules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void TR::ValidateLivenessBoundaries::updateNodeState(TR::Node *node,
if (!liveNodes.isEmpty())
{
traceMsg(comp(), " -- Live nodes: {");
char *separator = "";
const char *separator = "";
for (TR::LiveNodeWindow::Iterator lnwi(liveNodes); lnwi.currentNode(); ++lnwi)
{
traceMsg(comp(), "%sn%dn", separator,
Expand Down
30 changes: 15 additions & 15 deletions compiler/ras/LimitFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ TR_Debug::scanInlineFilters(FILE * inlineFile, int32_t & lineNumber, TR::Compila
* The unmodified parameter option if there is a problem with the file, aborting JIT initialization.
* Otherwise a pointer to the next comma or NULL.
*/
char *
TR_Debug::inlinefileOption(char *option, void *base, TR::OptionTable *entry, TR::Options * cmdLineOptions)
const char *
TR_Debug::inlinefileOption(const char *option, void *base, TR::OptionTable *entry, TR::Options *cmdLineOptions)
{
char *endOpt = option;
char *name = option;
char *fail = option;
char *endOpt = (char *)option;
const char *name = option;
const char *fail = option;

// move to the end of this option
for (; *endOpt && *endOpt != ','; endOpt++)
Expand Down Expand Up @@ -406,12 +406,12 @@ TR_Debug::inlinefileOption(char *option, void *base, TR::OptionTable *entry, TR:
* The unmodified parameter option if there is a problem with the file, aborting JIT initialization.
* Otherwise a pointer to the next comma or NULL.
*/
char *
TR_Debug::limitfileOption(char *option, void *base, TR::OptionTable *entry, TR::Options * cmdLineOptions, bool loadLimit, TR_PseudoRandomNumbersListElement **pseudoRandomListHeadPtr)
const char *
TR_Debug::limitfileOption(const char *option, void *base, TR::OptionTable *entry, TR::Options * cmdLineOptions, bool loadLimit, TR_PseudoRandomNumbersListElement **pseudoRandomListHeadPtr)
{
char *endOpt = option;
char *name = option;
char *fail = option;
char *endOpt = (char *)option;
const char *name = option;
const char *fail = option;

bool range = false;
if (*endOpt == '(')
Expand Down Expand Up @@ -611,10 +611,10 @@ TR_Debug::limitfileOption(char *option, void *base, TR::OptionTable *entry, TR::
return endOpt;
}

char *
TR_Debug::limitOption(char *option, void *base, TR::OptionTable *entry, TR::Options * cmdLineOptions, TR::CompilationFilters *&filters)
const char *
TR_Debug::limitOption(const char *option, void *base, TR::OptionTable *entry, TR::Options * cmdLineOptions, TR::CompilationFilters *&filters)
{
char *p = option;
char *p = (char *)option;

filters = findOrCreateFilters(filters);
TR_FilterBST *filter = addFilter(p, static_cast<int32_t>(entry->parm1), 0, 0, filters);
Expand Down Expand Up @@ -682,8 +682,8 @@ TR_Debug::limitOption(char *option, void *base, TR::OptionTable *entry, TR::Opti
return p;
}

char *
TR_Debug::limitOption(char *option, void *base, TR::OptionTable *entry, TR::Options * cmdLineOptions, bool loadLimit)
const char *
TR_Debug::limitOption(const char *option, void *base, TR::OptionTable *entry, TR::Options * cmdLineOptions, bool loadLimit)
{
if (loadLimit)
{
Expand Down
28 changes: 14 additions & 14 deletions compiler/ras/OptionsDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@
#define DEFAULT_OPTION_LINE_WIDTH 80

static char optionCategories[] = {' ','C','O','L','D','R','I','M',0}; // Must match categories[] in codegen.dev/Options.cpp
static char *optionCategoryNames[] = {"\nGeneral options:\n",
"\nCode generation options:\n",
"\nOptimization options:\n",
"\nLogging and display options:\n",
"\nDebugging options:\n",
"\nRecompilation and profiling options:\n",
"\nInternal options:\n",
"\nOther options:\n",
0 // Fail quickly if we run past the end of this array
};
static const char *optionCategoryNames[] = {"\nGeneral options:\n",
"\nCode generation options:\n",
"\nOptimization options:\n",
"\nLogging and display options:\n",
"\nDebugging options:\n",
"\nRecompilation and profiling options:\n",
"\nInternal options:\n",
"\nOther options:\n",
0 // Fail quickly if we run past the end of this array
};



Expand Down Expand Up @@ -280,9 +280,9 @@ void TR_Debug::dumpOptionHelp(TR::OptionTable * firstOjit, TR::OptionTable * fir

void
TR_Debug::dumpOptions(
char *optionsType,
char *options,
char *envOptions,
const char *optionsType,
const char *options,
const char *envOptions,
TR::Options *cmdLineOptions,
TR::OptionTable *ojit,
TR::OptionTable *ofe,
Expand Down Expand Up @@ -493,7 +493,7 @@ TR_Debug::dumpOptions(
//since java uses different function, we need to check for that to get our verbose options printed
TR_VerboseLog::write("{");
base = (char*)cmdLineOptions;
char *sep = "";
const char *sep = "";
for (int i=0; i < TR_NumVerboseOptions; i++)
{
TR_VerboseFlags flag = (TR_VerboseFlags)i;
Expand Down
2 changes: 1 addition & 1 deletion compiler/ras/Tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,7 @@ TR_Debug::printNodeInfo(TR::Node * node, TR_PrettyPrinterString& output, bool pr
{
output.appends(" ; array type is ");

char *typeStr;
const char *typeStr;
switch (node->getInt())
{
case 4:
Expand Down

0 comments on commit c134038

Please sign in to comment.