Add broken FS switch behaviour for compatibility.

In the absence of a 'default' label within a switch, FS falls through to the first CASE label (or to the code before the first CASE if there's any).

This commit adds an option, active by default for FS compatibility, that mimics this broken behaviour, as well as a warning in case the 'default' label is absent, which also triggers another warning when the option is active.
This commit is contained in:
Sei Lisa 2016-05-06 20:15:46 +02:00
parent bb198b3745
commit b1b84a123e
2 changed files with 18 additions and 5 deletions

View file

@ -228,6 +228,11 @@ Optimizer options (+ means active by default, - means inactive by default):
will go to the last label with that name). This flag
works around that limitation by replacing the names of
the labels in the output with unique ones.
brokennodefault + Mimic Firestorm's legacy broken behaviour when the
'default' label in a switch statement is absent. Rather
than jumping to the end of the switch in that case
(which is how it behaves when this option is not set),
it falls through and executes the first 'case' label.
Deprecated / compatibility syntax extensions options:
@ -300,7 +305,7 @@ def main():
# Default options
options = set(('extendedglobalexpr','extendedtypecast','extendedassignment',
'allowkeyconcat','allowmultistrings','skippreproc','optimize',
'optsigns','optfloats','constfold','dcr'
'optsigns','optfloats','constfold','dcr', 'brokennodefault',
))
try: