[PATCH v4] Use a proper C tokenizer to implement the obsolete typedefs test.
Zack Weinberg
zackw@panix.com
Tue Mar 12 01:00:00 GMT 2019
On Mon, Mar 11, 2019 at 2:57 PM Carlos O'Donell <carlos@redhat.com> wrote:
> > * scripts/check-obsolete-constructs.py: New test script.
> > * scripts/check-installed-headers.sh: Remove tests for
> > obsolete typedefs, superseded by check-obsolete-constructs.py.
> > * Rules: Run scripts/check-obsolete-constructs.py over $(headers)
> > as a special test. Update commentary.
> > * posix/bits/types.h (__SQUAD_TYPE, __S64_TYPE): Define as __int64_t.
> > (__UQUAD_TYPE, __U64_TYPE): Define as __uint64_t.
> > Update commentary.
> > * posix/sys/types.h (__u_intN_t): Remove.
> > (u_int8_t): Typedef using __uint8_t.
> > (u_int16_t): Typedef using __uint16_t.
> > (u_int32_t): Typedef using __uint32_t.
> > (u_int64_t): Typedef using __uint64_t.
>
> OK for master if you:
> - Fix the conditional in check-installed-headers.sh.
>
> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Is it now the convention that we put Reviewed-by: lines into the final
commit message, or just that we say that on the mailing list?
> > if $cc_cmd -fsyntax-only $lang_mode "$cih_test_c" 2>&1
> > - then
> > - includes=$($cc_cmd -fsyntax-only -H $lang_mode \
> > - "$cih_test_c" 2>&1 | sed -ne 's/^[.][.]* //p')
> > - for h in $includes; do
> > - # Don't repeat work.
> > - eval 'case "$h" in ('"$already"') continue;; esac'
> > -
> > - if grep -qE "$obsolete_type_re" "$h"; then
> > - echo "*** Obsolete types detected:"
> > - grep -HE "$obsolete_type_re" "$h"
> > - failed=1
> > - fi
> > - already="$already|$h"
> > - done
> > - else
> > - failed=1
> > + then :
> > + else failed=1
>
> Why not 'if ! $cc_cmd ...' ? Which avoids the odd empty if block e.g. ":".
`if ! ...` is not portable shell, despite being included in the POSIX
shell language. See
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Limitations-of-Builtins.html
(under `!`) `if command_1; then :; else command_2; fi` is the
alternative idiom I learned back in the days of SunOS 4.
Possibly `if ! ...` is portable enough for this script, but I try not
to think about whether semi-portable shell constructs are portable
enough for the current script.
Do you still want me to change it?
zw
More information about the Libc-alpha
mailing list