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
107103e2
Commit
107103e2
authored
Dec 03, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wpp: Remove some dead code.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
506bdf42
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
173 deletions
+39
-173
wpp.h
include/wine/wpp.h
+0
-1
ppl.l
libs/wpp/ppl.l
+3
-17
ppy.y
libs/wpp/ppy.y
+10
-25
preproc.c
libs/wpp/preproc.c
+11
-59
wpp.c
libs/wpp/wpp.c
+3
-24
wpp_private.h
libs/wpp/wpp_private.h
+8
-38
widl.c
tools/widl/widl.c
+4
-9
No files found.
include/wine/wpp.h
View file @
107103e2
...
...
@@ -24,7 +24,6 @@
#include <stdio.h>
#include <stdarg.h>
extern
void
wpp_add_define
(
const
char
*
name
,
const
char
*
value
);
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
);
...
...
libs/wpp/ppl.l
View file @
107103e2
...
...
@@ -210,7 +210,7 @@ ul [uUlL]|[uUlL][lL]|[lL][uU]|[lL][lL][uU]|[uU][lL][lL]|[lL][uU][lL]
typedef struct bufferstackentry {
YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */
void *filehandle; /* Handle to be used with wpp_callbacks->read
*/
FILE *file; /* File handle
*/
pp_entry_t *define; /* Points to expanding define or NULL if handling includes */
int line_number; /* Line that we were handling */
int char_number; /* The current position on that line */
...
...
@@ -849,10 +849,6 @@ static void newline(int dowrite)
*
* FIXME:
* The sizes of resulting 'int' and 'long' are compiler specific.
* I depend on sizeof(int) > 2 here (although a relatively safe
* assumption).
* Long longs are not yet implemented because this is very compiler
* specific and I don't want to think too much about the problems.
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1223,10 +1219,6 @@ static void expand_macro(macexpstackentry_t *mep)
*/
static void new_string(void)
{
#ifdef DEBUG
if(strbuf_idx)
ppy_warning("new_string: strbuf_idx != 0");
#endif
strbuf_idx = 0;
str_startline = pp_status.line_number;
}
...
...
@@ -1259,18 +1251,12 @@ static char *get_string(void)
memcpy(str, strbuffer, strbuf_idx);
str[strbuf_idx] = '\0';
#ifdef DEBUG
strbuf_idx = 0;
#endif
return str;
}
static void put_string(void)
{
put_buffer(strbuffer, strbuf_idx);
#ifdef DEBUG
strbuf_idx = 0;
#endif
}
static int string_start(void)
...
...
@@ -1293,7 +1279,7 @@ static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0]));
bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER;
bufferstack[bufferstackidx].file
handle
= pp_status.file;
bufferstack[bufferstackidx].file
= pp_status.file;
bufferstack[bufferstackidx].define = ppp;
bufferstack[bufferstackidx].line_number = pp_status.line_number;
bufferstack[bufferstackidx].char_number = pp_status.char_number;
...
...
@@ -1383,7 +1369,7 @@ static bufferstackentry_t *pop_buffer(void)
bufferstack[bufferstackidx].filename,
bufferstack[bufferstackidx].should_pop);
pp_status.file = bufferstack[bufferstackidx].file
handle
;
pp_status.file = bufferstack[bufferstackidx].file;
ppy__switch_to_buffer(bufferstack[bufferstackidx].bufferstate);
if(bufferstack[bufferstackidx].should_pop)
...
...
libs/wpp/ppy.y
View file @
107103e2
...
...
@@ -108,8 +108,7 @@ static void cast_to_slong(cval_t *v);
static void cast_to_ulong(cval_t *v);
static void cast_to_sll(cval_t *v);
static void cast_to_ull(cval_t *v);
static marg_t *new_marg(char *str, def_arg_t type);
static marg_t *add_new_marg(char *str, def_arg_t type);
static char *add_new_marg(char *str);
static int marg_index(char *id);
static mtext_t *new_mtext(char *str, int idx, def_exp_t type);
static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp);
...
...
@@ -118,7 +117,7 @@ static char *merge_text(char *s1, char *s2);
/*
* Local variables
*/
static
marg_t
**macro_args; /* Macro parameters array while parsing */
static
char
**macro_args; /* Macro parameters array while parsing */
static int nmacro_args;
%}
...
...
@@ -133,7 +132,7 @@ static int nmacro_args;
int *iptr;
char *cptr;
cval_t cval;
marg_t
*marg;
char
*marg;
mtext_t *mtext;
}
...
...
@@ -327,11 +326,11 @@ allmargs: /* Empty */ { $$ = 0; macro_args = NULL; nmacro_args = 0; }
;
emargs : margs { $$ = $1; }
| margs ',' tELLIPSIS {
$$ = add_new_marg(NULL, arg_list);
nmacro_args *= -1; }
| margs ',' tELLIPSIS { nmacro_args *= -1; }
;
margs : margs ',' tIDENT { $$ = add_new_marg($3
, arg_single
); }
| tIDENT { $$ = add_new_marg($1
, arg_single
); }
margs : margs ',' tIDENT { $$ = add_new_marg($3); }
| tIDENT { $$ = add_new_marg($1); }
;
opt_mtexts
...
...
@@ -543,25 +542,11 @@ static int boolean(cval_t *v)
return 0;
}
static
marg_t *new_marg(char *str, def_arg_t type
)
static
char *add_new_marg(char *str
)
{
marg_t *ma = pp_xmalloc(sizeof(marg_t));
ma->arg = str;
ma->type = type;
ma->nnl = 0;
return ma;
}
static marg_t *add_new_marg(char *str, def_arg_t type)
{
marg_t *ma;
if(!str)
return NULL;
char *ma;
macro_args = pp_xrealloc(macro_args, (nmacro_args+1) * sizeof(macro_args[0]));
ma = new_marg(str, type);
macro_args[nmacro_args] = ma;
nmacro_args++;
macro_args[nmacro_args++] = ma = pp_xstrdup(str);
return ma;
}
...
...
@@ -572,7 +557,7 @@ static int marg_index(char *id)
return -1;
for(t = 0; t < nmacro_args; t++)
{
if(!strcmp(id, macro_args[t]
->arg
))
if(!strcmp(id, macro_args[t]))
break;
}
return t < nmacro_args ? t : -1;
...
...
libs/wpp/preproc.c
View file @
107103e2
...
...
@@ -37,38 +37,12 @@ struct pp_status pp_status;
#define HASHKEY 2039
typedef
struct
pp_def_state
{
struct
list
entry
;
struct
list
defines
[
HASHKEY
];
}
pp_def_state_t
;
static
struct
list
pp_states
=
LIST_INIT
(
pp_states
);
static
pp_def_state_t
*
pp_def_state
;
static
struct
list
pp_defines
[
HASHKEY
];
#define MAXIFSTACK 64
static
pp_if_state_t
if_stack
[
MAXIFSTACK
];
static
int
if_stack_idx
=
0
;
#if 0
void pp_print_status(void) __attribute__((destructor));
void pp_print_status(void)
{
int i;
int sum;
int total = 0;
fprintf(stderr, "Defines statistics:\n");
for(i = 0; i < HASHKEY; i++)
{
sum = list_count( &pp_def_state->defines[i] );
total += sum;
if (sum) fprintf(stderr, "%4d, %3d\n", i, sum);
}
fprintf(stderr, "Total defines: %d\n", total);
}
#endif
void
*
pp_xmalloc
(
size_t
size
)
{
void
*
res
;
...
...
@@ -186,7 +160,7 @@ pp_entry_t *pplookup(const char *ident)
if
(
!
ident
)
return
NULL
;
idx
=
pphash
(
ident
);
LIST_FOR_EACH_ENTRY
(
ppp
,
&
pp_def
_state
->
def
ines
[
idx
],
pp_entry_t
,
entry
)
LIST_FOR_EACH_ENTRY
(
ppp
,
&
pp_defines
[
idx
],
pp_entry_t
,
entry
)
{
if
(
!
strcmp
(
ident
,
ppp
->
ident
))
return
ppp
;
...
...
@@ -206,27 +180,23 @@ static void free_pp_entry( pp_entry_t *ppp, int idx )
free
(
ppp
);
}
/*
push a new (empty)
define state */
void
pp_
push
_define_state
(
void
)
/*
initialize the
define state */
void
pp_
init
_define_state
(
void
)
{
pp_def_state_t
*
state
=
pp_xmalloc
(
sizeof
(
*
state
)
);
int
i
;
for
(
i
=
0
;
i
<
HASHKEY
;
i
++
)
list_init
(
&
state
->
defines
[
i
]
);
list_add_head
(
&
pp_states
,
&
state
->
entry
);
pp_def_state
=
state
;
for
(
i
=
0
;
i
<
HASHKEY
;
i
++
)
list_init
(
&
pp_defines
[
i
]
);
}
/*
pop
the current define state */
void
pp_
pop
_define_state
(
void
)
/*
free
the current define state */
void
pp_
free
_define_state
(
void
)
{
int
i
;
pp_entry_t
*
ppp
,
*
ppp2
;
pp_def_state_t
*
state
=
pp_def_state
;
for
(
i
=
0
;
i
<
HASHKEY
;
i
++
)
{
LIST_FOR_EACH_ENTRY_SAFE
(
ppp
,
ppp2
,
&
state
->
defines
[
i
],
pp_entry_t
,
entry
)
LIST_FOR_EACH_ENTRY_SAFE
(
ppp
,
ppp2
,
&
pp_
defines
[
i
],
pp_entry_t
,
entry
)
{
free
(
ppp
->
ident
);
free
(
ppp
->
subst
.
text
);
...
...
@@ -234,9 +204,6 @@ void pp_pop_define_state(void)
free_pp_entry
(
ppp
,
i
);
}
}
list_remove
(
&
state
->
entry
);
free
(
state
);
pp_def_state
=
LIST_ENTRY
(
list_head
(
&
pp_states
),
pp_def_state_t
,
entry
);
}
void
pp_del_define
(
const
char
*
name
)
...
...
@@ -281,7 +248,7 @@ pp_entry_t *pp_add_define(const char *def, const char *text)
ppp
->
subst
.
text
=
text
?
pp_xstrdup
(
text
)
:
NULL
;
ppp
->
filename
=
pp_xstrdup
(
pp_status
.
input
?
pp_status
.
input
:
"<internal or cmdline>"
);
ppp
->
linenumber
=
pp_status
.
input
?
pp_status
.
line_number
:
0
;
list_add_head
(
&
pp_def
_state
->
def
ines
[
idx
],
&
ppp
->
entry
);
list_add_head
(
&
pp_defines
[
idx
],
&
ppp
->
entry
);
if
(
ppp
->
subst
.
text
)
{
/* Strip trailing white space from subst text */
...
...
@@ -302,7 +269,7 @@ pp_entry_t *pp_add_define(const char *def, const char *text)
return
ppp
;
}
pp_entry_t
*
pp_add_macro
(
char
*
id
,
marg_t
*
args
[],
int
nargs
,
mtext_t
*
exp
)
pp_entry_t
*
pp_add_macro
(
char
*
id
,
char
*
args
[],
int
nargs
,
mtext_t
*
exp
)
{
int
idx
;
pp_entry_t
*
ppp
;
...
...
@@ -323,7 +290,7 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp)
ppp
->
subst
.
mtext
=
exp
;
ppp
->
filename
=
pp_xstrdup
(
pp_status
.
input
?
pp_status
.
input
:
"<internal or cmdline>"
);
ppp
->
linenumber
=
pp_status
.
input
?
pp_status
.
line_number
:
0
;
list_add_head
(
&
pp_def
_state
->
def
ines
[
idx
],
&
ppp
->
entry
);
list_add_head
(
&
pp_defines
[
idx
],
&
ppp
->
entry
);
if
(
pp_status
.
debug
)
{
fprintf
(
stderr
,
"Added macro (%s, %d) <%s(%d)> to <"
,
pp_status
.
input
,
pp_status
.
line_number
,
ppp
->
ident
,
nargs
);
...
...
@@ -574,26 +541,11 @@ int pp_get_if_depth(void)
return
if_stack_idx
;
}
/* #define WANT_NEAR_INDICATION */
static
void
generic_msg
(
const
char
*
s
,
const
char
*
t
,
const
char
*
n
,
va_list
ap
)
{
fprintf
(
stderr
,
"%s:%d:%d: %s: "
,
pp_status
.
input
?
pp_status
.
input
:
"stdin"
,
pp_status
.
line_number
,
pp_status
.
char_number
,
t
);
vfprintf
(
stderr
,
s
,
ap
);
#ifdef WANT_NEAR_INDICATION
{
char
*
cpy
,
*
p
;
if
(
n
)
{
cpy
=
pp_xstrdup
(
n
);
for
(
p
=
cpy
;
*
p
;
p
++
)
if
(
!
isprint
(
*
p
))
*
p
=
' '
;
fprintf
(
stderr
,
" near '%s'"
,
cpy
);
free
(
cpy
);
}
}
end:
#endif
fprintf
(
stderr
,
"
\n
"
);
}
...
...
libs/wpp/wpp.c
View file @
107103e2
...
...
@@ -49,16 +49,6 @@ static void add_cmdline_defines(void)
}
}
static
void
del_cmdline_defines
(
void
)
{
struct
define
*
def
;
LIST_FOR_EACH_ENTRY
(
def
,
&
cmdline_defines
,
struct
define
,
entry
)
{
if
(
def
->
value
)
pp_del_define
(
def
->
name
);
}
}
static
void
add_special_defines
(
void
)
{
time_t
now
=
time
(
NULL
);
...
...
@@ -78,17 +68,8 @@ static void add_special_defines(void)
ppp
->
type
=
def_special
;
}
static
void
del_special_defines
(
void
)
{
pp_del_define
(
"__DATE__"
);
pp_del_define
(
"__TIME__"
);
pp_del_define
(
"__FILE__"
);
pp_del_define
(
"__LINE__"
);
}
/* add a define to the preprocessor list */
void
wpp_add_define
(
const
char
*
name
,
const
char
*
value
)
static
void
wpp_add_define
(
const
char
*
name
,
const
char
*
value
)
{
struct
define
*
def
;
...
...
@@ -166,7 +147,7 @@ int wpp_parse( const char *input, FILE *output )
pp_status
.
line_number
=
1
;
pp_status
.
char_number
=
1
;
pp_
push
_define_state
();
pp_
init
_define_state
();
add_cmdline_defines
();
add_special_defines
();
...
...
@@ -188,8 +169,6 @@ int wpp_parse( const char *input, FILE *output )
}
/* Clean if_stack, it could remain dirty on errors */
while
(
pp_get_if_depth
())
pp_pop_if
();
del_special_defines
();
del_cmdline_defines
();
pp_pop_define_state
();
pp_free_define_state
();
return
ret
;
}
libs/wpp/wpp_private.h
View file @
107103e2
...
...
@@ -37,20 +37,6 @@ typedef struct includelogicentry {
}
includelogicentry_t
;
/*
* The arguments of a macrodefinition
*/
typedef
enum
{
arg_single
,
arg_list
}
def_arg_t
;
typedef
struct
marg
{
def_arg_t
type
;
/* Normal or ... argument */
char
*
arg
;
/* The textual argument */
int
nnl
;
/* Number of newlines in the text to subst */
}
marg_t
;
/*
* The expansiontext of a macro
*/
typedef
enum
{
...
...
@@ -84,7 +70,7 @@ typedef struct pp_entry {
struct
list
entry
;
def_type_t
type
;
/* Define or macro */
char
*
ident
;
/* The key */
marg_t
**
margs
;
/* Macro arguments array or NULL if none */
char
**
margs
;
/* Macro arguments array or NULL if none */
int
nargs
;
union
{
mtext_t
*
mtext
;
/* The substitution sequence or NULL if none */
...
...
@@ -131,21 +117,13 @@ typedef struct
int
seen_junk
;
/* Set when junk is seen */
}
include_state_t
;
#define SIZE_CHAR 1
#define SIZE_SHORT 2
#define SIZE_INT 3
#define SIZE_LONG 4
#define SIZE_LONGLONG 5
#define SIZE_INT 1
#define SIZE_LONG 2
#define SIZE_LONGLONG 3
#define SIZE_MASK 0x00ff
#define FLAG_SIGNED 0x0100
typedef
enum
{
#if 0
cv_schar = SIZE_CHAR + FLAG_SIGNED,
cv_uchar = SIZE_CHAR,
cv_sshort = SIZE_SHORT + FLAG_SIGNED,
cv_ushort = SIZE_SHORT,
#endif
cv_sint
=
SIZE_INT
+
FLAG_SIGNED
,
cv_uint
=
SIZE_INT
,
cv_slong
=
SIZE_LONG
+
FLAG_SIGNED
,
...
...
@@ -157,12 +135,6 @@ typedef enum {
typedef
struct
cval
{
ctype_t
type
;
union
{
#if 0
signed char sc; /* Explicitly signed because compilers are stupid */
unsigned char uc;
short ss;
unsigned short us;
#endif
int
si
;
unsigned
int
ui
;
long
sl
;
...
...
@@ -178,10 +150,10 @@ void *pp_xmalloc(size_t);
void
*
pp_xrealloc
(
void
*
,
size_t
);
char
*
pp_xstrdup
(
const
char
*
str
);
pp_entry_t
*
pplookup
(
const
char
*
ident
);
void
pp_
push
_define_state
(
void
);
void
pp_
pop
_define_state
(
void
);
void
pp_
init
_define_state
(
void
);
void
pp_
free
_define_state
(
void
);
pp_entry_t
*
pp_add_define
(
const
char
*
def
,
const
char
*
text
);
pp_entry_t
*
pp_add_macro
(
char
*
ident
,
marg_t
*
args
[],
int
nargs
,
mtext_t
*
exp
);
pp_entry_t
*
pp_add_macro
(
char
*
ident
,
char
*
args
[],
int
nargs
,
mtext_t
*
exp
);
void
pp_del_define
(
const
char
*
name
);
void
*
pp_open_include
(
const
char
*
name
,
int
type
,
const
char
*
parent_name
,
char
**
newpath
);
void
pp_push_if
(
pp_if_state_t
s
);
...
...
@@ -196,8 +168,6 @@ char *wpp_lookup(const char *name, int type, const char *parent_name,
#define __attribute__(x)
/*nothing*/
#endif
extern
const
struct
wpp_callbacks
*
wpp_callbacks
;
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
)));
...
...
@@ -207,7 +177,7 @@ void pp_internal_error(const char *file, int line, const char *s, ...) __attribu
struct
pp_status
{
char
*
input
;
/* current input file name */
void
*
file
;
/* current input file descriptor */
FILE
*
file
;
/* current input file descriptor */
int
line_number
;
/* current line number */
int
char_number
;
/* current char number in line */
int
pedantic
;
/* pedantic option */
...
...
tools/widl/widl.c
View file @
107103e2
...
...
@@ -249,6 +249,7 @@ static char *dup_basename_token(const char *name, const char *ext)
static
void
add_widl_version_define
(
void
)
{
char
version_str
[
32
];
unsigned
int
version
;
const
char
*
p
=
PACKAGE_VERSION
;
...
...
@@ -267,14 +268,8 @@ static void add_widl_version_define(void)
if
(
p
)
version
+=
atoi
(
p
+
1
);
if
(
version
!=
0
)
{
char
version_str
[
11
];
snprintf
(
version_str
,
sizeof
(
version_str
),
"0x%x"
,
version
);
wpp_add_define
(
"__WIDL__"
,
version_str
);
}
else
wpp_add_define
(
"__WIDL__"
,
NULL
);
snprintf
(
version_str
,
sizeof
(
version_str
),
"__WIDL__=0x%x"
,
version
);
wpp_add_cmdline_define
(
version_str
);
}
/* set the target platform */
...
...
@@ -922,7 +917,7 @@ int main(int argc,char *argv[])
if
(
do_regscript
)
regscript_token
=
dup_basename_token
(
regscript_name
,
"_r.rgs"
);
add_widl_version_define
();
wpp_add_
define
(
"_WIN32"
,
NULL
);
wpp_add_
cmdline_define
(
"_WIN32=1"
);
atexit
(
rm_tempfile
);
if
(
!
no_preprocess
)
...
...
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