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 firstname.lastname@example.org: https://hg.mozilla.org/integration/mozilla-inbound/rev/2863cfa9daf1 Enable clang's -Wstring-conversion warnings. r=glandium
You need to log in before you can comment on or make changes to this bug.