Closed Bug 1336994 Opened 5 years ago Closed 5 years ago

Fix two -Wmax-unsigned-zero warnings

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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: nobody → sledru
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+
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
Blocks: 1336978
https://hg.mozilla.org/mozilla-central/rev/6332ef237e21
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Blocks: 1330397
You need to log in before you can comment on or make changes to this bug.