diff --git a/compiler/il/OMRResolvedMethodSymbol.cpp b/compiler/il/OMRResolvedMethodSymbol.cpp index e2d32b2a585..b541155e4d2 100644 --- a/compiler/il/OMRResolvedMethodSymbol.cpp +++ b/compiler/il/OMRResolvedMethodSymbol.cpp @@ -268,7 +268,7 @@ bcIndexForFakeInduce(TR::Compilation* comp, int16_t* callSiteInsertionPoint, if (!p) break; strncpy(signatureRegex, p, temp - p); signatureRegex[temp-p] = '\0'; - char* tempRegex = signatureRegex; + const char *tempRegex = (const char *)signatureRegex; TR::SimpleRegex* regex = TR::SimpleRegex::create(tempRegex); if (regex) { diff --git a/compiler/infra/InterferenceGraph.cpp b/compiler/infra/InterferenceGraph.cpp index 17538f0726b..c6e2b5f8d64 100644 --- a/compiler/infra/InterferenceGraph.cpp +++ b/compiler/infra/InterferenceGraph.cpp @@ -503,7 +503,7 @@ bool TR_InterferenceGraph::select() #ifdef DEBUG -void TR_InterferenceGraph::dumpIG(char *msg) +void TR_InterferenceGraph::dumpIG(const char *msg) { if (msg) { diff --git a/compiler/infra/InterferenceGraph.hpp b/compiler/infra/InterferenceGraph.hpp index 59d7adc84a7..251be599b84 100644 --- a/compiler/infra/InterferenceGraph.hpp +++ b/compiler/infra/InterferenceGraph.hpp @@ -144,9 +144,9 @@ class TR_InterferenceGraph : public TR_IGBase IGNodeColour findMinimumChromaticNumber(); #ifdef DEBUG - void dumpIG(char *msg = NULL); + void dumpIG(const char *msg = NULL); #else - void dumpIG(char *msg = NULL) {} + void dumpIG(const char *msg = NULL) {} #endif }; #endif diff --git a/compiler/infra/SimpleRegex.cpp b/compiler/infra/SimpleRegex.cpp index 584af0eceb3..bee17f68670 100644 --- a/compiler/infra/SimpleRegex.cpp +++ b/compiler/infra/SimpleRegex.cpp @@ -55,11 +55,11 @@ namespace TR { -SimpleRegex *SimpleRegex::create(char *&s) +SimpleRegex *SimpleRegex::create(const char *& s) { if (s == NULL || s[0] != '{') return NULL; - char *origStr = s; + const char *origStr = s; ++s; bool negate = (s[0] == '^'); if (negate) @@ -78,7 +78,7 @@ SimpleRegex *SimpleRegex::create(char *&s) } -SimpleRegex::Regex *SimpleRegex::processRegex(char *&s, bool &foundError) +SimpleRegex::Regex *SimpleRegex::processRegex(const char *&s, bool &foundError) { // First get rid of all + and | // @@ -108,10 +108,10 @@ void *SimpleRegex::Component::operator new (size_t size, PERSISTENT_NEW_DECLARE, // Process a simple_pattern: a sequence of components // -SimpleRegex::Simple *SimpleRegex::processSimple(char *&s, TR_YesNoMaybe allowAlternates, bool &foundError) +SimpleRegex::Simple *SimpleRegex::processSimple(const char *&s, TR_YesNoMaybe allowAlternates, bool &foundError) { int32_t i,lo,hi; - char *startSimple = s; + const char *startSimple = s; if (s[0] == '\0' || s[0] == ',' || s[0] == '|' || s[0] == '}') return NULL; diff --git a/compiler/infra/SimpleRegex.hpp b/compiler/infra/SimpleRegex.hpp index d2efa87cb45..114fb59b3b0 100644 --- a/compiler/infra/SimpleRegex.hpp +++ b/compiler/infra/SimpleRegex.hpp @@ -50,7 +50,7 @@ class SimpleRegex // Create a new regular expression // - static SimpleRegex *create(char *&s); + static SimpleRegex *create(const char *& s); // Check whether a string matches this regular expression // @@ -139,15 +139,15 @@ class SimpleRegex private: - static Regex *processRegex(char *&s, bool &foundError); - static Simple *processSimple(char *&s, TR_YesNoMaybe allowAlternates, bool &foundError); + static Regex *processRegex(const char *&s, bool &foundError); + static Simple *processSimple(const char *&s, TR_YesNoMaybe allowAlternates, bool &foundError); Regex *_regex; bool _negate; // Length and pointer to the original string that the regex was parsed from size_t _regexStrLen; - char *_regexStr; + const char *_regexStr; }; } diff --git a/compiler/infra/Statistics.hpp b/compiler/infra/Statistics.hpp index 78c3efd3fac..fb031a52554 100644 --- a/compiler/infra/Statistics.hpp +++ b/compiler/infra/Statistics.hpp @@ -272,13 +272,13 @@ class TR_StatsEvents public: enum {NAME_LEN=31}; TR_StatsEvents() {} - TR_StatsEvents(const char *name, char **binNames, int minEventId) + TR_StatsEvents(const char *name, const char **binNames, int minEventId) { init(name, binNames, minEventId); } // the init method can be used if we want to declare an array of stats // that are initialized later (in a for loop) - void init(const char *name, char **binNames, int minEventId) + void init(const char *name, const char **binNames, int minEventId) { strncpy(_name, name, NAME_LEN); _name[NAME_LEN] = 0; // just in case name is longer than _name @@ -341,12 +341,12 @@ class TR_StatsEvents } unsigned samples() const {return _numSamples;} protected: - char _name[NAME_LEN+1]; - int _bins[N]; - char** _binNames; - int _minEventId; // value of smallest bin - int _numSamples; - int _numInvalidSamples; + char _name[NAME_LEN+1]; + int _bins[N]; + const char **_binNames; + int _minEventId; // value of smallest bin + int _numSamples; + int _numInvalidSamples; }; #endif diff --git a/compiler/optimizer/Inliner.cpp b/compiler/optimizer/Inliner.cpp index 11556845a81..8731fb9eded 100644 --- a/compiler/optimizer/Inliner.cpp +++ b/compiler/optimizer/Inliner.cpp @@ -4258,11 +4258,11 @@ void TR_InlinerBase::applyPolicyToTargets(TR_CallStack *callStack, TR_CallSite * static bool traceIfMatchesPattern(TR::Compilation* comp) { - static char* cRegex = feGetEnv ("TR_printIfRegex"); + static const char *cRegex = feGetEnv ("TR_printIfRegex"); if (cRegex && comp->getOptions() && comp->getOptions()->getDebug()) { - static TR::SimpleRegex * regex = TR::SimpleRegex::create(cRegex); + static TR::SimpleRegex *regex = TR::SimpleRegex::create(cRegex); if (TR::SimpleRegex::match(regex, comp->signature(), false)) { return true; diff --git a/compiler/ras/Debug.hpp b/compiler/ras/Debug.hpp index 7f0fd013610..bf474d2f45a 100644 --- a/compiler/ras/Debug.hpp +++ b/compiler/ras/Debug.hpp @@ -481,10 +481,10 @@ class TR_Debug virtual void clearFilters(TR::CompilationFilters *); void clearFilters(bool loadLimit); virtual bool scanInlineFilters(FILE *, int32_t &, TR::CompilationFilters *); - virtual TR_FilterBST * addFilter(char * &, int32_t, int32_t, int32_t, TR::CompilationFilters *); - virtual TR_FilterBST * addFilter(char * &, int32_t, int32_t, int32_t, bool loadLimit); + virtual TR_FilterBST * addFilter(const char *&, int32_t, int32_t, int32_t, TR::CompilationFilters *); + virtual TR_FilterBST * addFilter(const char *&, int32_t, int32_t, int32_t, bool loadLimit); virtual TR_FilterBST * addExcludedMethodFilter(bool loadLimit); - virtual int32_t scanFilterName(char *, TR_FilterBST *); + virtual int32_t scanFilterName(const char *, TR_FilterBST *); virtual void printFilters(TR::CompilationFilters *); virtual void printFilters(); virtual void print(TR_FilterBST * filter); diff --git a/compiler/ras/LimitFile.cpp b/compiler/ras/LimitFile.cpp index 3bcdead5a2e..8fd42dec961 100644 --- a/compiler/ras/LimitFile.cpp +++ b/compiler/ras/LimitFile.cpp @@ -102,7 +102,7 @@ TR_Debug::findOrCreateFilters(bool loadLimit) } TR_FilterBST * -TR_Debug::addFilter(char * & filterString, int32_t scanningExclude, int32_t optionSetIndex, int32_t lineNum, TR::CompilationFilters * anyFilters) +TR_Debug::addFilter(const char *& filterString, int32_t scanningExclude, int32_t optionSetIndex, int32_t lineNum, TR::CompilationFilters * anyFilters) { uint32_t filterType = scanningExclude ? TR_FILTER_EXCLUDE_NAME_ONLY : TR_FILTER_NAME_ONLY; @@ -115,7 +115,7 @@ TR_Debug::addFilter(char * & filterString, int32_t scanningExclude, int32_t opti int32_t nameLength; if (*filterString == '{') { - char *filterCursor = filterString; + const char *filterCursor = filterString; filterType = scanningExclude ? TR_FILTER_EXCLUDE_REGEX : TR_FILTER_REGEX; filterBST->setFilterType(filterType); @@ -184,7 +184,7 @@ TR_Debug::addFilter(char * & filterString, int32_t scanningExclude, int32_t opti } TR_FilterBST * -TR_Debug::addFilter(char * & filterString, int32_t scanningExclude, int32_t optionSetIndex, int32_t lineNum, bool loadLimit) +TR_Debug::addFilter(const char *& filterString, int32_t scanningExclude, int32_t optionSetIndex, int32_t lineNum, bool loadLimit) { if (loadLimit) { @@ -254,7 +254,7 @@ TR_Debug::scanInlineFilters(FILE * inlineFile, int32_t & lineNumber, TR::Compila } else if (includeFlag == '+' || includeFlag == '-') { - char *p = limitReadBuffer+1; + const char *p = limitReadBuffer + 1; int32_t optionSet; if (*p >= '0' && *p <= '9') optionSet = *(p++) - '0'; @@ -409,7 +409,7 @@ TR_Debug::inlinefileOption(const char *option, void *base, TR::OptionTable *entr const char * TR_Debug::limitfileOption(const char *option, void *base, TR::OptionTable *entry, TR::Options * cmdLineOptions, bool loadLimit, TR_PseudoRandomNumbersListElement **pseudoRandomListHeadPtr) { - char *endOpt = (char *)option; + const char *endOpt = option; const char *name = option; const char *fail = option; @@ -470,7 +470,7 @@ TR_Debug::limitfileOption(const char *option, void *base, TR::OptionTable *entry char includeFlag = limitReadBuffer[0]; if (strncmp(limitReadBuffer,"-precompileMethod",17) == 0) { - char *p = limitReadBuffer+18; + const char *p = limitReadBuffer + 18; if (!addFilter(p, 0, 0, lineNumber, loadLimit)) { limitFileError = true; @@ -479,7 +479,7 @@ TR_Debug::limitfileOption(const char *option, void *base, TR::OptionTable *entry } else if (strncmp(limitReadBuffer,"-noprecompileMethod",19) == 0) { - char *p = limitReadBuffer+20; + const char *p = limitReadBuffer + 20; if (!addFilter(p, 1, 0, lineNumber, loadLimit)) { limitFileError = true; @@ -488,7 +488,7 @@ TR_Debug::limitfileOption(const char *option, void *base, TR::OptionTable *entry } else if (includeFlag == '+' || includeFlag == '-') { - char *p = limitReadBuffer+1; + const char *p = limitReadBuffer + 1; int32_t optionSet; if (*p >= '0' && *p <= '9') optionSet = *(p++) - '0'; @@ -614,7 +614,7 @@ TR_Debug::limitfileOption(const char *option, void *base, TR::OptionTable *entry const char * TR_Debug::limitOption(const char *option, void *base, TR::OptionTable *entry, TR::Options * cmdLineOptions, TR::CompilationFilters *&filters) { - char *p = (char *)option; + const char *p = option; filters = findOrCreateFilters(filters); TR_FilterBST *filter = addFilter(p, static_cast(entry->parm1), 0, 0, filters); @@ -651,7 +651,7 @@ TR_Debug::limitOption(const char *option, void *base, TR::OptionTable *entry, TR // If an option subset was found, save the information for later // processing // - char *startOptString = ++p; + const char *startOptString = ++p; int32_t parenNest = 1; for (; *p; p++) { @@ -931,7 +931,7 @@ TR_Debug::printFilterTree(TR_FilterBST *root) } int32_t -TR_Debug::scanFilterName(char *string, TR_FilterBST *filter) +TR_Debug::scanFilterName(const char *string, TR_FilterBST *filter) { // help for OMR parsing bool seenFileName = false; @@ -941,11 +941,11 @@ TR_Debug::scanFilterName(char *string, TR_FilterBST *filter) // Walk the filter to determine the type. // //TR_VerboseLog::writeLine("filterName: %s", string); - char *nameChars = NULL; + const char *nameChars = NULL; int32_t nameLen = 0; - char *classChars = NULL; + const char *classChars = NULL; int32_t classLen = 0; - char *signatureChars = string; + const char *signatureChars = string; int32_t signatureLen = 0; char filterType = filter->getFilterType(); if (*string == '/' || *string == '.') // hack that works for linux @@ -1027,7 +1027,7 @@ TR_Debug::scanFilterName(char *string, TR_FilterBST *filter) if (omrPattern) { // need to swap name and signature, since name is currently the line number - char *tempChars = nameChars; + const char *tempChars = nameChars; int32_t tempLen = nameLen; nameChars = signatureChars; nameLen = signatureLen;