This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Likely incorrect patch: remove the faulty basename() prototype from libiberty


On Sun, 29 May 2016, DJ Delorie wrote:

> I think the right path to go down is to add libgen.h to the list in
> AC_CHECK_HEADERS for every project that uses basename() (including
> libiberty itself, and binutils, gdb, and gcc), and then everyone who
> uses basename() from libiberty.h would need to include libgen.h *if*
> it's found by configure.

Note that there are two different and incompatible basename functions.  
libgen.h has the POSIX one.  libiberty has the GNU one (which glibc 
declares in <string.h> with _GNU_SOURCE).  If you include libgen.h with 
glibc, you get basename defined to __xpg_basename, which presumably is not 
what is wanted by applications using libiberty.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]