Skip to content

Commit

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

Signed-off-by: Dylan Tuttle <[email protected]>
  • Loading branch information
dylanjtuttle committed Nov 27, 2023
1 parent c134038 commit b90378c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion compiler/infra/InterferenceGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions compiler/infra/InterferenceGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions compiler/infra/SimpleRegex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 |
//
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions compiler/infra/SimpleRegex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -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;
};

}
Expand Down
16 changes: 8 additions & 8 deletions compiler/infra/Statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit b90378c

Please sign in to comment.