Skip to content

[clang-format] bug in c formatting when "switch" appears as a token #114408

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

Closed
mtfurlan opened this issue Oct 31, 2024 · 2 comments · Fixed by #114506
Closed

[clang-format] bug in c formatting when "switch" appears as a token #114408

mtfurlan opened this issue Oct 31, 2024 · 2 comments · Fixed by #114506
Assignees

Comments

@mtfurlan
Copy link

mtfurlan commented Oct 31, 2024

This is a c file that is correctly formatted according to clang-format 18, but not according to clang-format 19
clang-format --dry-run --Werror --style="{BasedOnStyle: llvm, BreakBeforeBraces: Linux}" test.c

FOOBAR(switch); // if we use a word that isn't "switch" everything is fine
// if we do use "switch", the "BreakBeforeBraces: Linux" isn't respected and it
// tries to do "void foo(void) {"

void foo(void)
{ 
  int i = 5;
  printf("foo: %d\n", i);
}

I bisected it to 236b3e1 [clang-format] Handle Java switch expressions (#91112)

@owenca owenca self-assigned this Nov 1, 2024
@owenca owenca added the regression:19 Regression in 19 release label Nov 1, 2024
@owenca owenca added this to the LLVM 19.X Release milestone Nov 1, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage in LLVM Release Status Nov 1, 2024
owenca added a commit to owenca/llvm-project that referenced this issue Nov 1, 2024
@owenca owenca closed this as completed in 6ca816f Nov 2, 2024
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in LLVM Release Status Nov 2, 2024
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in LLVM Release Status Nov 2, 2024
@owenca
Copy link
Contributor

owenca commented Nov 2, 2024

/cherry-pick 6ca816f

@llvmbot
Copy link
Member

llvmbot commented Nov 2, 2024

/pull-request #114640

smallp-o-p pushed a commit to smallp-o-p/llvm-project that referenced this issue Nov 3, 2024
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this issue Nov 4, 2024
tru pushed a commit to llvmbot/llvm-project that referenced this issue Nov 12, 2024
tru pushed a commit to llvmbot/llvm-project that referenced this issue Nov 15, 2024
nikic pushed a commit to rust-lang/llvm-project that referenced this issue Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants