This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Move tst-signal-numbers to Python
- From: Florian Weimer <fweimer at redhat dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Mon, 10 Dec 2018 15:59:55 +0100
- Subject: Re: Move tst-signal-numbers to Python
- References: <alpine.DEB.2.21.1811302339060.4397@digraph.polyomino.org.uk> <alpine.DEB.2.21.1812040107540.3340@digraph.polyomino.org.uk>
* Joseph Myers:
> + # Filter out constants that aren't signal numbers.
> + 'SIG[A-Z]+',
> + # Discard obsolete signal numbers and unrelated constants:
> + # SIGCLD, SIGIOT, SIGSWI, SIGUNUSED.
> + # SIGSTKSZ, SIGRTMIN, SIGRTMAX.
> + 'SIG(CLD|IOT|RT(MIN|MAX)|STKSZ|SWI|UNUSED)'))
I would expect something not based on regular expression for those
filters, and it's odd there are two of them. I don't think using two
filters does not include expressiveness here.
re_signal_macro = re.compile(r'^SIG[A-Z].*')
ignored_macros = set("SIGCLD SIGIOT SIGSWI SIGUNUSED"
" SIGSTKSZ SIGRTMIN SIGRTMAX".split())
def signal_macro(name):
return re_signal_macro.match(name) and name not in ignored_macros
And then:
glibcextract.compare_macro_consts(
'#define _GNU_SOURCE 1\n'
'#include <signal.h>\n',
'#define _GNU_SOURCE 1\n'
'#include <stddef.h>\n'
'#include <asm/signal.h>\n',
args.cc, filter_name=signal_macro)
Thanks,
Florian