Menu

#108 --add-braces does not add braces to multiple levels of unbraced statements

1.0
accepted
2023-01-27
2017-07-27
Cordelia
No

Here is the test file:

#include <stdio.h>

int main()
{
    for(;;)
        if (true)
            printf("hello");

    return 0;
}

Expected output when run with --add-braces:

#include <stdio.h>

int main()
{
    for(;;) {
        if (true) {
            printf("hello");
        }
    }

    return 0;
}

Actual output:

#include <stdio.h>

int main()
{
    for(;;)
        if (true) {
            printf("hello");
        }

    return 0;
}

I hope that I have not misunderstood the expected behavior of the --add-braces flag.

Discussion

  • Jim Pattee

    Jim Pattee - 2018-01-29

    Ticket moved from /p/astyle/bugs/453/

     
  • André Simon

    André Simon - 2023-01-27
    • status: open --> accepted
    • assigned_to: André Simon
    • Milestone: --> 1.0
     

Log in to post a comment.