mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-18 14:21:36 +00:00
Better handling of __VA_ARGS__ subscripting.
This commit is contained in:
parent
b9fcd64a1f
commit
1597f38f45
1 changed files with 10 additions and 5 deletions
15
ftepp.c
15
ftepp.c
|
@ -408,13 +408,18 @@ static bool ftepp_define_body(ftepp_t *ftepp, ppmacro *macro)
|
|||
{
|
||||
pptoken *ptok;
|
||||
while (ftepp->token != TOKEN_EOL && ftepp->token < TOKEN_EOF) {
|
||||
size_t index;
|
||||
bool subscript = false;
|
||||
size_t index = 0;
|
||||
if (macro->variadic && !strcmp(ftepp_tokval(ftepp), "__VA_ARGS__")) {
|
||||
/* remember the token */
|
||||
if (ftepp_next(ftepp) == '#' &&
|
||||
ftepp_next(ftepp) == '#' &&
|
||||
ftepp_next(ftepp) == '[')
|
||||
{
|
||||
if (ftepp_next(ftepp) == '#') {
|
||||
subscript = true;
|
||||
}
|
||||
|
||||
if (subscript && ftepp_next(ftepp) != '#') {
|
||||
ftepp_error(ftepp, "expected `##` in __VA_ARGS__ for subscripting");
|
||||
return false;
|
||||
} else if (subscript && ftepp_next(ftepp) == '[') {
|
||||
if (ftepp_next(ftepp) != TOKEN_INTCONST) {
|
||||
ftepp_error(ftepp, "expected index for __VA_ARGS__ subscript");
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue