[PATCH] D52137: Added warning for unary minus used with unsigned type
Dávid Bolvanský via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 1 18:42:13 PDT 2018
xbolva00 marked an inline comment as done.
xbolva00 added inline comments.
================
Comment at: test/Sema/unary-minus-integer-impcast-2.c:1
+// RUN: %clang_cc1 %s -verify -Wconversion -fsyntax-only -triple i386-pc-linux-gnu
+
----------------
rsmith wrote:
> You can combine the two tests together into a single file using a #ifdef to detect which set of warnings to expect:
>
> ```
> unsigned long b2 = -a;
> #ifdef __X86_64__
> // expected-warning at -2 {{higher order bits are zeroes}}
> #endif
> long c2 = -a;
> #ifdef __X86_64__
> // expected-warning at -2 {{value is always non-negative}}
> #else
> // expected-warning at -4 {{implicit conversion changes signedness}}
> #endif
> ```
ok, thanks!
https://reviews.llvm.org/D52137
More information about the cfe-commits
mailing list