Commit ae8cb346 by Richard Stallman

(check_for_full_enumeration_handling): Don't create a

default label if all enumeration literals are covered by cases.

From-SVN: r4640
parent a2469305
...@@ -3654,6 +3654,11 @@ check_for_full_enumeration_handling (type) ...@@ -3654,6 +3654,11 @@ check_for_full_enumeration_handling (type)
} }
} }
#if 0
/* ??? This optimization is disabled because it causes valid programs to
fail. ANSI C does not guarantee that an expression with enum type
will have a value that is the same as one of the enumation literals. */
/* If all values were found as case labels, make one of them the default /* If all values were found as case labels, make one of them the default
label. Thus, this switch will never fall through. We arbitrarily pick label. Thus, this switch will never fall through. We arbitrarily pick
the last one to make the default since this is likely the most the last one to make the default since this is likely the most
...@@ -3669,6 +3674,7 @@ check_for_full_enumeration_handling (type) ...@@ -3669,6 +3674,7 @@ check_for_full_enumeration_handling (type)
case_stack->data.case_stmt.default_label = (*l)->code_label; case_stack->data.case_stmt.default_label = (*l)->code_label;
*l = 0; *l = 0;
} }
#endif /* 0 */
} }
/* Terminate a case (Pascal) or switch (C) statement /* Terminate a case (Pascal) or switch (C) statement
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment