Skip to content

Conversation

@elliottt
Copy link
Contributor

@elliottt elliottt commented Jun 1, 2022

Add a .clang-format config in the project root with mostly default settings (line length is set to 100 instead of 80). Also add a ci job to run ci/clang-format.sh on all tracked c/c++ source.

@elliottt elliottt force-pushed the trevor/clang-format branch 4 times, most recently from d89a077 to b5dce22 Compare June 1, 2022 20:24
@elliottt elliottt marked this pull request as ready for review June 1, 2022 20:27
@elliottt elliottt requested a review from tschneidereit June 1, 2022 20:27
@elliottt elliottt force-pushed the trevor/clang-format branch from b5dce22 to 5b2685b Compare June 1, 2022 21:14
Copy link
Contributor

@jameysharp jameysharp left a comment

Choose a reason for hiding this comment

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

I'm sad that this changes so much code, but checking and canonicalizing formatting is so valuable that it's worth doing anyway. I spent a little while trying to see if there were settings that might reduce the amount of code churn here, but the source tree wasn't really internally consistent so nevermind.

I do think it's important to not touch wizer.h though since that comes from another project. xqd.h might be in the same situation, but I haven't yet found where the original might be if there is one.

Copy link
Contributor

Choose a reason for hiding this comment

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

c-dependencies/js-compute-runtime/wizer.h is copied from https://github.com/bytecodealliance/wizer/blob/main/include/wizer.h so I think it should also be excluded here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've excluded it and xqd.h, thanks for catching this!

Copy link
Contributor

Choose a reason for hiding this comment

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

Can I suggest if ! cmp -s "$file" "$formatted"; then instead? It should be faster than diff since you don't care what the differences are, only if there are any. Of note, the -s flag to cmp is standardized in POSIX, but the --quiet and --silent synonyms are GNU extensions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So much better, thank you!

@elliottt elliottt force-pushed the trevor/clang-format branch from 790532d to e80259d Compare June 8, 2022 00:42
@elliottt elliottt force-pushed the trevor/clang-format branch from e80259d to d8941ff Compare June 8, 2022 01:10
@elliottt elliottt merged commit b174d37 into main Jun 8, 2022
@elliottt elliottt deleted the trevor/clang-format branch June 9, 2022 17:58
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