From 0276d7e50ab81073b290e150b52d4a95dd2eea6b Mon Sep 17 00:00:00 2001 From: Nicholas Wilson Date: Wed, 21 Aug 2024 15:01:48 +0800 Subject: [PATCH] Remove deprecation for bugzilla 22999 (#16800) --- changelog/dmd.deprecation-case.dd | 18 ++++++++++++++++++ compiler/src/dmd/blockexit.d | 9 ++------- compiler/test/fail_compilation/test22999.d | 5 ++--- 3 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 changelog/dmd.deprecation-case.dd diff --git a/changelog/dmd.deprecation-case.dd b/changelog/dmd.deprecation-case.dd new file mode 100644 index 0000000000..cbcc3e8e66 --- /dev/null +++ b/changelog/dmd.deprecation-case.dd @@ -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 +} +``` diff --git a/compiler/src/dmd/blockexit.d b/compiler/src/dmd/blockexit.d index d77af7e1c5..75293bce0f 100644 --- a/compiler/src/dmd/blockexit.d +++ b/compiler/src/dmd/blockexit.d @@ -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); } } } diff --git a/compiler/test/fail_compilation/test22999.d b/compiler/test/fail_compilation/test22999.d index 99dfe70378..921ab6075c 100644 --- a/compiler/test/fail_compilation/test22999.d +++ b/compiler/test/fail_compilation/test22999.d @@ -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 --- */