Fix upcoming D-Scanner argument warnings (#8753)

* upgrade D-Scanner

* Fix upcoming D-Scanner argument checks
This commit is contained in:
Jan Jurzitza 2023-05-30 08:42:02 +02:00 committed by GitHub
parent 75a507f883
commit f8c80db44e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 19 deletions

View file

@ -74,7 +74,7 @@ ROOT_OF_THEM_ALL = generated
ROOT = $(ROOT_OF_THEM_ALL)/$(OS)/$(BUILD)/$(MODEL) ROOT = $(ROOT_OF_THEM_ALL)/$(OS)/$(BUILD)/$(MODEL)
DUB=dub DUB=dub
TOOLS_DIR=../tools TOOLS_DIR=../tools
DSCANNER_HASH=d5d6920502bf1bfdb29474007a59fd606df0aadc DSCANNER_HASH=5a53c538d0aa832f03840840271b6631fbbfc53d
DSCANNER_DIR=$(ROOT_OF_THEM_ALL)/dscanner-$(DSCANNER_HASH) DSCANNER_DIR=$(ROOT_OF_THEM_ALL)/dscanner-$(DSCANNER_HASH)
# Set DRUNTIME name and full path # Set DRUNTIME name and full path

View file

@ -254,11 +254,11 @@ public:
static if (op=="+") static if (op=="+")
{ {
data = BigUint.addOrSubInt(data, u, sign != (y<0), sign); data = BigUint.addOrSubInt!ulong(data, u, wantSub: sign != (y<0), sign);
} }
else static if (op=="-") else static if (op=="-")
{ {
data = BigUint.addOrSubInt(data, u, sign == (y<0), sign); data = BigUint.addOrSubInt!ulong(data, u, wantSub: sign == (y<0), sign);
} }
else static if (op=="*") else static if (op=="*")
{ {
@ -613,7 +613,7 @@ public:
static if (op == "-") static if (op == "-")
{ {
r.sign = sign; r.sign = sign;
r.data = BigUint.addOrSubInt(data, u, sign == (y<0), r.sign); r.data = BigUint.addOrSubInt!ulong(data, u, wantSub: sign == (y<0), r.sign);
r.negate(); r.negate();
} }
return r; return r;
@ -670,12 +670,12 @@ public:
{ {
static if (op=="++") static if (op=="++")
{ {
data = BigUint.addOrSubInt(data, 1UL, sign, sign); data = BigUint.addOrSubInt!ulong(data, 1UL, wantSub: sign, sign);
return this; return this;
} }
else static if (op=="--") else static if (op=="--")
{ {
data = BigUint.addOrSubInt(data, 1UL, !sign, sign); data = BigUint.addOrSubInt!ulong(data, 1UL, wantSub: !sign, sign);
return this; return this;
} }
} }

View file

@ -2129,16 +2129,16 @@ static:
{ {
// Not value convertible, only viable option is rhs fits within the // Not value convertible, only viable option is rhs fits within the
// bounds of Lhs // bounds of Lhs
static if (ProperCompare.hookOpCmp(Rhs.min, Lhs.min) < 0) static if (ProperCompare.hookOpCmp!(Rhs, Lhs)(lhs: Rhs.min, rhs: Lhs.min) < 0)
{ {
// Example: hookOpCast!short(int(42)), hookOpCast!uint(int(42)) // Example: hookOpCast!short(int(42)), hookOpCast!uint(int(42))
if (ProperCompare.hookOpCmp(rhs, Lhs.min) < 0) if (ProperCompare.hookOpCmp!(Rhs, Lhs)(lhs: rhs, rhs: Lhs.min) < 0)
return defaultValue!Lhs; return defaultValue!Lhs;
} }
static if (ProperCompare.hookOpCmp(Rhs.max, Lhs.max) > 0) static if (ProperCompare.hookOpCmp!(Rhs, Lhs)(lhs: Rhs.max, rhs: Lhs.max) > 0)
{ {
// Example: hookOpCast!int(uint(42)) // Example: hookOpCast!int(uint(42))
if (ProperCompare.hookOpCmp(rhs, Lhs.max) > 0) if (ProperCompare.hookOpCmp!(Rhs, Lhs)(lhs: rhs, rhs: Lhs.max) > 0)
return defaultValue!Lhs; return defaultValue!Lhs;
} }
return cast(Lhs) rhs; return cast(Lhs) rhs;

View file

@ -376,17 +376,17 @@ version (Posix)
{ {
// https://issues.dlang.org/show_bug.cgi?id=16398 // https://issues.dlang.org/show_bug.cgi?id=16398
// test the "pseudo" alignedReallocate for Posix // test the "pseudo" alignedReallocate for Posix
void[] s = AlignedMallocator.instance.alignedAllocate(16, 32); void[] b = AlignedMallocator.instance.alignedAllocate(16, 32);
(cast(ubyte[]) s)[] = ubyte(1); (cast(ubyte[]) b)[] = ubyte(1);
AlignedMallocator.instance.alignedReallocate(s, 32, 32); AlignedMallocator.instance.alignedReallocate(b, 32, 32);
ubyte[16] o; ubyte[16] o;
o[] = 1; o[] = 1;
assert((cast(ubyte[]) s)[0 .. 16] == o); assert((cast(ubyte[]) b)[0 .. 16] == o);
AlignedMallocator.instance.alignedReallocate(s, 4, 32); AlignedMallocator.instance.alignedReallocate(b, 4, 32);
assert((cast(ubyte[]) s)[0 .. 3] == o[0 .. 3]); assert((cast(ubyte[]) b)[0 .. 3] == o[0 .. 3]);
AlignedMallocator.instance.alignedReallocate(s, 128, 32); AlignedMallocator.instance.alignedReallocate(b, 128, 32);
assert((cast(ubyte[]) s)[0 .. 3] == o[0 .. 3]); assert((cast(ubyte[]) b)[0 .. 3] == o[0 .. 3]);
AlignedMallocator.instance.deallocate(s); AlignedMallocator.instance.deallocate(b);
void[] c; void[] c;
AlignedMallocator.instance.alignedReallocate(c, 32, 32); AlignedMallocator.instance.alignedReallocate(c, 32, 32);