Bug 487995
Summary: | basename prototype mis-match between libiberty.h and string.h | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | William Cohen <wcohen> | ||||
Component: | binutils | Assignee: | Nick Clifton <nickc> | ||||
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | low | ||||||
Version: | rawhide | CC: | jakub, jan.kratochvil, nickc | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2009-04-09 14:45:35 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
William Cohen
2009-03-02 04:32:29 UTC
Hi Will, First of all there is a small mistake in your example program (b.cpp). Currently you are assigning the result of calling basename() into a char, hence the error message for line 9 in b.cpp. Also the pointer returned by basename, according to string.h, is a const char *, so you have a type mismatch as well. Hence I changed the source to: [...] const char *b; int main(int argc, char **argv) { b = basename("/usr/bin/xyz.sdf"); [...] Which just leaves the ambiguity between libiberty.h and string.h. I do not really think that libiberty.h is at fault here, since it is following the XPG specifications for the basename function. (Rather than the ISO C++ specification which is what is being used by string.h). An easy workaround is to define HAVE_DECL_BASENAME to 1 before including libiberty.h, like this: #include <string.h> #define HAVE_DECL_BASENAME 1 #include <libiberty.h> Or use autoconf to test for basename and include config.h before libiberty.h. Cheers Nick Added the following in the configure.in: AC_CHECK_DECLS([basename], [], [], [[#include <libgen.h>]]) This produces the needed define in config.h and allows things to compile on f11. Have fix in oprofile-0.9.4-6.fc11. |