bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

make autoconf tests work with -Werror=implicit-function-declaration


From: Bruno Haible
Subject: make autoconf tests work with -Werror=implicit-function-declaration
Date: Sat, 14 Sep 2019 19:50:12 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-159-generic; KDE/5.18.0; x86_64; ; )

There are indications that future GCC versions may be stricter regarding
invocations of undeclared functions. [1] Configuring with
  CC="gcc -Werror=implicit-function-declaration"
is a way to exercise similar functionality with released GCCs.

So, what I did is
  1. create a testdir of all of gnulib,
  2. configure it once with CC="gcc" and once with
     CC="gcc -Werror=implicit-function-declaration", both with option '-C',
  3. compare the resulting config.cache files.

I got differences in the cache variables
  gl_cv_func_ptsname_sets_errno
  gt_cv_locale_tr_utf8

This patch fixes the issues.

[1] https://lists.gnu.org/archive/html/bug-gettext/2019-09/msg00012.html


2019-09-14  Bruno Haible  <address@hidden>

        Make autoconf tests work with -Werror=implicit-function-declaration.
        * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Include <wctype.h>, for
        towupper() declaration.
        * m4/ptsname.m4 (gl_FUNC_PTSNAME): Include <stdlib.h>, for ptsname()
        declaration.

diff --git a/m4/locale-tr.m4 b/m4/locale-tr.m4
index aeb2419..4c413f0 100644
--- a/m4/locale-tr.m4
+++ b/m4/locale-tr.m4
@@ -1,4 +1,4 @@
-# locale-tr.m4 serial 11
+# locale-tr.m4 serial 12
 dnl Copyright (C) 2003, 2005-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,6 +21,7 @@ changequote(,)dnl
 #endif
 #include <stdlib.h>
 #include <string.h>
+#include <wctype.h>
 struct tm t;
 char buf[16];
 int main () {
diff --git a/m4/ptsname.m4 b/m4/ptsname.m4
index 5033d90..04bfd3b 100644
--- a/m4/ptsname.m4
+++ b/m4/ptsname.m4
@@ -1,4 +1,4 @@
-# ptsname.m4 serial 7
+# ptsname.m4 serial 8
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,10 +19,12 @@ AC_DEFUN([gl_FUNC_PTSNAME],
     AC_CACHE_CHECK([whether ptsname sets errno on failure],
       [gl_cv_func_ptsname_sets_errno],
       [AC_RUN_IFELSE(
-         [AC_LANG_PROGRAM([[#include <errno.h>
-      ]], [[
-      return ptsname (-1) || !errno;
-           ]])],
+         [AC_LANG_PROGRAM([[
+              #include <stdlib.h>
+              #include <errno.h>
+            ]], [[
+              return ptsname (-1) || !errno;
+            ]])],
          [gl_cv_func_ptsname_sets_errno=yes],
          [gl_cv_func_ptsname_sets_errno=no],
          [case "$host_os" in




reply via email to

[Prev in Thread] Current Thread [Next in Thread]