Skip to content

Commit d53d4a1

Browse files
authored
Merge pull request #18470 from dylanjtuttle/constCharStep3
Fix string literal conversion warnings in ilgen, runtime, control, ras
2 parents c51c0a0 + 473941f commit d53d4a1

25 files changed

+318
-318
lines changed

runtime/compiler/control/CompilationRuntime.hpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,24 +1119,24 @@ class CompilationInfo
11191119
int32_t computeDynamicDumbInlinerBytecodeSizeCutoff(TR::Options *options);
11201120
TR_YesNoMaybe shouldActivateNewCompThread();
11211121
#if DEBUG
1122-
void debugPrint(char *debugString);
1123-
void debugPrint(J9VMThread *, char *);
1124-
void debugPrint(char *, intptr_t);
1125-
void debugPrint(J9VMThread *, char *, IDATA);
1122+
void debugPrint(const char *debugString);
1123+
void debugPrint(J9VMThread *, const char *);
1124+
void debugPrint(const char *, intptr_t);
1125+
void debugPrint(J9VMThread *, const char *, IDATA);
11261126
void debugPrint(J9Method*);
1127-
void debugPrint(char *, J9Method *);
1128-
void debugPrint(J9VMThread *, char *, TR_MethodToBeCompiled *);
1129-
void debugPrint(char * debugString, TR::IlGeneratorMethodDetails & details, J9VMThread * vmThread);
1127+
void debugPrint(const char *, J9Method *);
1128+
void debugPrint(J9VMThread *, const char *, TR_MethodToBeCompiled *);
1129+
void debugPrint(const char * debugString, TR::IlGeneratorMethodDetails & details, J9VMThread * vmThread);
11301130
void printQueue();
11311131
#else // !DEBUG
1132-
void debugPrint(char *debugString) {}
1133-
void debugPrint(J9VMThread *, char *) {}
1134-
void debugPrint(char *, intptr_t) {}
1135-
void debugPrint(J9VMThread *, char *, IDATA) {}
1132+
void debugPrint(const char *debugString) {}
1133+
void debugPrint(J9VMThread *, const char *) {}
1134+
void debugPrint(const char *, intptr_t) {}
1135+
void debugPrint(J9VMThread *, const char *, IDATA) {}
11361136
void debugPrint(J9Method*) {}
1137-
void debugPrint(char *, J9Method *) {}
1138-
void debugPrint(J9VMThread *, char *, TR_MethodToBeCompiled *) {}
1139-
void debugPrint(char * debugString, TR::IlGeneratorMethodDetails & details, J9VMThread * vmThread) { }
1137+
void debugPrint(const char *, J9Method *) {}
1138+
void debugPrint(J9VMThread *, const char *, TR_MethodToBeCompiled *) {}
1139+
void debugPrint(const char * debugString, TR::IlGeneratorMethodDetails & details, J9VMThread * vmThread) { }
11401140
void printQueue() {}
11411141
#endif // DEBUG
11421142
void debugPrint(TR_OpaqueMethodBlock *omb){ debugPrint((J9Method*)omb); }

runtime/compiler/control/CompilationThread.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ TR::CompilationInfoPerThread::openRTLogFile()
887887

888888
if (!truncated)
889889
{
890-
_rtLogFile = fileOpen(TR::Options::getAOTCmdLineOptions(), jitConfig, fn, "wb", true);
890+
_rtLogFile = fileOpen(TR::Options::getAOTCmdLineOptions(), jitConfig, fn, const_cast<char *>("wb"), true);
891891
}
892892
else
893893
{
@@ -986,7 +986,7 @@ TR::CompilationInfoPerThread::waitForGCCycleMonitor(bool threadHasVMAccess)
986986
#endif
987987
}
988988

989-
extern char *compilationErrorNames[]; // defined in rossa.cpp
989+
extern const char *compilationErrorNames[]; // defined in rossa.cpp
990990

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

1176211762
#if DEBUG
1176311763
void
11764-
TR::CompilationInfo::debugPrint(char * debugString)
11764+
TR::CompilationInfo::debugPrint(const char *debugString)
1176511765
{
1176611766
if (!_traceCompiling)
1176711767
return;
1176811768
fprintf(stderr, "%s", debugString);
1176911769
}
1177011770

1177111771
void
11772-
TR::CompilationInfo::debugPrint(J9VMThread * vmThread, char * debugString)
11772+
TR::CompilationInfo::debugPrint(J9VMThread *vmThread, const char *debugString)
1177311773
{
1177411774
if (!_traceCompiling)
1177511775
return;
@@ -11778,15 +11778,15 @@ TR::CompilationInfo::debugPrint(J9VMThread * vmThread, char * debugString)
1177811778
}
1177911779

1178011780
void
11781-
TR::CompilationInfo::debugPrint(char * debugString, intptr_t val)
11781+
TR::CompilationInfo::debugPrint(const char *debugString, intptr_t val)
1178211782
{
1178311783
if (!_traceCompiling)
1178411784
return;
1178511785
fprintf(stderr, debugString, val);
1178611786
}
1178711787

1178811788
void
11789-
TR::CompilationInfo::debugPrint(J9VMThread * vmThread, char * debugString, IDATA val)
11789+
TR::CompilationInfo::debugPrint(J9VMThread *vmThread, const char *debugString, IDATA val)
1179011790
{
1179111791
if (!_traceCompiling)
1179211792
return;
@@ -11795,7 +11795,7 @@ TR::CompilationInfo::debugPrint(J9VMThread * vmThread, char * debugString, IDATA
1179511795
}
1179611796

1179711797
void
11798-
TR::CompilationInfo::debugPrint(J9Method * method)
11798+
TR::CompilationInfo::debugPrint(J9Method *method)
1179911799
{
1180011800
if (!_traceCompiling)
1180111801
return;
@@ -11814,7 +11814,7 @@ TR::CompilationInfo::debugPrint(J9Method * method)
1181411814
}
1181511815

1181611816
void
11817-
TR::CompilationInfo::debugPrint(char * debugString, J9Method * method)
11817+
TR::CompilationInfo::debugPrint(const char *debugString, J9Method *method)
1181811818
{
1181911819
if (!_traceCompiling)
1182011820
return;
@@ -11824,7 +11824,7 @@ TR::CompilationInfo::debugPrint(char * debugString, J9Method * method)
1182411824
}
1182511825

1182611826
void
11827-
TR::CompilationInfo::debugPrint(char * debugString, TR::IlGeneratorMethodDetails & details, J9VMThread * vmThread)
11827+
TR::CompilationInfo::debugPrint(const char *debugString, TR::IlGeneratorMethodDetails & details, J9VMThread *vmThread)
1182811828
{
1182911829
if (!_traceCompiling)
1183011830
return;
@@ -11847,7 +11847,7 @@ TR::CompilationInfo::debugPrint(char * debugString, TR::IlGeneratorMethodDetails
1184711847
}
1184811848

1184911849
void
11850-
TR::CompilationInfo::debugPrint(J9VMThread * vmThread, char * msg, TR_MethodToBeCompiled *entry)
11850+
TR::CompilationInfo::debugPrint(J9VMThread *vmThread, const char *msg, TR_MethodToBeCompiled *entry)
1185111851
{
1185211852
if (!_traceCompiling)
1185311853
return;

runtime/compiler/control/DLLMain.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static IDATA initializeCompilerArgs(J9JavaVM* vm,
6767

6868
char* xCommandLineOptions = NULL;
6969

70-
char *VMOPT_WITH_COLON;
70+
const char *VMOPT_WITH_COLON;
7171
const char *fatalErrorStr = NULL;
7272
if (isXjit)
7373
{
@@ -221,8 +221,8 @@ IDATA J9VMDllMain(J9JavaVM* vm, IDATA stage, void * reserved)
221221
J9JITConfig * jitConfig = 0;
222222
UDATA initialFlags = 0;
223223
J9VMDllLoadInfo* loadInfo = FIND_DLL_TABLE_ENTRY( THIS_DLL_NAME );
224-
char* xjitCommandLineOptions = "";
225-
char* xaotCommandLineOptions = "";
224+
char *xjitCommandLineOptions = const_cast<char *>("");
225+
char *xaotCommandLineOptions = const_cast<char *>("");
226226
IDATA fullSpeedDebugSet = FALSE;
227227
IDATA argIndex = 0;
228228

runtime/compiler/control/HookedByTheJit.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ TR::OptionSet *findOptionSet(J9Method *method, bool isAOT)
208208
return optionSet;
209209
}
210210

211-
static void reportHook(J9VMThread *curThread, char *name, char *format=NULL, ...)
211+
static void reportHook(J9VMThread *curThread, const char *name, const char *format=NULL, ...)
212212
{
213213
J9JITConfig * jitConfig = curThread->javaVM->jitConfig;
214214
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
@@ -228,7 +228,7 @@ static void reportHook(J9VMThread *curThread, char *name, char *format=NULL, ...
228228
}
229229
}
230230

231-
static void reportHookFinished(J9VMThread *curThread, char *name, char *format=NULL, ...)
231+
static void reportHookFinished(J9VMThread *curThread, const char *name, const char *format=NULL, ...)
232232
{
233233
J9JITConfig * jitConfig = curThread->javaVM->jitConfig;
234234
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
@@ -246,7 +246,7 @@ static void reportHookFinished(J9VMThread *curThread, char *name, char *format=N
246246
}
247247
}
248248

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

25142514
void jitFlushCompilationQueue(J9VMThread * currentThread, J9JITFlushCompilationQueueReason reason)
25152515
{
2516-
char *buffer = "unknown reason";
2516+
const char *buffer = "unknown reason";
25172517
if (reason == J9FlushCompQueueDataBreakpoint)
25182518
buffer = "DataBreakpoint";
25192519
else
@@ -4458,7 +4458,7 @@ static void samplingObservationsLogic(J9JITConfig * jitConfig, TR::CompilationIn
44584458
compInfo->_stats._methodsSampleWindowReset = 0;
44594459
}
44604460

4461-
char* jitStateNames[]=
4461+
const char* jitStateNames[]=
44624462
{
44634463
"UNDEFINED",
44644464
"IDLE ",
@@ -5541,7 +5541,7 @@ static void initJitGCMapCheckAsyncHook(J9JavaVM * vm, IDATA handlerKey, J9JITCon
55415541

55425542

55435543
//int32_t samplerThreadStateFrequencies[TR::CompilationInfo::SAMPLER_LAST_STATE+1] = {0, 2, 1000, 100000, INT_MAX, INT_MAX, -1};
5544-
char* samplerThreadStateNames[TR::CompilationInfo::SAMPLER_LAST_STATE+1] =
5544+
const char* samplerThreadStateNames[TR::CompilationInfo::SAMPLER_LAST_STATE+1] =
55455545
{
55465546
"NOT_INITIALIZED",
55475547
"DEFAULT",

0 commit comments

Comments
 (0)