Skip to content

Commit 7f4a65a

Browse files
committed
Parse (but do not process) __builtin_convertvector
1 parent b46270b commit 7f4a65a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/ansi-c/parser.y

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ extern char *yyansi_ctext;
148148
%token TOK_GCC_BUILTIN_TYPES_COMPATIBLE_P "__builtin_types_compatible_p"
149149
%token TOK_OFFSETOF "__offsetof"
150150
%token TOK_ALIGNOF "__alignof__"
151+
%token TOK_CONVERTVECTOR "__builtin_convertvector"
151152
%token TOK_MSC_TRY "__try"
152153
%token TOK_MSC_FINALLY "__finally"
153154
%token TOK_MSC_EXCEPT "__except"
@@ -647,6 +648,11 @@ unary_expression:
647648
stack($$).id(ID_alignof);
648649
stack($$).add(ID_type_arg).swap(stack($3));
649650
}
651+
| TOK_CONVERTVECTOR '(' unary_expression ',' type_name ')'
652+
{
653+
// TODO: cast each vector element of $3 to $5
654+
$$=$3;
655+
}
650656
;
651657

652658
cast_expression:

src/ansi-c/scanner.l

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,17 @@ void ansi_c_scanner_init()
686686
return make_identifier();
687687
}
688688

689+
"__builtin_convertvector" {
690+
if(PARSER.mode==configt::ansi_ct::flavourt::APPLE)
691+
{
692+
loc();
693+
return TOK_CONVERTVECTOR;
694+
}
695+
else
696+
return make_identifier();
697+
}
698+
699+
689700
%{
690701
/* C++ Keywords and Operators */
691702
%}

0 commit comments

Comments
 (0)