[Issue 17172] New: redundant `statement is not reachable`: should only show 1 per code block
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Feb 9 22:28:44 PST 2017
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 at puremagic.com
Reporter: timothee.cour2 at 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.
--
More information about the Digitalmars-d-bugs
mailing list