Fix several warnings that occur on NDEBUG builds:

* Missing returns from function
 * Functions that are defined in both DEBUG and NDEBUG builds but only used in DEBUG builds

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6179 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-10-16 14:22:29 +00:00
parent abebc970fe
commit 64910221e7
5 changed files with 35 additions and 23 deletions

View File

@ -151,11 +151,14 @@ static size_t unicode_utf8_char_length(const utf_32_char unicode_char)
*/ */
else if (unicode_char < 0x00110000) else if (unicode_char < 0x00110000)
return 4; // stores 21 bits return 4; // stores 21 bits
else
/* Apparently this character lies outside the 0x0 - 0x10FFFF /* Apparently this character lies outside the 0x0 - 0x10FFFF
* Unicode range, so don't accept it. * Unicode range, so don't accept it.
*/ */
ASSERT(!"out-of-range Unicode codepoint", "This Unicode codepoint is too large (%u > 0x10FFFF) to be a valid Unicode codepoint", (unsigned int)unicode_char); ASSERT(!"out-of-range Unicode codepoint", "This Unicode codepoint is too large (%u > 0x10FFFF) to be a valid Unicode codepoint", (unsigned int)unicode_char);
// Dummy value to prevent warnings about missing return from function
return 0;
} }
char *UTF8CharacterAtOffset(const char *utf8_string, size_t index) char *UTF8CharacterAtOffset(const char *utf8_string, size_t index)

View File

@ -57,6 +57,24 @@ static SDWORD eventTraceLevel=3;
#define DB_TRIGINF(psTrigger, level)\ #define DB_TRIGINF(psTrigger, level)\
if (eventTraceLevel >= (level)) \ if (eventTraceLevel >= (level)) \
eventPrintTriggerInfo(psTrigger) eventPrintTriggerInfo(psTrigger)
// Print out all the info available about a trigger
static void eventPrintTriggerInfo(ACTIVE_TRIGGER *psTrigger)
{
SCRIPT_CODE *psCode = psTrigger->psContext->psCode;
const char *pTrigLab, *pEventLab;
// find the debug info for the trigger
pTrigLab = eventGetTriggerID(psCode, psTrigger->trigger);
// find the debug info for the event
pEventLab = eventGetEventID(psCode, psTrigger->event);
debug(LOG_WARNING, "trigger %s at %d -> %s", pTrigLab, psTrigger->testTime, pEventLab);
if (psTrigger->offset != 0)
{
debug(LOG_WARNING, " %d", psTrigger->offset);
}
}
#else #else
#define DB_TRIGINF(psTrigger, level) #define DB_TRIGINF(psTrigger, level)
#endif #endif
@ -266,24 +284,6 @@ const char *eventGetEventID(SCRIPT_CODE *psCode, SDWORD event)
return pID; return pID;
} }
// Print out all the info available about a trigger
static void eventPrintTriggerInfo(ACTIVE_TRIGGER *psTrigger)
{
SCRIPT_CODE *psCode = psTrigger->psContext->psCode;
const char *pTrigLab, *pEventLab;
// find the debug info for the trigger
pTrigLab = eventGetTriggerID(psCode, psTrigger->trigger);
// find the debug info for the event
pEventLab = eventGetEventID(psCode, psTrigger->event);
debug(LOG_WARNING, "trigger %s at %d -> %s", pTrigLab, psTrigger->testTime, pEventLab);
if (psTrigger->offset != 0)
{
debug(LOG_WARNING, " %d", psTrigger->offset);
}
}
// Initialise the create/release function array - specify the maximum value type // Initialise the create/release function array - specify the maximum value type
BOOL eventInitValueFuncs(SDWORD maxType) BOOL eventInitValueFuncs(SDWORD maxType)
{ {

View File

@ -1128,6 +1128,9 @@ void audioTest()
for (i = 0; i < 50; i++) for (i = 0; i < 50; i++)
{ {
// On non-debug builds prevent warnings about defining but not using dummyCB
(void)dummyCB;
assert(audio_Shutdown()); assert(audio_Shutdown());
assert(audio_Init(dummyCB)); assert(audio_Init(dummyCB));
assert(!audio_Disabled()); assert(!audio_Disabled());

View File

@ -607,6 +607,9 @@ void fpathTest(int x, int y, int x2, int y2)
FPATH_RETVAL r; FPATH_RETVAL r;
int i; int i;
// On non-debug builds prevent warnings about defining but not using fpathJobQueueLength
(void)fpathJobQueueLength;
/* Check initial state */ /* Check initial state */
assert(fpathThread != NULL); assert(fpathThread != NULL);
assert(fpathSemaphore != NULL); assert(fpathSemaphore != NULL);

View File

@ -386,6 +386,9 @@ static STRUCTURE_TYPE structureType(const char* typeName)
} }
ASSERT(!"unknown structure type", "Unknown Structure Type (%s)", typeName); ASSERT(!"unknown structure type", "Unknown Structure Type (%s)", typeName);
// Dummy value to prevent warnings about missing return from function
return 0;
} }