From: Robert Bradshaw Date: Fri, 17 Aug 2007 08:47:56 +0000 (-0700) Subject: Raise error when declaring reserved names. X-Git-Tag: 0.9.6.14~29^2~129^2~17^2~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=58f3285de1e15aa5ba37bed7db86e32115a85fa5;p=cython.git Raise error when declaring reserved names. --- 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)