Fix two -Wmax-unsigned-zero warnings

RESOLVED FIXED in Firefox 54

Status

()

RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: sylvestre, Assigned: sylvestre)

Tracking

(Blocks: 1 bug)

Trunk
mozilla54
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox54 fixed)

Details

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
Building with clang 4.0 rc1 + --enable-warnings-as-errors, the build breaks with:
 0:06.53 /home/sylvestre/dev/mozilla/mozilla-central.hg/dom/html/HTMLImageElement.cpp:773:14: error: taking the max of a value and unsigned zero is always equal to the other value [-Werror,-Wmax-unsigned-zero]
 0:06.53     height = std::max(height, 0u);
 0:06.53              ^~~~~~~~         ~~
 0:06.53 /home/sylvestre/dev/mozilla/mozilla-central.hg/dom/html/HTMLImageElement.cpp:773:14: note: remove call to max function and unsigned zero argument
 0:06.53     height = std::max(height, 0u);
 0:06.53              ^~~~~~~~       ~~~~
 0:06.53 /home/sylvestre/dev/mozilla/mozilla-central.hg/dom/html/HTMLImageElement.cpp:801:13: error: taking the max of a value and unsigned zero is always equal to the other value [-Werror,-Wmax-unsigned-zero]
 0:06.53     width = std::max(width, 0u);
 0:06.53             ^~~~~~~~        ~~
(Assignee)

Updated

2 years ago
Assignee: nobody → sledru
Comment hidden (mozreview-request)
Comment on attachment 8833996 [details]
Bug 1336994 - Fix two -Wmax-unsigned-zero warnings (std::max(unsigned int, 0u)

https://reviewboard.mozilla.org/r/110102/#review111092

Yeah, it's bunk to do that given that height/width are unsigned...
Attachment #8833996 - Flags: review?(bzbarsky) → review+

Comment 3

2 years ago
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6332ef237e21
Fix two -Wmax-unsigned-zero warnings (std::max(unsigned int, 0u) r=bz
(Assignee)

Updated

2 years ago
Blocks: 1336978

Comment 4

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/6332ef237e21
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox54: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54

Updated

2 years ago
Blocks: 1330397
You need to log in before you can comment on or make changes to this bug.