digitalmars.D.bugs - [Issue 17172] New: redundant `statement is not reachable`: should
- via Digitalmars-d-bugs (39/39) Feb 09 2017 https://issues.dlang.org/show_bug.cgi?id=17172
https://issues.dlang.org/show_bug.cgi?id=17172 Issue ID: 17172 Summary: redundant `statement is not reachable`: should only show 1 per code block Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: timothee.cour2 gmail.com D20170209T222632 dmd -c -o- -w test.d: ``` void test(){ version(linux) return; int a=1; int b=1; } ``` test.d(1): Warning: statement is not reachable test.d(2): Warning: statement is not reachable Expected: test.d(1): Warning: statement is not reachable The 2nd warning is in the same code block so is redundant. This is annoying: * when debugging and doing an early return as shown, it can show tons of warnings (masking more useful ones) * the workaround is to use: version(none){ // unused code } but it has issues: - increases indentation - the code is no longer checked for being compilable, and after a while becomes out of sync. --
Feb 09 2017