bug-gnulib
[Top][All Lists]
Advanced

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

iconv-h: enable 'posixcheck' warnings


From: Bruno Haible
Subject: iconv-h: enable 'posixcheck' warnings
Date: Sun, 05 Aug 2018 22:51:39 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-130-generic; KDE/5.18.0; x86_64; ; )

2018-08-05  Bruno Haible  <address@hidden>

        iconv-h: Enable 'posixcheck' warnings.
        * m4/iconv_h.m4 (gl_ICONV_H): Check for declarations of iconv and
        iconv_open.
        * lib/iconv.in.h (iconv_open, iconv): Use _GL_WARN_ON_USE.

diff --git a/lib/iconv.in.h b/lib/iconv.in.h
index 882e4cf..584d6de 100644
--- a/lib/iconv.in.h
+++ b/lib/iconv.in.h
@@ -52,6 +52,12 @@ _GL_CXXALIAS_SYS (iconv_open, iconv_t,
                   (const char *tocode, const char *fromcode));
 # endif
 _GL_CXXALIASWARN (iconv_open);
+#elif defined GNULIB_POSIXCHECK
+# undef iconv_open
+# if HAVE_RAW_DECL_ICONV_OPEN
+_GL_WARN_ON_USE (iconv_open, "iconv_open is not working correctly everywhere - 
"
+                 "use gnulib module iconv for portability");
+# endif
 #endif
 
 #if @REPLACE_ICONV_UTF@
@@ -90,6 +96,12 @@ _GL_CXXALIASWARN (iconv);
 # ifndef ICONV_CONST
 #  define ICONV_CONST @ICONV_CONST@
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef iconv
+# if HAVE_RAW_DECL_ICONV
+_GL_WARN_ON_USE (iconv, "iconv is not working correctly everywhere - "
+                 "use gnulib module iconv for portability");
+# endif
 #endif
 
 #if @GNULIB_ICONV@
diff --git a/m4/iconv_h.m4 b/m4/iconv_h.m4
index 824f90c..f910faf 100644
--- a/m4/iconv_h.m4
+++ b/m4/iconv_h.m4
@@ -1,4 +1,4 @@
-# iconv_h.m4 serial 8
+# iconv_h.m4 serial 9
 dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,6 +11,12 @@ AC_DEFUN([gl_ICONV_H],
   dnl Execute this unconditionally, because ICONV_H may be set by other
   dnl modules, after this code is executed.
   gl_CHECK_NEXT_HEADERS([iconv.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <iconv.h>
+    ]], [iconv iconv_open])
 ])
 
 dnl Unconditionally enables the replacement of <iconv.h>.




reply via email to

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