diff options
author | Xavier Leroy <xavier.leroy@college-de-france.fr> | 2019-02-12 11:49:23 +0100 |
---|---|---|
committer | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2019-02-25 17:15:36 +0100 |
commit | d7dfc21c20f55b705e3e749c2c7b31f9a4611c39 (patch) | |
tree | ee0b6e0ad06941260244deba916e553d68f882e5 /cparser/Cutil.mli | |
parent | 0616171c89d3db651b6842338fdf2da9da885aa1 (diff) | |
download | compcert-kvx-d7dfc21c20f55b705e3e749c2c7b31f9a4611c39.tar.gz compcert-kvx-d7dfc21c20f55b705e3e749c2c7b31f9a4611c39.zip |
Distinguish object-related and name-related attributes
This is a second step towards mimicking GCC/Clang's handling of attributes.
This commit introduces a distinction between
- Object-related attributes, such as "section", which apply to the object (function, variable) being defined;
- Name-related attributes, such as "aligned", which apply to the name (object, struct/union member, struct/union/enum tag) being defined.
In particular, "aligned" is now attached to "struct" and "union" definitions, while it used to be "floated up" before.
The C11 _Alignas modifier is treated like an object-related attribute, so that
```
struct s { ... };
_Alignas(64) struct s x;
```
correctly associates the alignment with "x" and not with "struct s", where it would be ignored because it was not part of the original definition of s.
Diffstat (limited to 'cparser/Cutil.mli')
-rw-r--r-- | cparser/Cutil.mli | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cparser/Cutil.mli b/cparser/Cutil.mli index a99bf3af..400a6319 100644 --- a/cparser/Cutil.mli +++ b/cparser/Cutil.mli @@ -64,7 +64,10 @@ val has_std_alignas : Env.t -> typ -> bool (* Do the attributes of the type contain the C11 _Alignas attribute *) type attribute_class = - | Attr_name (* Attribute applies to the names being declared *) + | Attr_object (* Attribute applies to the object being declared + (function, global variable, local variable) *) + | Attr_name (* Attribute applies to the name being declared + (object, struct/union member, struct/union/enum tag *) | Attr_type (* Attribute applies to types *) | Attr_struct (* Attribute applies to struct, union and enum *) | Attr_function (* Attribute applies to function types and decls *) |