Fix compilation warnings and a couple of errors due to GCC -pedantic flags
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1329 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
61df7cd551
commit
99135b1237
39 changed files with 77 additions and 188 deletions
|
@ -240,11 +240,10 @@ $ac_distutils_result])
|
|||
LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
|
||||
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
|
||||
AC_LANG_PUSH([C])
|
||||
AC_TRY_LINK(AC_LANG_PROGRAM([
|
||||
#include <Python.h>
|
||||
],[
|
||||
Py_Initialize();
|
||||
]),[pythonexists=yes],[pythonexists=no])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[#include <Python.h>]],
|
||||
[[Py_Initialize();]])
|
||||
],[pythonexists=yes],[pythonexists=no])
|
||||
AC_LANG_POP([C])
|
||||
# turn back to default flags
|
||||
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||
|
|
|
@ -91,12 +91,12 @@ PythonCPUPolicy::PythonCPUPolicy(const char* name) throw(MalformedPolicyExceptio
|
|||
|
||||
PythonCPUPolicy::~PythonCPUPolicy()
|
||||
{
|
||||
if (_adapter) Py_DECREF(_adapter);
|
||||
if (_adapter) { Py_DECREF(_adapter); }
|
||||
|
||||
// We keep this alive until dtor time, because
|
||||
// the user may have defined some static global-space
|
||||
// variables and they make use of them.
|
||||
if (_upolicy_dict) Py_DECREF(_upolicy_dict);
|
||||
if (_upolicy_dict) { Py_DECREF(_upolicy_dict); }
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -135,7 +135,7 @@ PythonCPUPolicy::configure() throw(UserInterruptException, MalformedPolicyExcept
|
|||
Glib::RecMutex::Lock lock(_mtx);;
|
||||
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
|
||||
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, "async_configure", NULL);
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_configure"), NULL);
|
||||
Py_DECREF(retval);
|
||||
|
||||
wait_unlock();
|
||||
|
@ -150,7 +150,7 @@ PythonCPUPolicy::sort_queue() const throw(UserInterruptException, MalformedPolic
|
|||
Glib::RecMutex::Lock lock(_mtx);;
|
||||
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
|
||||
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, "async_sort_queue", NULL);
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_sort_queue"), NULL);
|
||||
|
||||
// Do minimal debugging
|
||||
if (!retval) PyErr_Print();
|
||||
|
@ -181,13 +181,13 @@ PythonCPUPolicy::is_pre_emptive() const throw(UserInterruptException, MalformedP
|
|||
Glib::RecMutex::Lock lock(_mtx);;
|
||||
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
|
||||
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, "async_is_preemptive", NULL);
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_is_preemptive"), NULL);
|
||||
Py_DECREF(retval);
|
||||
|
||||
wait_unlock();
|
||||
|
||||
// Parse return value stored in global Python object
|
||||
retval = PyObject_CallMethod(_adapter, "get_return_value", NULL);
|
||||
retval = PyObject_CallMethod(_adapter, const_cast<char*>("get_return_value"), NULL);
|
||||
assert(retval);
|
||||
bool ret = PyObject_IsTrue(retval);
|
||||
Py_DECREF(retval);
|
||||
|
@ -203,7 +203,7 @@ PythonCPUPolicy::get_time_slice() const throw(UserInterruptException, MalformedP
|
|||
Glib::RecMutex::Lock lock(_mtx);;
|
||||
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
|
||||
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, "async_get_time_slice", NULL);
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_get_time_slice"), NULL);
|
||||
|
||||
// Do minimal debugging
|
||||
if (!retval) PyErr_Print();
|
||||
|
@ -212,7 +212,7 @@ PythonCPUPolicy::get_time_slice() const throw(UserInterruptException, MalformedP
|
|||
wait_unlock();
|
||||
|
||||
// Parse return value stored in global Python object
|
||||
retval = PyObject_CallMethod(_adapter, "get_return_value", NULL);
|
||||
retval = PyObject_CallMethod(_adapter, const_cast<char*>("get_return_value"), NULL);
|
||||
assert(retval);
|
||||
long tmp = PyInt_AsLong(retval);
|
||||
Py_DECREF(retval);
|
||||
|
@ -239,7 +239,7 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException, MalformedPoli
|
|||
Glib::usleep(wait_for); // hack'a'ton! magggggiccc nummmbeeerrrrrs!!
|
||||
Py_BLOCK_THREADS;
|
||||
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, "mutex_test_lock", NULL);
|
||||
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("mutex_test_lock"), NULL);
|
||||
assert(retval);
|
||||
still_locked = PyObject_IsTrue(retval);
|
||||
Py_DECREF(retval);
|
||||
|
@ -263,7 +263,7 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException, MalformedPoli
|
|||
|
||||
// check if there were unhandled exception in the user-defined code
|
||||
|
||||
PyObject* pException = PyObject_CallMethod(_adapter, "get_last_exception", NULL);
|
||||
PyObject* pException = PyObject_CallMethod(_adapter, const_cast<char*>("get_last_exception"), NULL);
|
||||
|
||||
if(pException != NULL)
|
||||
{
|
||||
|
@ -325,9 +325,9 @@ PythonCPUPolicy::get_exception_information()
|
|||
else
|
||||
msg = string(_("no available information for this error"));
|
||||
|
||||
if (pType != NULL) Py_DECREF(pType);
|
||||
if (pValue != NULL) Py_DECREF(pValue);
|
||||
if (pTraceback != NULL) Py_DECREF(pTraceback);
|
||||
if (pType != NULL) { Py_DECREF(pType); }
|
||||
if (pValue != NULL) { Py_DECREF(pValue); }
|
||||
if (pTraceback != NULL) { Py_DECREF(pTraceback); }
|
||||
|
||||
PyErr_Clear();
|
||||
|
||||
|
|
|
@ -138,67 +138,14 @@ void XMLSerializer::fill_doc(xmlDocPtr doc, const History& hist)
|
|||
* Creates a DTD declaration. Isn't mandatory.
|
||||
*/
|
||||
xmlDtdPtr dtd = xmlCreateIntSubset(doc, (const xmlChar *) "sgpem", NULL, (const xmlChar *) "sgpem.dtd");
|
||||
|
||||
//TODO: check for DTD compliance??
|
||||
|
||||
XMLVisitor xvisit(root_node);
|
||||
xvisit.from_history(hist);
|
||||
/*
|
||||
//
|
||||
// xmlNewChild() creates a new node, which is "attached" as child node
|
||||
// of root_node node.
|
||||
//
|
||||
xmlNodePtr resources_node = xmlNewChild(root_node, NULL, (const xmlChar *) "resources", NULL);
|
||||
//
|
||||
// The same as above, but the new child node doesn't have a content
|
||||
//
|
||||
xmlNodePtr schedulables_node = xmlNewChild(root_node, NULL, (const xmlChar *) "schedulables", NULL);
|
||||
|
||||
fill_resources(resources_node, hist);
|
||||
fill_schedulables(schedulables_node, hist);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
void XMLSerializer::fill_resources(xmlNodePtr resources_node, const History& hist)
|
||||
{
|
||||
|
||||
|
||||
const Environment& env = hist.get_last_environment();
|
||||
|
||||
const Environment::Resources& rvect = env.get_resources();
|
||||
typedef Environment::Resources::const_iterator res_iterator;
|
||||
|
||||
res_iterator iter = rvect.begin();
|
||||
res_iterator end = rvect.end();
|
||||
while(iter!=end)
|
||||
{
|
||||
XMLVisitor xvisit(resources_node);
|
||||
Glib::ustring key;
|
||||
int_to_string((int)(*iter).first, key);
|
||||
xvisit.from_resource(*((*iter).second), key);
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
void XMLSerializer::fill_schedulables(xmlNodePtr schedulables_node, const History& hist)
|
||||
{
|
||||
|
||||
|
||||
const Environment& env = hist.get_last_environment();
|
||||
|
||||
const Environment::Processes& pvect = env.get_processes();
|
||||
typedef std::vector<Process*>::const_iterator proc_iterator;
|
||||
|
||||
proc_iterator iter = pvect.begin();
|
||||
proc_iterator end = pvect.end();
|
||||
while(iter!=end)
|
||||
{
|
||||
XMLVisitor xvisit(schedulables_node);
|
||||
xvisit.from_process(*(*iter));
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void XMLSerializer::read_doc(xmlDocPtr doc, XMLSerializerFactory& fact) throw(SerializerError)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -86,7 +86,7 @@ XMLSerializerFactory::create_resource(Parameters& parameters)
|
|||
int arrival_time = 0;
|
||||
int how_many = 1;
|
||||
bool preemptable = false;
|
||||
int old_key;
|
||||
int old_key = 0;
|
||||
Parameters::iterator pos;
|
||||
|
||||
// read "name" property
|
||||
|
|
|
@ -44,7 +44,7 @@ XMLVisitor::~XMLVisitor()
|
|||
{
|
||||
}
|
||||
|
||||
void XMLVisitor::from_resource(const Resource& obj) throw(SerializerError)
|
||||
void XMLVisitor::from_resource(const Resource& /*obj*/) throw(SerializerError)
|
||||
{
|
||||
throw SerializerError(
|
||||
_("XMLVisitor: unsupported method from_resource(const Resource& obj)")
|
||||
|
@ -203,8 +203,7 @@ void XMLVisitor::from_process(xmlNodePtr parent, const Process& obj) throw(Seria
|
|||
while (iter != end)
|
||||
{
|
||||
const Thread* t = *iter;
|
||||
|
||||
from_thread(threads_node, *(*iter));
|
||||
from_thread(threads_node, *t);
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
@ -244,8 +243,7 @@ void XMLVisitor::from_thread(xmlNodePtr parent, const Thread& obj) throw(Seriali
|
|||
while (iter != end)
|
||||
{
|
||||
const Request* r = *iter;
|
||||
|
||||
from_request(requests_node, *(*iter));
|
||||
from_request(requests_node, *r);
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
@ -278,7 +276,7 @@ void XMLVisitor::from_request(xmlNodePtr parent, const Request& obj) throw(Seria
|
|||
while (iter != end)
|
||||
{
|
||||
const SubRequest* sr = *iter;
|
||||
from_subrequest(request_node, *(*iter));
|
||||
from_subrequest(request_node, *sr);
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue