Bug 6449 – Unused label warning

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-08-07T05:40:56Z
Last change time
2018-10-19T02:47:06Z
Keywords
diagnostic
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-08-07T05:40:56Z
This is related to issue 3960 (that is about unused variable warnings). This is a C program (it's valid D code too): int main() { int x = 0; A: if (x) goto B; x++; B: return x; } With DMD 2.054 it gives no errors or warnings, but GCC 4.6.0 shows a warning that I'd like in D too (it's less commonly useful than unused variable warnings): ...>gcc -Wall test.c -o test test.c: In function 'main': test.c:3:5: warning: label 'A' defined but not used [-Wunused-label]
Comment #1 by pro.mathias.lang — 2018-10-19T02:47:06Z
The consensus nowadays is that this kind of checks should belong to a linter. While those warnings can be useful to spot mistypes, they also bring a lot of false positive with them, which usually makes development harder. 3960 has a great amount of discussion and is WONTFIX, so I'm going to follow the same route here.