codegen will not include C headers for more than one enum with cname = "int"
Submitted by Maciek Borzecki
Link to original bug (#763343)
Description
Failing example: https://gist.github.com/bboozzoo/a7d427a20e1d299d929e
When Vala.CCodeBaseModule.add_symbol_declaration() is called, the first thing it does is to check if symbol has already been declared. If so, the function leaves early returning null. The function is called from Vala.CCodeBaseModule.generate_enum_declaration(), with a symbol name returned by get_ccode_name().
If a vapi file contains a vala enum, mapped to 'int' in C, the get_ccode_name() returns "int". Assume that there are at least 2 enums in vapi, both with cname = "int", however each defined in different header. Then the geneated C code will include only one header, that of the enum used first.
In the minimal example only foo.h is included. While in order to compile the C code, bar.h has to be included as well.