public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* MinGW compilation warnings in libiberty's xstrndup.c
@ 2017-05-08 15:37 Eli Zaretskii
  2017-05-19 15:27 ` Pedro Alves
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Eli Zaretskii @ 2017-05-08 15:37 UTC (permalink / raw)
  To: gcc-patches; +Cc: gdb-patches

When compiling libiberty (as part of GDB) with MinGW on MS-Windows, I
see the following warning:

     gcc -c -DHAVE_CONFIG_H -O2 -gdwarf-4 -g3 -D__USE_MINGW_ACCESS  -I. -I./../include   -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  -D_GNU_SOURCE ./xstrndup.c -o xstrndup.o
     ./xstrndup.c: In function 'xstrndup':
     ./xstrndup.c:51:16: warning: implicit declaration of function 'strnlen' [-Wimplicit-function-declaration]
	size_t len = strnlen (s, n);
		     ^

This happens because libiberty.h uses incorrect guards for the
prototype of strnlen:

  #if defined (HAVE_DECL_STRNLEN) && !HAVE_DECL_STRNLEN
  extern size_t strnlen (const char *, size_t);
  #endif

It should use HAVE_STRNLEN instead, because that's the only
strnlen-related macro defined in config.g when strnlen is probed by
the configure script.

Thanks.

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

end of thread, other threads:[~2017-05-31  6:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-08 15:37 MinGW compilation warnings in libiberty's xstrndup.c Eli Zaretskii
2017-05-19 15:27 ` Pedro Alves
2017-05-19 15:47   ` Eli Zaretskii
2017-05-19 16:08     ` Pedro Alves
2017-05-19 22:28 ` DJ Delorie
2017-05-19 22:31   ` Pedro Alves
2017-05-19 22:56     ` DJ Delorie
2017-05-19 23:22       ` Pedro Alves
2017-05-20  1:25         ` DJ Delorie
2017-05-22 16:28           ` Pedro Alves
2017-05-26 21:49 ` DJ Delorie
2017-05-28 18:31   ` Eli Zaretskii
2017-05-31  6:17     ` DJ Delorie
2017-05-31  6:55       ` Eli Zaretskii

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