Commit 2d778c5e authored by Alexandre Julliard's avatar Alexandre Julliard

wpp: Change the prefix on bison-generated names to avoid the name-prefix directive.

parent 1be6e9a6
......@@ -123,8 +123,6 @@ static int nmacro_args;
%}
%name-prefix="pp"
%union{
int sint;
unsigned int uint;
......@@ -225,7 +223,7 @@ preprocessor
break;
case if_elsetrue:
case if_elsefalse:
pperror("#elif cannot follow #else");
ppy_error("#elif cannot follow #else");
default:
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s);
}
......@@ -248,7 +246,7 @@ preprocessor
break;
case if_elsetrue:
case if_elsefalse:
pperror("#else clause already defined");
ppy_error("#else clause already defined");
default:
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s);
}
......@@ -273,21 +271,21 @@ preprocessor
| tMACRO res_arg allmargs tMACROEND opt_mtexts tNL {
pp_add_macro($1, macro_args, nmacro_args, $5);
}
| tLINE tSINT tDQSTRING tNL { fprintf(ppout, "# %d %s\n", $2 , $3); free($3); }
| tGCCLINE tSINT tDQSTRING tNL { fprintf(ppout, "# %d %s\n", $2 , $3); free($3); }
| tLINE tSINT tDQSTRING tNL { fprintf(ppy_out, "# %d %s\n", $2 , $3); free($3); }
| tGCCLINE tSINT tDQSTRING tNL { fprintf(ppy_out, "# %d %s\n", $2 , $3); free($3); }
| tGCCLINE tSINT tDQSTRING tSINT tNL
{ fprintf(ppout, "# %d %s %d\n", $2, $3, $4); free($3); }
{ fprintf(ppy_out, "# %d %s %d\n", $2, $3, $4); free($3); }
| tGCCLINE tSINT tDQSTRING tSINT tSINT tNL
{ fprintf(ppout, "# %d %s %d %d\n", $2 ,$3, $4, $5); free($3); }
{ fprintf(ppy_out, "# %d %s %d %d\n", $2 ,$3, $4, $5); free($3); }
| tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tNL
{ fprintf(ppout, "# %d %s %d %d %d\n", $2 ,$3 ,$4 ,$5, $6); free($3); }
{ fprintf(ppy_out, "# %d %s %d %d %d\n", $2 ,$3 ,$4 ,$5, $6); free($3); }
| tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tSINT tNL
{ fprintf(ppout, "# %d %s %d %d %d %d\n", $2 ,$3 ,$4 ,$5, $6, $7); free($3); }
{ fprintf(ppy_out, "# %d %s %d %d %d %d\n", $2 ,$3 ,$4 ,$5, $6, $7); free($3); }
| tGCCLINE tNL /* The null-token */
| tERROR opt_text tNL { pperror("#error directive: '%s'", $2); if($2) free($2); }
| tWARNING opt_text tNL { ppwarning("#warning directive: '%s'", $2); if($2) free($2); }
| tPRAGMA opt_text tNL { fprintf(ppout, "#pragma %s\n", $2 ? $2 : ""); if ($2) free($2); }
| tPPIDENT opt_text tNL { if(pp_status.pedantic) ppwarning("#ident ignored (arg: '%s')", $2); if($2) free($2); }
| tERROR opt_text tNL { ppy_error("#error directive: '%s'", $2); if($2) free($2); }
| tWARNING opt_text tNL { ppy_warning("#warning directive: '%s'", $2); if($2) free($2); }
| tPRAGMA opt_text tNL { fprintf(ppy_out, "#pragma %s\n", $2 ? $2 : ""); if ($2) free($2); }
| tPPIDENT opt_text tNL { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", $2); if($2) free($2); }
| tRCINCLUDE tRCINCLUDEPATH {
int nl=strlen($2) +3;
char *fn=pp_xmalloc(nl);
......@@ -347,7 +345,7 @@ mtext : tLITERAL { $$ = new_mtext($1, 0, exp_text); }
| tSTRINGIZE tIDENT {
int mat = marg_index($2);
if(mat < 0)
pperror("Stringification identifier must be an argument parameter");
ppy_error("Stringification identifier must be an argument parameter");
$$ = new_mtext(NULL, mat, exp_stringize);
}
| tIDENT {
......
......@@ -203,7 +203,7 @@ void pp_del_define(const char *name)
if((ppp = pplookup(name)) == NULL)
{
if(pp_status.pedantic)
ppwarning("%s was not defined", name);
ppy_warning("%s was not defined", name);
return;
}
......@@ -223,7 +223,7 @@ pp_entry_t *pp_add_define(char *def, char *text)
if((ppp = pplookup(def)) != NULL)
{
if(pp_status.pedantic)
ppwarning("Redefinition of %s\n\tPrevious definition: %s:%d", def, ppp->filename, ppp->linenumber);
ppy_warning("Redefinition of %s\n\tPrevious definition: %s:%d", def, ppp->filename, ppp->linenumber);
pp_del_define(def);
}
ppp = pp_xmalloc(sizeof(pp_entry_t));
......@@ -265,7 +265,7 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp)
if((ppp = pplookup(id)) != NULL)
{
if(pp_status.pedantic)
ppwarning("Redefinition of %s\n\tPrevious definition: %s:%d", id, ppp->filename, ppp->linenumber);
ppy_warning("Redefinition of %s\n\tPrevious definition: %s:%d", id, ppp->filename, ppp->linenumber);
pp_del_define(id);
}
ppp = pp_xmalloc(sizeof(pp_entry_t));
......@@ -524,7 +524,7 @@ void pp_push_if(pp_if_state_t s)
pp_if_state_t pp_pop_if(void)
{
if(if_stack_idx <= 0)
pperror("#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)");
ppy_error("#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)");
switch(pp_if_state())
{
......@@ -606,21 +606,21 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
fprintf(stderr, "\n");
}
int pperror(const char *s, ...)
int ppy_error(const char *s, ...)
{
va_list ap;
va_start(ap, s);
generic_msg(s, "Error", pptext, ap);
generic_msg(s, "Error", ppy_text, ap);
va_end(ap);
exit(1);
return 1;
}
int ppwarning(const char *s, ...)
int ppy_warning(const char *s, ...)
{
va_list ap;
va_start(ap, s);
generic_msg(s, "Warning", pptext, ap);
generic_msg(s, "Warning", ppy_text, ap);
va_end(ap);
return 0;
}
......
......@@ -28,7 +28,7 @@
#include "wpp_private.h"
#include "wine/wpp.h"
int ppdebug, pp_flex_debug;
int ppy_debug, pp_flex_debug;
struct define
{
......@@ -126,7 +126,7 @@ void wpp_add_cmdline_define( const char *value )
void wpp_set_debug( int lex_debug, int parser_debug, int msg_debug )
{
pp_flex_debug = lex_debug;
ppdebug = parser_debug;
ppy_debug = parser_debug;
pp_status.debug = msg_debug;
}
......@@ -149,8 +149,8 @@ int wpp_parse( const char *input, FILE *output )
add_cmdline_defines();
add_special_defines();
if (!input) ppin = stdin;
else if (!(ppin = fopen(input, "rt")))
if (!input) ppy_in = stdin;
else if (!(ppy_in = fopen(input, "rt")))
{
fprintf(stderr,"Could not open %s\n", input);
exit(2);
......@@ -158,12 +158,12 @@ int wpp_parse( const char *input, FILE *output )
pp_status.input = input;
ppout = output;
fprintf(ppout, "# 1 \"%s\" 1\n", input ? input : "");
ppy_out = output;
fprintf(ppy_out, "# 1 \"%s\" 1\n", input ? input : "");
ret = ppparse();
ret = ppy_parse();
if (input) fclose(ppin);
if (input) fclose(ppy_in);
pp_pop_define_state();
return ret;
}
......
......@@ -217,8 +217,8 @@ int pp_get_if_depth(void);
#define __attribute__(x) /*nothing*/
#endif
int pperror(const char *s, ...) __attribute__((format (printf, 1, 2)));
int ppwarning(const char *s, ...) __attribute__((format (printf, 1, 2)));
int ppy_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
int ppy_warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
void pp_internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4)));
/* current preprocessor state */
......@@ -239,11 +239,11 @@ extern includelogicentry_t *pp_includelogiclist;
/*
* From ppl.l
*/
extern FILE *ppin;
extern FILE *ppout;
extern char *pptext;
extern FILE *ppy_in;
extern FILE *ppy_out;
extern char *ppy_text;
extern int pp_flex_debug;
int pplex(void);
int ppy_lex(void);
void pp_do_include(char *fname, int type);
void pp_push_ignore_state(void);
......@@ -253,7 +253,7 @@ void pp_pop_ignore_state(void);
/*
* From ppy.y
*/
int ppparse(void);
extern int ppdebug;
int ppy_parse(void);
extern int ppy_debug;
#endif /* __WINE_WPP_PRIVATE_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment