wrc: Use the existing global variable for pedantic mode.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-09-24 09:50:54 +02:00
parent 1e173eaa8c
commit df08cd443a
6 changed files with 10 additions and 17 deletions

View file

@ -115,6 +115,7 @@ ws [ \f\t\r]
#include "utils.h"
#include "parser.h"
#include "newstruc.h"
#include "wpp_private.h"
#include "parser.tab.h"

View file

@ -281,7 +281,7 @@ preprocessor
| tERROR opt_text tNL { ppy_error("#error directive: '%s'", $2); free($2); }
| tWARNING opt_text tNL { ppy_warning("#warning directive: '%s'", $2); free($2); }
| tPRAGMA opt_text tNL { fprintf(ppy_out, "#pragma %s\n", $2 ? $2 : ""); free($2); }
| tPPIDENT opt_text tNL { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", $2); free($2); }
| tPPIDENT opt_text tNL { if(pedantic) ppy_warning("#ident ignored (arg: '%s')", $2); free($2); }
| tRCINCLUDE tRCINCLUDEPATH {
pp_do_include(strmake( "\"%s\"", $2 ),1);
}

View file

@ -191,7 +191,7 @@ void pp_del_define(const char *name)
if((ppp = pplookup(name)) == NULL)
{
if(pp_status.pedantic)
if(pedantic)
ppy_warning("%s was not defined", name);
return;
}
@ -215,8 +215,9 @@ pp_entry_t *pp_add_define(const char *def, const char *text)
idx = pphash(def);
if((ppp = pplookup(def)) != NULL)
{
if(pp_status.pedantic)
ppy_warning("Redefinition of %s\n\tPrevious definition: %s:%d", def, ppp->filename, ppp->linenumber);
if(pedantic)
ppy_warning("Redefinition of %s\n%s:%d: note: previous definition was here",
def, ppp->filename, ppp->linenumber);
pp_del_define(def);
}
ppp = xmalloc(sizeof(pp_entry_t));
@ -255,8 +256,9 @@ pp_entry_t *pp_add_macro(char *id, char *args[], int nargs, mtext_t *exp)
idx = pphash(id);
if((ppp = pplookup(id)) != NULL)
{
if(pp_status.pedantic)
ppy_warning("Redefinition of %s\n\tPrevious definition: %s:%d", id, ppp->filename, ppp->linenumber);
if(pedantic)
ppy_warning("Redefinition of %s\n%s:%d: note: previous definition was here",
id, ppp->filename, ppp->linenumber);
pp_del_define(id);
}
ppp = xmalloc(sizeof(pp_entry_t));
@ -637,13 +639,6 @@ void wpp_set_debug( int lex_debug, int parser_debug, int msg_debug )
}
/* set the pedantic mode */
void wpp_set_pedantic( int on )
{
pp_status.pedantic = on;
}
/* the main preprocessor parsing loop */
int wpp_parse( const char *input, FILE *output )
{

View file

@ -27,7 +27,6 @@
extern void wpp_del_define( const char *name );
extern void wpp_add_cmdline_define( const char *value );
extern void wpp_set_debug( int lex_debug, int parser_debug, int msg_debug );
extern void wpp_set_pedantic( int on );
extern void wpp_add_include_path( const char *path );
extern char *wpp_find_include( const char *name, const char *parent_name );
/* Return value == 0 means successful execution */
@ -177,12 +176,12 @@ struct pp_status
FILE *file; /* current input file descriptor */
int line_number; /* current line number */
int char_number; /* current char number in line */
int pedantic; /* pedantic option */
int debug; /* debug messages flag */
};
extern struct pp_status pp_status;
extern include_state_t pp_incl_state;
extern int pedantic;
/*
* From ppl.l

View file

@ -439,7 +439,6 @@ int main(int argc,char *argv[])
break;
case LONG_OPT_PEDANTIC:
pedantic = 1;
wpp_set_pedantic(1);
break;
case LONG_OPT_VERIFY_TRANSL:
verify_translations_mode = 1;

View file

@ -35,7 +35,6 @@ extern int debuglevel;
extern int win32;
extern int extensions;
extern int pedantic;
extern int byteorder;
extern int preprocess_only;
extern int no_preprocess;