Failures to parse SYSCALLS.TXT-like files should be errors.
Previously we'd output a diagnostic but just blindly carry on.
Test: ran locally without my previous fix
Change-Id: I99a2411eae5bd72d97b6a4335c699d1e44d7b55a
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index d3e6ef4..a525a98 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -333,10 +333,12 @@
class SysCallsTxtParser:
def __init__(self):
self.syscalls = []
- self.lineno = 0
+ self.lineno = 0
+ self.errors = False
def E(self, msg):
print("%d: %s" % (self.lineno, msg))
+ self.errors = True
def parse_line(self, line):
""" parse a syscall spec line.
@@ -443,6 +445,8 @@
if not line: continue
if line[0] == '#': continue
self.parse_line(line)
+ if self.errors:
+ sys.exit(1)
def parse_file(self, file_path):
with open(file_path) as fp: