Background: The compiler may insert padding into a struct to make it's members align better. This will result in the sizeof the struct being larger than the sum of the sizes of it's members. Reordering the members of the structure so they pack better can remove the need for the compiler to pad in this manner and make the struct smaller saving memory. I need to get those memory savings.
The fallback option is to check every struct by hand. I'm looking for an automated approach that can cut down the effort.
Even if it only reduces the number of structs to be checked by hand that would help.
So for example a process/tool/etc that lists all the enums that are bigger than the sum of the sizes of their members, while not perfect would still be helpful as it would limit the ones that need to be manually checked.
Does anyone know of any tools that can do this or can anyone suggest any approaches that might help.
p.s. I need to do this on an embedded C codebase containing over 1 million lines of code.