Commit cc33f3bf authored by Sergio Costas's avatar Sergio Costas

Removed GNU extension for designated initializer in structs. It is not needed...

Removed GNU extension for designated initializer in structs. It is not needed because C99 already supports a simmilar way ( field:value in GCC vs .field=value in C99 )
parent 2b062ae9
......@@ -686,24 +686,12 @@ initializer
initializer_list
: initializer { $$ = $1; }
| IDENTIFIER ':' initializer { $$ = $2;
$$->type = '=';
// initializer for designated initializer in struct GNU extension
$$->child1 = $1;
$$->child2 = $3; }
| designation initializer { $$ = $1;
// initializer for designated initializer in struct
$$->child2 = $2; }
| initializer_list ',' initializer { $$ = $1;
append_right($$,$3);
free_tree($2); }
| initializer_list ',' IDENTIFIER ':' initializer { $$ = $1;
append_right($$,$4);
$4->type = '=';
// initializer for designated initializer in struct GNU extension
$4->child1 = $3;
$4->child2 = $5;
free_tree($2); }
| initializer_list ',' designation initializer { $$ = $1;
append_right($$, $3);
$3->child2 = $4;
......
int a; // just to ensure that variables with the same name than a field doesn't interfere
struct {int a; char b;} name1 = { a:5, b:8}; // must support this definition format
struct {int a; char b;} name2 = { .a = 5, .b = 8}; // must support this definition format too
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment