Consider the below code, by default GCC avoids producing debug symbol output for types that are unused.
union my_type_A { int _; };
int main() {}
Option -fno-eliminate-unused-debug-types results in a significant amount of space overhead as the real project is much more complicated.
Currently, I work it around by adding an unused function:
void foo(my_type_A) {}
So, the type can be used in GDB. My WAR seems not that straightforward. Is there a pragma or attribute to avoid an unused debug type being eliminated by GCC? Thanks.