Skip to content

Commit

Permalink
Merge pull request #18465 from dylanjtuttle/constCharAnyTime
Browse files Browse the repository at this point in the history
Fix string literal conversion warnings in codegen and il
  • Loading branch information
hzongaro authored Dec 13, 2023
2 parents d53d4a1 + 874fe48 commit 9785c66
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
10 changes: 5 additions & 5 deletions runtime/compiler/codegen/CodeGenGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static const char* getOpCodeName(TR::ILOpCodes opcode) {
}


char *nvvmTypeNames[TR::NumOMRTypes] =
const char *nvvmTypeNames[TR::NumOMRTypes] =
{
"void", // TR::NoType
"i8", // TR::Int8
Expand All @@ -515,7 +515,7 @@ static const char* getTypeName(TR::DataType type) {
}
}

char *nvvmVarTypeNames[TR::NumOMRTypes] =
const char *nvvmVarTypeNames[TR::NumOMRTypes] =
{
"void", // TR::NoType
"i8", // TR::Int8
Expand Down Expand Up @@ -572,7 +572,7 @@ class NVVMIRBuffer
buffer = (char*)m->allocateHeapMemory(size);
s = buffer;
}
void print(char *format, ...)
void print(const char *format, ...)
{
va_list args;
va_start (args, format);
Expand Down Expand Up @@ -671,7 +671,7 @@ static void getNodeName(TR::Node* node, char * s, TR::Compilation *comp)
}
}

char* getNVVMMathFunctionName(TR::Node *node)
const char* getNVVMMathFunctionName(TR::Node *node)
{
switch (((TR::MethodSymbol*)node->getSymbolReference()->getSymbol())->getRecognizedMethod())
{
Expand Down Expand Up @@ -1121,7 +1121,7 @@ bool isThisPointer(TR::SymbolReference * symRef)
((TR::ParameterSymbol *)symRef->getSymbol())->getSlot() == 0;
}

char * getTypeNameFromSignature(char* sig, int32_t sigLength)
const char *getTypeNameFromSignature(char* sig, int32_t sigLength)
{
TR_ASSERT(sigLength == 2 && sig[0] == '[', "only handling static shared arrays");
switch (sig[1])
Expand Down
8 changes: 4 additions & 4 deletions runtime/compiler/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ J9::CodeGenerator::lowerTreeIfNeeded(
//Anchoring node to either extract register pressure(performance)
//or ensure instanceof doesn't have a parent node of CALL (correctness)
//
char *anchoringReason = "register hog";
const char *anchoringReason = "register hog";
switch (node->getOpCodeValue())
{
// Extract heavy register pressure trees when dictated at the start of the walk
Expand Down Expand Up @@ -2977,7 +2977,7 @@ void J9::CodeGenerator::addExternalRelocation(TR::Relocation *r, TR::RelocationD
#endif /* defined(J9VM_OPT_JITSERVER) */

void J9::CodeGenerator::addProjectSpecializedRelocation(uint8_t *location, uint8_t *target, uint8_t *target2,
TR_ExternalRelocationTargetKind kind, char *generatingFileName, uintptr_t generatingLineNumber, TR::Node *node)
TR_ExternalRelocationTargetKind kind, const char *generatingFileName, uintptr_t generatingLineNumber, TR::Node *node)
{
(target2 == NULL) ?
self()->addExternalRelocation(
Expand All @@ -3002,7 +3002,7 @@ void J9::CodeGenerator::addProjectSpecializedRelocation(uint8_t *location, uint8
}

void J9::CodeGenerator::addProjectSpecializedRelocation(TR::Instruction *instr, uint8_t *target, uint8_t *target2,
TR_ExternalRelocationTargetKind kind, char *generatingFileName, uintptr_t generatingLineNumber, TR::Node *node)
TR_ExternalRelocationTargetKind kind, const char *generatingFileName, uintptr_t generatingLineNumber, TR::Node *node)
{
(target2 == NULL) ?
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::BeforeBinaryEncodingExternalRelocation(instr, target, kind, self()),
Expand All @@ -3012,7 +3012,7 @@ void J9::CodeGenerator::addProjectSpecializedRelocation(TR::Instruction *instr,
}

void J9::CodeGenerator::addProjectSpecializedPairRelocation(uint8_t *location, uint8_t *location2, uint8_t *target,
TR_ExternalRelocationTargetKind kind, char *generatingFileName, uintptr_t generatingLineNumber, TR::Node *node)
TR_ExternalRelocationTargetKind kind, const char *generatingFileName, uintptr_t generatingLineNumber, TR::Node *node)
{
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalOrderedPair32BitRelocation(location, location2, target, kind, self()),
generatingFileName, generatingLineNumber, node);
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/codegen/J9CodeGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,23 @@ class OMR_EXTENSIBLE CodeGenerator : public OMR::CodeGeneratorConnector
uint8_t *target,
uint8_t *target2, //pass in NULL when no target2
TR_ExternalRelocationTargetKind kind,
char *generatingFileName,
const char *generatingFileName,
uintptr_t generatingLineNumber,
TR::Node *node);
//TR::ExternalOrderedPair32BitRelocation
void addProjectSpecializedPairRelocation(uint8_t *location1,
uint8_t *location2,
uint8_t *target,
TR_ExternalRelocationTargetKind kind,
char *generatingFileName,
const char *generatingFileName,
uintptr_t generatingLineNumber,
TR::Node *node);
//TR::BeforeBinaryEncodingExternalRelocation
void addProjectSpecializedRelocation(TR::Instruction *instr,
uint8_t *target,
uint8_t *target2, //pass in NULL when no target2
TR_ExternalRelocationTargetKind kind,
char *generatingFileName,
const char *generatingFileName,
uintptr_t generatingLineNumber,
TR::Node *node);

Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/il/J9DataTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const int32_t packedDecimalPrecisionToByteLengthMap[TR_MAX_DECIMAL_PRECISION+1]



char *J9::DataType::_TR_RawBCDSignCodeNames[num_raw_bcd_sign_codes] =
const char *J9::DataType::_TR_RawBCDSignCodeNames[num_raw_bcd_sign_codes] =
{
"raw_bcd_sign_unknown",
"0xc",
Expand All @@ -163,7 +163,7 @@ int32_t J9::DataType::_TR_RawBCDSignCodeValues[num_raw_bcd_sign_codes] =
0xf, // raw_bcd_sign_0xf
};

char *J9::DataType::_TR_BCDSignCodeNames[num_bcd_sign_codes] =
const char *J9::DataType::_TR_BCDSignCodeNames[num_bcd_sign_codes] =
{
"bcd_sign_unknown",
"plus",
Expand Down
14 changes: 7 additions & 7 deletions runtime/compiler/il/J9DataTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,20 @@ class OMR_EXTENSIBLE DataType : public OMR::DataTypeConnector
return bcd_invalid_sign;
}

static char *getName(TR_RawBCDSignCode s)
static const char *getName(TR_RawBCDSignCode s)
{
if (s < num_raw_bcd_sign_codes)
return _TR_RawBCDSignCodeNames[s];
else
return (char*)"unknown raw sign";
return "unknown raw sign";
}

static char *getName(TR_BCDSignCode s)
static const char *getName(TR_BCDSignCode s)
{
if (s < num_bcd_sign_codes)
return _TR_BCDSignCodeNames[s];
else
return (char*)"unknown bcd sign";
return "unknown bcd sign";
}

static int32_t getValue(TR_RawBCDSignCode s)
Expand Down Expand Up @@ -345,9 +345,9 @@ class OMR_EXTENSIBLE DataType : public OMR::DataTypeConnector
static bool normalizedSignIsNegative(TR::DataType dt, TR_BCDSignCode normalizedSign);

private:
static char* _TR_RawBCDSignCodeNames[num_raw_bcd_sign_codes];
static int32_t _TR_RawBCDSignCodeValues[num_raw_bcd_sign_codes];
static char* _TR_BCDSignCodeNames[num_bcd_sign_codes];
static const char* _TR_RawBCDSignCodeNames[num_raw_bcd_sign_codes];
static int32_t _TR_RawBCDSignCodeValues[num_raw_bcd_sign_codes];
static const char* _TR_BCDSignCodeNames[num_bcd_sign_codes];
};

}
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/il/J9Symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ J9::Symbol::searchRecognizedField(TR::Compilation * comp, TR_ResolvedMethod * ow
int32_t totalLen;
char *fieldName;
fieldName = owningMethod->staticName(cpIndex, totalLen, comp->trMemory()); // totalLen = strlen("<class>" + "<field>" + "<sig>") + 3
static char *assertionsDisabledStr = "$assertionsDisabled Z";
static const char *assertionsDisabledStr = "$assertionsDisabled Z";
//string will be of the form "<class>.$assertionsDisabled Z"
if (declaringClass
&& totalLen >= 22
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/il/J9SymbolReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ SymbolReference::SymbolReference(
}


static char * dataTypeToSig[] = {0,"B","Z","C","S","I","J","F","D",0,0,0};
static const char *dataTypeToSig[] = {0, "B", "Z", "C", "S", "I", "J", "F", "D", 0, 0, 0};

/**
* This method is used when _cpIndex is to be used for resolution.
Expand Down
14 changes: 7 additions & 7 deletions runtime/compiler/runtime/RelocationRuntime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,17 +301,17 @@ class TR_RelocationRuntime {
virtual bool validateAOTHeader(TR_FrontEnd *fe, J9VMThread *curThread);
virtual OMRProcessorDesc getProcessorDescriptionFromSCC(J9VMThread *curThread);

static uintptr_t getGlobalValue(uint32_t g)
static uintptr_t getGlobalValue(uint32_t g)
{
TR_ASSERT(g >= 0 && g < TR_NumGlobalValueItems, "invalid index for global item");
return _globalValueList[g];
}
static void setGlobalValue(uint32_t g, uintptr_t v)
static void setGlobalValue(uint32_t g, uintptr_t v)
{
TR_ASSERT(g >= 0 && g < TR_NumGlobalValueItems, "invalid index for global item");
_globalValueList[g] = v;
}
static const char * nameOfGlobal(uint32_t g)
static const char *nameOfGlobal(uint32_t g)
{
TR_ASSERT(g >= 0 && g < TR_NumGlobalValueItems, "invalid index for global item");
return _globalValueNames[g];
Expand Down Expand Up @@ -385,10 +385,10 @@ class TR_RelocationRuntime {
TR_AotRelocationCleanUp _relocationStatus;
void relocationFailureCleanup();

static bool _globalValuesInitialized;
static uintptr_t _globalValueList[TR_NumGlobalValueItems];
static uint8_t _globalValueSizeList[TR_NumGlobalValueItems];
static const char *_globalValueNames[TR_NumGlobalValueItems];
static bool _globalValuesInitialized;
static uintptr_t _globalValueList[TR_NumGlobalValueItems];
static uint8_t _globalValueSizeList[TR_NumGlobalValueItems];
static const char *_globalValueNames[TR_NumGlobalValueItems];

TR_RelocationErrorCode _reloErrorCode;
static const char *_reloErrorCodeNames[];
Expand Down

0 comments on commit 9785c66

Please sign in to comment.