diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2001-09-05 10:27:53 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2001-09-05 10:27:53 (GMT) |
commit | 5a1516bce5c9aa6f957f1e93ba85d143d8eac03a (patch) | |
tree | d48afe8f566541f75befc3b77b737f41a34277d2 /Tools/bgen | |
parent | 703ad705c34deba4b559fd9e62c380dcbdc6861e (diff) | |
download | cpython-5a1516bce5c9aa6f957f1e93ba85d143d8eac03a.zip cpython-5a1516bce5c9aa6f957f1e93ba85d143d8eac03a.tar.gz cpython-5a1516bce5c9aa6f957f1e93ba85d143d8eac03a.tar.bz2 |
Only output the buffer size error label if it is used.
Shuts up another couple of gcc warnings.
Diffstat (limited to 'Tools/bgen')
-rw-r--r-- | Tools/bgen/bgen/bgenBuffer.py | 9 | ||||
-rw-r--r-- | Tools/bgen/bgen/bgenHeapBuffer.py | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/Tools/bgen/bgen/bgenBuffer.py b/Tools/bgen/bgen/bgenBuffer.py index 9d28b80..e948a14 100644 --- a/Tools/bgen/bgen/bgenBuffer.py +++ b/Tools/bgen/bgen/bgenBuffer.py @@ -36,6 +36,7 @@ class FixedInputOutputBufferType(InputOnlyType): self.datatype = datatype self.sizetype = sizetype self.sizeformat = sizeformat or type2format[sizetype] + self.label_needed = 0 def declare(self, name): self.declareBuffer(name) @@ -67,6 +68,7 @@ class FixedInputOutputBufferType(InputOnlyType): Output('PyErr_SetString(PyExc_TypeError, "buffer length should be %s");', self.size) Output("goto %s__error__;", name) + self.label_needed = 1 OutRbrace() self.transferSize(name) @@ -83,9 +85,10 @@ class FixedInputOutputBufferType(InputOnlyType): return "%s__out__, (int)%s" % (name, self.size) def cleanup(self, name): - DedentLevel() - Output(" %s__error__: ;", name) - IndentLevel() + if self.label_needed: + DedentLevel() + Output(" %s__error__: ;", name) + IndentLevel() class FixedCombinedInputOutputBufferType(FixedInputOutputBufferType): diff --git a/Tools/bgen/bgen/bgenHeapBuffer.py b/Tools/bgen/bgen/bgenHeapBuffer.py index c6160ba..1b16d55 100644 --- a/Tools/bgen/bgen/bgenHeapBuffer.py +++ b/Tools/bgen/bgen/bgenHeapBuffer.py @@ -24,6 +24,7 @@ class HeapInputOutputBufferType(FixedInputOutputBufferType): OutLbrace() Output('PyErr_NoMemory();') Output("goto %s__error__;", name) + self.label_needed = 1 OutRbrace() Output("%s__len__ = %s__in_len__;", name, name) |