bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* vasnprintf.c Android bug?
       [not found] <87a627487f.fsf.ref@yahoo.com>
@ 2023-01-25  3:13 ` Po Lu
  2023-01-25 12:44   ` Bruno Haible
  2023-01-28 18:42   ` Bruno Haible
  0 siblings, 2 replies; 4+ messages in thread
From: Po Lu @ 2023-01-25  3:13 UTC (permalink / raw)
  To: bug-gnulib

With the build API version set to 21 on the NDK r26b, vasnprintf.c needs
to include:

#include <wchar.h>

or else it cannot find mbstate_t.  In addition, this warning is still
emitted by Clang:

 ANDROID_CC   vasnprintf.o
vasnprintf.c:2416:21: warning: variable 'flags' set but not used [-Wunused-but-set-variable]
                int flags = dp->flags;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: vasnprintf.c Android bug?
  2023-01-25  3:13 ` vasnprintf.c Android bug? Po Lu
@ 2023-01-25 12:44   ` Bruno Haible
  2023-01-25 13:13     ` Po Lu
  2023-01-28 18:42   ` Bruno Haible
  1 sibling, 1 reply; 4+ messages in thread
From: Bruno Haible @ 2023-01-25 12:44 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Po Lu

Hi,

Po Lu wrote:
> With the build API version set to 21 on the NDK r26b, vasnprintf.c needs
> to include:
> 
> #include <wchar.h>
> 
> or else it cannot find mbstate_t.

Thanks for the report. This patch should fix it.


2023-01-25  Bruno Haible  <bruno@clisp.org>

	vasnprintf: Fix compilation error on Android NDK r26b.
	Reported by Po Lu <luangruo@yahoo.com>.
	* lib/vasnprintf.c: Include <wchar.h>.

diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index ab11ad026e..277c39e3e0 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -83,6 +83,7 @@
 #include <stdio.h>      /* snprintf(), sprintf() */
 #include <stdlib.h>     /* abort(), malloc(), realloc(), free() */
 #include <string.h>     /* memcpy(), strlen() */
+#include <wchar.h>      /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb() */
 #include <errno.h>      /* errno */
 #include <limits.h>     /* CHAR_BIT */
 #include <float.h>      /* DBL_MAX_EXP, LDBL_MAX_EXP */





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: vasnprintf.c Android bug?
  2023-01-25 12:44   ` Bruno Haible
@ 2023-01-25 13:13     ` Po Lu
  0 siblings, 0 replies; 4+ messages in thread
From: Po Lu @ 2023-01-25 13:13 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib

Bruno Haible <bruno@clisp.org> writes:

> Hi,
>
> Po Lu wrote:
>> With the build API version set to 21 on the NDK r26b, vasnprintf.c needs
>> to include:
>> 
>> #include <wchar.h>
>> 
>> or else it cannot find mbstate_t.
>
> Thanks for the report. This patch should fix it.
>
>
> 2023-01-25  Bruno Haible  <bruno@clisp.org>
>
> 	vasnprintf: Fix compilation error on Android NDK r26b.
> 	Reported by Po Lu <luangruo@yahoo.com>.
> 	* lib/vasnprintf.c: Include <wchar.h>.
>
> diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
> index ab11ad026e..277c39e3e0 100644
> --- a/lib/vasnprintf.c
> +++ b/lib/vasnprintf.c
> @@ -83,6 +83,7 @@
>  #include <stdio.h>      /* snprintf(), sprintf() */
>  #include <stdlib.h>     /* abort(), malloc(), realloc(), free() */
>  #include <string.h>     /* memcpy(), strlen() */
> +#include <wchar.h>      /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb() */
>  #include <errno.h>      /* errno */
>  #include <limits.h>     /* CHAR_BIT */
>  #include <float.h>      /* DBL_MAX_EXP, LDBL_MAX_EXP */

Thanks.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: vasnprintf.c Android bug?
  2023-01-25  3:13 ` vasnprintf.c Android bug? Po Lu
  2023-01-25 12:44   ` Bruno Haible
@ 2023-01-28 18:42   ` Bruno Haible
  1 sibling, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2023-01-28 18:42 UTC (permalink / raw)
  To: Po Lu; +Cc: bug-gnulib

Po Lu wrote:
> In addition, this warning is still emitted by Clang:
> 
>  ANDROID_CC   vasnprintf.o
> vasnprintf.c:2416:21: warning: variable 'flags' set but not used [-Wunused-but-set-variable]
>                 int flags = dp->flags;

Thanks for the report! This warning indeed indicated a bug. I have committed
a fix now.

Bruno





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-28 18:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87a627487f.fsf.ref@yahoo.com>
2023-01-25  3:13 ` vasnprintf.c Android bug? Po Lu
2023-01-25 12:44   ` Bruno Haible
2023-01-25 13:13     ` Po Lu
2023-01-28 18:42   ` Bruno Haible

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