Move tst-signal-numbers to Python
Florian Weimer
fweimer@redhat.com
Mon Dec 10 15:08:00 GMT 2018
* 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
More information about the Libc-alpha
mailing list