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

Fix MSVC linter warning about uninitialized TestSuite variables #471

Merged
merged 1 commit into from
Mar 21, 2021

Conversation

Reedbeta
Copy link
Contributor

In MSVC 2019 the Intellisense linter pops a warning whenever I used TEST_SUITE. It was unhappy that the static doctest::detail::TestSuite data was uninitialized. Fixed by default-initializing that in two places where it appears. Thanks!

@Reedbeta Reedbeta changed the base branch from master to dev February 14, 2021 20:25
@Reedbeta Reedbeta force-pushed the fix-uninit-testsuite branch from fa36771 to 9181cda Compare February 14, 2021 20:30
@Reedbeta
Copy link
Contributor Author

Reedbeta commented Feb 14, 2021

OK, the CI is failing and I am not sure why this is not working when compiled as C++11... the TestSuite struct is all trivial types, so it should just be getting zero-filled??

@Reedbeta
Copy link
Contributor Author

I think the CI is just running this on some really old and buggy versions of gcc. 😕

@onqtam
Copy link
Member

onqtam commented Feb 18, 2021

I guess we should be able to get the old GCC builds running by silencing -Wmissing-field-initializers around the problematic pieces of code like this:

DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wmissing-field-initializers")
// ... code with ={};
DOCTEST_GCC_SUPPRESS_WARNING_POP

- Fixes an MSVC Intellisense linter warning
@Reedbeta Reedbeta force-pushed the fix-uninit-testsuite branch from 9181cda to 51422f9 Compare February 28, 2021 19:15
@Reedbeta
Copy link
Contributor Author

Alright, I put the warning suppress in, but it's still failing gcc 4.8 and 4.9. 🤪 Doesn't make any sense. I even tried it on godbolt to verify that warning can be suppressed, and it works fine there.

@onqtam
Copy link
Member

onqtam commented Mar 21, 2021

Let's merge this and I'll try to figure out how to get gcc 4.8 & 4.9 not to complain. Thanks!

@onqtam onqtam merged commit 2c93c1a into doctest:dev Mar 21, 2021
onqtam added a commit that referenced this pull request Mar 21, 2021
onqtam pushed a commit that referenced this pull request Mar 22, 2021
- Fixes an MSVC Intellisense linter warning
onqtam added a commit that referenced this pull request Mar 22, 2021
@Reedbeta Reedbeta deleted the fix-uninit-testsuite branch May 23, 2021 22:20
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