public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] scripts/glibcelf.py: Properly report <elf.h> parsing failures Date: Thu, 3 Nov 2022 11:28:39 +0000 (GMT) [thread overview] Message-ID: <20221103112839.1179A3858D37@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d33705c0b020632274318323931695a99753b5be commit d33705c0b020632274318323931695a99753b5be Author: Florian Weimer <fweimer@redhat.com> Date: Thu Nov 3 12:24:17 2022 +0100 scripts/glibcelf.py: Properly report <elf.h> parsing failures 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 Diff: --- 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):
reply other threads:[~2022-11-03 11:28 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221103112839.1179A3858D37@sourceware.org \ --to=fw@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).