Alexandre Julliard : wrc: Use the existing global variable for pedantic mode.

Alexandre Julliard julliard at winehq.org
Fri Sep 24 15:31:59 CDT 2021


Module: wine
Branch: master
Commit: df08cd443a1ab47eb057f372f48d5107d5e85e5c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=df08cd443a1ab47eb057f372f48d5107d5e85e5c

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Sep 24 09:50:54 2021 +0200

wrc: Use the existing global variable for pedantic mode.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/wrc/parser.l      |  1 +
 tools/wrc/ppy.y         |  2 +-
 tools/wrc/wpp.c         | 19 +++++++------------
 tools/wrc/wpp_private.h |  3 +--
 tools/wrc/wrc.c         |  1 -
 tools/wrc/wrc.h         |  1 -
 6 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/tools/wrc/parser.l b/tools/wrc/parser.l
index f0cec77945e..0c71396de73 100644
--- a/tools/wrc/parser.l
+++ b/tools/wrc/parser.l
@@ -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"
 
diff --git a/tools/wrc/ppy.y b/tools/wrc/ppy.y
index 79058de170d..7dc75ac1965 100644
--- a/tools/wrc/ppy.y
+++ b/tools/wrc/ppy.y
@@ -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);
 	}
diff --git a/tools/wrc/wpp.c b/tools/wrc/wpp.c
index 30d6dd79291..200b21f8a2a 100644
--- a/tools/wrc/wpp.c
+++ b/tools/wrc/wpp.c
@@ -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 )
 {
diff --git a/tools/wrc/wpp_private.h b/tools/wrc/wpp_private.h
index 2dfb7bbd0ab..435dbcc005a 100644
--- a/tools/wrc/wpp_private.h
+++ b/tools/wrc/wpp_private.h
@@ -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
diff --git a/tools/wrc/wrc.c b/tools/wrc/wrc.c
index 757a3915e7a..56c4c2f656b 100644
--- a/tools/wrc/wrc.c
+++ b/tools/wrc/wrc.c
@@ -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;
diff --git a/tools/wrc/wrc.h b/tools/wrc/wrc.h
index d39284fbe96..d086c5c60f9 100644
--- a/tools/wrc/wrc.h
+++ b/tools/wrc/wrc.h
@@ -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;




More information about the wine-cvs mailing list