I'm not 100% sure, but I believe there is no such option. The construct you have is not meaning the same thing in the two cases - first one is an initialization of one structure, the second is a a strcuture containing a structure or array. Which of course float
isn't.
You may be able to work around it with
struct t_
{
struct
{
float f;
};
int i;
};
At least clang is happy with that. As is g++. That may be easier than changing a lot of initialization statements with extra braces in them. But it is admittedly still a change to the source code. Unfortunately, I'm pretty certain that this is necessary.
Complete example that I was testing with:
struct t_
{
struct
{
float f;
};
int i;
};
t_ t2 = { {0.3}, 0 };
int main()
{
t2.f = 7;
}
Edit: If it's not at all possible to edit the source, you'll need to parse the source code, identify the incorrect braces and output "correct" code. The more I think about this, the less I believe that it's at all possible to fix without some sort of edit to the source. Or that it has ever compiled...