From 9e3a2d7ae9fce31bfbba19f39fc882e6ded78462 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Thu, 3 Oct 2013 21:43:48 -0700 Subject: [PATCH] Warn for non-trivial type declarators in shared declarations. --- Cython/Compiler/Nodes.py | 6 ++++++ Cython/Compiler/Options.py | 1 + 2 files changed, 7 insertions(+) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index fe7adb3..8b726f1 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1175,6 +1175,12 @@ class CVarDefNode(StatNode): visibility = self.visibility for declarator in self.declarators: + + if (len(self.declarators) > 1 + and not isinstance(declarator, CNameDeclaratorNode) + and env.directives['warn.multiple_declarators']): + warning(declarator.pos, "Non-trivial type declarators in shared declaration.", 1) + if isinstance(declarator, CFuncDeclaratorNode): name_declarator, type = declarator.analyse(base_type, env, directive_locals=self.directive_locals) else: diff --git a/Cython/Compiler/Options.py b/Cython/Compiler/Options.py index 472dfdc..05f123e 100644 --- a/Cython/Compiler/Options.py +++ b/Cython/Compiler/Options.py @@ -123,6 +123,7 @@ directive_defaults = { 'warn.unused': False, 'warn.unused_arg': False, 'warn.unused_result': False, + 'warn.multiple_declarators': True, # optimizations 'optimize.inline_defnode_calls': True, -- 2.7.4