Closed Bug 1807583 (Wtautological-constant-in-range-compare) Opened 1 year ago Closed 1 year ago

Enable -Wtautological-constant-in-range-compare warnings

Categories

(Firefox Build System :: General, task, P3)

task

Tracking

(firefox111 fixed)

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

There are no -Wtautological-constant-in-range-compare warnings in C or C++ code in mozilla-central, so we can enable this warning.

However, the -Wtautological-constant-in-range-compare flag also enables -Wtautological-value-range-compare warnings and there are some -Wtautological-value-range-compare warnings in some third-party C code.

https://releases.llvm.org/15.0.0/tools/clang/docs/DiagnosticsReference.html#wtautological-constant-in-range-compare

I filed https://bugs.chromium.org/p/google-breakpad/issues/detail?id=859 for the Google Breakpad warning.


toolkit/crashreporter/google-breakpad/src/third_party/libdisasm/ia32_invariant.c:112:30 [-Wtautological-value-range-compare] result of comparison of 3-bit unsigned value == 101 is always false

js/src/zydis/Zydis/Decoder.c:2200:43 [-Wtautological-value-range-compare] result of comparison of 2-bit unsigned value < 4 is always true
js/src/zydis/Zydis/Decoder.c:2213:43 [-Wtautological-value-range-compare] result of comparison of 2-bit unsigned value < 4 is always true
js/src/zydis/Zydis/Decoder.c:2226:43 [-Wtautological-value-range-compare] result of comparison of 2-bit unsigned value < 4 is always true
js/src/zydis/Zydis/Decoder.c:3650:46 [-Wtautological-value-range-compare] result of comparison of 3-bit unsigned value < 8 is always true
js/src/zydis/Zydis/SharedData.c:119:47 [-Wtautological-value-range-compare] result of comparison of 15-bit unsigned value != 65535 is always true

third_party/aom/aom_dsp/intrapred.c:94:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true
third_party/aom/aom_dsp/intrapred.c:123:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true
third_party/aom/aom_dsp/intrapred.c:152:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true
third_party/aom/aom_dsp/intrapred.c:413:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true
third_party/aom/aom_dsp/intrapred.c:444:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true
third_party/aom/aom_dsp/intrapred.c:475:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true

There are no -Wtautological-constant-in-range-compare warnings in C or C++ code in mozilla-central, so we can enable this warning.

However, the -Wtautological-constant-in-range-compare flag also enables -Wtautological-value-range-compare warnings and there are some -Wtautological-value-range-compare warnings in some third-party C code.

I filed https://bugs.chromium.org/p/google-breakpad/issues/detail?id=859 for the Google Breakpad warning.


toolkit/crashreporter/google-breakpad/src/third_party/libdisasm/ia32_invariant.c:112:30 [-Wtautological-value-range-compare] result of comparison of 3-bit unsigned value == 101 is always false

js/src/zydis/Zydis/Decoder.c:2200:43 [-Wtautological-value-range-compare] result of comparison of 2-bit unsigned value < 4 is always true
js/src/zydis/Zydis/Decoder.c:2213:43 [-Wtautological-value-range-compare] result of comparison of 2-bit unsigned value < 4 is always true
js/src/zydis/Zydis/Decoder.c:2226:43 [-Wtautological-value-range-compare] result of comparison of 2-bit unsigned value < 4 is always true
js/src/zydis/Zydis/Decoder.c:3650:46 [-Wtautological-value-range-compare] result of comparison of 3-bit unsigned value < 8 is always true
js/src/zydis/Zydis/SharedData.c:119:47 [-Wtautological-value-range-compare] result of comparison of 15-bit unsigned value != 65535 is always true

third_party/aom/aom_dsp/intrapred.c:94:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true
third_party/aom/aom_dsp/intrapred.c:123:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true
third_party/aom/aom_dsp/intrapred.c:152:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true
third_party/aom/aom_dsp/intrapred.c:413:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true
third_party/aom/aom_dsp/intrapred.c:444:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true
third_party/aom/aom_dsp/intrapred.c:475:3 [-Wtautological-value-range-compare] result of comparison of 4-bit unsigned value < 31 is always true

Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d9c33212d62e
Enable -Wtautological-constant-in-range-compare warnings. r=firefox-build-system-reviewers,glandium
Attachment #9309826 - Attachment description: Bug 1807583 - Enable -Wtautological-constant-in-range-compare warnings. r?#firefox-build-system-reviewers → Bug 1807583 - Enable -Wtautological-constant-in-range-compare warnings. r?#firefox-build-system-reviewers,glandium
Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8dd315952fe9
Enable -Wtautological-constant-in-range-compare warnings. r=firefox-build-system-reviewers,glandium
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
Flags: needinfo?(cpeterson)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: