Last Comment Bug 747469 - GCC 4.6 warning: nsHTMLDocument.cpp:2308:49: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
: GCC 4.6 warning: nsHTMLDocument.cpp:2308:49: warning: comparison of unsigned ...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: x86_64 Linux
: -- normal (vote)
: mozilla15
Assigned To: Daniel Holbert [:dholbert]
:
Mentors:
Depends on:
Blocks: buildwarning 768344 contenteditable
  Show dependency treegraph
 
Reported: 2012-04-20 11:05 PDT by Daniel Holbert [:dholbert]
Modified: 2012-06-26 01:40 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix v1 (1.00 KB, patch)
2012-04-20 11:09 PDT, Daniel Holbert [:dholbert]
ehsan: review+
Details | Diff | Splinter Review

Description Daniel Holbert [:dholbert] 2012-04-20 11:05:39 PDT
{
content/html/document/src/nsHTMLDocument.cpp: In member function ‘virtual nsresult nsHTMLDocument::ChangeContentEditableCount(nsIContent*, PRInt32)’:
content/html/document/src/nsHTMLDocument.cpp:2308:49: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
}

This is from this code...
> 2305 nsHTMLDocument::ChangeContentEditableCount(nsIContent *aElement,
> 2306                                            PRInt32 aChange)
> 2307 {
> 2308   NS_ASSERTION(mContentEditableCount + aChange >= 0,
> 2309                "Trying to decrement too much.");
...added in this cset: http://hg.mozilla.org/mozilla-central/rev/15cda702358e

mContentEditableCount is unsigned, so [mContentEditableCount + aChange] is unsigned and will always be >=0 by definition.  So the assertion doesn't check what it's trying to check.

Simplest/cleanest fix is probably to just add a PRInt32 cast.
Comment 1 Daniel Holbert [:dholbert] 2012-04-20 11:09:43 PDT
Created attachment 617040 [details] [diff] [review]
fix v1
Comment 2 Daniel Holbert [:dholbert] 2012-04-20 16:05:29 PDT
https://hg.mozilla.org/projects/birch/rev/5da92b15cfeb

Note You need to log in before you can comment on or make changes to this bug.