Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GH-10751 #10785

Merged
merged 2 commits into from
Mar 7, 2023
Merged

Fix GH-10751 #10785

merged 2 commits into from
Mar 7, 2023

Commits on Mar 7, 2023

  1. */*.m4: update main() signatures.

    The next generation of C compilers is going to enforce the C standard
    more strictly:
    
      https://wiki.gentoo.org/wiki/Modern_C_porting
    
    One warning that will soon become an error is -Wstrict-prototypes.
    This is relatively easy to catch in most code (it will fail to
    compile), but inside of autoconf tests it can go unnoticed because
    many feature-test compilations fail by design. For example,
    
      $ export CFLAGS="$CFLAGS -Werror=strict-prototypes"
      $ ./configure
      ...
      checking if iconv supports errno... no
      configure: error: iconv does not support errno
    
    (this is on a system where iconv *does* support errno). If errno
    support were optional, that test would have "silently" disabled
    it. The underlying issue here, from config.log, is
    
      conftest.c:211:5: error: function declaration isn't a prototype
      [-Werror=strict-prototypes]
        211 | int main() {
    
    This commit goes through all of our autoconf tests, replacing main()
    with main(void). Up to equivalent types and variable renamings, that's
    one of the two valid signatures, and satisfies the compiler (gcc-12 in
    this case).
    
    Fixes GH-10751
    orlitzky committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    5e57c9b View commit details
    Browse the repository at this point in the history
  2. ext/iconv/config.m4: add missing stdio.h include.

    The next generation of C compilers is going to enforce the C standard
    more strictly:
    
      https://wiki.gentoo.org/wiki/Modern_C_porting
    
    One warning that will eventually become an error is
    -Wimplicit-function-declaration. This is relatively easy to catch in
    most code (it will fail to compile), but inside of autoconf tests it
    can go unnoticed because many feature-test compilations fail by
    design. For example,
    
      AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iconv.h>]],
                     [[iconv_ccs_init(NULL, NULL);]])]...
    
    is designed to fail if iconv_ccs_init() is not in iconv.h. On the
    other hand,
    
      AC_RUN_IFELSE([AC_LANG_SOURCE([[
      #include <iconv.h>
      int main() {
        printf("%d", _libiconv_version);
        return 0;
      }
    
    should pass if _libiconv_version is defined. If the user has
    -Werror=implicit-function-declaration in his CFLAGS, however,
    it will not:
    
      $ export CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
      $ ./configure
      ...
      checking if using GNU libiconv... no
    
    This is because the stdio.h header that defines printf() is missing:
    
      conftest.c:240:3: error: implicit declaration of function 'printf'
      [-Werror=implicit-function-declaration]
        240 |   printf("%d", _libiconv_version);
            |   ^~~~~~
      conftest.c:239:1: note: include '<stdio.h>' or provide a declaration
      of 'printf'
    
    This commit adds the include, correcting the test with any compiler
    that balks at implicit function definitions.
    
    Closes GH-10751
    orlitzky committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    560d030 View commit details
    Browse the repository at this point in the history