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
1e173eaa
Commit
1e173eaa
authored
Sep 24, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Use asserts instead of explicit internal error.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
04ae435f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
91 additions
and
158 deletions
+91
-158
genres.c
tools/wrc/genres.c
+47
-66
newstruc.c
tools/wrc/newstruc.c
+7
-7
parser.y
tools/wrc/parser.y
+10
-12
ppl.l
tools/wrc/ppl.l
+5
-18
ppy.y
tools/wrc/ppy.y
+1
-5
utils.c
tools/wrc/utils.c
+14
-30
utils.h
tools/wrc/utils.h
+0
-1
wpp.c
tools/wrc/wpp.c
+7
-18
wpp_private.h
tools/wrc/wpp_private.h
+0
-1
No files found.
tools/wrc/genres.c
View file @
1e173eaa
...
...
@@ -266,28 +266,26 @@ static void string_to_upper(string_t *str)
{
int
i
;
if
(
str
->
type
==
str_char
)
switch
(
str
->
type
)
{
case
str_char
:
for
(
i
=
0
;
i
<
str
->
size
;
i
++
)
if
(
str
->
str
.
cstr
[
i
]
>=
'a'
&&
str
->
str
.
cstr
[
i
]
<=
'z'
)
str
->
str
.
cstr
[
i
]
-=
32
;
}
else
if
(
str
->
type
==
str_unicode
)
{
break
;
case
str_unicode
:
for
(
i
=
0
;
i
<
str
->
size
;
i
++
)
if
(
str
->
str
.
wstr
[
i
]
>=
'a'
&&
str
->
str
.
wstr
[
i
]
<=
'z'
)
str
->
str
.
wstr
[
i
]
-=
32
;
}
else
{
internal_error
(
__FILE__
,
__LINE__
,
"Invalid string type %d
\n
"
,
str
->
type
);
break
;
}
}
static
int
parse_accel_string
(
const
string_t
*
key
,
int
flags
)
{
int
keycode
;
int
keycode
=
0
;
if
(
key
->
type
==
str_char
)
switch
(
key
->
type
)
{
case
str_char
:
if
(
key
->
str
.
cstr
[
0
]
==
'#'
)
return
0
;
/* ignore message contexts */
if
((
flags
&
WRC_AF_VIRTKEY
)
&&
!
((
key
->
str
.
cstr
[
0
]
>=
'A'
&&
key
->
str
.
cstr
[
0
]
<=
'Z'
)
||
...
...
@@ -316,9 +314,9 @@ static int parse_accel_string( const string_t *key, int flags )
}
else
keycode
=
key
->
str
.
cstr
[
0
];
}
else
{
break
;
case
str_unicode
:
if
(
key
->
str
.
wstr
[
0
]
==
'#'
)
return
0
;
/* ignore message contexts */
if
((
flags
&
WRC_AF_VIRTKEY
)
&&
!
((
key
->
str
.
wstr
[
0
]
>=
'A'
&&
key
->
str
.
wstr
[
0
]
<=
'Z'
)
||
...
...
@@ -346,6 +344,7 @@ static int parse_accel_string( const string_t *key, int flags )
}
else
keycode
=
key
->
str
.
wstr
[
0
];
break
;
}
return
keycode
;
}
...
...
@@ -391,9 +390,7 @@ static void put_string(res_t *res, const string_t *str, int isterm, const langua
}
else
{
if
(
str
->
type
==
str_unicode
)
internal_error
(
__FILE__
,
__LINE__
,
"Unicode string %s in 16-bit
\n
"
,
convert_string_utf8
(
str
,
0
));
assert
(
str
->
type
==
str_char
);
if
(
!
isterm
)
put_byte
(
res
,
str
->
size
);
for
(
cnt
=
0
;
cnt
<
str
->
size
;
cnt
++
)
{
...
...
@@ -417,23 +414,20 @@ static void put_string(res_t *res, const string_t *str, int isterm, const langua
*/
static
void
put_name_id
(
res_t
*
res
,
name_id_t
*
nid
,
int
upcase
,
const
language_t
*
lang
)
{
if
(
nid
->
type
==
name_ord
)
switch
(
nid
->
type
)
{
case
name_ord
:
if
(
win32
)
put_word
(
res
,
0xffff
);
else
put_byte
(
res
,
0xff
);
put_word
(
res
,
(
WORD
)
nid
->
name
.
i_name
);
}
else
if
(
nid
->
type
==
name_str
)
{
break
;
case
name_str
:
if
(
upcase
)
string_to_upper
(
nid
->
name
.
s_name
);
put_string
(
res
,
nid
->
name
.
s_name
,
TRUE
,
lang
);
}
else
{
internal_error
(
__FILE__
,
__LINE__
,
"Invalid name_id type %d
\n
"
,
nid
->
type
);
break
;
}
}
...
...
@@ -703,10 +697,7 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg)
put_dword
(
res
,
ctrl
->
id
);
else
put_word
(
res
,
ctrl
->
id
);
if
(
ctrl
->
ctlclass
)
put_name_id
(
res
,
ctrl
->
ctlclass
,
FALSE
,
dlg
->
lvc
.
language
);
else
internal_error
(
__FILE__
,
__LINE__
,
"Control has no control-class
\n
"
);
put_name_id
(
res
,
ctrl
->
ctlclass
,
FALSE
,
dlg
->
lvc
.
language
);
if
(
ctrl
->
title
)
put_name_id
(
res
,
ctrl
->
title
,
FALSE
,
dlg
->
lvc
.
language
);
else
...
...
@@ -764,19 +755,14 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg)
put_word
(
res
,
ctrl
->
height
);
put_word
(
res
,
ctrl
->
id
);
put_dword
(
res
,
ctrl
->
gotstyle
?
ctrl
->
style
->
or_mask
:
WS_CHILD
);
if
(
ctrl
->
ctlclass
)
{
if
(
ctrl
->
ctlclass
->
type
==
name_ord
&&
ctrl
->
ctlclass
->
name
.
i_name
>=
0x80
&&
ctrl
->
ctlclass
->
name
.
i_name
<=
0x85
)
put_byte
(
res
,
ctrl
->
ctlclass
->
name
.
i_name
);
else
if
(
ctrl
->
ctlclass
->
type
==
name_str
)
put_name_id
(
res
,
ctrl
->
ctlclass
,
FALSE
,
NULL
);
else
error
(
"Unknown control-class %04x
\n
"
,
ctrl
->
ctlclass
->
name
.
i_name
);
}
if
(
ctrl
->
ctlclass
->
type
==
name_ord
&&
ctrl
->
ctlclass
->
name
.
i_name
>=
0x80
&&
ctrl
->
ctlclass
->
name
.
i_name
<=
0x85
)
put_byte
(
res
,
ctrl
->
ctlclass
->
name
.
i_name
);
else
if
(
ctrl
->
ctlclass
->
type
==
name_str
)
put_name_id
(
res
,
ctrl
->
ctlclass
,
FALSE
,
NULL
);
else
internal_error
(
__FILE__
,
__LINE__
,
"Control has no control-class
\n
"
);
error
(
"Unknown control-class %04x
\n
"
,
ctrl
->
ctlclass
->
name
.
i_name
);
if
(
ctrl
->
title
)
put_name_id
(
res
,
ctrl
->
title
,
FALSE
,
NULL
);
else
...
...
@@ -1378,8 +1364,9 @@ static void versionblock2res(res_t *res, ver_block_t *blk, int level, const lang
put_pad
(
res
);
for
(
val
=
blk
->
values
;
val
;
val
=
val
->
next
)
{
if
(
val
->
type
==
val_str
)
switch
(
val
->
type
)
{
case
val_str
:
valblksizetag
=
res
->
size
;
put_word
(
res
,
0
);
/* Will be overwritten later */
valvalsizetag
=
res
->
size
;
...
...
@@ -1398,9 +1385,8 @@ static void versionblock2res(res_t *res, ver_block_t *blk, int level, const lang
set_word
(
res
,
valvalsizetag
,
(
WORD
)(
res
->
size
-
tag
));
set_word
(
res
,
valblksizetag
,
(
WORD
)(
res
->
size
-
valblksizetag
));
put_pad
(
res
);
}
else
if
(
val
->
type
==
val_words
)
{
break
;
case
val_words
:
valblksizetag
=
res
->
size
;
put_word
(
res
,
0
);
/* Will be overwritten later */
valvalsizetag
=
res
->
size
;
...
...
@@ -1419,14 +1405,10 @@ static void versionblock2res(res_t *res, ver_block_t *blk, int level, const lang
set_word
(
res
,
valvalsizetag
,
(
WORD
)(
res
->
size
-
tag
));
set_word
(
res
,
valblksizetag
,
(
WORD
)(
res
->
size
-
valblksizetag
));
put_pad
(
res
);
}
else
if
(
val
->
type
==
val_block
)
{
break
;
case
val_block
:
versionblock2res
(
res
,
val
->
value
.
block
,
level
+
1
,
lang
);
}
else
{
internal_error
(
__FILE__
,
__LINE__
,
"Invalid value indicator %d in VERSIONINFO
\n
"
,
val
->
type
);
break
;
}
}
...
...
@@ -1591,11 +1573,12 @@ static res_t *dlginit2res(name_id_t *name, dlginit_t *dit)
#define MAXNAMELEN 32
char
*
prep_nid_for_label
(
const
name_id_t
*
nid
)
{
static
char
buf
[
MAXNAMELEN
+
1
];
assert
(
nid
!=
NULL
);
static
char
buf
[
MAXNAMELEN
+
1
];
if
(
nid
->
type
==
name_str
&&
nid
->
name
.
s_name
->
type
==
str_unicode
)
switch
(
nid
->
type
)
{
case
name_str
:
if
(
nid
->
name
.
s_name
->
type
==
str_unicode
)
{
WCHAR
*
sptr
;
int
i
;
...
...
@@ -1610,7 +1593,7 @@ char *prep_nid_for_label(const name_id_t *nid)
}
buf
[
i
]
=
'\0'
;
}
else
if
(
nid
->
type
==
name_str
&&
nid
->
name
.
s_name
->
type
==
str_char
)
else
{
char
*
cptr
;
int
i
;
...
...
@@ -1625,15 +1608,13 @@ char *prep_nid_for_label(const name_id_t *nid)
}
buf
[
i
]
=
'\0'
;
}
else
if
(
nid
->
type
==
name_ord
)
{
sprintf
(
buf
,
"%u"
,
nid
->
name
.
i_name
);
}
else
{
internal_error
(
__FILE__
,
__LINE__
,
"Resource name_id with invalid type %d
\n
"
,
nid
->
type
);
}
return
buf
;
break
;
case
name_ord
:
sprintf
(
buf
,
"%u"
,
nid
->
name
.
i_name
);
break
;
}
return
buf
;
}
#undef MAXNAMELEN
...
...
@@ -1787,7 +1768,7 @@ void resources2res(resource_t *top)
top
->
binres
=
anicurico2res
(
top
->
name
,
top
->
res
.
ani
,
top
->
type
);
break
;
default:
internal_error
(
__FILE__
,
__LINE__
,
"Unknown resource type encountered %d in binary res generation
\n
"
,
top
->
type
);
assert
(
0
);
}
top
->
c_name
=
make_c_name
(
get_c_typename
(
top
->
type
),
top
->
name
,
top
->
lan
);
top
=
top
->
next
;
...
...
tools/wrc/newstruc.c
View file @
1e173eaa
...
...
@@ -892,11 +892,11 @@ static void handle_ani_list(riff_tag_t *lst, enum res_e type, int isswapped)
rtp
=
NEXT_TAG
(
rtp
);
}
else
internal_error
(
__FILE__
,
__LINE__
,
"Unknown tag
\"
%c%c%c%c
\"
in RIFF file
\n
"
,
isprint
(
rtp
->
tag
[
0
])
?
rtp
->
tag
[
0
]
:
'.'
,
isprint
(
rtp
->
tag
[
1
])
?
rtp
->
tag
[
1
]
:
'.'
,
isprint
(
rtp
->
tag
[
2
])
?
rtp
->
tag
[
2
]
:
'.'
,
isprint
(
rtp
->
tag
[
3
])
?
rtp
->
tag
[
3
]
:
'.'
);
error
(
"Unknown tag
\"
%c%c%c%c
\"
in RIFF file
\n
"
,
isprint
(
rtp
->
tag
[
0
])
?
rtp
->
tag
[
0
]
:
'.'
,
isprint
(
rtp
->
tag
[
1
])
?
rtp
->
tag
[
1
]
:
'.'
,
isprint
(
rtp
->
tag
[
2
])
?
rtp
->
tag
[
2
]
:
'.'
,
isprint
(
rtp
->
tag
[
3
])
?
rtp
->
tag
[
3
]
:
'.'
);
if
((
UINT_PTR
)
rtp
&
1
)
rtp
=
SKIP_TAG
(
rtp
,
1
);
...
...
@@ -1002,7 +1002,7 @@ ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt)
rtp
=
NEXT_TAG
(
rtp
);
}
else
internal_error
(
__FILE__
,
__LINE__
,
"Unknown tag
\"
%c%c%c%c
\"
in RIFF file
\n
"
,
error
(
"Unknown tag
\"
%c%c%c%c
\"
in RIFF file
\n
"
,
isprint
(
rtp
->
tag
[
0
])
?
rtp
->
tag
[
0
]
:
'.'
,
isprint
(
rtp
->
tag
[
1
])
?
rtp
->
tag
[
1
]
:
'.'
,
isprint
(
rtp
->
tag
[
2
])
?
rtp
->
tag
[
2
]
:
'.'
,
...
...
@@ -1098,7 +1098,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
* the ID, offset and length (and flag) fields to be very sure.
*/
if
(
hi
&&
lo
)
internal_error
(
__FILE__
,
__LINE__
,
"Messagetable contains more than 65535 blocks; cannot determine endian
\n
"
);
error
(
"Messagetable contains more than 65535 blocks; cannot determine endian
\n
"
);
if
(
!
hi
&&
!
lo
)
parser_error
(
"Invalid messagetable block count 0"
);
...
...
tools/wrc/parser.y
View file @
1e173eaa
...
...
@@ -553,7 +553,7 @@ resource_definition
{
$$
=
rsc
=
new_resource(res_anicur,
$1->u.ani,
$1->u.ani->memopt,
$1->u.ani->data->lvc.language);
}
else
if
(
$
1-
>
type
==
res_curg
)
else
/* res_curg */
{
cursor_t
*cur;
$$
=
rsc
=
new_resource(res_curg,
$1->u.curg,
$1->u.curg->memopt,
$1->u.curg->lvc.language);
...
...
@@ -567,8 +567,6 @@ resource_definition
rsc->name->name.i_name
=
cur->id;
}
}
else
internal_error
(
__FILE__
,
__LINE__
,
"Invalid top-level type %d in cursor resource\n"
,
$
1-
>
type
);
free
(
$
1
);
}
|
dialog
{
$$
=
new_resource(res_dlg,
$1,
$1->memopt,
$1->lvc.language);
}
...
...
@@ -587,7 +585,7 @@ resource_definition
{
$$
=
rsc
=
new_resource(res_aniico,
$1->u.ani,
$1->u.ani->memopt,
$1->u.ani->data->lvc.language);
}
else
if
(
$
1-
>
type
==
res_icog
)
else
/* res_icog */
{
icon_t
*ico;
$$
=
rsc
=
new_resource(res_icog,
$1->u.icog,
$1->u.icog->memopt,
$1->u.icog->lvc.language);
...
...
@@ -601,8 +599,6 @@ resource_definition
rsc->name->name.i_name
=
ico->id;
}
}
else
internal_error
(
__FILE__
,
__LINE__
,
"Invalid top-level type %d in icon resource\n"
,
$
1-
>
type
);
free
(
$
1
);
}
|
menu
{
$$
=
new_resource(res_men,
$1,
$1->memopt,
$1->lvc.language);
}
...
...
@@ -2258,10 +2254,13 @@ static raw_data_t *str2raw_data(string_t *str)
rd
=
new_raw_data();
rd->size
=
str->size
*
(str->type
==
str_char
?
1
:
2
);
rd->data
=
xmalloc(rd->size);
if(str->type
==
str_char)
memcpy(rd->data,
str->str.cstr,
rd->size);
else
if(str->type
==
str_unicode)
switch
(str->type)
{
case
str_char
:
memcpy
(
rd-
>
data
,
str-
>
str
.
cstr
,
rd-
>
size
);
break;
case
str_unicode
:
{
int
i
;
switch(byteorder)
{
...
...
@@ -2286,9 +2285,8 @@ static raw_data_t *str2raw_data(string_t *str)
}
break
;
}
}
}
else
internal_error
(
__FILE__
,
__LINE__
,
"Invalid stringtype\n"
);
return
rd
;
}
...
...
@@ -2720,7 +2718,7 @@ static resource_t *build_fontdirs(resource_t *tail)
if
((
byteorder
==
WRC_BO_BIG
&&
!
isswapped
)
||
(
byteorder
!=
WRC_BO_BIG
&&
isswapped
))
#endif
{
internal_error(__FILE__,
__LINE__,
"User
supplied
FONTDIR
needs
byteswapping\n");
error(
"User
supplied
FONTDIR
needs
byteswapping\n");
}
}
...
...
tools/wrc/ppl.l
View file @
1e173eaa
...
...
@@ -672,7 +672,7 @@ static struct list pp_includelogiclist = LIST_INIT( pp_includelogiclist );
push_macro(ppp);
break;
default:
pp_internal_error(__FILE__, __LINE__, "Invalid define type %d\n", ppp->type
);
assert(0
);
}
}
else put_buffer(ppy_text, ppy_leng);
...
...
@@ -916,8 +916,6 @@ static void expand_special(pp_entry_t *ppp)
buf = xrealloc(buf, strlen(pp_status.input) + 3);
sprintf(buf, "\"%s\"", pp_status.input);
}
else
pp_internal_error(__FILE__, __LINE__, "Special macro '%s' not found...\n", ppp->ident);
if(pp_flex_debug)
fprintf(stderr, "expand_special(%d): %s:%d: '%s' -> '%s'\n",
...
...
@@ -1059,9 +1057,6 @@ static mtext_t *add_expand_text(mtext_t *mtp, macexpstackentry_t *mep, int *nnl)
if(pp_flex_debug)
fprintf(stderr, "add_expand_text: exp_subst(%d): '%s'\n", mtp->subst.argidx, exp);
break;
default:
pp_internal_error(__FILE__, __LINE__, "Invalid expansion type (%d) in macro expansion\n", mtp->type);
}
return mtp;
}
...
...
@@ -1196,7 +1191,7 @@ static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
if(ppy_debug)
printf("push_buffer(%d): %p %p %p %d\n", bufferstackidx, ppp, filename, incname, pop);
if(bufferstackidx >= MAXBUFFERSTACK)
pp_internal_error(__FILE__, __LINE__,
"Buffer stack overflow");
error(
"Buffer stack overflow");
memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0]));
bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER;
...
...
@@ -1221,16 +1216,11 @@ static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
pp_status.input = filename;
ncontinuations = 0;
}
else if(!pop)
pp_internal_error(__FILE__, __LINE__, "Pushing buffer without knowing where to go to");
bufferstackidx++;
}
static bufferstackentry_t *pop_buffer(void)
{
if(bufferstackidx < 0)
pp_internal_error(__FILE__, __LINE__, "Bufferstack underflow?");
if(bufferstackidx == 0)
return NULL;
...
...
@@ -1295,10 +1285,8 @@ static bufferstackentry_t *pop_buffer(void)
if(bufferstack[bufferstackidx].should_pop)
{
if(yy_current_state() == pp_macexp)
macro_add_expansion();
else
pp_internal_error(__FILE__, __LINE__, "Pop buffer and state without macro expansion state");
assert( yy_current_state() == pp_macexp );
macro_add_expansion();
yy_pop_state();
}
...
...
@@ -1332,8 +1320,7 @@ static macexpstackentry_t *top_macro(void)
static macexpstackentry_t *pop_macro(void)
{
if(macexpstackidx <= 0)
pp_internal_error(__FILE__, __LINE__, "Macro expansion stack underflow\n");
assert(macexpstackidx > 0);
return macexpstack[--macexpstackidx];
}
...
...
tools/wrc/ppy.y
View file @
1e173eaa
...
...
@@ -86,7 +86,7 @@
case SIZE_INT: BIN_OP_INT(r, v1, v2, OP); break; \
case SIZE_LONG: BIN_OP_LONG(r, v1, v2, OP); break; \
case SIZE_LONGLONG: BIN_OP_LONGLONG(r, v1, v2, OP); break; \
default:
pp_internal_error(__FILE__, __LINE__, "Invalid type indicator (0x%04x)", v1.type);
\
default:
assert(0);
\
}
...
...
@@ -219,8 +219,6 @@ preprocessor
break;
case if_error:
break;
default:
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s);
}
}
| tELSE tNL {
...
...
@@ -245,8 +243,6 @@ preprocessor
break;
case if_error:
break;
default:
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s);
}
}
| tENDIF tNL {
...
...
tools/wrc/utils.c
View file @
1e173eaa
...
...
@@ -85,16 +85,6 @@ int parser_warning(const char *s, ...)
return
0
;
}
void
internal_error
(
const
char
*
file
,
int
line
,
const
char
*
s
,
...)
{
va_list
ap
;
va_start
(
ap
,
s
);
fprintf
(
stderr
,
"Internal error (please report) %s %d: "
,
file
,
line
);
vfprintf
(
stderr
,
s
,
ap
);
va_end
(
ap
);
exit
(
3
);
}
void
fatal_perror
(
const
char
*
msg
,
...
)
{
va_list
valist
;
...
...
@@ -264,36 +254,30 @@ int compare_striW( const WCHAR *str1, const WCHAR *str2 )
*/
int
compare_name_id
(
const
name_id_t
*
n1
,
const
name_id_t
*
n2
)
{
if
(
n1
->
type
==
name_ord
&&
n2
->
type
==
name_ord
)
{
return
n1
->
name
.
i_name
-
n2
->
name
.
i_name
;
}
else
if
(
n1
->
type
==
name_str
&&
n2
->
type
==
name_str
)
switch
(
n1
->
type
)
{
case
name_ord
:
if
(
n2
->
type
==
name_ord
)
return
n1
->
name
.
i_name
-
n2
->
name
.
i_name
;
return
1
;
case
name_str
:
if
(
n2
->
type
==
name_str
)
{
if
(
n1
->
name
.
s_name
->
type
==
str_char
&&
n2
->
name
.
s_name
->
type
==
str_char
)
{
return
compare_striA
(
n1
->
name
.
s_name
->
str
.
cstr
,
n2
->
name
.
s_name
->
str
.
cstr
);
}
else
if
(
n1
->
name
.
s_name
->
type
==
str_unicode
&&
n2
->
name
.
s_name
->
type
==
str_unicode
)
{
return
compare_striW
(
n1
->
name
.
s_name
->
str
.
wstr
,
n2
->
name
.
s_name
->
str
.
wstr
);
}
else
{
internal_error
(
__FILE__
,
__LINE__
,
"Can't yet compare strings of mixed type
\n
"
);
assert
(
n1
->
name
.
s_name
->
type
==
str_unicode
);
assert
(
n2
->
name
.
s_name
->
type
==
str_unicode
);
return
compare_striW
(
n1
->
name
.
s_name
->
str
.
wstr
,
n2
->
name
.
s_name
->
str
.
wstr
);
}
}
else
if
(
n1
->
type
==
name_ord
&&
n2
->
type
==
name_str
)
return
1
;
else
if
(
n1
->
type
==
name_str
&&
n2
->
type
==
name_ord
)
return
-
1
;
else
internal_error
(
__FILE__
,
__LINE__
,
"Comparing name-ids with unknown types (%d, %d)
\n
"
,
n1
->
type
,
n2
->
type
);
return
0
;
/* Keep the compiler happy */
return
-
1
;
}
return
0
;
/* Keep the compiler happy */
}
#ifdef _WIN32
...
...
tools/wrc/utils.h
View file @
1e173eaa
...
...
@@ -39,7 +39,6 @@ char *strmake(const char* fmt, ...) __attribute__((__format__ (__printf__, 1, 2
int
strendswith
(
const
char
*
str
,
const
char
*
end
);
int
parser_error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
parser_warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
internal_error
(
const
char
*
file
,
int
line
,
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
3
,
4
),
noreturn
));
void
fatal_perror
(
const
char
*
msg
,
...
)
__attribute__
((
format
(
printf
,
1
,
2
),
noreturn
));
void
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
),
noreturn
));
void
warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
...
...
tools/wrc/wpp.c
View file @
1e173eaa
...
...
@@ -428,7 +428,7 @@ static const char * const pp_if_state_str[] = {
void
pp_push_if
(
pp_if_state_t
s
)
{
if
(
if_stack_idx
>=
MAXIFSTACK
)
pp_internal_error
(
__FILE__
,
__LINE__
,
"#if-stack overflow; #{if,ifdef,ifndef} nested too deeply (> %d)"
,
MAXIFSTACK
);
error
(
"#if-stack overflow; #{if,ifdef,ifndef} nested too deeply (> %d)"
,
MAXIFSTACK
);
if
(
pp_flex_debug
)
fprintf
(
stderr
,
"Push if %s:%d: %s(%d) -> %s(%d)
\n
"
,
pp_status
.
input
,
pp_status
.
line_number
,
pp_if_state_str
[
pp_if_state
()],
if_stack_idx
,
pp_if_state_str
[
s
],
if_stack_idx
+
1
);
...
...
@@ -446,8 +446,8 @@ 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
()
);
case
if_error
:
assert
(
0
);
}
}
...
...
@@ -470,8 +470,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
()
);
case
if_error
:
assert
(
0
);
}
if
(
pp_flex_debug
)
...
...
@@ -509,8 +509,8 @@ void pp_next_if_state(int i)
case
if_ignore
:
pp_push_if
(
if_ignore
);
break
;
default
:
pp_internal_error
(
__FILE__
,
__LINE__
,
"Invalid pp_if_state (%d) in #{if,ifdef,ifndef} directive"
,
(
int
)
pp_if_state
()
);
case
if_error
:
assert
(
0
);
}
}
...
...
@@ -545,17 +545,6 @@ int ppy_warning(const char *s, ...)
return
0
;
}
void
pp_internal_error
(
const
char
*
file
,
int
line
,
const
char
*
s
,
...)
{
va_list
ap
;
va_start
(
ap
,
s
);
fprintf
(
stderr
,
"Internal error (please report) %s %d: "
,
file
,
line
);
vfprintf
(
stderr
,
s
,
ap
);
fprintf
(
stderr
,
"
\n
"
);
va_end
(
ap
);
exit
(
3
);
}
static
void
add_cmdline_defines
(
void
)
{
struct
define
*
def
;
...
...
tools/wrc/wpp_private.h
View file @
1e173eaa
...
...
@@ -168,7 +168,6 @@ int pp_get_if_depth(void);
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 */
/* everything is in this structure to avoid polluting the global symbol space */
...
...
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