1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-07 11:49:40 +00:00

Make GDB build when basename() is POSIX compliant.

GDB's libiberty.h has a prototype of the basename() function it which
does not match the one that is part of POSIX, declared in libgen.h. This
is normally never visible, as GDB never includes libgen.h. On FreeBSD,
it unfortunately is, as our locally added copy of kgdb includes both.

Fix up libiberty.h to just include libgen.h. I'm currently discussing
with upstream how a clean fix should be done, but I guess that
requires more refactoring to the existing code. We'd better not bother
importing that and stick to this compact workaround.

Reviewed by:	bapt@, mi@, Luca Pizzamiglio
Differential Revision:	https://reviews.freebsd.org/D6630
This commit is contained in:
Ed Schouten 2016-06-01 15:35:42 +00:00
parent 53b3e4e18b
commit faa2902e74
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=416247
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--- include/libiberty.h
+++ include/libiberty.h
@@ -109,7 +109,7 @@
|| defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
|| defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
|| defined (__DragonFly__) || defined (HAVE_DECL_BASENAME)
-extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
+#include <libgen.h>
#else
/* Do not allow basename to be used if there is no prototype seen. We
either need to use the above prototype or have one from

View File

@ -0,0 +1,11 @@
--- include/libiberty.h
+++ include/libiberty.h
@@ -98,7 +98,7 @@
is 1, we found it so don't provide any declaration at all. */
#if !HAVE_DECL_BASENAME
#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
-extern char *basename (const char *);
+#include <libgen.h>
#else
/* Do not allow basename to be used if there is no prototype seen. We
either need to use the above prototype or have one from