Skip to content

Whole-tree reformat with clang-format-19#4661

Merged
Sonicadvance1 merged 3 commits intoFEX-Emu:mainfrom
pmatos:feature/reformat-clang-format-19
Jul 17, 2025
Merged

Whole-tree reformat with clang-format-19#4661
Sonicadvance1 merged 3 commits intoFEX-Emu:mainfrom
pmatos:feature/reformat-clang-format-19

Conversation

@pmatos
Copy link
Copy Markdown
Collaborator

@pmatos pmatos commented Jul 11, 2025

No description provided.

@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 11, 2025

@Sonicadvance1 here it is.

@neobrain
Copy link
Copy Markdown
Member

The changes to lambda indentation are unfortunate - does LambdaBodyIndentation: Signature produce a less drastic diff by any chance?

Comment on lines +189 to +190
[[maybe_unused]]
const auto IsImm = IsImmLogical(Imm, RegSizeInBits(s), &n, &imms, &immr);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line breaks here add a lot of noise, so I'm tempted to just switch to BreakAfterAttributes: Leave at the expense of not enforcing breaks in function declarations anymore.

What do you think?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I will try to see what works to avoid that. Another thing I just noticed is that we are reformatting stuff in External/. Does it make sense? My gut feeling is that we shouldn't be doing it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked and we didn't do it for the initial reformatting so lets skip it again, unless you disagree.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing I just noticed is that we are reformatting stuff in External/.
I just checked and we didn't do it for the initial reformatting so lets skip it again, unless you disagree.

Sounds good.

Been trying to undo the issue with attribute being broken but playing around with the penalties means making something else worse. Do you have any further comments or suggestions?

Does BreakAfterAttributes: Leave have undesired side-effects too or are you just experimenting to see if something better can be found?

@pmatos pmatos force-pushed the feature/reformat-clang-format-19 branch from d736e8f to c9befa5 Compare July 11, 2025 11:46
@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 11, 2025

Been trying to undo the issue with attribute being broken but playing around with the penalties means making something else worse. Do you have any further comments or suggestions?

@Sonicadvance1
Copy link
Copy Markdown
Member

From a quick scan, nothing here seems terrible. Fine with me.

@pmatos pmatos force-pushed the feature/reformat-clang-format-19 branch from c9befa5 to a117f05 Compare July 14, 2025 12:15
@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 14, 2025

From a quick scan, nothing here seems terrible. Fine with me.

OK - rebased. Once it's ok just merge, otherwise I will have to keep updating the sha in .git-blame-ignore-revs.

Copy link
Copy Markdown
Member

@neobrain neobrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try BreakAfterAttributes: Leave and LambdaBodyIndentation: Signature before merging this to avoid switching formatting back and forth unnecessarily? I suspect that would significantly cut down the number of modified lines.

@pmatos pmatos force-pushed the feature/reformat-clang-format-19 branch from a117f05 to 1d73276 Compare July 14, 2025 13:09
@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 14, 2025

Can we try BreakAfterAttributes: Leave and LambdaBodyIndentation: Signature before merging this to avoid switching formatting back and forth unnecessarily? I suspect that would significantly cut down the number of modified lines.

Argh, I reformatted and forgot those because I resetted the changed .clang-format. Sorry. Added the .clang-format change as a commit together wtih the reformat and so on. What do you think?

@neobrain
Copy link
Copy Markdown
Member

Argh, I reformatted and forgot those because I resetted the changed .clang-format. Sorry. Added the .clang-format change as a commit together wtih the reformat and so on. What do you think?

No worries! Going from a 1250 loc diff to 250 sounds like a solid win to me.

Not sure why clang 16 missed so many lambda indentation cases before, but personally I like LambdaBodyIndentation: Signature better anyway so if it's closer to existing code I'll gladly take it. The other changes look in line with what I'd expect from a clang-format update.

Thanks for taking care of this; looking forward to finally re-enabling auto-formatting in my IDE :)

@neobrain
Copy link
Copy Markdown
Member

CI is failing with

clang-format: Unknown command line argument '-list-ignored'.  Try: 'clang-format --help'

Any idea what's happening there?

@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 14, 2025

Argh, I reformatted and forgot those because I resetted the changed .clang-format. Sorry. Added the .clang-format change as a commit together wtih the reformat and so on. What do you think?

No worries! Going from a 1250 loc diff to 250 sounds like a solid win to me.

Not sure why clang 16 missed so many lambda indentation cases before, but personally I like LambdaBodyIndentation: Signature better anyway so if it's closer to existing code I'll gladly take it. The other changes look in line with what I'd expect from a clang-format update.

Thanks for taking care of this; looking forward to finally re-enabling auto-formatting in my IDE :)

yeah, I also prefer Signature. Unsure why we decided initially to use Outer.

@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 14, 2025

CI is failing with

clang-format: Unknown command line argument '-list-ignored'.  Try: 'clang-format --help'

Any idea what's happening there?

Looking into it.

@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 14, 2025

CI is failing with

clang-format: Unknown command line argument '-list-ignored'.  Try: 'clang-format --help'

Any idea what's happening there?

I assumed git-clang-format-19 would always call clang-format-10 but doesn't. it calls the system clang-format which in the CI runners is clang-format-16 which don't support -list-ignored. We need to define the clang-format to call in clangformat.binary git config. I will create a PR for this.

@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 14, 2025

See #4666

@Sonicadvance1
Copy link
Copy Markdown
Member

With that PR merged, this should be trivial once rebased?

@pmatos pmatos force-pushed the feature/reformat-clang-format-19 branch from 1d73276 to 4473054 Compare July 17, 2025 06:11
@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 17, 2025

With that PR merged, this should be trivial once rebased?

Good to go, I think.

@Sonicadvance1 Sonicadvance1 merged commit e17c2c8 into FEX-Emu:main Jul 17, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants