Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix string literal conversion warnings in ilgen, runtime, control, ras #18470

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions runtime/compiler/control/CompilationRuntime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,24 +1120,24 @@ class CompilationInfo
int32_t computeDynamicDumbInlinerBytecodeSizeCutoff(TR::Options *options);
TR_YesNoMaybe shouldActivateNewCompThread();
#if DEBUG
void debugPrint(char *debugString);
void debugPrint(J9VMThread *, char *);
void debugPrint(char *, intptr_t);
void debugPrint(J9VMThread *, char *, IDATA);
void debugPrint(const char *debugString);
void debugPrint(J9VMThread *, const char *);
void debugPrint(const char *, intptr_t);
void debugPrint(J9VMThread *, const char *, IDATA);
void debugPrint(J9Method*);
void debugPrint(char *, J9Method *);
void debugPrint(J9VMThread *, char *, TR_MethodToBeCompiled *);
void debugPrint(char * debugString, TR::IlGeneratorMethodDetails & details, J9VMThread * vmThread);
void debugPrint(const char *, J9Method *);
void debugPrint(J9VMThread *, const char *, TR_MethodToBeCompiled *);
void debugPrint(const char * debugString, TR::IlGeneratorMethodDetails & details, J9VMThread * vmThread);
void printQueue();
#else // !DEBUG
void debugPrint(char *debugString) {}
void debugPrint(J9VMThread *, char *) {}
void debugPrint(char *, intptr_t) {}
void debugPrint(J9VMThread *, char *, IDATA) {}
void debugPrint(const char *debugString) {}
void debugPrint(J9VMThread *, const char *) {}
void debugPrint(const char *, intptr_t) {}
void debugPrint(J9VMThread *, const char *, IDATA) {}
void debugPrint(J9Method*) {}
void debugPrint(char *, J9Method *) {}
void debugPrint(J9VMThread *, char *, TR_MethodToBeCompiled *) {}
void debugPrint(char * debugString, TR::IlGeneratorMethodDetails & details, J9VMThread * vmThread) { }
void debugPrint(const char *, J9Method *) {}
void debugPrint(J9VMThread *, const char *, TR_MethodToBeCompiled *) {}
void debugPrint(const char * debugString, TR::IlGeneratorMethodDetails & details, J9VMThread * vmThread) { }
void printQueue() {}
#endif // DEBUG
void debugPrint(TR_OpaqueMethodBlock *omb){ debugPrint((J9Method*)omb); }
Expand Down
22 changes: 11 additions & 11 deletions runtime/compiler/control/CompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ TR::CompilationInfoPerThread::openRTLogFile()

if (!truncated)
{
_rtLogFile = fileOpen(TR::Options::getAOTCmdLineOptions(), jitConfig, fn, "wb", true);
_rtLogFile = fileOpen(TR::Options::getAOTCmdLineOptions(), jitConfig, fn, const_cast<char *>("wb"), true);
}
else
{
Expand Down Expand Up @@ -986,7 +986,7 @@ TR::CompilationInfoPerThread::waitForGCCycleMonitor(bool threadHasVMAccess)
#endif
}

extern char *compilationErrorNames[]; // defined in rossa.cpp
extern const char *compilationErrorNames[]; // defined in rossa.cpp

void
TR::CompilationInfoPerThreadBase::setCompilationThreadState(CompilationThreadState v)
Expand Down Expand Up @@ -1709,7 +1709,7 @@ TR_Stats statBudgetEpoch("Budget len at begining of epoch");
TR_Stats statBudgetSmallLag("Budget/comp when smallLag");
TR_Stats statBudgetMediumLag("Budget/comp when mediumLag");
TR_Stats statEpochLength("Epoch lengh (ms)");
char *eventNames[]={"SyncReq", "SmallLag", "LargeLag", "Medium-NoBudget", "Medium-highBudget", "Medium-LowBudget", "Medium-Idle"};
const char *eventNames[]={"SyncReq", "SmallLag", "LargeLag", "Medium-NoBudget", "Medium-highBudget", "Medium-LowBudget", "Medium-Idle"};
TR_StatsEvents<7> statEvents("Scenarios", eventNames, 0);
char *priorityName[]={"High","Normal"};
TR_StatsEvents<2> statLowPriority("Medium-lowBudget-priority",priorityName,0);
Expand Down Expand Up @@ -11690,15 +11690,15 @@ void TR::CompilationInfo::printCompQueue()

#if DEBUG
void
TR::CompilationInfo::debugPrint(char * debugString)
TR::CompilationInfo::debugPrint(const char *debugString)
{
if (!_traceCompiling)
return;
fprintf(stderr, "%s", debugString);
}

void
TR::CompilationInfo::debugPrint(J9VMThread * vmThread, char * debugString)
TR::CompilationInfo::debugPrint(J9VMThread *vmThread, const char *debugString)
{
if (!_traceCompiling)
return;
Expand All @@ -11707,15 +11707,15 @@ TR::CompilationInfo::debugPrint(J9VMThread * vmThread, char * debugString)
}

void
TR::CompilationInfo::debugPrint(char * debugString, intptr_t val)
TR::CompilationInfo::debugPrint(const char *debugString, intptr_t val)
{
if (!_traceCompiling)
return;
fprintf(stderr, debugString, val);
}

void
TR::CompilationInfo::debugPrint(J9VMThread * vmThread, char * debugString, IDATA val)
TR::CompilationInfo::debugPrint(J9VMThread *vmThread, const char *debugString, IDATA val)
{
if (!_traceCompiling)
return;
Expand All @@ -11724,7 +11724,7 @@ TR::CompilationInfo::debugPrint(J9VMThread * vmThread, char * debugString, IDATA
}

void
TR::CompilationInfo::debugPrint(J9Method * method)
TR::CompilationInfo::debugPrint(J9Method *method)
{
if (!_traceCompiling)
return;
Expand All @@ -11743,7 +11743,7 @@ TR::CompilationInfo::debugPrint(J9Method * method)
}

void
TR::CompilationInfo::debugPrint(char * debugString, J9Method * method)
TR::CompilationInfo::debugPrint(const char *debugString, J9Method *method)
{
if (!_traceCompiling)
return;
Expand All @@ -11753,7 +11753,7 @@ TR::CompilationInfo::debugPrint(char * debugString, J9Method * method)
}

void
TR::CompilationInfo::debugPrint(char * debugString, TR::IlGeneratorMethodDetails & details, J9VMThread * vmThread)
TR::CompilationInfo::debugPrint(const char *debugString, TR::IlGeneratorMethodDetails & details, J9VMThread *vmThread)
{
if (!_traceCompiling)
return;
Expand All @@ -11776,7 +11776,7 @@ TR::CompilationInfo::debugPrint(char * debugString, TR::IlGeneratorMethodDetails
}

void
TR::CompilationInfo::debugPrint(J9VMThread * vmThread, char * msg, TR_MethodToBeCompiled *entry)
TR::CompilationInfo::debugPrint(J9VMThread *vmThread, const char *msg, TR_MethodToBeCompiled *entry)
{
if (!_traceCompiling)
return;
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/control/DLLMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static IDATA initializeCompilerArgs(J9JavaVM* vm,

char* xCommandLineOptions = NULL;

char *VMOPT_WITH_COLON;
const char *VMOPT_WITH_COLON;
const char *fatalErrorStr = NULL;
if (isXjit)
{
Expand Down Expand Up @@ -221,8 +221,8 @@ IDATA J9VMDllMain(J9JavaVM* vm, IDATA stage, void * reserved)
J9JITConfig * jitConfig = 0;
UDATA initialFlags = 0;
J9VMDllLoadInfo* loadInfo = FIND_DLL_TABLE_ENTRY( THIS_DLL_NAME );
char* xjitCommandLineOptions = "";
char* xaotCommandLineOptions = "";
char *xjitCommandLineOptions = const_cast<char *>("");
char *xaotCommandLineOptions = const_cast<char *>("");
IDATA fullSpeedDebugSet = FALSE;
IDATA argIndex = 0;

Expand Down
12 changes: 6 additions & 6 deletions runtime/compiler/control/HookedByTheJit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ TR::OptionSet *findOptionSet(J9Method *method, bool isAOT)
return optionSet;
}

static void reportHook(J9VMThread *curThread, char *name, char *format=NULL, ...)
static void reportHook(J9VMThread *curThread, const char *name, const char *format=NULL, ...)
{
J9JITConfig * jitConfig = curThread->javaVM->jitConfig;
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
Expand All @@ -228,7 +228,7 @@ static void reportHook(J9VMThread *curThread, char *name, char *format=NULL, ...
}
}

static void reportHookFinished(J9VMThread *curThread, char *name, char *format=NULL, ...)
static void reportHookFinished(J9VMThread *curThread, const char *name, const char *format=NULL, ...)
{
J9JITConfig * jitConfig = curThread->javaVM->jitConfig;
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
Expand All @@ -246,7 +246,7 @@ static void reportHookFinished(J9VMThread *curThread, char *name, char *format=N
}
}

static void reportHookDetail(J9VMThread *curThread, char *name, char *format, ...)
static void reportHookDetail(J9VMThread *curThread, const char *name, const char *format, ...)
{
J9JITConfig * jitConfig = curThread->javaVM->jitConfig;
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
Expand Down Expand Up @@ -2513,7 +2513,7 @@ void jitClassesRedefined(J9VMThread * currentThread, UDATA classCount, J9JITRede

void jitFlushCompilationQueue(J9VMThread * currentThread, J9JITFlushCompilationQueueReason reason)
{
char *buffer = "unknown reason";
const char *buffer = "unknown reason";
if (reason == J9FlushCompQueueDataBreakpoint)
buffer = "DataBreakpoint";
else
Expand Down Expand Up @@ -4458,7 +4458,7 @@ static void samplingObservationsLogic(J9JITConfig * jitConfig, TR::CompilationIn
compInfo->_stats._methodsSampleWindowReset = 0;
}

char* jitStateNames[]=
const char* jitStateNames[]=
{
"UNDEFINED",
"IDLE ",
Expand Down Expand Up @@ -5541,7 +5541,7 @@ static void initJitGCMapCheckAsyncHook(J9JavaVM * vm, IDATA handlerKey, J9JITCon


//int32_t samplerThreadStateFrequencies[TR::CompilationInfo::SAMPLER_LAST_STATE+1] = {0, 2, 1000, 100000, INT_MAX, INT_MAX, -1};
char* samplerThreadStateNames[TR::CompilationInfo::SAMPLER_LAST_STATE+1] =
const char* samplerThreadStateNames[TR::CompilationInfo::SAMPLER_LAST_STATE+1] =
{
"NOT_INITIALIZED",
"DEFAULT",
Expand Down
Loading