On Wed, Jan 9, 2019 at 3:26 PM Branko Čibej <br...@apache.org> wrote:

> > On Wed, Jan 9, 2019 at 9:38 AM Stefan Sperling <s...@apache.org> wrote:
> >
> >> APR's configure script logic results in inconsistent type and format
> >> string definitions on OpenBSD. apr_off_t is defined as 'long long'
> >> but APR_OFF_T_FMT is defined as "ld".
> >>
> >> /home/stsp/svn/src/httpd-2.4.37/server/util_expr_eval.c:1144:56: error:
> >> format specifies type 'long' but the argument has type 'apr_off_t'
> >>       (aka 'long long') [-Werror,-Wformat]
> >>
> >>         return apr_psprintf(ctx->p, "%" APR_OFF_T_FMT, sb.size);
> >>
> >> This happens because off_t is defined as 'long long', and because
> >> sizeof(long) and sizeof(long long) are both 8, on OpenBSD/amd64.
> >>
> >> This looks like a generic problem, but I am not sure the existing logic
> >> could
> >> be make to work in general. Switching the order of checks makes the
> >> configure
> >> script produce valid results on OpenBSD but I am not sure if that would
> be
> >> a
> >> correct thing to do on other platforms.
>
> How come this works on x86_64 Linux, which is also LP64?
>

As a cautionary measure the compiler in here disambiguates
printf formatting int from long from long long, even if they are
identities. This helps detect invalid code as the code is moved
from the current x86_64 model to one supporting longer long long
or shorter long types. The compiler is right, it's beneficial.

Reply via email to