Bug 1312313 - turn off -Wc++11-narrowing on clang; r?ted.mielczarek
Breakpad has enums that look like:
typedef enum {
VAL1 = 0xc000008f,
...
} WeirdEnum;
The C++ standard says that the implementation needs to pick the
underlying type of the enum such that it can safely hold all values
of the enumeration. For the above enum, uint32_t would be such a
type. However, MSVC (and clang-cl) apparently do something quite
different, and clang-cl complains when you use the enum above like
so:
uint32_t testval = ...;
switch (testval) {
case VAL1:
...
};
since you can't convert VAL1 (a negative, signed 32-bit integer)
into a uint32_t to compare with testval.
The easiest way avoid this is to disable the warning for breakpad
code. We also disable the related -Wmicrosoft-enum-value warning
globally, for similar reasons.
MozReview-Commit-ID: 4IoEHSrb7aH
--- a/toolkit/crashreporter/crashreporter.mozbuild
+++ b/toolkit/crashreporter/crashreporter.mozbuild
@@ -13,15 +13,19 @@ if CONFIG['_MSC_VER']:
CXXFLAGS += [
'-wd4005', # macro redefinition
]
elif CONFIG['GNU_CXX']:
CXXFLAGS += [
'-Wno-unused-local-typedefs',
'-Wno-shadow',
]
- if CONFIG['CLANG_CXX']:
- CXXFLAGS += ['-Wno-implicit-fallthrough']
+
+if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
+ CXXFLAGS += [
+ '-Wno-implicit-fallthrough',
+ '-Wno-c++11-narrowing',
+ ]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
DEFINES['ELFSIZE'] = 32
DEFINES['NO_STABS_SUPPORT'] = True