This is an archive of the discontinued LLVM Phabricator instance.

[clang] removes trailing whitespace
AbandonedPublic

Authored by cjdb on Apr 20 2023, 12:51 PM.

Details

Summary

Lots of files have trailing whitespace characters, which get removed by
many text editors upon save. I've run sed -i 's/\s*$//g' on all files
in clang except for clang-format, and manually reverted anything that
causes ninja check-clang check-clang-utils to fail. This ensures that
commits of substance don't accrue bogus diffs and commentary requesting
they be reverted.

Diff Detail

Event Timeline

cjdb created this revision.Apr 20 2023, 12:51 PM
Herald added a reviewer: NoQ. · View Herald Transcript
Herald added a reviewer: ributzka. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
NOTE: Clang-Format Team Automated Review Comment

Your review contains a change to ClangFormatStyleOptions.rst but not a change to clang/include/clang/Format/Format.h

ClangFormatStyleOptions.rst is auto generated from Format.h via clang/docs/tools/dump_format_style.py, please run this to regenerate the .rst

You can validate that the rst is valid by running.

./docs/tools/dump_format_style.py
mkdir -p html
/usr/bin/sphinx-build -n ./docs ./html
cjdb requested review of this revision.Apr 20 2023, 12:51 PM
cjdb abandoned this revision.Apr 20 2023, 1:26 PM

I've had some very good input about why this probably shouldn't go ahead: git history erasure :')

I've had some very good input about why this probably shouldn't go ahead: git history erasure :')

While that is a common criticism, if we're going to do this at all, we should do it in a single patch, as we can use --ignore-rev: https://akrabat.com/ignoring-revisions-with-git-blame/

This is a pretty common thing to do, and I don't think it should prevent us from doing this, which I think is the 'greater good' here. The alternative is to continue having a bunch of unrelated patches piece-meal 'erase' git history as people accidentally fix these.

I've had some very good input about why this probably shouldn't go ahead: git history erasure :')

While that is a common criticism, if we're going to do this at all, we should do it in a single patch, as we can use --ignore-rev: https://akrabat.com/ignoring-revisions-with-git-blame/

This is a pretty common thing to do, and I don't think it should prevent us from doing this, which I think is the 'greater good' here. The alternative is to continue having a bunch of unrelated patches piece-meal 'erase' git history as people accidentally fix these.

We already ignore blame revisions like this today: https://github.com/llvm/llvm-project/blob/main/.git-blame-ignore-revs

However, I'd ask that we hold off on this change unless we have some tooling in place that rejects new additions of trailing whitespace, otherwise we're going to end up in this exact same situation again in another week or two. When CI starts failing on patches that insert *new* trailing whitespace, then I'm all for this change because we can fix it once and hopefully keep it fixed.

cjdb added a comment.Apr 21 2023, 11:31 AM

I've had some very good input about why this probably shouldn't go ahead: git history erasure :')

While that is a common criticism, if we're going to do this at all, we should do it in a single patch, as we can use --ignore-rev: https://akrabat.com/ignoring-revisions-with-git-blame/

This is a pretty common thing to do, and I don't think it should prevent us from doing this, which I think is the 'greater good' here. The alternative is to continue having a bunch of unrelated patches piece-meal 'erase' git history as people accidentally fix these.

We already ignore blame revisions like this today: https://github.com/llvm/llvm-project/blob/main/.git-blame-ignore-revs

Oh cool, I had no idea this was possible :)

However, I'd ask that we hold off on this change unless we have some tooling in place that rejects new additions of trailing whitespace, otherwise we're going to end up in this exact same situation again in another week or two. When CI starts failing on patches that insert *new* trailing whitespace, then I'm all for this change because we can fix it once and hopefully keep it fixed.

Since Clang doesn't have pre-commit CI, how can we meaningfully progress here?

I've had some very good input about why this probably shouldn't go ahead: git history erasure :')

While that is a common criticism, if we're going to do this at all, we should do it in a single patch, as we can use --ignore-rev: https://akrabat.com/ignoring-revisions-with-git-blame/

This is a pretty common thing to do, and I don't think it should prevent us from doing this, which I think is the 'greater good' here. The alternative is to continue having a bunch of unrelated patches piece-meal 'erase' git history as people accidentally fix these.

We already ignore blame revisions like this today: https://github.com/llvm/llvm-project/blob/main/.git-blame-ignore-revs

Oh cool, I had no idea this was possible :)

However, I'd ask that we hold off on this change unless we have some tooling in place that rejects new additions of trailing whitespace, otherwise we're going to end up in this exact same situation again in another week or two. When CI starts failing on patches that insert *new* trailing whitespace, then I'm all for this change because we can fix it once and hopefully keep it fixed.

Since Clang doesn't have pre-commit CI, how can we meaningfully progress here?

Phab at least has Pre-commit CI, i would expect that to be sufficient? It would at least cut down accidential whitespace by orders of magnitude.

I've had some very good input about why this probably shouldn't go ahead: git history erasure :')

While that is a common criticism, if we're going to do this at all, we should do it in a single patch, as we can use --ignore-rev: https://akrabat.com/ignoring-revisions-with-git-blame/

This is a pretty common thing to do, and I don't think it should prevent us from doing this, which I think is the 'greater good' here. The alternative is to continue having a bunch of unrelated patches piece-meal 'erase' git history as people accidentally fix these.

We already ignore blame revisions like this today: https://github.com/llvm/llvm-project/blob/main/.git-blame-ignore-revs

Oh cool, I had no idea this was possible :)

However, I'd ask that we hold off on this change unless we have some tooling in place that rejects new additions of trailing whitespace, otherwise we're going to end up in this exact same situation again in another week or two. When CI starts failing on patches that insert *new* trailing whitespace, then I'm all for this change because we can fix it once and hopefully keep it fixed.

Since Clang doesn't have pre-commit CI, how can we meaningfully progress here?

Phab at least has Pre-commit CI, i would expect that to be sufficient? It would at least cut down accidential whitespace by orders of magnitude.

Yes, isn't this already covered by the existing use of clang-format on upload to phabricator (arc diff) ? At least for me it always gives me warnings if I try to upload anything that doesn't match clang-format.

cjdb added a comment.Apr 21 2023, 12:49 PM

I've had some very good input about why this probably shouldn't go ahead: git history erasure :')

While that is a common criticism, if we're going to do this at all, we should do it in a single patch, as we can use --ignore-rev: https://akrabat.com/ignoring-revisions-with-git-blame/

This is a pretty common thing to do, and I don't think it should prevent us from doing this, which I think is the 'greater good' here. The alternative is to continue having a bunch of unrelated patches piece-meal 'erase' git history as people accidentally fix these.

We already ignore blame revisions like this today: https://github.com/llvm/llvm-project/blob/main/.git-blame-ignore-revs

Oh cool, I had no idea this was possible :)

However, I'd ask that we hold off on this change unless we have some tooling in place that rejects new additions of trailing whitespace, otherwise we're going to end up in this exact same situation again in another week or two. When CI starts failing on patches that insert *new* trailing whitespace, then I'm all for this change because we can fix it once and hopefully keep it fixed.

Since Clang doesn't have pre-commit CI, how can we meaningfully progress here?

Phab at least has Pre-commit CI, i would expect that to be sufficient? It would at least cut down accidential whitespace by orders of magnitude.

Right, but Phab's precommit CI doesn't seem to be a blocker for merging, and often has false negatives, so I expect stuff to slip through :/

I've had some very good input about why this probably shouldn't go ahead: git history erasure :')

While that is a common criticism, if we're going to do this at all, we should do it in a single patch, as we can use --ignore-rev: https://akrabat.com/ignoring-revisions-with-git-blame/

This is a pretty common thing to do, and I don't think it should prevent us from doing this, which I think is the 'greater good' here. The alternative is to continue having a bunch of unrelated patches piece-meal 'erase' git history as people accidentally fix these.

We already ignore blame revisions like this today: https://github.com/llvm/llvm-project/blob/main/.git-blame-ignore-revs

Oh cool, I had no idea this was possible :)

However, I'd ask that we hold off on this change unless we have some tooling in place that rejects new additions of trailing whitespace, otherwise we're going to end up in this exact same situation again in another week or two. When CI starts failing on patches that insert *new* trailing whitespace, then I'm all for this change because we can fix it once and hopefully keep it fixed.

Since Clang doesn't have pre-commit CI, how can we meaningfully progress here?

Phab at least has Pre-commit CI, i would expect that to be sufficient? It would at least cut down accidential whitespace by orders of magnitude.

Yes, isn't this already covered by the existing use of clang-format on upload to phabricator (arc diff) ? At least for me it always gives me warnings if I try to upload anything that doesn't match clang-format.

There are folks who have historically uploaded using the web UI specifically to ignore clang-format's suggestions, and arc diff --nolint will skip the formatting stage.