[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Grep-devel] [PATCH] grep: use 'j' printf length modifier for [u]int
From: |
Jim Meyering |
Subject: |
Re: [Grep-devel] [PATCH] grep: use 'j' printf length modifier for [u]intmax_t |
Date: |
Mon, 17 Oct 2016 10:38:54 -0700 |
On Sun, Oct 16, 2016 at 11:43 PM, Paul Eggert <address@hidden> wrote:
> Jim Meyering wrote:
>>
>> I found that gettext has been using %j in one of its
>> tools for over two years
>
>
> While encouraging, gettext's users are developers who tend to use more
> up-to-date libraries, whereas grep is an end-user tool that is more likely
> to run atop ancient libraries. And if the libraries don't work, failures
> will be at run-time and plausibily will occur only with large inputs that
> our test cases won't match.
Good point.
> Before installing this patch, how about if we run gl_PRINTF_SIZES_C99 at
> configure-time, and have 'configure' fail on platforms where
> $gl_cv_func_printf_sizes_c99 is not 'yes'? That would nip these sorts of
> problems in the bud.
grep already uses printf.m4, so perhaps all that's needed is a few
lines near the end of configure.ac, e.g., like this:
gl_PRINTF_SIZES_C99
if test "$gl_cv_func_printf_sizes_c99" = yes; then
AC_DEFINE([HAVE_PRINTF_C99_SIZES], [1],
[Define to 1 if printf formats %j, %z, %t and %L work.])
fi
Zev, do you want to add that to your patch, #ifdef your new one-liner,
with the rest in an #else block and test that?
Then, we can think about removing the #else block at our leisure.