Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong variable indentation when using for loop block + #ifndef + label #3336

Open
sagikobi opened this issue Oct 4, 2021 · 8 comments · May be fixed by #3384
Open

Wrong variable indentation when using for loop block + #ifndef + label #3336

sagikobi opened this issue Oct 4, 2021 · 8 comments · May be fixed by #3384

Comments

@sagikobi
Copy link

sagikobi commented Oct 4, 2021

When I am using for loop block + #ifndef + label, the alignment of variable removed
file with C code example attached + configuration (just remove .txt extension)

uncrustify.cfg.txt
test.c.txt

@guy-maurel
Copy link
Contributor

which alignment?
Please push your ouput file,
and the p.txt file generated with
uncrustify ... -p p.txt

@sagikobi
Copy link
Author

sagikobi commented Oct 7, 2021

The alignment of variables declared in lines 29-37 are change although they not supposed to change
attached p.txt + test.c.after.txt (the result of uncrustify command)
command I used:
uncrustify --no-backup -p p.txt -l C -c uncrustify.cfg -f test.c
test.c.after.txt
p.txt

@sagikobi
Copy link
Author

Hi @guy-maurel ,
Do you need more info from my side?

@guy-maurel
Copy link
Contributor

No, thanks for the message, it is a difficult bug.
I am working on it.

@guy-maurel
Copy link
Contributor

PR #3384 is a bugfix proposal.
Please test it and report.

@sagikobi
Copy link
Author

Hi,
I take the branch with #3384 proposal (https://github.com/guy-maurel/uncrustify.git) but it does not solve my issue

@micheleCTDE
Copy link
Collaborator

micheleCTDE commented Nov 25, 2021

Hi, I take the branch with #3384 proposal (https://github.com/guy-maurel/uncrustify.git) but it does not solve my issue

As explained in the PR thread, PR #3384 is not good to go. It needs rework 😓

@guy-maurel
Copy link
Contributor

Try to change your source as:

    for (a = 0; a < 10; a++) {
    #ifndef SOME_DEF
        if (b != 8) {
            a = 5;
        }
    #endif
       if (x == 7) {
            printf("AAA");
            goto out;
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants