Closed Bug 414963 Opened 17 years ago Closed 16 years ago

C++ warnings in jsnum.c, jsutil.c (with g++ -Wconversion)

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9beta4

People

(Reporter: jorendorff, Assigned: jorendorff)

References

Details

Attachments

(1 file)

These lines in jsnum.c cause errors when building with g++ -Wconversion (which is what the Mozilla build does in actionmonkey branch, bug 357016):

  http://mxr.mozilla.org/mozilla/source/js/src/jsnum.c#781
      return (int32) (d >= two31) ? (d - two32) : d;
  http://mxr.mozilla.org/mozilla/source/js/src/jsnum.c#810
      return (uint32) (d >= 0) ? d : d + two32;

It's just a thinko regarding operator precedence; see patch.

There's also a spot in jsutil.c where g++ wants a cast:

  http://mxr.mozilla.org/mozilla/source/js/src/jsutil.c#201
      cnt = ceil(log10(cnt));
Attached patch v1Splinter Review
I thought I uploaded this last week.
Assignee: general → jorendorff
Status: NEW → ASSIGNED
Attachment #301033 - Flags: review?(brendan)
Comment on attachment 301033 [details] [diff] [review]
v1

Thanks. Safe to land to cut down on warnings in Moz2 builds, won't hurt 1.9 builds and may avoid warnings there too (I did not see any on Mac gcc builds, debug or opt).

/be
Attachment #301033 - Flags: review?(brendan)
Attachment #301033 - Flags: review+
Attachment #301033 - Flags: approval1.9+
Keywords: checkin-needed
Checking in js/src/jsnum.c;
/cvsroot/mozilla/js/src/jsnum.c,v  <--  jsnum.c
new revision: 3.104; previous revision: 3.103
done
Checking in js/src/jsutil.c;
/cvsroot/mozilla/js/src/jsutil.c,v  <--  jsutil.c
new revision: 3.29; previous revision: 3.28
done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9beta4
Flags: in-testsuite-
Flags: in-litmus-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: