diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/mips/isa/base.isa | 4 | ||||
-rw-r--r-- | src/arch/mips/isa/formats/branch.isa | 2 | ||||
-rw-r--r-- | src/arch/mips/isa/formats/int.isa | 4 | ||||
-rw-r--r-- | src/arch/mips/isa/formats/mt.isa | 4 | ||||
-rw-r--r-- | src/arch/sparc/isa/base.isa | 4 | ||||
-rw-r--r-- | src/arch/x86/insts/static_inst.cc | 2 | ||||
-rw-r--r-- | src/base/hostinfo.cc | 2 | ||||
-rw-r--r-- | src/base/hostinfo.hh | 2 | ||||
-rw-r--r-- | src/base/inifile.cc | 6 | ||||
-rw-r--r-- | src/cpu/legiontrace.cc | 4 | ||||
-rw-r--r-- | src/kern/linux/printk.cc | 2 | ||||
-rw-r--r-- | src/kern/tru64/printf.cc | 2 | ||||
-rw-r--r-- | src/python/swig/pyobject.cc | 14 | ||||
-rw-r--r-- | src/sim/main.cc | 6 |
14 files changed, 34 insertions, 24 deletions
diff --git a/src/arch/mips/isa/base.isa b/src/arch/mips/isa/base.isa index 7c042f16f..e8e1c856e 100644 --- a/src/arch/mips/isa/base.isa +++ b/src/arch/mips/isa/base.isa @@ -82,7 +82,7 @@ output decoder {{ // Need to find standard way to not print // this info. Maybe add bool variable to // class? - if (mnemonic != "syscall") { + if (strcmp(mnemonic, "syscall") != 0) { if(_numDestRegs > 0){ printReg(ss, _destRegIdx[0]); } @@ -100,7 +100,7 @@ output decoder {{ // Should we define a separate inst. class // just for two insts? - if(mnemonic == "sll" || mnemonic == "sra"){ + if (strcmp(mnemonic, "sll") == 0 || strcmp(mnemonic, "sra") == 0) { ccprintf(ss,", %d",SA); } diff --git a/src/arch/mips/isa/formats/branch.isa b/src/arch/mips/isa/formats/branch.isa index e959e4c1b..e786b3d9f 100644 --- a/src/arch/mips/isa/formats/branch.isa +++ b/src/arch/mips/isa/formats/branch.isa @@ -196,7 +196,7 @@ output decoder {{ ccprintf(ss, "%-10s ", mnemonic); - if ( mnemonic == "jal" ) { + if (strcmp(mnemonic, "jal") == 0) { Addr npc = pc + 4; ccprintf(ss,"0x%x",(npc & 0xF0000000) | disp); } else if (_numSrcRegs == 0) { diff --git a/src/arch/mips/isa/formats/int.isa b/src/arch/mips/isa/formats/int.isa index 7fa8e4817..f23c4cbf6 100644 --- a/src/arch/mips/isa/formats/int.isa +++ b/src/arch/mips/isa/formats/int.isa @@ -119,7 +119,7 @@ output header {{ { //If Bit 15 is 1 then Sign Extend int32_t temp = sextImm & 0x00008000; - if (temp > 0 && mnemonic != "lui") { + if (temp > 0 && strcmp(mnemonic, "lui") != 0) { sextImm |= 0xFFFF0000; } } @@ -313,7 +313,7 @@ output decoder {{ ss << ", "; } - if( mnemonic == "lui") + if (strcmp(mnemonic, "lui") == 0) ccprintf(ss, "0x%x ", sextImm); else ss << (int) sextImm; diff --git a/src/arch/mips/isa/formats/mt.isa b/src/arch/mips/isa/formats/mt.isa index b3520050a..d4c37f812 100644 --- a/src/arch/mips/isa/formats/mt.isa +++ b/src/arch/mips/isa/formats/mt.isa @@ -72,9 +72,9 @@ output decoder {{ { std::stringstream ss; - if (mnemonic == "mttc0" || mnemonic == "mftc0") { + if (strcmp(mnemonic, "mttc0") == 0 || strcmp(mnemonic, "mftc0") == 0) { ccprintf(ss, "%-10s r%d, r%d, %d", mnemonic, RT, RD, SEL); - } else if (mnemonic == "mftgpr") { + } else if (strcmp(mnemonic, "mftgpr") == 0) { ccprintf(ss, "%-10s r%d, r%d", mnemonic, RD, RT); } else { ccprintf(ss, "%-10s r%d, r%d", mnemonic, RT, RD); diff --git a/src/arch/sparc/isa/base.isa b/src/arch/sparc/isa/base.isa index 4339003e0..ce063bcdc 100644 --- a/src/arch/sparc/isa/base.isa +++ b/src/arch/sparc/isa/base.isa @@ -87,7 +87,7 @@ output header {{ FOrdered=0xF }; - extern char * CondTestAbbrev[]; + extern const char *CondTestAbbrev[]; /** * Base class for all SPARC static instructions. @@ -126,7 +126,7 @@ output header {{ output decoder {{ - char * CondTestAbbrev[] = + const char *CondTestAbbrev[] = { "nev", //Never "e", //Equal diff --git a/src/arch/x86/insts/static_inst.cc b/src/arch/x86/insts/static_inst.cc index 510295157..d2ec8878c 100644 --- a/src/arch/x86/insts/static_inst.cc +++ b/src/arch/x86/insts/static_inst.cc @@ -126,7 +126,7 @@ namespace X86ISA {"", "t%db", "t%dw", "", "t%dd", "", "", "", "t%d"}; if (reg < FP_Base_DepTag) { - char * suffix = ""; + const char * suffix = ""; bool fold = reg & (1 << 6); reg &= ~(1 << 6); diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc index 7cc07c11e..ef64feeb4 100644 --- a/src/base/hostinfo.cc +++ b/src/base/hostinfo.cc @@ -60,7 +60,7 @@ hostname() } uint64_t -procInfo(char *filename, char *target) +procInfo(const char *filename, const char *target) { int done = 0; char line[80]; diff --git a/src/base/hostinfo.hh b/src/base/hostinfo.hh index b6663ea69..70cd19203 100644 --- a/src/base/hostinfo.hh +++ b/src/base/hostinfo.hh @@ -37,7 +37,7 @@ std::string &hostname(); -uint64_t procInfo(char *filename, char *target); +uint64_t procInfo(const char *filename, const char *target); inline uint64_t memUsage() { return procInfo("/proc/self/status", "VmSize:"); } diff --git a/src/base/inifile.cc b/src/base/inifile.cc index 4d504d04f..809cbe172 100644 --- a/src/base/inifile.cc +++ b/src/base/inifile.cc @@ -111,7 +111,7 @@ IniFile::loadCPP(const string &file, vector<char *> &cppArgs) int arg_count = cppArgs.size(); - char **args = new char *[arg_count + 20]; + const char **args = new const char *[arg_count + 20]; int nextArg = 0; args[nextArg++] = "g++"; @@ -136,7 +136,9 @@ IniFile::loadCPP(const string &file, vector<char *> &cppArgs) if (dup2(tmp_fd, STDOUT_FILENO) == -1) exit(1); - execvp("g++", args); + // execvp signature is intentionally broken wrt const-ness for + // backwards compatibility... see man page + execvp("g++", const_cast<char * const *>(args)); exit(0); } diff --git a/src/cpu/legiontrace.cc b/src/cpu/legiontrace.cc index d30343025..0ca02eeec 100644 --- a/src/cpu/legiontrace.cc +++ b/src/cpu/legiontrace.cc @@ -100,7 +100,7 @@ setupSharedData() // Utility methods for pretty printing a report about a difference // -inline char * genCenteredLabel(int length, char * buffer, char * label) +inline char * genCenteredLabel(int length, char * buffer, const char * label) { int labelLength = strlen(label); assert(labelLength <= length); @@ -127,7 +127,7 @@ inline void printColumnLabels(ostream & os) ccprintf(os, "--------------------+-----------------------+-----------------------\n"); } -inline void printSectionHeader(ostream & os, char * name) +inline void printSectionHeader(ostream & os, const char * name) { char sectionString[70]; genCenteredLabel(69, sectionString, name); diff --git a/src/kern/linux/printk.cc b/src/kern/linux/printk.cc index 24e28e666..577245f95 100644 --- a/src/kern/linux/printk.cc +++ b/src/kern/linux/printk.cc @@ -168,7 +168,7 @@ Printk(stringstream &out, Arguments args) break; case 's': { - char *s = (char *)args; + const char *s = (const char *)args; if (!s) s = "<NULL>"; diff --git a/src/kern/tru64/printf.cc b/src/kern/tru64/printf.cc index ce77efa83..8b706c250 100644 --- a/src/kern/tru64/printf.cc +++ b/src/kern/tru64/printf.cc @@ -176,7 +176,7 @@ Printf(Arguments args) break; case 's': { - char *s = (char *)args; + const char *s = (const char *)args; if (!s) s = "<NULL>"; diff --git a/src/python/swig/pyobject.cc b/src/python/swig/pyobject.cc index c682b0fd7..eaa8baa8b 100644 --- a/src/python/swig/pyobject.cc +++ b/src/python/swig/pyobject.cc @@ -147,20 +147,28 @@ inifile() */ extern "C" SimObject *convertSwigSimObjectPtr(PyObject *); +// Python.h is notoriously not const-correct (for 2.4, anyway)... make +// a little define here to reduce the noise and make it easier to +// #ifdef away if Python.h gets fixed. Note there are a couple of +// these in sim/main.cc as well that are handled without this define. +#define PCC(s) const_cast<char *>(s) + + SimObject * resolveSimObject(const string &name) { - PyObject *module = PyImport_ImportModule("m5.SimObject"); + PyObject *module = PyImport_ImportModule(PCC("m5.SimObject")); if (module == NULL) panic("Could not import m5.SimObject"); - PyObject *resolver = PyObject_GetAttrString(module, "resolveSimObject"); + PyObject *resolver = + PyObject_GetAttrString(module, PCC("resolveSimObject")); if (resolver == NULL) { PyErr_Print(); panic("resolveSimObject: failed to find resolveSimObject"); } - PyObject *ptr = PyObject_CallFunction(resolver, "(s)", name.c_str()); + PyObject *ptr = PyObject_CallFunction(resolver, PCC("(s)"), name.c_str()); if (ptr == NULL) { PyErr_Print(); panic("resolveSimObject: failure on call to Python for %s", name); diff --git a/src/sim/main.cc b/src/sim/main.cc index 62ab9445b..baca556a0 100644 --- a/src/sim/main.cc +++ b/src/sim/main.cc @@ -82,7 +82,7 @@ python_main() PyObject *dict; PyObject *result; - module = PyImport_AddModule("__main__"); + module = PyImport_AddModule(const_cast<char*>("__main__")); if (module == NULL) fatal("Could not import __main__"); @@ -135,10 +135,10 @@ main(int argc, char **argv) if (setenv("PYTHONPATH", pythonpath.c_str(), true) == -1) fatal("setenv: %s\n", strerror(errno)); - char *python_home = getenv("PYTHONHOME"); + const char *python_home = getenv("PYTHONHOME"); if (!python_home) python_home = PYTHONHOME; - Py_SetPythonHome(python_home); + Py_SetPythonHome(const_cast<char*>(python_home)); // initialize embedded Python interpreter Py_Initialize(); |