Skip to content

Commit

Permalink
clang-18 warning fixes (part 1) (#785)
Browse files Browse the repository at this point in the history
* clang-18 warning fixes (part 1)

* format fixes

* More format fixes

* More format fixes
  • Loading branch information
bwelton authored Apr 18, 2024
1 parent 21170b8 commit c668028
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
42 changes: 21 additions & 21 deletions source/lib/rocprofiler-sdk-tool/statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ struct statistics
static_assert(std::is_arithmetic<Tp>::value, "only supports arithmetic types");

public:
inline statistics() = default;
inline ~statistics() = default;
inline statistics(const statistics&) = default;
inline statistics(statistics&&) noexcept = default;
inline statistics& operator=(const statistics&) = default;
inline statistics& operator=(statistics&&) noexcept = default;
statistics() = default;
~statistics() = default;
statistics(const statistics&) = default;
statistics(statistics&&) noexcept = default;
statistics& operator=(const statistics&) = default;
statistics& operator=(statistics&&) noexcept = default;

explicit statistics(value_type val)
: m_cnt(1)
Expand All @@ -77,13 +77,13 @@ struct statistics

public:
// Accumulated values
inline int64_t get_count() const { return m_cnt; }
inline value_type get_min() const { return m_min; }
inline value_type get_max() const { return m_max; }
inline value_type get_sum() const { return m_sum; }
inline value_type get_sqr() const { return m_sqr; }
inline float_type get_mean() const { return static_cast<float_type>(m_sum) / m_cnt; }
inline float_type get_variance() const
int64_t get_count() const { return m_cnt; }
value_type get_min() const { return m_min; }
value_type get_max() const { return m_max; }
value_type get_sum() const { return m_sum; }
value_type get_sqr() const { return m_sqr; }
float_type get_mean() const { return static_cast<float_type>(m_sum) / m_cnt; }
float_type get_variance() const
{
if(m_cnt < 2) return (m_sum - m_sum);

Expand All @@ -92,10 +92,10 @@ struct statistics
return (_sum_of_squared_samples - _sum_squared_mean) / static_cast<float_type>(m_cnt - 1);
}

inline float_type get_stddev() const { return ::std::sqrt(::std::abs(get_variance())); }
float_type get_stddev() const { return ::std::sqrt(::std::abs(get_variance())); }

// Modifications
inline void reset()
void reset()
{
m_cnt = 0;
m_sum = value_type{};
Expand All @@ -106,7 +106,7 @@ struct statistics

public:
// Operators (value_type)
inline statistics& operator+=(value_type val)
statistics& operator+=(value_type val)
{
if(m_cnt == 0)
{
Expand All @@ -127,7 +127,7 @@ struct statistics
return *this;
}

inline statistics& operator-=(value_type val)
statistics& operator-=(value_type val)
{
if(m_cnt > 1) --m_cnt;
m_sum -= val;
Expand All @@ -137,7 +137,7 @@ struct statistics
return *this;
}

inline statistics& operator*=(value_type val)
statistics& operator*=(value_type val)
{
m_sum *= val;
m_sqr *= (val * val);
Expand All @@ -146,7 +146,7 @@ struct statistics
return *this;
}

inline statistics& operator/=(value_type val)
statistics& operator/=(value_type val)
{
m_sum /= val;
m_sqr /= (val * val);
Expand All @@ -157,7 +157,7 @@ struct statistics

public:
// Operators (this_type)
inline statistics& operator+=(const statistics& rhs)
statistics& operator+=(const statistics& rhs)
{
if(m_cnt == 0)
{
Expand All @@ -178,7 +178,7 @@ struct statistics
}

// Operators (this_type)
inline statistics& operator-=(const statistics& rhs)
statistics& operator-=(const statistics& rhs)
{
if(m_cnt > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion source/lib/rocprofiler-sdk-tool/tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ write_ring_buffer(Tb* _v, buffer_type_t type)
ptr = _tmp_buf->request(false);
CHECK(ptr != nullptr);
}
*ptr = std::move(*reinterpret_cast<Tb*>(_v));
*ptr = std::move(*_v);
}

template <typename Tp>
Expand Down
2 changes: 1 addition & 1 deletion source/lib/rocprofiler-sdk/aql/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ hsa_ven_amd_aqlprofile_id_query_t
get_query_info(rocprofiler_agent_id_t agent, const counters::Metric& metric)
{
auto aql_agent = *CHECK_NOTNULL(rocprofiler::agent::get_aql_agent(agent));
aqlprofile_pmc_profile_t profile{.agent = aql_agent};
aqlprofile_pmc_profile_t profile = {.agent = aql_agent};
hsa_ven_amd_aqlprofile_id_query_t query = {metric.block().c_str(), 0, 0};
if(aqlprofile_get_pmc_info(&profile, AQLPROFILE_INFO_BLOCK_ID, &query) != HSA_STATUS_SUCCESS)
{
Expand Down
4 changes: 2 additions & 2 deletions source/lib/rocprofiler-sdk/aql/tests/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ findDeviceMetrics(const rocprofiler_agent_t& agent, const std::unordered_set<std
hsa_ven_amd_aqlprofile_id_query_t
v1_get_query_info(hsa_agent_t agent, const counters::Metric& metric)
{
hsa_ven_amd_aqlprofile_profile_t profile{.agent = agent};
hsa_ven_amd_aqlprofile_id_query_t query = {metric.block().c_str(), 0, 0};
hsa_ven_amd_aqlprofile_profile_t profile = {.agent = agent};
hsa_ven_amd_aqlprofile_id_query_t query = {metric.block().c_str(), 0, 0};
if(hsa_ven_amd_aqlprofile_get_info(&profile, HSA_VEN_AMD_AQLPROFILE_INFO_BLOCK_ID, &query) !=
HSA_STATUS_SUCCESS)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ struct poll_kfd_t
active = true;
}

inline static auto get_event_id(const std::string_view& strn)
static auto get_event_id(const std::string_view& strn)
{
uint32_t event_id{std::numeric_limits<uint32_t>::max()};
std::sscanf(strn.data(), "%x ", &event_id);
Expand Down

0 comments on commit c668028

Please sign in to comment.