<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/rss.xsl.xml"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Changes in tautological-unsigned-enum-zero-compare.cpp</title>
    <description></description>
    <language>en</language>
    <copyright>Copyright 2015</copyright>
    <generator>Java</generator><item>
        <title>c5417aaf - [Sema] -Wtautological-constant-compare is too good. Cripple it.</title>
        <link>http://172.16.0.5:8080/history/llvm-project-15.0.7/clang/test/Sema/tautological-unsigned-enum-zero-compare.cpp#c5417aaf</link>
        <description>[Sema] -Wtautological-constant-compare is too good. Cripple it.Summary:The diagnostic was mostly introduced in D38101 by me, as a reaction to wasting a lot of time, see [[ https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20171009/206427.html | mail ]].However, the diagnostic is pretty dumb. While it works with no false-positives,there are some questionable cases that are diagnosed when one would argue that they should not be.The common complaint is that it diagnoses the comparisons between an `int` and`long` when compiling for a 32-bit target as tautological, but not whencompiling for 64-bit targets. The underlying problem is obvious: data model.In most cases, 64-bit target is `LP64` (`int` is 32-bit, `long` and pointer are64-bit), and the 32-bit target is `ILP32` (`int`, `long`, and pointer are 32-bit).I.e. the common pattern is: (pseudocode)```#include &lt;limits&gt;#include &lt;cstdint&gt;int main() {  using T1 = long;  using T2 = int;  T1 r;  if (r &lt; std::numeric_limits&lt;T2&gt;::min()) {}  if (r &gt; std::numeric_limits&lt;T2&gt;::max()) {}}```As an example, D39149 was trying to fix this diagnostic in libc++, and it was not well-received.This *could* be &quot;fixed&quot;, by changing the diagnostics logic to something like`if the types of the values being compared are different, but are of the same size, then do diagnose`,and i even attempted to do so in D39462, but as @rjmccall rightfully commented,that implementation is incomplete to say the least.So to stop causing trouble, and avoid contaminating upcoming release, lets do this workaround:* move these three diags (`warn_unsigned_always_true_comparison`, `warn_unsigned_enum_always_true_comparison`, `warn_tautological_constant_compare`) into it&apos;s own `-Wtautological-constant-in-range-compare`* Disable them by default* Make them part of `-Wextra`* Additionally, give `warn_tautological_constant_compare` it&apos;s own flag `-Wtautological-type-limit-compare`.  I&apos;m not happy about that name, but i can&apos;t come up with anything better.This way all three of them can be enabled/disabled either altogether, or one-by-one.Reviewers: aaron.ballman, rsmith, smeenai, rjmccall, rnk, mclow.lists, dimReviewed By: aaron.ballman, rsmith, dimSubscribers: thakis, compnerd, mehdi_amini, dim, hans, cfe-commits, rjmccallTags: #clangDifferential Revision: https://reviews.llvm.org/D41512llvm-svn: 321691

            List of files:
            /llvm-project-15.0.7/clang/test/Sema/tautological-unsigned-enum-zero-compare.cpp</description>
        <pubDate>Wed, 03 Jan 2018 08:45:19 +0000</pubDate>
        <dc:creator>Roman Lebedev &lt;lebedev.ri@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>05e46484 - [VerifyDiagnosticConsumer] support -verify=&lt;prefixes&gt;</title>
        <link>http://172.16.0.5:8080/history/llvm-project-15.0.7/clang/test/Sema/tautological-unsigned-enum-zero-compare.cpp#05e46484</link>
        <description>[VerifyDiagnosticConsumer] support -verify=&lt;prefixes&gt;This mimics FileCheck&apos;s --check-prefixes option.The default prefix is &quot;expected&quot;. That is, &quot;-verify&quot; is equivalent to&quot;-verify=expected&quot;.The goal is to permit exercising a single test suite source file with differentcompiler options producing different sets of diagnostics.  While cpp can becombined with the existing -verify to accomplish the same goal, source is ofteneasier to maintain when it&apos;s not cluttered with preprocessor directives orduplicate passages of code. For example, this patch also rewrites some existingclang tests to demonstrate the benefit of this feature.Patch by Joel E. Denny, thanks!Differential Revision: https://reviews.llvm.org/D39694llvm-svn: 320908

            List of files:
            /llvm-project-15.0.7/clang/test/Sema/tautological-unsigned-enum-zero-compare.cpp</description>
        <pubDate>Sat, 16 Dec 2017 02:23:22 +0000</pubDate>
        <dc:creator>Hal Finkel &lt;hfinkel@anl.gov&gt;</dc:creator>
    </item>
<item>
        <title>371e9e8a - Fix a bunch of wrong &quot;tautological unsigned enum compare&quot; diagnostics in C++.</title>
        <link>http://172.16.0.5:8080/history/llvm-project-15.0.7/clang/test/Sema/tautological-unsigned-enum-zero-compare.cpp#371e9e8a</link>
        <description>Fix a bunch of wrong &quot;tautological unsigned enum compare&quot; diagnostics in C++.An enumeration with a fixed underlying type can have any value in itsunderlying type, not just those spanned by the values of its enumerators.llvm-svn: 319875

            List of files:
            /llvm-project-15.0.7/clang/test/Sema/tautological-unsigned-enum-zero-compare.cpp</description>
        <pubDate>Wed, 06 Dec 2017 03:00:51 +0000</pubDate>
        <dc:creator>Richard Smith &lt;richard-llvm@metafoo.co.uk&gt;</dc:creator>
    </item>
<item>
        <title>ca1aaacc - [Sema] Fixes for enum handling for tautological comparison diagnostics</title>
        <link>http://172.16.0.5:8080/history/llvm-project-15.0.7/clang/test/Sema/tautological-unsigned-enum-zero-compare.cpp#ca1aaacc</link>
        <description>[Sema] Fixes for enum handling for tautological comparison diagnosticsSummary:As Mattias Eriksson has reported in PR35009, in C, for enums, the underlying type shouldbe used when checking for the tautological comparison, unlike C++, where the enumeratorvalues define the value range. So if not in CPlusPlus mode, use the enum underlying type.Also, i have discovered a problem (a crash) when evaluating tautological-ness of the following comparison:```enum A { A_a = 0 };if (a &lt; 0) // expected-warning {{comparison of unsigned enum expression &lt; 0 is always false}}return 0;```This affects both the C and C++, but after the first fix, only C++ code was affected.That was also fixed, while preserving (i think?) the proper diagnostic output.And while there, attempt to enhance the test coverage.Yes, some tests got moved around, sorry about that :)Fixes PR35009Reviewers: aaron.ballman, rsmith, rjmccallReviewed By: aaron.ballmanSubscribers: Rakete1111, efriedma, materi, cfe-commitsTags: #clangDifferential Revision: https://reviews.llvm.org/D39122llvm-svn: 316268

            List of files:
            /llvm-project-15.0.7/clang/test/Sema/tautological-unsigned-enum-zero-compare.cpp</description>
        <pubDate>Sat, 21 Oct 2017 16:44:03 +0000</pubDate>
        <dc:creator>Roman Lebedev &lt;lebedev.ri@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>30d26086 - Replace r313747, don&apos;t always warn on enums, rework testcases.</title>
        <link>http://172.16.0.5:8080/history/llvm-project-15.0.7/clang/test/Sema/tautological-unsigned-enum-zero-compare.cpp#30d26086</link>
        <description>Replace r313747, don&apos;t always warn on enums, rework testcases.As Aaron Ballman has pointed out, that is not really correct.So the key problem there is the invalidity of the testcase.Revert r313747, and rework testcase in such a way, so thesedetails (platform-specific default enum sigdness) areaccounted for.Also, add a C++-specific testcase.llvm-svn: 313756

            List of files:
            /llvm-project-15.0.7/clang/test/Sema/tautological-unsigned-enum-zero-compare.cpp</description>
        <pubDate>Wed, 20 Sep 2017 13:50:01 +0000</pubDate>
        <dc:creator>Roman Lebedev &lt;lebedev.ri@gmail.com&gt;</dc:creator>
    </item>
</channel>
</rss>
