Skip to content

Warning fixes: unused member, cast, unused function#61

Merged
copybara-service[bot] merged 1 commit intodevfrom
test_610949239
Feb 28, 2024
Merged

Warning fixes: unused member, cast, unused function#61
copybara-service[bot] merged 1 commit intodevfrom
test_610949239

Conversation

@copybara-service
Copy link

Warning fixes: unused member, cast, unused function

Copy link
Contributor

@austinvhuang austinvhuang left a comment

Choose a reason for hiding this comment

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

LGTM

for (size_t layer_idx = 0; layer_idx < TConfig::kLayers; ++layer_idx) {
Layer<TConfig>* layer = weights ? &weights->layers[layer_idx] : nullptr;
CompressedLayer<TConfig>* c_layer = c_weights.CLayer(layer_idx);
for (int layer_idx = 0; layer_idx < static_cast<int>(TConfig::kLayers);
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the motivation here for having int layer_idx and a size_t idx vs the previous size_t layer_idx?

Copy link
Member

Choose a reason for hiding this comment

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

snprintf requires an int, but the two functions below want size_t. Making the loop counter size_t would require many casts, one per snprintf.

@austinvhuang austinvhuang added the copybara-import Trigger Copybara for merging pull requests label Feb 28, 2024
class DistortionStats {
public:
void Notify(float original, float distorted) {
(void)padding_; // prevent unused member warning
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be better to use HWY_MAYBE_UNUSED

Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately GCC seems to turn that into another warning:

class Test {
    HWY_MAYBE_UNUSED int member;
};
<source>:11:26: warning: 'unused' attribute ignored [-Wattributes]
   11 |     HWY_MAYBE_UNUSED int member;
      |                          ^~~~~~

@copybara-service copybara-service bot merged commit 272f17d into dev Feb 28, 2024
@copybara-service copybara-service bot deleted the test_610949239 branch February 28, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copybara-import Trigger Copybara for merging pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants