Skip to content
Snippets Groups Projects
Commit ad7e702a authored by Andre Maroneze's avatar Andre Maroneze
Browse files

Merge branch 'fix/parser/attribute' into 'master'

[parsing] Allow attributes in declarator lists

Closes #616

See merge request frama-c/frama-c!2202
parents 75f2a486 6bd64624
No related branches found
No related tags found
No related merge requests found
......@@ -1035,9 +1035,22 @@ declaration: /* ISO 6.7.*/
init_declarator_list: /* ISO 6.7 */
init_declarator { [$1] }
| init_declarator COMMA init_declarator_list { $1 :: $3 }
| init_declarator COMMA init_declarator_attr_list { $1 :: $3 }
;
init_declarator_attr_list:
init_declarator_attr { [ $1 ] }
| init_declarator_attr COMMA init_declarator_attr_list { $1 :: $3 }
;
init_declarator_attr:
attribute_nocv_list init_declarator {
let ((name, decl, attrs, loc), init) = $2 in
((name, PARENTYPE ($1,decl,[]), attrs, loc), init)
}
;
init_declarator: /* ISO 6.7 */
declarator { ($1, NO_INIT) }
| declarator EQ init_expression
......
......@@ -41,3 +41,7 @@ iptr h(volatile iptr ip2) {
}
iptr volatile h(const iptr ip3);
void test(void) {
int a, __attribute__((unused)) b;
}
......@@ -42,4 +42,11 @@ iptr h(iptr volatile ip3)
return __retres;
}
void test(void)
{
int a;
int b __attribute__((__unused__));
return;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment