summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-05-19 13:59:18 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-05-19 13:59:18 (GMT)
commit656fe69383df865fb3e7437af56ed7c342b3ffb5 (patch)
tree4c62e40436a281a6722b18bf1456fdca94878abd /Tools
parent25e0c7948790e8476a6cfe42ac1b46ea36aeda6e (diff)
downloadcpython-656fe69383df865fb3e7437af56ed7c342b3ffb5.zip
cpython-656fe69383df865fb3e7437af56ed7c342b3ffb5.tar.gz
cpython-656fe69383df865fb3e7437af56ed7c342b3ffb5.tar.bz2
Generate prototype-style function headers in stead of K&R style. Makes life easier with gcc -Wstrict-function-prototypes.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/bgen/bgen/bgenGenerator.py8
-rw-r--r--Tools/bgen/bgen/bgenModule.py2
-rw-r--r--Tools/bgen/bgen/bgenObjectDefinition.py35
3 files changed, 12 insertions, 33 deletions
diff --git a/Tools/bgen/bgen/bgenGenerator.py b/Tools/bgen/bgen/bgenGenerator.py
index bf81096..94905be 100644
--- a/Tools/bgen/bgen/bgenGenerator.py
+++ b/Tools/bgen/bgen/bgenGenerator.py
@@ -37,12 +37,8 @@ class BaseFunctionGenerator:
def functionheader(self):
Output()
- Output("static PyObject *%s_%s(_self, _args)",
- self.prefix, self.name)
- IndentLevel()
- Output("%s *_self;", self.objecttype)
- Output("PyObject *_args;")
- DedentLevel()
+ Output("static PyObject *%s_%s(%s *_self, PyObject *_args)",
+ self.prefix, self.name, self.objecttype)
OutLbrace()
Output("PyObject *_res = NULL;")
diff --git a/Tools/bgen/bgen/bgenModule.py b/Tools/bgen/bgen/bgenModule.py
index b1d5d14..b4a3db0 100644
--- a/Tools/bgen/bgen/bgenModule.py
+++ b/Tools/bgen/bgen/bgenModule.py
@@ -38,7 +38,7 @@ class Module(GeneratorGroup):
Output("%s", self.finalstuff)
Output()
- Output("void init%s()", self.name)
+ Output("void init%s(void)", self.name)
OutLbrace()
Output("PyObject *m;")
Output("PyObject *d;")
diff --git a/Tools/bgen/bgen/bgenObjectDefinition.py b/Tools/bgen/bgen/bgenObjectDefinition.py
index f3d120c..b6f33fe 100644
--- a/Tools/bgen/bgen/bgenObjectDefinition.py
+++ b/Tools/bgen/bgen/bgenObjectDefinition.py
@@ -80,10 +80,8 @@ class ObjectDefinition(GeneratorGroup):
def outputNew(self):
Output()
- Output("%sPyObject *%s_New(itself)", self.static, self.prefix)
- IndentLevel()
- Output("%s %sitself;", self.itselftype, self.argref)
- DedentLevel()
+ Output("%sPyObject *%s_New(%s %sitself)", self.static, self.prefix,
+ self.itselftype, self.argref)
OutLbrace()
Output("%s *it;", self.objecttype)
self.outputCheckNewArg()
@@ -100,11 +98,8 @@ class ObjectDefinition(GeneratorGroup):
"Override this method to apply additional checks/conversions"
def outputConvert(self):
- Output("%s%s_Convert(v, p_itself)", self.static, self.prefix)
- IndentLevel()
- Output("PyObject *v;")
- Output("%s *p_itself;", self.itselftype)
- DedentLevel()
+ Output("%s%s_Convert(PyObject *v, %s *p_itself)", self.static, self.prefix,
+ self.itselftype)
OutLbrace()
self.outputCheckConvertArg()
Output("if (!%s_Check(v))", self.prefix)
@@ -121,10 +116,7 @@ class ObjectDefinition(GeneratorGroup):
def outputDealloc(self):
Output()
- Output("static void %s_dealloc(self)", self.prefix)
- IndentLevel()
- Output("%s *self;", self.objecttype)
- DedentLevel()
+ Output("static void %s_dealloc(%s *self)", self.prefix, self.objecttype)
OutLbrace()
self.outputCleanupStructMembers()
Output("PyMem_DEL(self);")
@@ -138,11 +130,7 @@ class ObjectDefinition(GeneratorGroup):
def outputGetattr(self):
Output()
- Output("static PyObject *%s_getattr(self, name)", self.prefix)
- IndentLevel()
- Output("%s *self;", self.objecttype)
- Output("char *name;")
- DedentLevel()
+ Output("static PyObject *%s_getattr(%s *self, char *name)", self.prefix, self.objecttype)
OutLbrace()
self.outputGetattrBody()
OutRbrace()
@@ -226,10 +214,8 @@ class ObjectIdentityMixin:
def outputCompare(self):
Output()
- Output("static int %s_compare(self, other)", self.prefix)
- IndentLevel()
- Output("%s *self, *other;", self.objecttype)
- DedentLevel()
+ Output("static int %s_compare(%s *self, %s *other)", self.prefix, self.objecttype,
+ self.objecttype)
OutLbrace()
Output("unsigned long v, w;")
Output()
@@ -250,10 +236,7 @@ class ObjectIdentityMixin:
def outputHash(self):
Output()
- Output("static long %s_hash(self)", self.prefix)
- IndentLevel()
- Output("%s *self;", self.objecttype)
- DedentLevel()
+ Output("static long %s_hash(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("return (long)self->ob_itself;")
OutRbrace()