New submission from Mike Frysinger:

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 :)

----------
components: Cross-Build
messages: 252968
nosy: vapier
priority: normal
severity: normal
status: open
title: improve ac_cv_have_long_long_format GCC fallback
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25397>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to