CIL seems to be dropping attributes on type declarations. See attached files.
(.cil output generated using cil-1.6.0 with options -c and --keepunused)
For what it is worth:
http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
says:
"You may specify type attributes in an enum, struct or union type declaration or definition, or for other types in a typedef declaration. "
-- test.c -- __attribute__((x)) struct foo __attribute__((y)); __attribute__((a)) struct foo { int a; } __attribute__((b)); -- test.cil -- /* Generated by CIL v. 1.6.0 */ /* print_CIL_Input is true */ #line 2 "test.c" struct foo; #line 2 struct foo; #line 4 "test.c" struct foo { int a ; } __attribute__((__b__, __a__)) ;
This would be easy to fix, it is only a pretty-printing issue --- CIL has the exact same internal representation for declarations and definitions, we just need to adjust the pretty-printing for GCompTagDecl. I'll try and push it if it does not break the test suite (however, I would feel more confident if you could provide a real-world use-case of attributes applied to type declarations).
If CIL is retaining the attributes associated with the type declarations
and we could
print it out .. that would be OK.
I had sort of expected the annotations associated with the declaration to
be merged into
the definition .. in much the same way CIL merges attributes on variable
declarations.
The example I provided is essentially what I was trying to accomplish ..
with the
attribute names changed to protect the innocent. What would you like to
see in a
different example?
On Tue, May 27, 2014 at 4:39 AM, Gabriel Kerneis kerneis@users.sf.netwrote:
Related
Bugs:
#137Hmm, it looks like I overlooked the actual issue in my patch, namely that the merge of attributes fails indeed somehow to preserve all of them.
I'll try and fix it tomorrow, thanks for your feedback.
Gabriel
This should now be fully fixed in df7c9ad (by merging attributes indeed).
Let me know if it behaves as you expect. Thanks for the report.
That is fantastic. Thanks, Gabriel!
When do you expect the next release?
Dave
On Thu, May 29, 2014 at 10:48 AM, Gabriel Kerneis kerneis@users.sf.net
wrote:
Related
Bugs:
#137