summaryrefslogtreecommitdiff
path: root/libc/kernel/tools/cpp.py
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-05-25 13:48:01 -0700
committerElliott Hughes <enh@google.com>2017-05-25 13:48:01 -0700
commit96c1db7b9d601c31d103389cac074a6cce0d7633 (patch)
tree510f40be13090fa582b61aed7c3eb7e70d3ff559 /libc/kernel/tools/cpp.py
parent6c01208e902b18aad4b0254ccb95b94a2b5fc341 (diff)
Remove the repetitive warnings from the uapi headers.
Having WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS every four lines made the headers harder to read, made the diffs much worse each time we upgraded, and wasn't really providing any benefit. Before the next uapi update, let's just stop doing this. Bug: N/A Test: builds, manually inspected files look right Change-Id: Id7088cf750894c9d24950f3d53587fe3156c4f7d
Diffstat (limited to 'libc/kernel/tools/cpp.py')
-rw-r--r--libc/kernel/tools/cpp.py26
1 files changed, 6 insertions, 20 deletions
diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py
index 10ce29022..bca491bad 100644
--- a/libc/kernel/tools/cpp.py
+++ b/libc/kernel/tools/cpp.py
@@ -1098,33 +1098,24 @@ class Block(object):
return result, indent
- def writeWithWarning(self, out, warning, left_count, repeat_count, indent):
- """Dump the current block with warnings."""
+ def write(self, out, indent):
+ """Dump the current block."""
# removeWhiteSpace() will sometimes creates non-directive blocks
# without any tokens. These come from blocks that only contained
# empty lines and spaces. They should not be printed in the final
# output, and then should not be counted for this operation.
#
if self.directive is None and not self.tokens:
- return left_count, indent
+ return indent
if self.directive:
out.write(str(self) + '\n')
- left_count -= 1
- if left_count == 0:
- out.write(warning)
- left_count = repeat_count
-
else:
lines, indent = self.format_blocks(self.tokens, indent)
for line in lines:
out.write(line + '\n')
- left_count -= 1
- if left_count == 0:
- out.write(warning)
- left_count = repeat_count
- return left_count, indent
+ return indent
def __repr__(self):
"""Generate the representation of a given block."""
@@ -1243,14 +1234,9 @@ class BlockList(object):
return result
def write(self, out):
- out.write(str(self))
-
- def writeWithWarning(self, out, warning, repeat_count):
- left_count = repeat_count
indent = 0
for b in self.blocks:
- left_count, indent = b.writeWithWarning(out, warning, left_count,
- repeat_count, indent)
+ indent = b.write(out, indent)
def removeVarsAndFuncs(self, knownStatics=None):
"""Remove variable and function declarations.
@@ -1795,7 +1781,7 @@ def test_optimizeAll():
#endif
#ifndef __SIGRTMAX
#define __SIGRTMAX 123
-#endif\
+#endif
"""
out = utils.StringOutput()