This is an archive of the discontinued LLVM Phabricator instance.

clang-format.el: fix warnings
ClosedPublic

Authored by augfab on Feb 8 2023, 1:27 AM.

Details

Summary

Emacs trunk complained about:

Warning (comp): clang-format.el:87:15: Warning: Case 'replacement will match ‘quote’.  If that’s intended, write (replacement quote) instead.  Otherwise, don’t quote ‘replacement’.
Warning (comp): clang-format.el:98:15: Warning: Case 'cursor will match ‘quote’.  If that’s intended, write (cursor quote) instead.  Otherwise, don’t quote ‘cursor’.

Fixed the syntax by applying the second suggestion.

Checked that the code works like before the change by stepping through the execution of the function.

Ran tests with Emacs 26.3 and Emacs trunk with:

$ emacs -Q -batch -l clang/tools/clang-format/clang-format.el -l clang/tools/clang-format/clang-format-test.el -f ert-run-tests-batch-and-exit

Diff Detail

Event Timeline

augfab created this revision.Feb 8 2023, 1:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 8 2023, 1:27 AM
augfab requested review of this revision.Feb 8 2023, 1:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 8 2023, 1:27 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
phst requested changes to this revision.Feb 8 2023, 1:43 AM
phst added inline comments.
clang/tools/clang-format/clang-format.el
85

what's the change here?

96

same here, what is being changed?

102

The intention here is that this should be just `replacement' since I'm pretty sure we don't have XML tags like <quote>

115

same here, AIUI this should just be `quote'

This revision now requires changes to proceed.Feb 8 2023, 1:43 AM

I think the other suggestion from the warning should be applied, as I don't think it _is_ intended that "quote" is matched by either of these. It would actually be odd if it did as you'd have two matches.

clang/tools/clang-format/clang-format.el
115

I think you mean "just cursor" here

augfab added inline comments.Feb 8 2023, 5:32 AM
clang/tools/clang-format/clang-format.el
85

There is no change here, nor on line 80.
I don't understand why Phabricator highlights these two lines in red/green.
The raw diff doesn't show these two lines: https://reviews.llvm.org/file/data/u6j4564axwglt6pu42ff/PHID-FILE-fa54axif3rocku7zfmix/D143560.diff

96

Same as above, no change, no idea why it's highlighted 😕

102

You are right, thanks. I misunderstood what cl-case does.

115

You are right.

augfab updated this revision to Diff 495815.Feb 8 2023, 5:52 AM
augfab edited the summary of this revision. (Show Details)

Applied suggestions.

phst accepted this revision.Feb 13 2023, 4:21 AM
This revision is now accepted and ready to land.Feb 13 2023, 4:21 AM

Hi @phst , is anything left for me to do before this patch is merged?
This is my first patch to LLVM so I'm not too familiar with the process.
Thanks for your help 🙂

phst added a comment.Feb 24 2023, 1:31 AM

I'm not super familiar with the process either, but IIRC @sammccall or @djasper have to merge this.

I'm one of the code owners for clang-format, but I'm not an emacs user (don't hate me..), honestly I don't think you'll get a response from anyone others than the clang-format team @owenpan, @HazardyKnusperkeks , @rymiel etc.. but again I can't say if they are emacs users.

If its been accepted by others we can land it.

please mark the comments as done when you've addressed them

I'm not super familiar with the process either, but IIRC @sammccall or @djasper have to merge this.

Anyone with commit access can do that.

Hi @phst , is anything left for me to do before this patch is merged?
This is my first patch to LLVM so I'm not too familiar with the process.
Thanks for your help 🙂

If you don't have commit access yourself, please post your name and email for the commit. Someone will come and commit it on your behalf.

augfab marked 5 inline comments as done.Feb 27 2023, 12:22 AM

All comments were addressed, marking them as Done.

I don't have commit access, here's my name and email: Augustin Fabre <augustin.fabre@arm.com>.

Thanks!

This revision was automatically updated to reflect the committed changes.