This is an archive of the discontinued LLVM Phabricator instance.

[libc++][test] NFC: Don't include name in banner comment
AbandonedPublic

Authored by jloser on Sep 29 2021, 5:22 PM.

Details

Reviewers
ldionne
Quuxplusone
Mordante
Group Reviewers
Restricted Project
Summary

Some files include their component name in the banner which is not what
most of the libc++ files do. So, let's be consistent and remove the
name in the banner for the few files that have it. Remove the C++ editor
comment too. It's obviously a C++ file given its extension.

Found with:

git grep "//===" libcxx/test | grep "\- "

Came up during discussion in https://reviews.llvm.org/D110503.

Note that several files in libcxx/test have the editor comment:

-*- C++ -*-

and we should get rid of that in a separate PR I'd argue.

Diff Detail

Event Timeline

jloser requested review of this revision.Sep 29 2021, 5:22 PM
jloser created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptSep 29 2021, 5:22 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

I really like the removal of the filename, I've seen it copy-pasted in new files too often, without an update of the name.

libcxx/test/std/containers/views/span.cons/array.fail.cpp
1

Your description says you want to do that in a separate commit, or what do you exactly mean there?

1

Why is the line now one character longer?
It now looks this line is one character longer than line 7.

libcxx/test/support/constexpr_char_traits.h
1

I prefer to keep these in the header files .h can be a c or c++ file.
IMO removing them has little benefit and might break somebodies setup.

Quuxplusone requested changes to this revision.Sep 30 2021, 9:37 AM

@jloser, I propose that I commandeer this PR to make the following completely mechanical changes in two separate and unreviewed commits:

  • Normalize the copyright notice (by cutting and pasting from a good file), for all files in git grep '//===-----' libcxx/test/ | grep -v '//===----------------------------------------------------------------------===//'
  • Remove // -*- C++ -*- from the first line of find libcxx/test/ -name *.cpp (but not from any other files)
libcxx/test/support/constexpr_char_traits.h
1

FWIW, I do prefer to remove them from .h files to reduce cruft. I don't think anyone will work on libc++ very long in an editor that (1) cares what language the code is written in, and yet (2) can't be configured to open .h files as C++ by default.
However, I don't care to submit such a PR myself, and don't care enough to complain if someone else (e.g. you :)) blocks it. And I agree that it should be done in a separate (completely mechanical) commit. If other people want to go have the political discussion, and decide, and come back and tell me "OK, go remove all the editor comments from find libcxx/ -name *.h," I do volunteer to make that mechanical commit myself. :)

This revision now requires changes to proceed.Sep 30 2021, 9:37 AM
jloser added a comment.EditedSep 30 2021, 9:40 AM

@jloser, I propose that I commandeer this PR to make the following completely mechanical changes in two separate and unreviewed commits:

  • Normalize the copyright notice (by cutting and pasting from a good file), for all files in git grep '//===-----' libcxx/test/ | grep -v '//===----------------------------------------------------------------------===//'
  • Remove // -*- C++ -*- from the first line of find libcxx/test/ -name *.cpp (but not from any other files)

Works for me Arthur. Feel free to do exactly that. I shouldn't have removed the // -*- C++ -*- comment when fixing the banner; should have let that be its own commit as you proposed.

FWIW, I'm OK removing the C++ editor comment in the .h files, but make sure @Mordante, @ldionne and others are on board. In any case, we can have that be its own 3rd (reviewed to facilitate the discussion) commit.

Mordante added inline comments.Sep 30 2021, 10:01 AM
libcxx/test/support/constexpr_char_traits.h
1

I'm not per se against removing it from the .h files, I only don't think it has a real benefit. Maybe we can discuss it on Discord and see whether it breaks the setup of our regular contributors.

libcxx/test/support/constexpr_char_traits.h
1

I'm gonna do my mechanical thing. The "remove editor comments from .cpp files" part is now D110874. I found that I needed to remove it from the Python-generated files, so I split it into two commits: one for the Python scripts and generated files, and a second commit for the rest of the .cpp files. I also decided to be bold and do it for all .cpp files in libcxx/, not just those in libcxx/test/.

The mechanical fixing of copyright headers I'll just do without poking buildkite, unless it runs into some unexpected difficulty.

jloser abandoned this revision.Oct 1 2021, 1:38 PM

Closing this in favor of https://reviews.llvm.org/D110874 from @Quuxplusone that landed today. Thanks, Arthur!

ldionne added a comment.EditedOct 1 2021, 1:41 PM

I fell a bit behind on reviews and now I'm really confused, but I think this can be closed now?

Edit: Race condition!

jloser added a comment.Oct 1 2021, 2:17 PM

I fell a bit behind on reviews and now I'm really confused, but I think this can be closed now?

Edit: Race condition!

@ldionne yeah, just closed this. Arthur took this work over and landed it earlier today.