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

Fixed warning cast between incompatible function types from FARPROC_ to gettickcount64_t #227

Merged
merged 1 commit into from
Aug 9, 2018

Conversation

kivadiu
Copy link
Contributor

@kivadiu kivadiu commented Aug 8, 2018

On Windows, GetProcAddress must be cast to something useful which
generates a warning with gcc. This patch silents the warning.

Fixes issue #225

// GetProcAddress returned.
// However, gcc warns about that.
#if BOOST_COMP_GNUC
#pragma GCC diagnostic push
Copy link
Member

Choose a reason for hiding this comment

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

Pragma diagnostic push/pop appeared only since gcc 4.6. You should check for the compiler version.

Also, you don't need Boost.Predef to detect gcc. You can use BOOST_GCC from Boost.Config. Also, it is quite possible that clang also emits a similar warning, you can check for it with BOOST_CLANG.

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 cannot check for clang as I do not cross-compile to Windows with clang but I will use BOOST_GCC.

// However, gcc warns about that.
#if BOOST_COMP_GNUC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
Copy link
Member

Choose a reason for hiding this comment

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

This warning is only documented (and likely implemented) since gcc 8.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right, thanks. I will change that.

…to gettickcount64_t

On Windows, GetProcAddress must be cast to something useful which
generates a warning with gcc. This patch silents the warning.

Fixes issue boostorg#225
@kivadiu
Copy link
Contributor Author

kivadiu commented Aug 9, 2018

I am very surprised by test failures in completely unrelated code.
For example, it fails with msvc-11 (but not with 9, 10 and 12) at test/threads/thread/members/try_join_for_pass.cpp:147:

boost::thread t0( (G()));
BOOST_TEST(t0.joinable());
t0.try_join_for(boost::chrono::milliseconds(250));
try
{
  t0.join();
  BOOST_TEST(false); // line 147: test failure here
}
catch (boost::system::system_error& e)
{
  BOOST_TEST(e.code().value() == boost::system::errc::invalid_argument);
}

Is it possible that the test server is so heavily loaded that 250 ms are not enough and t0.join() does not fail as expected?

@Lastique
Copy link
Member

Lastique commented Aug 9, 2018

It is possible, as with any other time-based test.

@viboes
Copy link
Collaborator

viboes commented Aug 9, 2018

Andrey is right. This kind of tests can unfortunately fail.

@kivadiu
Copy link
Contributor Author

kivadiu commented Aug 9, 2018

How do you normally decide if a patch is harmless then?

@viboes viboes merged commit c5e756d into boostorg:develop Aug 9, 2018
@viboes
Copy link
Collaborator

viboes commented Aug 9, 2018

I need to check the kind of issue :(

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