bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: Re: vasnwprintf: Port to older platforms without swprintf
Date: Wed, 22 Mar 2023 21:34:09 +0100	[thread overview]
Message-ID: <5420485.iZASKD2KPV@nimes> (raw)
In-Reply-To: <5048354.tdWV9SEqCh@nimes>

Now, on Solaris 11.3 with gcc, I see a warning

../../gllib/vasnprintf.c:275:25: warning: implicit declaration of function ‘wcsnlen’ [-Wimplicit-function-declaration]

I don't know whether that's a Solaris 11 bug or a GCC installation/configuration
problem. Anyway, this simple patch fixes it.


2023-03-22  Bruno Haible  <bruno@clisp.org>

	vasnwprintf: Fix a warning: implicit declaration of function ‘wcsnlen’.
	* m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Test also whether wcsnlen is
	declared.
	* lib/vasnprintf.c (local_wcsnlen): Together with HAVE_WCSNLEN, test
	also HAVE_DECL_WCSNLEN.

diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 618fae7c77..732d13661f 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -271,7 +271,7 @@ local_wcslen (const wchar_t *s)
 #endif
 
 #if (!USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && HAVE_WCHAR_T && WIDE_CHAR_VERSION
-# if HAVE_WCSNLEN
+# if HAVE_WCSNLEN && HAVE_DECL_WCSNLEN
 #  define local_wcsnlen wcsnlen
 # else
 #  ifndef local_wcsnlen_defined
diff --git a/m4/vasnprintf.m4 b/m4/vasnprintf.m4
index 911e77c874..a42b5f83ac 100644
--- a/m4/vasnprintf.m4
+++ b/m4/vasnprintf.m4
@@ -1,4 +1,4 @@
-# vasnprintf.m4 serial 45
+# vasnprintf.m4 serial 46
 dnl Copyright (C) 2002-2004, 2006-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -96,6 +96,7 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNWPRINTF]
 [
   AC_CHECK_FUNCS_ONCE([swprintf wcsnlen mbrtowc])
   AC_CHECK_DECLS([_snwprintf], , , [[#include <stdio.h>]])
+  AC_CHECK_DECLS([wcsnlen], , , [[#include <wchar.h>]])
   gl_SWPRINTF_WORKS
   case "$gl_cv_func_swprintf_works" in
     *yes)





      parent reply	other threads:[~2023-03-22 20:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 18:29 vasnwprintf: Port to older platforms without swprintf Bruno Haible
2023-03-21 16:52 ` Bruno Haible
2023-03-22 13:45   ` Bruno Haible
2023-03-22 18:42   ` Bruno Haible
2023-03-22 20:28     ` Bruno Haible
2023-03-22 20:34     ` Bruno Haible [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5420485.iZASKD2KPV@nimes \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).