classification
Title: improve ac_cv_have_long_long_format GCC fallback
Type: enhancement Stage: resolved
Components: Cross-Build Versions: Python 3.6, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka, vapier
Priority: normal Keywords:

Created on 2015-10-13 22:50 by vapier, last changed 2020-02-26 19:19 by serhiy.storchaka. This issue is now closed.

Messages (2)
msg252968 - (view) Author: Mike Frysinger (vapier) Date: 2015-10-13 22:50
the ac_cv_have_long_long_format test has a nice compile-time fallback for gcc based compilers:
    CFLAGS="$CFLAGS -Werror -Wformat"
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
        #include <stdio.h>
        #include <stddef.h>
      ]], [[
      char *buffer;
      sprintf(buffer, "%lld", (long long)123);
      sprintf(buffer, "%lld", (long long)-123);
      sprintf(buffer, "%llu", (unsigned long long)123);
      ]])],
      ac_cv_have_long_long_format=yes
    )

unfortunately, this turns on the global -Werror flag in order to check things.  that means if the code triggers unrelated warnings, the test still fails ;(.  this comes up w/bionic which complains about unsafe use of the sprintf function, and can come up in general in this code because buffer is not initialized :).

the good news is that gcc-4.2 has supported a directed -Werror=format option.
https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Warning-Options.html

so instead of using -Werror -Wformat, you could use -Werror=format.  the downside is that the fallback no longer works with <=gcc-4.1, but maybe that's ok considering gcc-4.2 was released May 2007 (almost 9 years ago) ?

note: this also applies to various other tests in the configure file.

NB: landing a fix in py3.5+ (and ignoring 3.[0-4]) is fine, but please also to fix py2.7 :)
msg362718 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-02-26 19:19
It is too later for 2.7. The long long type is required for recent Python 3 versions, so this macro is no longer used.
History
Date User Action Args
2020-02-26 19:19:15serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg362718

resolution: out of date
stage: resolved
2015-10-13 22:50:58vapiercreate