feat(errors): enable verrors=context globally (#20576)

Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
This commit is contained in:
Royal Simpson Pinto 2025-01-03 02:47:59 +05:30 committed by GitHub
parent c57da0cf59
commit 45e4a09a3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 87 additions and 52 deletions

View file

@ -1,4 +1,4 @@
/* REQUIRED_ARGS: -m64
/* REQUIRED_ARGS: -verrors=simple -m64
TEST_OUTPUT:
---
compilable/b16976.d(33): Deprecation: foreach: loop index implicitly converted from `size_t` to `int`

View file

@ -1,9 +1,10 @@
// https://issues.dlang.org/show_bug.cgi?id=20643
// https://issues.dlang.org/show_bug.cgi?id=20644
// REQUIRED_ARGS: -verrors=simple
/*
TEST_OUTPUT:
----
compilable/chkformat.d(14): Deprecation: more format specifiers than 0 arguments
compilable/chkformat.d(15): Deprecation: more format specifiers than 0 arguments
----
*/
import core.stdc.stdio;

View file

@ -1,9 +1,10 @@
// COMPILABLE_MATH_TEST
// PERMUTE_ARGS:
// REQUIRED_ARGS: -verrors=simple
// EXTRA_FILES: imports/a12506.d
/* TEST_OUTPUT:
---
compilable/compile1.d(230): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
compilable/compile1.d(231): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
---
*/

View file

@ -1,5 +1,5 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -wi -o-
// REQUIRED_ARGS: -verrors=simple -D -Dd${RESULTS_DIR}/compilable -wi -o-
/*
TEST_OUTPUT:

View file

@ -1,5 +1,5 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -wi -o-
// REQUIRED_ARGS: -verrors=simple -D -Dd${RESULTS_DIR}/compilable -wi -o-
/*
TEST_OUTPUT:

View file

@ -1,5 +1,5 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -wi -o-
// REQUIRED_ARGS: -verrors=simple -D -Dd${RESULTS_DIR}/compilable -wi -o-
/*
TEST_OUTPUT:
---

View file

@ -1,5 +1,5 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -wi -o-
// REQUIRED_ARGS: -verrors=simple -D -Dd${RESULTS_DIR}/compilable -wi -o-
/*
TEST_OUTPUT:

View file

@ -1,5 +1,5 @@
/*
REQUIRED_ARGS: -dw
REQUIRED_ARGS: -verrors=simple -dw
TEST_OUTPUT:
---
compilable/depmsg.d(39): Deprecation: struct `depmsg.main.Inner.A` is deprecated - With message!

View file

@ -1,5 +1,5 @@
// https://issues.dlang.org/show_bug.cgi?id=22668
// REQUIRED_ARGS: -verrors=simple
// Overrides with same deprecated'ness are allowed
class SameParent

View file

@ -1,5 +1,5 @@
/*
REQUIRED_ARGS: -verrors=3
REQUIRED_ARGS: -verrors=simple -verrors=3
TEST_OUTPUT:
---
compilable/deprecationlimit.d(18): Deprecation: function `deprecationlimit.f` is deprecated

View file

@ -1,3 +1,4 @@
// REQUIRED_ARGS: -verrors=simple
/*
TEST_OUTPUT:
---

View file

@ -1,5 +1,5 @@
/+
REQUIRED_ARGS: -HC -c -o- -wi -extern-std=c++20
REQUIRED_ARGS: -verrors=simple -HC -c -o- -wi -extern-std=c++20
PERMUTE_ARGS:
TEST_OUTPUT:
---

View file

@ -1,8 +1,9 @@
// PERMUTE_ARGS: -inline
// REQUIRED_ARGS: -verrors=simple
/*
TEST_OUTPUT:
---
compilable/interpret3.d(6350): Deprecation: identity comparison of static arrays implicitly coerces them to slices, which are compared by reference
compilable/interpret3.d(6351): Deprecation: identity comparison of static arrays implicitly coerces them to slices, which are compared by reference
---
*/

View file

@ -1,5 +1,5 @@
/*
REQUIRED_ARGS: -inline -wi
REQUIRED_ARGS: -verrors=simple -inline -wi
TEST_OUTPUT:
---
compilable/pragmainline2.d(14): Warning: cannot inline function `pragmainline2.foo`

View file

@ -1,5 +1,5 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS: -unittest -verrors=0
// REQUIRED_ARGS: -verrors=simple -unittest -verrors=0
/*
TEST_OUTPUT:

View file

@ -1,4 +1,4 @@
// REQUIRED_ARGS:
// REQUIRED_ARGS: -verrors=simple
// EXTRA_FILES: imports/a12567.d
// PERMUTE_ARGS:
/*

View file

@ -1,7 +1,8 @@
// https://issues.dlang.org/show_bug.cgi?id=19227
// REQUIRED_ARGS: -verrors=simple
/* TEST_OUTPUT:
---
compilable/test19227.d(16): Deprecation: use of complex type `cfloat` is deprecated, use `std.complex.Complex!(float)` instead
compilable/test19227.d(17): Deprecation: use of complex type `cfloat` is deprecated, use `std.complex.Complex!(float)` instead
Deprecation: use of complex type `const(cfloat)` is deprecated, use `std.complex.Complex!(float)` instead
---
*/

View file

@ -1,11 +1,12 @@
// https://issues.dlang.org/show_bug.cgi?id=19609
// REQUIRED_ARGS: -verrors=simple
// EXTRA_FILES: imports/test19609a.d imports/test19609b.d imports/test19609c.d
/*
TEST_OUTPUT:
---
compilable/test19609.d(11): Deprecation: module `imports.test19609a` is deprecated
compilable/test19609.d(12): Deprecation: module `imports.test19609b` is deprecated - hello
compilable/test19609.d(13): Deprecation: module `imports.test19609c` is deprecated
compilable/test19609.d(12): Deprecation: module `imports.test19609a` is deprecated
compilable/test19609.d(13): Deprecation: module `imports.test19609b` is deprecated - hello
compilable/test19609.d(14): Deprecation: module `imports.test19609c` is deprecated
---
*/
import imports.test19609a;

View file

@ -1,7 +1,8 @@
// REQUIRED_ARGS: -verrors=simple
/* TEST_OUTPUT:
---
compilable/test20063.d(10): Deprecation: function `test20063.main.f!(delegate () pure nothrow @safe => new C).f` function requires a dual-context, which is deprecated
compilable/test20063.d(19): instantiated from here: `f!(delegate () pure nothrow @safe => new C)`
compilable/test20063.d(11): Deprecation: function `test20063.main.f!(delegate () pure nothrow @safe => new C).f` function requires a dual-context, which is deprecated
compilable/test20063.d(20): instantiated from here: `f!(delegate () pure nothrow @safe => new C)`
---
*/

View file

@ -1,15 +1,16 @@
// https://issues.dlang.org/show_bug.cgi?id=21514
// REQUIRED_ARGS: -verrors=simple
// DISABLED: win32 win64
/* TEST_OUTPUT:
---
compilable/test21514.d(16): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
compilable/test21514.d(16): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
compilable/test21514.d(17): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
compilable/test21514.d(17): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
compilable/test21514.d(19): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
compilable/test21514.d(19): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
compilable/test21514.d(20): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
compilable/test21514.d(20): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
compilable/test21514.d(17): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
compilable/test21514.d(17): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
compilable/test21514.d(18): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
compilable/test21514.d(18): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
compilable/test21514.d(20): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
compilable/test21514.d(20): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead
compilable/test21514.d(21): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
compilable/test21514.d(21): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
---
*/

View file

@ -1,5 +1,5 @@
/* https://issues.dlang.org/show_bug.cgi?id=23097
REQUIRED_ARGS: -verrors=spec
REQUIRED_ARGS: -verrors=simple -verrors=spec
TEST_OUTPUT:
---
(spec:2) compilable/test23097.d(14): Error: `inout` constructor `test23097.S23097.this` creates const object, not mutable

View file

@ -1,11 +1,12 @@
// REQUIRED_ARGS: -verrors=simple
/* TEST_OUTPUT:
---
compilable/test324.d(17): Deprecation: function `test324.main.doStuff!((i)
compilable/test324.d(18): Deprecation: function `test324.main.doStuff!((i)
{
return i;
}
).doStuff` function requires a dual-context, which is deprecated
compilable/test324.d(23): instantiated from here: `doStuff!((i)
compilable/test324.d(24): instantiated from here: `doStuff!((i)
{
return i;
}

View file

@ -1,9 +1,10 @@
// https://issues.dlang.org/show_bug.cgi?id=9701
// REQUIRED_ARGS: -verrors=simple
/*
TEST_OUTPUT:
---
compilable/test9701.d(68): Deprecation: enum member `test9701.Enum.value7` is deprecated
compilable/test9701.d(68): Deprecation: enum member `test9701.Enum.value8` is deprecated - message
compilable/test9701.d(69): Deprecation: enum member `test9701.Enum.value7` is deprecated
compilable/test9701.d(69): Deprecation: enum member `test9701.Enum.value8` is deprecated - message
---
*/

View file

@ -15,17 +15,24 @@ compare()
fi
}
normalize() { tr -d "\n\r" ; }
normalize()
{
if uname | grep -qi "freebsd"; then
tr -d "\n\r" | sed 's/void foo() {} void main() { goo(); }//; s/[[:space:]]\+\^$//'
else
tr -d "\n\r" | sed -E 's/void foo\(\) \{\} void main\(\) \{ goo\(\); \}//; s/\s+\^$//'
fi
}
check()
{
local actual expected
actual=$(echo "$2" | ("$DMD" -c -o- "$1" - 2>&1 || true) | normalize)
actual=$(echo "$2" | ("$DMD" -c -o- -verrors=simple "$1" - 2>&1 || true) | normalize)
compare "$actual" "$3"
}
expectedWithoutColor=__stdin.d\(2\):\ Error:\ no\ identifier\ for\ declarator\ \`test\`
expectedWithColor=$'\033'\[1m__stdin.d\(2\):\ $'\033'\[1\;31mError:\ $'\033'\[mno\ identifier\ for\ declarator\ \`$'\033'\[0\;36m$'\033'\[m$'\033'\[1mtest$'\033'\[0\;36m$'\033'\[m\`
expectedWithoutColor='__stdin.d(2): Error: no identifier for declarator `test`'
expectedWithColor=$'\033[1m__stdin.d(2): \033[1;31mError: \033[mno identifier for declarator `\033[0;36m\033[m\033[1mtest\033[0;36m\033[m`'
check -c "test" "$expectedWithoutColor"
check -color=auto "test" "$expectedWithoutColor"
@ -40,7 +47,7 @@ check -color=off "$gooCode" "$gooExpectedWithoutColor"
if [[ "$(script --version)" == script\ from\ util-linux\ * ]]
then
actual="$(SHELL="$(command -v bash)" TERM="faketerm" script -q -c "echo test | ( $DMD -c -o- -)" /dev/null | normalize)" || true
actual="$(SHELL="$(command -v bash)" TERM="faketerm" script -q -c "echo test | ( $DMD -c -o- -verrors=simple -)" /dev/null | normalize)" || true
# Weird results for WSL, probably some environmental issue
if uname -a | grep -i linux | grep -i microsoft &> /dev/null

View file

@ -1,4 +1,4 @@
// REQUIRED_ARGS:
// REQUIRED_ARGS: -verrors=simple
// PERMUTE_ARGS:
// EXTRA_FILES: imports/udamodule1.d
/*

View file

@ -1,6 +1,6 @@
/*
PERMUTE_ARGS:
REQUIRED_ARGS: -verrors=spec
REQUIRED_ARGS: -verrors=simple -verrors=spec
TEST_OUTPUT:
---
(spec:1) compilable/verrors_spec.d(13): Error: cannot implicitly convert expression `& i` of type `int*` to `int`