Commit 58f3285d authored by Robert Bradshaw's avatar Robert Bradshaw

Raise error when declaring reserved names.

parent 213f5c77
...@@ -198,6 +198,9 @@ class Scope: ...@@ -198,6 +198,9 @@ class Scope:
# Create new entry, and add to dictionary if # Create new entry, and add to dictionary if
# name is not None. Reports a warning if already # name is not None. Reports a warning if already
# declared. # 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 dict = self.entries
if name and dict.has_key(name): if name and dict.has_key(name):
warning(pos, "'%s' redeclared " % name, 0) warning(pos, "'%s' redeclared " % name, 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment