songgaoye opened a new pull request, #3613:
URL: https://github.com/apache/brpc/pull/3613
### What problem does this PR solve?
Issue Number: resolve
Problem Summary:
The macOS CI build reports `-Wnontrivial-memcall` for
`PercentileSamples` because its constructor clears the entire object with
`memset(this, 0, sizeof(*this))`.
`PercentileSamples` has a user-defined destructor, copy constructor, and
assignment operator, so it is not trivially copyable. Clearing the whole
object
by bytes is fragile and triggers the compiler warning.
### What is changed and the side effects?
Changed:
- Replace whole-object `memset` with explicit value initialization of
`_num_added` and `_intervals`.
- Preserve the original initial state: zero added samples and null interval
pointers.
Side effects:
* Performance effects:
None. Both implementations initialize the same small scalar and pointer
members.
* Breaking backward compatibility:
None.
* * *
### Check List:
- [x] Build `test_bvar`
- [x] Run `PercentileTest.*`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]