Skip to content

Commit

Permalink
Merge pull request #586 from zrax/gcc9_warn
Browse files Browse the repository at this point in the history
Warning cleanup
  • Loading branch information
zrax committed Jul 3, 2019
2 parents 010baa1 + 87f6df6 commit 7bdab86
Show file tree
Hide file tree
Showing 23 changed files with 900 additions and 893 deletions.
5 changes: 4 additions & 1 deletion Sources/Plasma/CoreLib/HeadSpin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void ErrorEnableGui(bool enabled)
s_GuiAsserts = enabled;
}

void ErrorAssert(int line, const char* file, const char* fmt, ...)
NORETURN void ErrorAssert(int line, const char* file, const char* fmt, ...)
{
#if defined(HS_DEBUGGING) || !defined(PLASMA_EXTERNAL_RELEASE)
char msg[1024];
Expand All @@ -146,6 +146,9 @@ void ErrorAssert(int line, const char* file, const char* fmt, ...)
#else
DebugBreakIfDebuggerPresent();
#endif // defined(HS_DEBUGGING) || !defined(PLASMA_EXTERNAL_RELEASE)

// If no debugger break occurred, just crash.
std::abort();
}

bool DebugIsDebuggerPresent()
Expand Down
4 changes: 3 additions & 1 deletion Sources/Plasma/CoreLib/HeadSpin.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,10 @@ inline float hsRadiansToDegrees(float rad) { return float(rad * (180 / M_PI)); }

#ifdef _MSC_VER
# define ALIGN(n) __declspec(align(n))
# define NORETURN __declspec(noreturn)
#else
# define ALIGN(n) __attribute__((aligned(n)))
# define NORETURN __attribute__((noreturn))
#endif

/************************ Debug/Error Macros **************************/
Expand All @@ -424,7 +426,7 @@ extern hsDebugMessageProc gHSStatusProc;
hsDebugMessageProc hsSetStatusMessageProc(hsDebugMessageProc newProc);

void ErrorEnableGui (bool enabled);
void ErrorAssert (int line, const char* file, const char* fmt, ...);
NORETURN void ErrorAssert (int line, const char* file, const char* fmt, ...);

bool DebugIsDebuggerPresent();
void DebugBreakIfDebuggerPresent();
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/CoreLib/plFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ plFileName plFileSystem::GetCurrentAppPath()
if (appPath.IsValid())
return appPath;

hsAssert(0, "Your OS doesn't make life easy, does it?");
FATAL("Your OS doesn't make life easy, does it?");
#endif
}

Expand Down
5 changes: 4 additions & 1 deletion Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,10 @@ void pfConsole::IHandleKey( plKeyEventMsg *msg )
if( fWorkingLine[ 0 ] == 0 )
IPrintSomeHelp();
else if( stricmp( fWorkingLine, "commands" ) == 0 )
fEngine->PrintCmdHelp( "", IAddLineCallback );
{
char empty[] = "";
fEngine->PrintCmdHelp( empty, IAddLineCallback );
}
else if( !fEngine->PrintCmdHelp( fWorkingLine, IAddLineCallback ) )
{
c = (char *)fEngine->GetErrorMsg();
Expand Down
13 changes: 8 additions & 5 deletions Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,8 +1012,7 @@ PyObject* cyMisc::GetNPC(int npcID)
if ( so )
return pySceneObject::New(so->GetKey());

char* errmsg = "NPC not found";
PyErr_SetString(PyExc_NameError, errmsg);
PyErr_SetString(PyExc_NameError, "NPC not found");
PYTHON_RETURN_ERROR;
}

Expand Down Expand Up @@ -2369,7 +2368,8 @@ class NetClientCommCallback : public plNetClientComm::Callback
PyTuple_SetItem(t, 1, PyLong_FromUnsignedLong(nPlayers));
PyList_SetItem(pyEL, i, t); // steals the ref
}
PyObject* retVal = PyObject_CallMethod(fPyObject, "gotPublicAgeList", "O", pyEL);
PyObject* retVal = PyObject_CallMethod(fPyObject,
_pycs("gotPublicAgeList"), _pycs("O"), pyEL);
Py_XDECREF(retVal);
}
}
Expand All @@ -2387,7 +2387,8 @@ class NetClientCommCallback : public plNetClientComm::Callback
if ( ageInfo )
{
PyObject* ageInfoObj = pyAgeInfoStruct::New(ageInfo);
PyObject* retVal = PyObject_CallMethod(fPyObject, "publicAgeCreated", "O", ageInfoObj);
PyObject* retVal = PyObject_CallMethod(fPyObject,
_pycs("publicAgeCreated"), _pycs("O"), ageInfoObj);
Py_XDECREF(retVal);
Py_DECREF(ageInfoObj);
}
Expand All @@ -2405,7 +2406,9 @@ class NetClientCommCallback : public plNetClientComm::Callback

if ( guid )
{
PyObject* retVal = PyObject_CallMethod(fPyObject, "publicAgeRemoved", "s", guid->AsString().c_str());
PyObject* retVal = PyObject_CallMethod(fPyObject,
_pycs("publicAgeRemoved"), _pycs("s"),
guid->AsString().c_str());
Py_XDECREF(retVal);
}
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ void PythonInterface::initPython()
FirstTimeInit = false;
// initialize the Python stuff
// let Python do some initialization...
Py_SetProgramName("plasma");
Py_SetProgramName(_pycs("plasma"));
Py_NoSiteFlag = 1;
Py_IgnoreEnvironmentFlag = 1;
Py_Initialize();
Expand Down Expand Up @@ -1644,7 +1644,7 @@ int PythonInterface::getOutputAndReset(std::string *output)
if ( dbgOut != nil )
{
// then send it the new text
PyObject* retVal = PyObject_CallFunction(dbgOut,"s",strVal.c_str());
PyObject* retVal = PyObject_CallFunction(dbgOut, _pycs("s"), strVal.c_str());
if ( retVal == nil )
{
// for some reason this function didn't, remember that and not call it again
Expand Down Expand Up @@ -1778,7 +1778,7 @@ PyObject* PythonInterface::CreateModule(const char* module)
//
// PURPOSE : get an item (probably a function) from the Plasma module
//
PyObject* PythonInterface::GetPlasmaItem(char* item)
PyObject* PythonInterface::GetPlasmaItem(const char* item)
{
if ( plasmaMod )
{
Expand All @@ -1796,7 +1796,7 @@ PyObject* PythonInterface::GetPlasmaItem(char* item)
//
// PURPOSE : get an item (probably a function) from a specific module
//
PyObject* PythonInterface::GetModuleItem(char* item, PyObject* module)
PyObject* PythonInterface::GetModuleItem(const char* item, PyObject* module)
{
if ( module )
{
Expand Down
4 changes: 2 additions & 2 deletions Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ class PythonInterface

// checks to see if a specific function is defined in this module
// get an item (probably a function) from the Plasma module
static PyObject* GetPlasmaItem(char* item);
static PyObject* GetPlasmaItem(const char* item);

// Determine if the module name is unique
static bool IsModuleNameUnique(const ST::string& module);
// get an item (probably a function) from a specific module
static PyObject* GetModuleItem(char* item, PyObject* module);
static PyObject* GetModuleItem(const char* item, PyObject* module);

// check a specific module for the define funcitons
static void CheckModuleForFunctions(PyObject* module, char** funcNames, PyObject** funcTable);
Expand Down

0 comments on commit 7bdab86

Please sign in to comment.