From 58f3285de1e15aa5ba37bed7db86e32115a85fa5 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Fri, 17 Aug 2007 01:47:56 -0700 Subject: [PATCH] Raise error when declaring reserved names. --- Cython/Compiler/Symtab.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 22122abf..9c437f19 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -198,6 +198,9 @@ class Scope: # Create new entry, and add to dictionary if # name is not None. Reports a warning if already # declared. + if not self.in_cinclude and re.match("^_[_A-Z]+$", cname): + # See http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html#Reserved-Names + error(pos, "'%s' is a reserved name in C." % cname) dict = self.entries if name and dict.has_key(name): warning(pos, "'%s' redeclared " % name, 0) -- 2.26.2