On Sat, Aug 27, 2011 at 2:27 PM, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> > Date: Sat, 27 Aug 2011 11:41:35 -0700 > Subject: [PATCH 2/3] Make 'linearize_switch()' helper function > > Rather than do it in that huge 'linearize_statement()' function, split > out the switch generation case. Avoids one level of indentation, and > makes for simpler and more straightforward functions. I apply the series already. BTW, I want to mention this, the current implementation of linearize switch statement is wrong. This is not about this patch. It is there at the very first linearization of switch statement. The current implementation works fine if the case statement does not overlap. If the case statement overlap like "Duff's device", the linearization will generate repeated code. The better way to do it should be linearize from "stmt->switch_statement" instead of "switch_case->symbol_list". In other words, "stmt->switch_statement" contain the full body of the switch statement. "switch_case->symbol_list" is just a list of case statement in the switch statement, like a list of labels. Some of those case statement can be embedded in other case statement. Linearization will emit the inner case statement twice. The code it emit will function currently, but it is not optimal because it has duplicate blocks. Chris -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html