Skip to content

fix: gcc-11 build issues/warnings in thread-pool-cpp - #6

Merged
stewartbright merged 2 commits into
SynaptiveMedical:synaptive/masterfrom
jasper-yeh:synaptive/dev/jasper/COM-822-fix-gcc-11-build-issues
Jun 15, 2022
Merged

fix: gcc-11 build issues/warnings in thread-pool-cpp#6
stewartbright merged 2 commits into
SynaptiveMedical:synaptive/masterfrom
jasper-yeh:synaptive/dev/jasper/COM-822-fix-gcc-11-build-issues

Conversation

@jasper-yeh

Copy link
Copy Markdown
Member

Fixes some build issues/warnings encountered under gcc-11.
Also updates googletest submodule to release tag 1.11.0 (also to resolve gcc-11 build warnings)

- undeclared symbol pow in thread_pool_options.hpp
- warning about catching polymorphic exception by value (WorkerStoppedException) in worker.hpp
- warning about test assertion comparing signed non-negative literal to unsigned result in tests fixed_function.t.cpp and thread_pool_options.t.cpp
- invalid type argument of unary * operator due to dereferencing an already dereferenced pointer in test thread_pool.t.cpp
inline ThreadPoolOptions::BusyWaitOptions::IterationFunction ThreadPoolOptions::BusyWaitOptions::defaultIterationFunction()
{
return [](size_t i) { return std::chrono::microseconds(static_cast<size_t>(pow(2, i))*1000); };
return [](size_t i) { return std::chrono::microseconds(static_cast<size_t>(std::pow(2, i))*1000); };

@jasper-yeh jasper-yeh Jun 14, 2022

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

probably only ever worked because our own usages included <cmath> and imported the std namespace?

}
}
catch (WorkerStoppedException)
catch (WorkerStoppedException const&)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

catch polymorphic exception by reference

ASSERT_EQ(0u, cop);
ASSERT_EQ(6u, mov);
ASSERT_EQ(0u, cop_ass);
ASSERT_EQ(0u, mov_ass);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

these would raise warnings about comparison between signed (the literal) and unsigned (the variable of type size_t)

@stewartbright
stewartbright merged commit f8e1831 into SynaptiveMedical:synaptive/master Jun 15, 2022
@jasper-yeh
jasper-yeh deleted the synaptive/dev/jasper/COM-822-fix-gcc-11-build-issues branch June 15, 2022 15:37
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.

4 participants