diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-02-01 14:56:21 +0100 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-02-01 14:56:21 +0100 |
commit | 34886d135cec62883e76ba25bda34b4623e4a696 (patch) | |
tree | 11f91b98317dbed13dabf2e1c02008eaca58dcdf | |
parent | 31f86965bf172fb32f9cca99a292ebdf6cea57b9 (diff) | |
download | compcert-34886d135cec62883e76ba25bda34b4623e4a696.tar.gz compcert-34886d135cec62883e76ba25bda34b4623e4a696.zip |
Change the syntax to gcc/clangs syntax.
This only means that there must be one identifier at the begining
and then a designator.
Bug 20765
-rw-r--r-- | cparser/Parser.vy | 6 | ||||
-rw-r--r-- | cparser/pre_parser.mly | 3 | ||||
-rw-r--r-- | runtime/include/stddef.h | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/cparser/Parser.vy b/cparser/Parser.vy index f6bd6a7e..7fe686f1 100644 --- a/cparser/Parser.vy +++ b/cparser/Parser.vy @@ -145,8 +145,10 @@ postfix_expression: { (CAST typ (COMPOUND_INIT (rev' init)), loc) } | loc = LPAREN typ = type_name RPAREN LBRACE init = initializer_list COMMA RBRACE { (CAST typ (COMPOUND_INIT (rev' init)), loc) } -| loc = BUILTIN_OFFSETOF LPAREN typ = type_name COMMA mem = designator_list RPAREN - { (BUILTIN_OFFSETOF typ (rev mem), loc) } +| loc = BUILTIN_OFFSETOF LPAREN typ = type_name COMMA id = OTHER_NAME mems = designator_list RPAREN + { (BUILTIN_OFFSETOF typ ((INFIELD_INIT (fst id))::(rev mems)), loc) } +| loc = BUILTIN_OFFSETOF LPAREN typ = type_name COMMA mem = OTHER_NAME RPAREN + { (BUILTIN_OFFSETOF typ [INFIELD_INIT (fst mem)], loc) } (* Semantic value is in reverse order. *) argument_expression_list: diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly index dc9c5319..cdd043a7 100644 --- a/cparser/pre_parser.mly +++ b/cparser/pre_parser.mly @@ -254,7 +254,8 @@ postfix_expression: | postfix_expression LBRACK expression RBRACK | postfix_expression LPAREN argument_expression_list? RPAREN | BUILTIN_VA_ARG LPAREN assignment_expression COMMA type_name RPAREN -| BUILTIN_OFFSETOF LPAREN type_name COMMA designator_list RPAREN +| BUILTIN_OFFSETOF LPAREN type_name COMMA other_identifier RPAREN +| BUILTIN_OFFSETOF LPAREN type_name COMMA other_identifier designator_list RPAREN | postfix_expression DOT other_identifier | postfix_expression PTR other_identifier | postfix_expression INC diff --git a/runtime/include/stddef.h b/runtime/include/stddef.h index 958720a1..452497c3 100644 --- a/runtime/include/stddef.h +++ b/runtime/include/stddef.h @@ -114,7 +114,7 @@ typedef signed int wchar_t; #endif #if defined(_STDDEF_H) && !defined(offsetof) -#define offsetof(ty,member) (__builtin_offsetof(ty,.member)) +#define offsetof(ty,member) (__builtin_offsetof(ty,member)) #endif #endif |