This arose out of the code in http://stackoverflow.com/q/25718838 and specifically answer http://stackoverflow.com/a/25719284.
Reduced to nearly the minimum, the macros generated the code:
void deallocate2(S **s_ptr)
{
{ void *stopper_for_apply = (int[]){0}; void **list_for_apply = (void *[]){(*s_ptr)->arr, *s_ptr, stopper_for_apply}; for (int i = 0; list_for_apply[i] != stopper_for_apply; i++) { saferFree((void *) & (list_for_apply[i])); } };
}
When I run that code through Uncrustify 0.60, the output is missing two semicolons, one after each of the array literals:
void deallocate2(S **s_ptr)
{
{
void *stopper_for_apply = (int[]){
0
} void **list_for_apply = (void *[]){
(*s_ptr)->arr, *s_ptr, stopper_for_apply
} for (int i = 0; list_for_apply[i] != stopper_for_apply; i++)
{
saferFree((void *) &(list_for_apply[i]));
}
}
}
The semicolons are in the original but not in the uncrustify output (so the previously valid code is made invalid by reformatting). The output should be more like:
void deallocate2(S **s_ptr)
{
{
void *stopper_for_apply = (int[]){ 0 };
void **list_for_apply = (void *[]){
(*s_ptr)->arr, *s_ptr, stopper_for_apply
};
for (int i = 0; list_for_apply[i] != stopper_for_apply; i++)
{
saferFree((void *) &(list_for_apply[i]));
}
}
}
I can certainly supply my uncrustify.cfg file if you need it. I'm not worried about layout formatting (where newlines and braces etc appear); I'm simply worried that compilable code became uncompilable.
Should now be fixed in git.
Last edit: Ben Gardner 2014-09-11
Thank you. That was swiftly fixed.