Last Comment Bug 749229 - nsEventSource.cpp:1113:35: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
: nsEventSource.cpp:1113:35: warning: comparison of unsigned expression >= 0 is...
Product: Core
Classification: Components
Component: DOM: Events (show other bugs)
: Trunk
: x86_64 Linux
: -- normal (vote)
: mozilla15
Assigned To: Daniel Holbert [:dholbert]
: Andrew Overholt [:overholt]
Depends on:
Blocks: buildwarning 338583
  Show dependency treegraph
Reported: 2012-04-26 09:11 PDT by Daniel Holbert [:dholbert]
Modified: 2012-04-27 06:57 PDT (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

fix (998 bytes, patch)
2012-04-26 09:17 PDT, Daniel Holbert [:dholbert]
bugs: review+
Details | Diff | Splinter Review

Description Daniel Holbert [:dholbert] 2012-04-26 09:11:01 PDT
Filing bug on this build warning:
/mozilla/content/base/src/nsEventSource.cpp: In member function ‘nsresult nsEventSource::SetReconnectionTimeout()’:
/mozilla/content/base/src/nsEventSource.cpp:1113:35: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]

for this assertion:
> 1113   NS_ASSERTION(mReconnectionTime >= 0, "mReconnectionTime lies");
where mReconnectionTime is unsigned (and has been ever since it & this assertion were introduced in bug 338583):

Looks like the assertion can just go away.
Comment 1 Daniel Holbert [:dholbert] 2012-04-26 09:12:00 PDT
(this is a warning in GCC 4.6.3, FWIW - I think that's the first version of GCC to warn about this)
Comment 2 Daniel Holbert [:dholbert] 2012-04-26 09:17:08 PDT
Created attachment 618684 [details] [diff] [review]
Comment 3 Daniel Holbert [:dholbert] 2012-04-26 09:20:37 PDT
Note: AFAICT, this value is read from an about:config pref, and then dynamically updated later on and clamped to the range [MIN_RECONNECTION_TIME_VALUE, MAX_RECONNECTION_TIME_VALUE]

So, it doesn't look like we're particularly worried about it underflowing or anything.
Comment 4 Daniel Holbert [:dholbert] 2012-04-26 09:44:24 PDT
Comment 5 Ed Morley [:emorley] 2012-04-27 06:57:22 PDT

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