Bug 1508927 - Enable clang's -Wbitfield-enum-conversion warnings. r=glandium

https://clang.llvm.org/docs/DiagnosticsReference.html#wbitfield-enum-conversion

This clang warning caught a real layout bug related to implicitly truncated enums in the table border style code (bug 1485179):

layout/tables/nsTableFrame.cpp:5318:14 [-Wbitfield-enum-conversion] bit-field 'ownerElem' is not wide enough to store all enumerators of 'BCBorderOwner'
layout/tables/nsTableFrame.cpp:5358:16 [-Wbitfield-enum-conversion] bit-field 'ownerElem' is not wide enough to store all enumerators of 'BCBorderOwner'
layout/tables/nsTableFrame.cpp:5374:18 [-Wbitfield-enum-conversion] bit-field 'subElem' is not wide enough to store all enumerators of 'BCBorderOwner'
layout/tables/nsTableFrame.cpp:5385:18 [-Wbitfield-enum-conversion] bit-field 'subElem' is not wide enough to store all enumerators of 'BCBorderOwner'

Also update the comment linking to clang and gcc's warning documentation.

Differential Revision: https://phabricator.services.mozilla.com/D12513

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Chris Peterson 2018-11-27 02:01:48 +00:00
Родитель ea4f22e526
Коммит fe4ed2b8bb
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -14,11 +14,15 @@ add_old_configure_assignment(
# GCC/Clang warnings:
# https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Warning-Options.html
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
# https://clang.llvm.org/docs/DiagnosticsReference.html
# lots of useful warnings
add_gcc_warning('-Wall')
# catch implicit truncation of enum values assigned to smaller bit fields
check_and_add_gcc_warning('-Wbitfield-enum-conversion')
# catches bugs, e.g. "if (c); foo();", few false positives
add_gcc_warning('-Wempty-body')