Closed Bug 1277428 Opened 9 years ago Closed 8 years ago

Enable clang's -Wstring-conversion warnings

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox48 wontfix, firefox49 affected, firefox50 fixed)

RESOLVED FIXED
mozilla50
Tracking Status
firefox48 --- wontfix
firefox49 --- affected
firefox50 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

clang's -Wstring-conversion warns about implicit conversion of string literals into bools. String literals are sometimes used like this for "always fail" assertions like assert(!"always fails"). "Always fail" assertions are better expressed using MOZ_ASSERT_UNREACHABLE() or MOZ_CRASH() with a reason string. In any other case, this usage is usually a bug. For example: * In bug 1276567, a function with return type bool returned a string literal "<dead CPOW>" without a compiler error or warning because the string literal was implicitly converted to true. * In bug 980810 and bug 1277009, some assertions with string literal arguments forgot the ! so the assertions were always true no-ops instead of always false aborts. That mistake would not be possible using MOZ_ASSERT_UNREACHABLE() or MOZ_CRASH(). Green Try build with -Wstring-conversion warnings enabled: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f26518fc2522
Attachment #8758985 - Flags: review?(mh+mozilla)
Attachment #8758985 - Flags: review?(mh+mozilla) → review+
Pushed by cpeterson@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/2863cfa9daf1 Enable clang's -Wstring-conversion warnings. r=glandium
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: