* Don't use an yyerror implementation with printf-format parsing for parsers/lexers that don't use it
- This reduces the complexity of those functions ''significantly'' * Mark yyerror functions with printf formatting with WZ_DECL_FORMAT(printf, ...) (@trunk = the original intented target for r6430) git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6432 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
550efd000a
commit
1538c2af41
|
@ -32,7 +32,7 @@
|
|||
/* Maximum length for any TEXT value */
|
||||
#define YYLMAX 255
|
||||
|
||||
void audp_error(const char* fmt, ...) WZ_DECL_FORMAT(printf, 1, 2);
|
||||
void audp_error(const char* fmt);
|
||||
|
||||
#include "lib/framework/lexer_input.h"
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ extern int audp_get_lineno(void);
|
|||
extern char* audp_get_text(void);
|
||||
extern void audp_set_extra(YY_EXTRA_TYPE user_defined);
|
||||
|
||||
void yyerror(const char* fmt, ...) WZ_DECL_FORMAT(printf, 1, 2);
|
||||
void yyerror(const char* fmt);
|
||||
|
||||
%}
|
||||
|
||||
|
@ -215,22 +215,9 @@ anim_state: INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER I
|
|||
%%
|
||||
|
||||
/* A simple error reporting routine */
|
||||
void yyerror(const char* msg, ...)
|
||||
void yyerror(const char* msg)
|
||||
{
|
||||
char* txtBuf;
|
||||
va_list args;
|
||||
size_t size;
|
||||
|
||||
va_start(args, msg);
|
||||
size = vsnprintf(NULL, 0, msg, args);
|
||||
va_end(args);
|
||||
|
||||
txtBuf = alloca(size + 1);
|
||||
va_start(args, msg);
|
||||
vsprintf(txtBuf, msg, args);
|
||||
va_end(args);
|
||||
|
||||
debug(LOG_ERROR, "RES file parse error:\n%s at line %d\nToken: %d, Text: '%s'\n", txtBuf, audp_get_lineno(), audp_char, audp_get_text());
|
||||
debug(LOG_ERROR, "RES file parse error:\n%s at line %d\nToken: %d, Text: '%s'\n", msg, audp_get_lineno(), audp_char, audp_get_text());
|
||||
}
|
||||
|
||||
/** Read an audio properties file
|
||||
|
|
|
@ -167,6 +167,8 @@ static void chat_reset_command(SDWORD cmdIndex)
|
|||
}
|
||||
}
|
||||
|
||||
static void yyerror(const char* msg);
|
||||
|
||||
%}
|
||||
|
||||
%name-prefix="chat_"
|
||||
|
@ -631,7 +633,7 @@ R_ALLY_PLAYER: _T_ALLY R_PLAYER R_EOD /* ally blue */
|
|||
scrParameter.v.ival = $2;
|
||||
if(!chat_store_parameter(&scrParameter))
|
||||
{
|
||||
chat_error("chat command: Too many parameters in the message");
|
||||
yyerror("chat command: Too many parameters in the message");
|
||||
}
|
||||
}
|
||||
;
|
||||
|
@ -644,7 +646,7 @@ R_ATTACK_PLAYER: R_INITIATE_ATTACK R_PLAYER R_EOD /* attack blue */
|
|||
scrParameter.v.ival = $2;
|
||||
if(!chat_store_parameter(&scrParameter))
|
||||
{
|
||||
chat_error("chat command: Too many parameters in the message");
|
||||
yyerror("chat command: Too many parameters in the message");
|
||||
}
|
||||
}
|
||||
| _T_GO R_PLAYER R_EOD /* go blue */
|
||||
|
@ -654,7 +656,7 @@ R_ATTACK_PLAYER: R_INITIATE_ATTACK R_PLAYER R_EOD /* attack blue */
|
|||
scrParameter.v.ival = $2;
|
||||
if(!chat_store_parameter(&scrParameter))
|
||||
{
|
||||
chat_error("chat command: Too many parameters in the message");
|
||||
yyerror("chat command: Too many parameters in the message");
|
||||
}
|
||||
}
|
||||
;
|
||||
|
@ -667,7 +669,7 @@ R_ATTACKING_PLAYER: R_ATTACKING R_PLAYER R_EOD /* attacking blue */
|
|||
scrParameter.v.ival = $2;
|
||||
if(!chat_store_parameter(&scrParameter))
|
||||
{
|
||||
chat_error("chat command: Too many parameters in the message");
|
||||
yyerror("chat command: Too many parameters in the message");
|
||||
}
|
||||
}
|
||||
;
|
||||
|
@ -680,7 +682,7 @@ R_PLAYER_HAS_VTOLS: R_PLAYER R_POSSESSES _T_VTOLS R_EOD /* blue has VTOLS
|
|||
scrParameter.v.ival = $1;
|
||||
if(!chat_store_parameter(&scrParameter))
|
||||
{
|
||||
chat_error("chat command: Too many parameters in the message");
|
||||
yyerror("chat command: Too many parameters in the message");
|
||||
}
|
||||
}
|
||||
;
|
||||
|
@ -692,7 +694,7 @@ R_GETTING_ENEMY_DERRICK: _T_GONNA R_INITIATE_ATTACK R_PLAYER_POSSESSION _T_D
|
|||
scrParameter.v.ival = $3;
|
||||
if(!chat_store_parameter(&scrParameter))
|
||||
{
|
||||
chat_error("chat command: Too many parameters in the message");
|
||||
yyerror("chat command: Too many parameters in the message");
|
||||
}
|
||||
}
|
||||
;
|
||||
|
@ -704,7 +706,7 @@ R_LASSAT_PLAYER: _T_LASSAT R_PLAYER R_EOD /* gonna get blue's derrick */
|
|||
scrParameter.v.ival = $2;
|
||||
if(!chat_store_parameter(&scrParameter))
|
||||
{
|
||||
chat_error("chat command: Too many parameters in the message");
|
||||
yyerror("chat command: Too many parameters in the message");
|
||||
}
|
||||
}
|
||||
;
|
||||
|
@ -755,18 +757,12 @@ BOOL chatLoad(char *pData, UDWORD size)
|
|||
}
|
||||
|
||||
/* A simple error reporting routine */
|
||||
void chat_error(const char *pMessage,...)
|
||||
static void yyerror(const char* msg)
|
||||
{
|
||||
int line;
|
||||
char *pText;
|
||||
char aTxtBuf[1024];
|
||||
va_list args;
|
||||
|
||||
va_start(args, pMessage);
|
||||
vsnprintf(aTxtBuf, sizeof(aTxtBuf), pMessage, args);
|
||||
va_end(args);
|
||||
|
||||
chatGetErrorData(&line, &pText);
|
||||
//debug(LOG_WARNING, "multiplayer message parse error: %s at line %d, token: %d, text: '%s'",
|
||||
// aTxtBuf, line, chat_char, pText);
|
||||
// msg, line, chat_char, pText);
|
||||
}
|
||||
|
|
|
@ -61,8 +61,6 @@ extern CHAT_MSG chat_msg;
|
|||
/* Store parameter extracted from the message - for scripts */
|
||||
//extern BOOL chat_store_parameter(INTERP_VAL *parameter);
|
||||
|
||||
extern void chat_error(const char *pMessage,...);
|
||||
|
||||
extern void chatGetErrorData(int *pLine, char **ppText);
|
||||
|
||||
/* Set the current input buffer for the lexer */
|
||||
|
|
|
@ -300,7 +300,7 @@ extern BOOL scriptInitParser(void);
|
|||
extern int scr_parse(void);
|
||||
|
||||
/* Give an error message */
|
||||
void scr_error(const char *pMessage, ...);
|
||||
void scr_error(const char *pMessage, ...) WZ_DECL_FORMAT(printf, 1, 2);
|
||||
|
||||
extern void scriptGetErrorData(int *pLine, char **ppText);
|
||||
|
||||
|
|
Loading…
Reference in New Issue