Bug 14905 – duplicate error message: 'Warning: statement is not reachable'

Status
REOPENED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2015-08-11T03:13:06Z
Last change time
2024-12-13T18:44:06Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Timothee Cour
See also
https://issues.dlang.org/show_bug.cgi?id=18528
Moved to GitHub: dmd#17719 →

Comments

Comment #0 by timothee.cour2 — 2015-08-11T03:13:06Z
dmd -w -c -o- main.d main.d(3): Warning: statement is not reachable main.d(3): Warning: statement is not reachable main.d: ---- bool fun(string s)() { return true; return false; } void main(){ cast(void)fun!"a"; cast(void)fun!"b"; } ---- Could we have a global hash of all generated warning/error messages to avoid repeating them? (as opposed to a one-off fix to just fix this particular case) See also relevant discussion: http://digitalmars-d.puremagic.narkive.com/cml7ma0c/dmd-diagnostic-any-way-to-remove-identical-lines-from-final-dmd-error-log
Comment #1 by k.hara.pg — 2015-08-11T04:50:53Z
They're not true duplication. If the error messages print their enclosing functions, the messages will be: main.d(3): Warning: statement is not reachable in 'main.fun!"a".fun' main.d(3): Warning: statement is not reachable in 'main.fun!"b".fun'
Comment #2 by timothee.cour2 — 2015-08-11T07:01:00Z
(In reply to Kenji Hara from comment #1) > They're not true duplication. If the error messages print their enclosing > functions, the messages will be: > > main.d(3): Warning: statement is not reachable in 'main.fun!"a".fun' > main.d(3): Warning: statement is not reachable in 'main.fun!"b".fun' But it doesn't. Either way, that's a technicality, it's the same root cause and should not result in dups. Here's the message that prompted me to file this bug: inifiled/source/inifiled.d(33): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable inifiled/source/inifiled.d(42): Warning: statement is not reachable when compiling Dscanner with local modification to get latest libdparse.
Comment #3 by k.hara.pg — 2015-08-11T08:10:57Z
(In reply to Timothee Cour from comment #2) > (In reply to Kenji Hara from comment #1) > > They're not true duplication. If the error messages print their enclosing > > functions, the messages will be: > > > > main.d(3): Warning: statement is not reachable in 'main.fun!"a".fun' > > main.d(3): Warning: statement is not reachable in 'main.fun!"b".fun' > > But it doesn't. > Either way, that's a technicality, it's the same root cause and should not > result in dups. Technically they're not dup. The two errors come from two different instantiated functions. So, I think the two errors should not be merged into one.
Comment #4 by razvan.nitu1305 — 2022-10-10T06:40:39Z
I agree with Kenji, those are technically different error messages. There is no way to fix this that would not impact warnings in conditional compilation. What we can do though is add the name of the template instance in the error message as to disambiguate. PR: https://github.com/dlang/dmd/pull/14543
Comment #5 by dlang-bot — 2022-10-23T20:20:08Z
dlang/dmd pull request #14588 "Revert "Fix Issue 14905 - duplicate error message: 'Warning: statement is not…"" was merged into stable: - 9da58efc5c9656a812ace267c24af7625e4011ee by Iain Buclaw: Revert "Fix Issue 14905 - duplicate error message: 'Warning: statement is not reachable' (#14543)" This reverts commit aae2fd363f56500ce3c17d6ae98524c724132435. https://github.com/dlang/dmd/pull/14588
Comment #6 by ibuclaw — 2022-10-23T20:54:28Z
PR was reverted.
Comment #7 by dlang-bot — 2022-11-01T11:40:35Z
@ibuclaw created dlang/dmd pull request #14609 "merge stable" mentioning this issue: - Revert "Fix Issue 14905 - duplicate error message: 'Warning: statement is not reachable' (#14543)" This reverts commit aae2fd363f56500ce3c17d6ae98524c724132435. https://github.com/dlang/dmd/pull/14609
Comment #8 by dlang-bot — 2022-11-01T16:30:35Z
dlang/dmd pull request #14609 "merge stable" was merged into master: - 12485385f1b8bfbe02f65785b9e43013e534b750 by Iain Buclaw: Revert "Fix Issue 14905 - duplicate error message: 'Warning: statement is not reachable' (#14543)" This reverts commit aae2fd363f56500ce3c17d6ae98524c724132435. https://github.com/dlang/dmd/pull/14609
Comment #9 by robert.schadek — 2024-12-13T18:44:06Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17719 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB