[all-commits] [llvm/llvm-project] d6492d: Add -Wtautological-value-range-compare warning.

Richard Smith via All-commits all-commits at lists.llvm.org
Thu Aug 6 13:29:10 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d6492d874478b1d3b1ce3adb4c3044618bec29e9
      https://github.com/llvm/llvm-project/commit/d6492d874478b1d3b1ce3adb4c3044618bec29e9
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2020-08-06 (Thu, 06 Aug 2020)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/Sema/tautological-constant-compare.c

  Log Message:
  -----------
  Add -Wtautological-value-range-compare warning.

This warning diagnoses cases where an expression is compared to a
constant, and the comparison is tautological due to the form of the
expression (but not merely due to its type). This applies in cases such
as comparisons of bit-fields and the result of bit-masks.

The new warning is added to the Clang diagnostic group
-Wtautological-constant-in-range-compare but not to the
formerly-equivalent GCC-compatibility diagnostic group -Wtype-limits,
which retains its old meaning of diagnosing only tautological
comparisons to extremal values of a type (eg, int > INT_MAX).

Reviewed By: rtrieu

Differential Revision: https://reviews.llvm.org/D85256




More information about the All-commits mailing list