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

changes to support newer clang-tidy errors #1898

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

changes to support newer clang-tidy errors #1898

wants to merge 7 commits into from

Conversation

dmah42
Copy link
Member

@dmah42 dmah42 commented Jan 8, 2025

No description provided.

@dmah42
Copy link
Member Author

dmah42 commented Jan 8, 2025

the segfault on cxx03_test is a bit of a surprise. i'm debating whether, given we now require c++17 to build the library, it's time to drop the cxx03 stuff and clean everything up anyway.

cc @LebedevRI

@dmah42
Copy link
Member Author

dmah42 commented Jan 8, 2025

so the issue here is that the check for BENCHMARK_HAS_CXX11 is checking if the compiler supports c++11 and not if the current --std is set to C++11 (or greater). so we end up using c++11 style enum definitions which somehow compile even though the standard is set to not support them. this then causes issues with where various pointers are pointing, etc, etc, we get a jump to an invalid address.

@dmah42
Copy link
Member Author

dmah42 commented Jan 8, 2025

i think the right way to do this would be a cxx compiler check in cmake that tries to compile the enum with type, setting a define specifically for that support, then use that in place of the CXX11 check.

or we get rid of the cxx03 stuff altogether now we require C++17 :)

@@ -11,6 +11,14 @@
#define BENCHMARK_HAS_CXX11
#endif

// This _MSC_VER check should detect VS 2017 v15.3 and newer.
#if __cplusplus >= 201703L || \
Copy link
Contributor

Choose a reason for hiding this comment

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

This is only defined if the Zc:__cplusplus flag is enabled.

Copy link
Member Author

Choose a reason for hiding this comment

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

on msvc, yes, which is why we have the rest of the check.

@dmah42
Copy link
Member Author

dmah42 commented Jan 8, 2025

running a straw poll on the discord

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.

2 participants