[pypy-svn] r9567 - pypy/dist/pypy/translator

tismer at codespeak.net tismer at codespeak.net
Tue Mar 1 21:23:42 CET 2005


Author: tismer
Date: Tue Mar  1 21:23:42 2005
New Revision: 9567

Modified:
   pypy/dist/pypy/translator/genc.py
Log:
hmm, my naming games produce new problems by clashing with reserved names. oh-oh

Modified: pypy/dist/pypy/translator/genc.py
==============================================================================
--- pypy/dist/pypy/translator/genc.py	(original)
+++ pypy/dist/pypy/translator/genc.py	Tue Mar  1 21:23:42 2005
@@ -61,6 +61,12 @@
             'Py_False = False',
             'Py_True  = True',
             ]
+        # just a few predefined names which cannot be reused.
+        # I think this should come from some external file,
+        # if we want to be complete
+        self.reserved_names = {}
+        for each in 'typedef static void'.split():
+            self.reserved_names[each] = 1
         self.latercode = []    # list of generators generating extra lines
                                #   for later in initxxx() -- for recursive
                                #   objects
@@ -703,7 +709,7 @@
                     else:
                         fmt = "%s_%d"
                     # don't use zero
-                    if len(thesenames) == 0:
+                    if len(thesenames) == 0 and v.name not in self.reserved_names:
                         fmt = fmt[:-3]
                         thesenames[v.name] = ret = fmt % name
                     else:



More information about the Pypy-commit mailing list