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". > > This results in obvious build failures e.g. if httpd is built with -Werror. > This is just one example of many such errors: > > /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. > > The configure script section which sets APR_OFF_T_FMT first checks for: > "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long" > and sets APR_OFF_T_FMT to "ld", before it checks for: > "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long". > > 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. > > Since the existing logic apparently works on other platforms it's > probably best to leave as it is and add an override for OpenBSD. > However, any platform where off_t is 'long long' and long is a 64 bit > type is affected by this issue. Couldn't some AC_TRY_COMPILE()s with -Wall catch this? I'd prefer we continue to attempt these in %d %ld %lld %I64d order. Least complex and most portable first.