This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Move tst-signal-numbers to Python


* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]