Thread overview
[Issue 11749] New: switch case fallthrough error is enabled with -w, but cannot be made informational warning
Dec 15, 2013
Rainer Schuetze
Dec 15, 2013
Rainer Schuetze
Dec 15, 2013
yebblies
Dec 15, 2013
Rainer Schuetze
December 15, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11749

           Summary: switch case fallthrough error is enabled with -w, but
                    cannot be made informational warning
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: r.sagitario@gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario@gmx.de> 2013-12-15 06:10:13 PST ---
This code from issue 9642 (slightly modified to also trigger the message with
dmd 2.064):

void main() {
    int x;
    switch ('x') {
        case 'a':
            x++;
        case 'b':
            x++;
            break;
        default:
    }
}

compiles without additional options, but reports error (not warning) with -w
and -wi.

>dmd fail9642.d && echo Success
Success

>dmd -w fail9642.d && echo Success
fail9642.d(6): Error: switch case fallthrough - use 'goto case;' if intended

>dmd -wi fail9642.d && echo Success
fail9642.d(6): Error: switch case fallthrough - use 'goto case;' if intended

Even with -wi compilation fails.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 15, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11749


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Rainer Schuetze <r.sagitario@gmx.de> 2013-12-15 06:17:28 PST ---
https://github.com/D-Programming-Language/dmd/pull/2965

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 15, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11749


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #2 from bearophile_hugs@eml.cc 2013-12-15 06:18:53 PST ---
I don't understand this issue. Isn't switch case fallthrough is always an error in D?

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 15, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11749



--- Comment #3 from github-bugzilla@puremagic.com 2013-12-15 06:59:47 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f9111190ae1b38938a7b02676cc84a7b6e4ea1d2 Merge pull request #2965 from rainers/issue11749

fix  Issue 11749 - switch case fallthrough error is enabled with -w, but cannot be made informational warning

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 15, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11749


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |FIXED


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 15, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11749



--- Comment #4 from bearophile_hugs@eml.cc 2013-12-15 08:03:13 PST ---
This should be an error in every case, I think.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 15, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11749



--- Comment #5 from Rainer Schuetze <r.sagitario@gmx.de> 2013-12-15 09:15:55 PST ---
> This should be an error in every case, I think.

I guess you are right. But that would probably mean that it needs to go through
deprecation.
The patch only tries to remove "D with informational warnings" from the set of
languages with different semantics due to warnings.

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