* [PATCH COMMITTED] scripts/glibcelf.py: Properly report <elf.h> parsing failures
@ 2022-11-03 11:29 Florian Weimer
0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2022-11-03 11:29 UTC (permalink / raw)
To: libc-alpha
Without this change, parse failures result in an exception:
Traceback (most recent call last):
File "tst-glibcelf.py", line 23, in <module>
import glibcelf
File "/path/to/git/scripts/glibcelf.py", line 226, in <module>
_elf_h = _parse_elf_h()
File "/path/to/git/scripts/glibcelf.py", line 221, in _parse_elf_h
result = glibcpp.macro_eval(glibcpp.macro_definitions(tokens), reporter)
File "/path/to/git/scripts/glibcpp.py", line 379, in macro_eval
reporter.error(md.line, 'macro {} redefined'.format(md.name))
File "/path/to/git/scripts/glibcelf.py", line 214, in error
errors += 1
UnboundLocalError: local variable 'errors' referenced before assignment
---
scripts/glibcelf.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/glibcelf.py b/scripts/glibcelf.py
index 420cb21943..59aab56ecf 100644
--- a/scripts/glibcelf.py
+++ b/scripts/glibcelf.py
@@ -211,7 +211,7 @@ def _parse_elf_h():
self.errors = 0
def error(self, line, message):
- errors += 1
+ self.errors += 1
print('{}:{}: error: {}'.format(path, line, message))
def note(self, line, message):
base-commit: ee1ada1bdb8074de6e1bdc956ab19aef7b6a7872
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-03 11:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 11:29 [PATCH COMMITTED] scripts/glibcelf.py: Properly report <elf.h> parsing failures Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).