Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
026ca4cd
Commit
026ca4cd
authored
Sep 28, 2009
by
Matteo Bruni
Committed by
Alexandre Julliard
Oct 02, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wpp: Remove the assumption ppy_error calls exit().
parent
37e71168
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
9 deletions
+45
-9
ppl.l
libs/wpp/ppl.l
+16
-1
ppy.y
libs/wpp/ppy.y
+10
-1
preproc.c
libs/wpp/preproc.c
+7
-0
wpp.c
libs/wpp/wpp.c
+9
-6
wpp_private.h
libs/wpp/wpp_private.h
+3
-1
No files found.
libs/wpp/ppl.l
View file @
026ca4cd
...
...
@@ -639,7 +639,7 @@ includelogicentry_t *pp_includelogiclist = NULL;
if(yy_current_state() == pp_inc)
ppy_error("Expected include filename");
if(yy_current_state() == pp_if)
else
if(yy_current_state() == pp_if)
{
ppy_lval.cptr = pp_xstrdup(ppy_text);
return tIDENT;
...
...
@@ -808,7 +808,10 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len)
ext[0] = len > 2 ? toupper(str[len-3]) : ' ';
if(!strcmp(ext, "LUL"))
{
ppy_error("Invalid constant suffix");
return 0;
}
else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL"))
{
is_ll++;
...
...
@@ -1085,7 +1088,10 @@ static void expand_macro(macexpstackentry_t *mep)
assert(ppp->expanding == 0);
if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs))
{
ppy_error("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs);
return;
}
for(n = 0; n < nargs; n++)
nnl += mep->nnls[n];
...
...
@@ -1323,7 +1329,10 @@ static bufferstackentry_t *pop_buffer(void)
static void push_macro(pp_entry_t *ppp)
{
if(macexpstackidx >= MAXMACEXPSTACK)
{
ppy_error("Too many nested macros");
return;
}
macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0]));
memset( macexpstack[macexpstackidx], 0, sizeof(macexpstack[0][0]));
...
...
@@ -1472,13 +1481,19 @@ void pp_do_include(char *fname, int type)
n = strlen(fname);
if(n <= 2)
{
ppy_error("Empty include filename");
return;
}
/* Undo the effect of the quotation */
fname[n-1] = '\0';
if((ppy_in = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL)
{
ppy_error("Unable to open include file %s", fname+1);
return;
}
fname[n-1] = *fname; /* Redo the quotes */
push_buffer(NULL, newpath, fname, 0);
...
...
libs/wpp/ppy.y
View file @
026ca4cd
...
...
@@ -224,6 +224,9 @@ preprocessor
case if_elsetrue:
case if_elsefalse:
ppy_error("#elif cannot follow #else");
break;
case if_error:
break;
default:
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s);
}
...
...
@@ -247,12 +250,16 @@ preprocessor
case if_elsetrue:
case if_elsefalse:
ppy_error("#else clause already defined");
break;
case if_error:
break;
default:
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s);
}
}
| tENDIF tNL {
pp_pop_if();
if(pp_pop_if() != if_error)
{
if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1)
{
pp_incl_state.state = 2;
...
...
@@ -266,6 +273,7 @@ preprocessor
fprintf(stderr, "tENDIF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n",
pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth);
}
}
| tUNDEF tIDENT tNL { pp_del_define($2); free($2); }
| tDEFINE opt_text tNL { pp_add_define($1, $2); }
| tMACRO res_arg allmargs tMACROEND opt_mtexts tNL {
...
...
@@ -346,6 +354,7 @@ mtext : tLITERAL { $$ = new_mtext($1, 0, exp_text); }
int mat = marg_index($2);
if(mat < 0)
ppy_error("Stringification identifier must be an argument parameter");
else
$$ = new_mtext(NULL, mat, exp_stringize);
}
| tIDENT {
...
...
libs/wpp/preproc.c
View file @
026ca4cd
...
...
@@ -519,13 +519,18 @@ void pp_push_if(pp_if_state_t s)
case
if_ignore
:
pp_push_ignore_state
();
break
;
default:
pp_internal_error
(
__FILE__
,
__LINE__
,
"Invalid pp_if_state (%d)"
,
(
int
)
pp_if_state
());
}
}
pp_if_state_t
pp_pop_if
(
void
)
{
if
(
if_stack_idx
<=
0
)
{
ppy_error
(
"#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)"
);
return
if_error
;
}
switch
(
pp_if_state
())
{
...
...
@@ -538,6 +543,8 @@ pp_if_state_t pp_pop_if(void)
case
if_ignore
:
pp_pop_ignore_state
();
break
;
default:
pp_internal_error
(
__FILE__
,
__LINE__
,
"Invalid pp_if_state (%d)"
,
(
int
)
pp_if_state
());
}
if
(
pp_flex_debug
)
...
...
libs/wpp/wpp.c
View file @
026ca4cd
...
...
@@ -144,6 +144,7 @@ int wpp_parse( const char *input, FILE *output )
int
ret
;
pp_status
.
input
=
NULL
;
pp_status
.
state
=
0
;
pp_push_define_state
();
add_cmdline_defines
();
...
...
@@ -152,8 +153,8 @@ int wpp_parse( const char *input, FILE *output )
if
(
!
input
)
ppy_in
=
stdin
;
else
if
(
!
(
ppy_in
=
fopen
(
input
,
"rt"
)))
{
fprintf
(
stderr
,
"Could not open %s
\n
"
,
input
);
exit
(
2
)
;
ppy_error
(
"Could not open %s
\n
"
,
input
);
return
2
;
}
pp_status
.
input
=
input
;
...
...
@@ -162,6 +163,8 @@ int wpp_parse( const char *input, FILE *output )
fprintf
(
ppy_out
,
"# 1
\"
%s
\"
1
\n
"
,
input
?
input
:
""
);
ret
=
ppy_parse
();
/* If there were errors during processing, return an error code */
if
(
!
ret
&&
pp_status
.
state
)
ret
=
pp_status
.
state
;
if
(
input
)
fclose
(
ppy_in
);
pp_pop_define_state
();
...
...
@@ -184,14 +187,14 @@ int wpp_parse_temp( const char *input, const char *output_base, char **output_na
if
((
fd
=
mkstemps
(
temp_name
,
0
))
==
-
1
)
{
fprintf
(
stderr
,
"Could not generate a temp name from %s
\n
"
,
temp_name
);
exit
(
2
)
;
ppy_error
(
"Could not generate a temp name from %s
\n
"
,
temp_name
);
return
2
;
}
if
(
!
(
output
=
fdopen
(
fd
,
"wt"
)))
{
fprintf
(
stderr
,
"Could not open fd %s for writing
\n
"
,
temp_name
);
exit
(
2
)
;
ppy_error
(
"Could not open fd %s for writing
\n
"
,
temp_name
);
return
2
;
}
*
output_name
=
temp_name
;
...
...
libs/wpp/wpp_private.h
View file @
026ca4cd
...
...
@@ -113,7 +113,8 @@ typedef enum {
if_elif
,
if_elsefalse
,
if_elsetrue
,
if_ignore
if_ignore
,
if_error
}
pp_if_state_t
;
...
...
@@ -228,6 +229,7 @@ struct pp_status
const
char
*
input
;
/* current input file name */
int
line_number
;
/* current line number */
int
char_number
;
/* current char number in line */
int
state
;
/* current error state */
int
pedantic
;
/* pedantic option */
int
debug
;
/* debug messages flag */
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment