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

Only enable "-pedantic-errors" when BENCHMARK_ENABLE_WERROR is ON #1775

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BraynStorm
Copy link

Newer versions of clang (on Windows at least) fail to compile benchmark with -Werror and -pedantic-errors.
Unfortunately, the BENCHMARK_ENABLE_WERROR option toggles only -Werror, and not -pedantic-errors.

.../build/Debug/_deps/benchmark-src/src/benchmark.cc:225:7: error: offset of on non-standard-layout type 'State' [-Werror,-Winvalid-offsetof]
   225 |       offsetof(State, skipped_) <= (cache_line_size - sizeof(skipped_)), "");
       |       ^               ~~~~~~~~
 C:\Program Files\LLVM\lib\clang\18\include\__stddef_offsetof.h:11:24: note: expanded from macro 'offsetof'
    11 | #define offsetof(t, d) __builtin_offsetof(t, d)
       |                        ^                     ~
 1 error generated.
 ninja: build stopped: subcommand failed.

This PR changes the CMakeLists.txt file to only append -pedantic-errors when BENCHMARK_ENABLE_WERROR is ON

Copy link

google-cla bot commented Mar 30, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@LebedevRI
Copy link
Collaborator

You'll need to deal with the CLA check...

@LebedevRI LebedevRI added the incomplete work needed label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incomplete work needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants