torproject / tor Public
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
Clang format prep 3 #1709
Closed
Closed
Clang format prep 3 #1709
Conversation
This code transformer makes a couple of changes that we want for our source code, and can be expanded to handle more.
The format is the same as in my previous efforts here. The script is a little tricky, since it invokes both clang-format and codetool, and it makes sure that files do not have a changed mtime unless there is actually some change in the file.
Clang-format wants to put these in, and they do make sense for consistency. Also allow more types.
(The original idiom here led clang-format to generating a too-wide line.)
When we use macro inline, clang-format likes to break it in the middle, which makes checkSpace get confused.
Clang-format wants to split these messages across multiple lines, which confuses the heck out of coccinelle.
We want our code to require semicolons after use of these macros, so that our code formatters and/or analysis tools don't get confused.
These belong in util_bug.h (and they already are there). Their presence made clang-format misindent these functions in a way that checkSpace.pl dislikes.
Doing this makes our macro usage a little clear IMO, and also avoids having to use an unadorned "new" within a macro. (Clang-format seems to think that "new" means we're doing C++, and so it generates some output that checkSpace.pl doesn't care for.)
clang-format sometimes thinks that "#name" should be written as "# name" if it appears at the start of a line. Using () appears to suppress this, while confusing Coccinelle.
These tables have aligned comments, so we don't want clang-format to mess with them.
Previously we would forbid macro indentations like this:
FOO({
int x;
})
But clang-format sometimes generates those.
clang-format wants to put no space here, so we need to tell the test to expect a lack of a space.
These are not a problem with 2-space indentation, but cocci will start getting confused when clang-format wraps them with 4-space indentation.
We're telling clang-format that a line with LCOV_EXCL must not be split -- that's fine, but we shouldn't complain when it indents it.
Pull Request Test Coverage Report for Build 8193
|
This change lets us use clang-format-6.0, and is okay since we now require semicolons after HT_PROTOTYPE/GENERATE.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
No description provided.
The text was updated successfully, but these errors were encountered: