Closed Bug 1276567 Opened 9 years ago Closed 9 years ago

Fix -Wstring-conversion warnings in js/ directory

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file, 1 obsolete file)

clang's -Wstring-conversion warning warns about the use of string literals as boolean expressions. This is not uncommon in "always fail" assertions, but MOZ_ASSERT_UNREACHABLE() or MOZ_CRASH() are better solutions. Is it safe to assert (or even MOZ_CRASH) in the "<dead CPOW>" case of WrapperAnswer::RecvClassName()? js/ipc/WrapperAnswer.cpp:531:16 [-Wstring-conversion] implicit conversion turns string literal into bool: 'const char [12]' to 'bool' js/src/jit/MIR.h:63:25 [-Wstring-conversion] implicit conversion turns string literal into bool: 'const char [26]' to 'bool' js/src/jit/SharedIC.cpp:1648:21 [-Wstring-conversion] implicit conversion turns string literal into bool: 'const char [30]' to 'bool' js/src/jsgc.cpp:7135:21 [-Wstring-conversion] implicit conversion turns string literal into bool: 'const char [59]' to 'bool'
Attachment #8757770 - Flags: review?(wmccloskey)
Comment on attachment 8757770 [details] [diff] [review] Fix -Wstring-conversion warnings in js/ directory Review of attachment 8757770 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/ipc/WrapperAnswer.cpp @@ +550,5 @@ > RootedObject obj(cx, findObjectById(cx, objId)); > if (!obj) { > // This is very unfortunate, but we have no choice. > + MOZ_ASSERT_UNREACHABLE("<dead CPOW>"); > + return false; This should assign "<dead CPOW>" to *name and return true.
Attachment #8757770 - Flags: review?(wmccloskey)
Patch v2 assigns "<dead CPOW>" to *name and returns true.
Attachment #8757770 - Attachment is obsolete: true
Attachment #8758359 - Flags: review?(wmccloskey)
Attachment #8758359 - Flags: review?(wmccloskey) → review+
Pushed by cpeterson@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/3d71c62d3caa Fix -Wstring-conversion warnings in js/ directory. r=billm
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Blocks: 1277428
Status: REOPENED → RESOLVED
Closed: 9 years ago9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: