diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-01-24 10:29:30 +0100 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-01-24 10:29:30 +0100 |
commit | d60b593c8b1d19a4adfdadaeeaa93aa10b9dba53 (patch) | |
tree | 838eef3aa4f09efd467971a51e6c76d49ebb8a59 /cparser/Parser.vy | |
parent | 47e818992372c1480b1052b64728a33d758637cf (diff) | |
download | compcert-d60b593c8b1d19a4adfdadaeeaa93aa10b9dba53.tar.gz compcert-d60b593c8b1d19a4adfdadaeeaa93aa10b9dba53.zip |
New version to support designators.
The c standard allows member designators for offsetof. The current
implementation works by recursively combining the offset of each
of the member designators. For array access the size of the
subtypes is multiplied by the index and for members the offset of
the member is calculated.
Bug 20765
Diffstat (limited to 'cparser/Parser.vy')
-rw-r--r-- | cparser/Parser.vy | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cparser/Parser.vy b/cparser/Parser.vy index fb0b7444..f6bd6a7e 100644 --- a/cparser/Parser.vy +++ b/cparser/Parser.vy @@ -145,8 +145,8 @@ 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 = OTHER_NAME RPAREN - { (BUILTIN_OFFSETOF typ (fst mem), loc) } +| loc = BUILTIN_OFFSETOF LPAREN typ = type_name COMMA mem = designator_list RPAREN + { (BUILTIN_OFFSETOF typ (rev mem), loc) } (* Semantic value is in reverse order. *) argument_expression_list: |