Remove deprecation for bugzilla 22999 (#16800)

This commit is contained in:
Nicholas Wilson 2024-08-21 15:01:48 +08:00 committed by GitHub
parent a74614204e
commit 0276d7e50a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 10 deletions

View file

@ -0,0 +1,18 @@
An error is now given for case fallthough for multivalued cases
This used to give a deprecation, this now gives an error:
```
int i;
switch (0)
{
case 0, 1: i = 20;
default: assert(0); // Error: switch case fallthrough - use 'goto default;' if intended
}
switch (0)
{
default:
case 0, 1: i = 20;
case 2, 3: i = 30; // Error: switch case fallthrough - use 'goto case;' if intended
}
```

View file

@ -140,13 +140,8 @@ int blockExit(Statement s, FuncDeclaration func, ErrorSink eSink)
else if (func.getModule().filetype != FileType.c)
{
const(char)* gototype = s.isCaseStatement() ? "case" : "default";
// @@@DEPRECATED_2.110@@@ https://issues.dlang.org/show_bug.cgi?id=22999
// Deprecated in 2.100
// Make an error in 2.110
if (sl && sl.isCaseStatement())
global.errorSink.deprecation(s.loc, "switch case fallthrough - use 'goto %s;' if intended", gototype);
else
global.errorSink.error(s.loc, "switch case fallthrough - use 'goto %s;' if intended", gototype);
// https://issues.dlang.org/show_bug.cgi?id=22999
global.errorSink.error(s.loc, "switch case fallthrough - use 'goto %s;' if intended", gototype);
}
}
}

View file

@ -1,9 +1,8 @@
/*
REQUIRED_ARGS: -de
TEST_OUTPUT:
---
fail_compilation/test22999.d(18): Deprecation: switch case fallthrough - use 'goto default;' if intended
fail_compilation/test22999.d(25): Deprecation: switch case fallthrough - use 'goto case;' if intended
fail_compilation/test22999.d(17): Error: switch case fallthrough - use 'goto default;' if intended
fail_compilation/test22999.d(24): Error: switch case fallthrough - use 'goto case;' if intended
---
*/