From 5de16aad4cd25eb5d3a02545703337c2199ed41f Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 12 May 2013 15:11:39 +0200 Subject: [PATCH] make SwitchTransform always generate a 'default' clause to silence C compiler warnings about unmatched enum values --- Cython/Compiler/Nodes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 46eeeb4..7df70b0 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -5347,6 +5347,11 @@ class SwitchStatNode(StatNode): code.putln("default:") self.else_clause.generate_execution_code(code) code.putln("break;") + else: + # Always generate a default clause to prevent C compiler warnings + # about unmatched enum values (it was not the user who decided to + # generate the switch statement, so shouldn't be bothered). + code.putln("default: break;") code.putln("}") def generate_function_definitions(self, env, code): -- 2.7.4