Skip to content
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

Add -pedantic to EXTRA_COPTS #210

Merged
merged 2 commits into from
Dec 12, 2023
Merged

Add -pedantic to EXTRA_COPTS #210

merged 2 commits into from
Dec 12, 2023

Conversation

chiphogg
Copy link
Contributor

Our godbolt link is broken! https://godbolt.org/z/KrvfhP4M3

To fix this robustly, we add the -pedantic option to our builds. We
put it in EXTRA_COPTS instead of BASE_CLANG_COPTS because otherwise,
the warning doesn't show up when we run this repro command:

bazel clean && bazel build --config=gcc //au:constant_test

This PR fixes all of the other warnings that started showing up when I
added this compiler option, too. Interestingly, the godbolt-breaking
problem (extra ;) seems like it shows up only for gcc's -pedantic
implementation, not clang's.

Our godbolt link is broken!  https://godbolt.org/z/KrvfhP4M3

To fix this robustly, we add the `-pedantic` option to our builds.  We
put it in `EXTRA_COPTS` instead of `BASE_CLANG_COPTS` because otherwise,
the warning doesn't show up when we run this repro command:

```sh
bazel clean && bazel build --config=gcc //au:constant_test
```

This PR fixes all of the other warnings that started showing up when I
added this compiler option, too.  Interestingly, the godbolt-breaking
problem (extra `;`) seems like it shows up only for gcc's `-pedantic`
implementation, not clang's.
@chiphogg chiphogg added the release notes: ⚙️ repo PR affecting the way the repository works label Dec 12, 2023
@chiphogg chiphogg requested a review from geoffviola December 12, 2023 21:34
@chiphogg
Copy link
Contributor Author

I intentionally delayed fixing the offending error just to double-check that CI would catch it. It would! Job link: https://github.com/aurora-opensource/au/actions/runs/7187543317/job/19575326547?pr=210

Copy link
Contributor

@geoffviola geoffviola left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this. I like the addition of pedantic for better compiler support. It's a shame that designated initializers didn't make the standard until C++20.

@chiphogg chiphogg merged commit 1e84a95 into main Dec 12, 2023
9 checks passed
@chiphogg chiphogg deleted the chiphogg/pedantic#209 branch December 12, 2023 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: ⚙️ repo PR affecting the way the repository works
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants