Bug 4812 - GCC __attribute__ annotations for printf, non-returning functions etc., patch by linux@youmustbejoking.demon.co.uk and Zack Middleton

This commit is contained in:
Thilo Schulz 2011-07-18 14:56:57 +00:00
parent 69a7ada911
commit 9dc32d55e2
30 changed files with 63 additions and 61 deletions

View file

@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
extern aas_t aasworld;
//AAS error message
void QDECL AAS_Error(char *fmt, ...);
void QDECL AAS_Error(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
//set AAS initialized
void AAS_SetInitialized(void);
//setup AAS with the given number of entities and clients

View file

@ -1065,7 +1065,7 @@ int AAS_ReadRouteCache(void)
botimport.FS_Read(&routecacheheader, sizeof(routecacheheader_t), fp );
if (routecacheheader.ident != RCID)
{
AAS_Error("%s is not a route cache dump\n");
AAS_Error("%s is not a route cache dump\n", filename);
return qfalse;
} //end if
if (routecacheheader.version != RCVERSION)

View file

@ -698,7 +698,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
StripDoubleQuotes(token.string);
if (strlen(token.string) <= 0)
{
SourceError(source, "empty string", token.string);
SourceError(source, "empty string");
FreeSource(source);
return NULL;
} //end if

View file

@ -170,7 +170,7 @@ typedef struct bot_entitystate_s
typedef struct botlib_import_s
{
//print messages from the bot library
void (QDECL *Print)(int type, char *fmt, ...);
void (QDECL *Print)(int type, char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
//trace a bbox through the world
void (*Trace)(bsp_trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask);
//trace a bbox against a specific entity

View file

@ -36,9 +36,9 @@ void Log_Close(void);
//close log file if present
void Log_Shutdown(void);
//write to the current opened log file
void QDECL Log_Write(char *fmt, ...);
void QDECL Log_Write(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
//write to the current opened log file with a time stamp
void QDECL Log_WriteTimeStamped(char *fmt, ...);
void QDECL Log_WriteTimeStamped(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
//returns a pointer to the log file
FILE *Log_FilePointer(void);
//flush log file

View file

@ -152,9 +152,9 @@ source_t *LoadSourceMemory(char *ptr, int length, char *name);
//free the given source
void FreeSource(source_t *source);
//print a source error
void QDECL SourceError(source_t *source, char *str, ...);
void QDECL SourceError(source_t *source, char *str, ...) __attribute__ ((format (printf, 2, 3)));
//print a source warning
void QDECL SourceWarning(source_t *source, char *str, ...);
void QDECL SourceWarning(source_t *source, char *str, ...) __attribute__ ((format (printf, 2, 3)));
#ifdef BSPC
// some of BSPC source does include game/q_shared.h and some does not

View file

@ -990,7 +990,7 @@ int PS_ExpectTokenType(script_t *script, int type, int subtype, token_t *token)
if (token->subtype != subtype)
{
ScriptError(script, "expected %s, found %s",
script->punctuations[subtype], token->string);
script->punctuations[subtype].p, token->string);
return 0;
} //end if
} //end else if
@ -1158,7 +1158,7 @@ float ReadSignedFloat(script_t *script)
{
if(!PS_ExpectAnyToken(script, &token))
{
ScriptError(script, "Missing float value\n", token.string);
ScriptError(script, "Missing float value\n");
return 0;
}
@ -1189,7 +1189,7 @@ signed long int ReadSignedInt(script_t *script)
{
if(!PS_ExpectAnyToken(script, &token))
{
ScriptError(script, "Missing integer value\n", token.string);
ScriptError(script, "Missing integer value\n");
return 0;
}

View file

@ -240,8 +240,8 @@ void FreeScript(script_t *script);
//set the base folder to load files from
void PS_SetBaseFolder(char *path);
//print a script error with filename and line number
void QDECL ScriptError(script_t *script, char *str, ...);
void QDECL ScriptError(script_t *script, char *str, ...) __attribute__ ((format (printf, 2, 3)));
//print a script warning with filename and line number
void QDECL ScriptWarning(script_t *script, char *str, ...);
void QDECL ScriptWarning(script_t *script, char *str, ...) __attribute__ ((format (printf, 2, 3)));

View file

@ -150,7 +150,7 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
} //end if
if (intval < intmin || intval > intmax)
{
SourceError(source, "value %d out of range [%d, %d]", intval, intmin, intmax);
SourceError(source, "value %ld out of range [%ld, %ld]", intval, intmin, intmax);
return 0;
} //end if
} //end if
@ -160,7 +160,7 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
{
if (intval < fd->floatmin || intval > fd->floatmax)
{
SourceError(source, "value %d out of range [%f, %f]", intval, fd->floatmin, fd->floatmax);
SourceError(source, "value %ld out of range [%f, %f]", intval, fd->floatmin, fd->floatmax);
return 0;
} //end if
} //end if