projects
/
platform
/
upstream
/
python-cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7666aa4
)
make SwitchTransform always generate a 'default' clause to silence C compiler warning...
author
Stefan Behnel
<stefan_ml@behnel.de>
Sun, 12 May 2013 13:11:39 +0000
(15:11 +0200)
committer
Stefan Behnel
<stefan_ml@behnel.de>
Sun, 12 May 2013 13:11:39 +0000
(15:11 +0200)
Cython/Compiler/Nodes.py
patch
|
blob
|
history
diff --git
a/Cython/Compiler/Nodes.py
b/Cython/Compiler/Nodes.py
index
46eeeb4
..
7df70b0
100644
(file)
--- 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):