summaryrefslogtreecommitdiff
path: root/src/python
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@gmail.com>2007-10-31 18:04:22 -0700
committerSteve Reinhardt <stever@gmail.com>2007-10-31 18:04:22 -0700
commit4b49bd47f464fb3fe31a943b913edb565fa68423 (patch)
tree34cea1a1e0ed0365bcd6b64ed0c2510ed37ca00c /src/python
parent71b033f4dcd2b34a01256139e280489b8f0f69ee (diff)
downloadgem5-4b49bd47f464fb3fe31a943b913edb565fa68423.tar.xz
String constant const-ness changes to placate g++ 4.2.
Also some bug fixes in MIPS ISA uncovered by g++ warnings (Python string compares don't work in C++!). --HG-- extra : convert_revision : b347cc0108f23890e9b73b3ee96059f0cea96cf6
Diffstat (limited to 'src/python')
-rw-r--r--src/python/swig/pyobject.cc14
1 files changed, 11 insertions, 3 deletions
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);