tags 507336 wontfix thanks, Ron,
For now, I tag this "wontfix", since I don't believe there is a problem here, but if, after reviewing my earlier message, you believe otherwise, please let me know. Thanks, Michael On Sun, Nov 30, 2008 at 10:45 AM, Michael Kerrisk <[EMAIL PROTECTED]> wrote: > Hi Ron, > > On Sat, Nov 29, 2008 at 11:50 PM, Ron Murray <[EMAIL PROTECTED]> wrote: >> Package: manpages-dev >> Version: 3.05-1 >> Severity: normal >> >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> The basename (3) man page says that there are two different versions >> of basename(): the POSIX one and the GNU version. This is >> correct. However, it goes on to say that you get the GNU version with >> >> #define _GNU_SOURCE >> #include <string.h> >> >> Confusingly, it also says (a little further down the page): >> >>> With glibc, one gets the POSIX version of basename() when <libgen.h> is >>> included, and the GNU version otherwise. >> >> Both are actually incorrect. If you have a program with >> >>> #include <stdio.h> >>> >>> int main(void) >>> { >>> char *p, *path = "/usr/nowhere/nothing"; >>> >>> p = basename(path); >>> >>> return 0; >>> } >> >> and try to compile it, you'll get >> >>> bt.c: In function 'main': >>> bt.c:7: warning: assignment makes pointer from integer without a cast >> >> (since basename hasn't been defined, its return type defaults to >> 'int'). >> >> Defining _GNU_SOURCE and including string.h, as the man page suggests, >> makes no difference. In fact, /usr/include/string.h doesn't use >> _GNU_SOURCE at all (though it does mention it in passing). >> >> If you #define __USE_GNU instead, however, then basename() is defined >> as the GNU version, and no compiler warnings result (the basename() >> definition in string.h is contained in a "#ifdef __USE_GNU" >> construct). > > Hmmmm.... > > $ cat f.c > #include <string.h> > #include <stdio.h> > > int main(void) > { > char *p, *path = "/usr/nowhere/nothing"; > > p = basename(path); > > return 0; > } > > $ cc f.c > f.c: In function âmainâ: > f.c:8: warning: assignment makes pointer from integer without a cast > > As you desribed... > > But: > > $ cc -D_GNU_SOURCE f.c > $ > > works fine. > >> To be honest, I'm not sure whether this is a manpage error or a >> glibc/header file error, but this seemed a good place to start. > > I think the bug report is in error. Have a thorough read of > feature_test_macros(7). > > Cheers, > > Michael > > -- > Michael Kerrisk > Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ > git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git > man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html > Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]