www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6449] New: Unused label warning

http://d.puremagic.com/issues/show_bug.cgi?id=6449

           Summary: Unused label warning
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2011-08-07 05:40:56 PDT ---
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]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 07 2011