Skip to content

Commit

Permalink
Function definitions in headers must be declared inline
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Kretz <[email protected]>
  • Loading branch information
mattkretz authored and RalphSteinhagen committed Oct 1, 2024
1 parent 92a08d9 commit c9ef707
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions algorithm/include/gnuradio-4.0/algorithm/ImChart.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ enum struct ResetChartView { RESET, KEEP };
enum class Style { Braille, Bars, Marker };

namespace detail {
std::vector<std::size_t>
optimalTickScreenPositions(std::size_t axisWidth, std::size_t minGapSize = 1) {
inline std::vector<std::size_t> optimalTickScreenPositions(std::size_t axisWidth, std::size_t minGapSize = 1) {
constexpr std::array preferredDivisors{ 10UZ, 8UZ, 5UZ, 4UZ, 3UZ, 2UZ };
std::size_t reducedAxisWidth = axisWidth - 1; // because we always require & add the '0'

Expand Down
2 changes: 1 addition & 1 deletion blocks/soapy/include/gnuradio-4.0/soapy/Soapy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace gr::blocks::soapy {

namespace detail {
bool equalWithinOnePercent(const std::vector<double>& a, const std::vector<double>& b) {
inline bool equalWithinOnePercent(const std::vector<double>& a, const std::vector<double>& b) {
return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin(), [](double x, double y) { return std::abs(x - y) <= 0.01 * std::max(std::abs(x), std::abs(y)); });
}
} // namespace detail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ constexpr const char* toSoapySDRFormat() {
return fmt::format("{}", fmt::join(flagNames, ", "));
}

void printSoapyReturnDebugInfo(int ret, int flags, long long time_ns) {
inline void printSoapyReturnDebugInfo(int ret, int flags, long long time_ns) {
if (ret == SOAPY_SDR_TIMEOUT) {
fmt::print("TIMEOUT - ");
} else if (ret < 0) {
Expand Down
8 changes: 4 additions & 4 deletions core/include/gnuradio-4.0/TriggerMatcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,21 @@ constexpr const char* kWaitingForStopNonMatch = "waitingForStopNonMatch";
constexpr const char* kIsSingleTrigger = "isSingleTrigger";
} // namespace key

void reset(property_map& state) noexcept {
inline void reset(property_map& state) noexcept {
state[key::kTriggerActive] = false;
state[key::kWaitingForStartNonMatch] = false;
state[key::kWaitingForStopNonMatch] = false;
}

[[nodiscard]] bool isSingleTrigger(const property_map& state) noexcept {
[[nodiscard]] inline bool isSingleTrigger(const property_map& state) noexcept {
if (state.contains(key::kStartDefined) && state.contains(key::kStopDefined)) {
return std::get<bool>(state.at(key::kStartDefined)) xor std::get<bool>(state.at(key::kStopDefined));
} else {
return false;
}
}

void verifyFilterState(std::string_view matchCriteria, property_map& state) {
inline void verifyFilterState(std::string_view matchCriteria, property_map& state) {
using namespace std::string_literals;
using namespace gr::trigger::detail;
if (state.contains(key::kFilter) && std::holds_alternative<std::string>(state.at(key::kFilter)) && (std::get<std::string>(state.at(key::kFilter)) == matchCriteria)) {
Expand Down Expand Up @@ -211,7 +211,7 @@ void verifyFilterState(std::string_view matchCriteria, property_map& state) {
state[key::kIsSingleTrigger] = bool(std::get<bool>(state.at(key::kStartDefined)) xor std::get<bool>(state.at(key::kStopDefined)));
}

[[nodiscard]] trigger::MatchResult filter(std::string_view filterDefinition, const Tag& tag, property_map& filterState) {
[[nodiscard]] inline trigger::MatchResult filter(std::string_view filterDefinition, const Tag& tag, property_map& filterState) {
using namespace gr::trigger::detail;
verifyFilterState(filterDefinition, filterState); // N.B. automatically generates config and state variables if needed

Expand Down

0 comments on commit c9ef707

Please sign in to comment.