mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader: Implement #ifdef.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
9a1317ff0f
commit
b0dbb35ec7
@ -110,6 +110,8 @@ IDENTIFIER [A-Za-z_][A-Za-z0-9_]*
|
|||||||
return T_ENDIF;
|
return T_ENDIF;
|
||||||
if (!strcmp(p, "if"))
|
if (!strcmp(p, "if"))
|
||||||
return T_IF;
|
return T_IF;
|
||||||
|
if (!strcmp(p, "ifdef"))
|
||||||
|
return T_IFDEF;
|
||||||
|
|
||||||
preproc_warning(ctx, yyget_lloc(yyscanner), VKD3D_SHADER_WARNING_PP_UNKNOWN_DIRECTIVE,
|
preproc_warning(ctx, yyget_lloc(yyscanner), VKD3D_SHADER_WARNING_PP_UNKNOWN_DIRECTIVE,
|
||||||
"Ignoring unknown directive \"%s\".", yytext);
|
"Ignoring unknown directive \"%s\".", yytext);
|
||||||
@ -199,6 +201,7 @@ int yylex(YYSTYPE *lval, YYLTYPE *lloc, yyscan_t scanner)
|
|||||||
case T_ELSE:
|
case T_ELSE:
|
||||||
case T_ENDIF:
|
case T_ENDIF:
|
||||||
case T_IF:
|
case T_IF:
|
||||||
|
case T_IFDEF:
|
||||||
ctx->current_directive = token;
|
ctx->current_directive = token;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -218,6 +221,7 @@ int yylex(YYSTYPE *lval, YYLTYPE *lloc, yyscan_t scanner)
|
|||||||
case T_ELSE:
|
case T_ELSE:
|
||||||
case T_ENDIF:
|
case T_ENDIF:
|
||||||
case T_IF:
|
case T_IF:
|
||||||
|
case T_IFDEF:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -183,6 +183,7 @@ static uint32_t preproc_parse_integer(const char *s)
|
|||||||
%token T_ELSE "#else"
|
%token T_ELSE "#else"
|
||||||
%token T_ENDIF "#endif"
|
%token T_ENDIF "#endif"
|
||||||
%token T_IF "#if"
|
%token T_IF "#if"
|
||||||
|
%token T_IFDEF "#ifdef"
|
||||||
|
|
||||||
%type <integer> expr
|
%type <integer> expr
|
||||||
%type <string> body_token
|
%type <string> body_token
|
||||||
@ -219,6 +220,11 @@ directive
|
|||||||
if (!preproc_push_if(ctx, !!$2))
|
if (!preproc_push_if(ctx, !!$2))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
| T_IFDEF T_IDENTIFIER T_NEWLINE
|
||||||
|
{
|
||||||
|
preproc_push_if(ctx, !!preproc_find_macro(ctx, $2));
|
||||||
|
vkd3d_free($2);
|
||||||
|
}
|
||||||
| T_ELIF expr T_NEWLINE
|
| T_ELIF expr T_NEWLINE
|
||||||
{
|
{
|
||||||
if (ctx->if_count)
|
if (ctx->if_count)
|
||||||
|
Reference in New Issue
Block a user