On Tuesday, October 11, 2011 14:34 CEST, "Sebastian Reitenbach" <[email protected]> wrote: > Hi, > > I'm trying to port the new gnustep libobjc2. When I compile it, I get the > following warning: > > clang -DTYPE_DEPENDENT_DISPATCH -DGNUSTEP -D__OBJC_RUNTIME_INTERNAL__=1 > -D_XOPEN_SOURCE=500 -D__BSD_VISIBLE=1 -DNO_SELECTOR_MISMATCH_WARNINGS -g -O0 > -fno-inline -O2 -pipe -g -O0 -std=gnu99 -fPIC -fexceptions -c block_to_imp.c > -o block_to_imp.o > block_to_imp.c:35:10: warning: implicit declaration of function 'asprintf' is > invalid in C99 [-Wimplicit-function-declaration] > if (0 > asprintf(&tmpPattern, "%s/objc_trampolinesXXXXXXXXXXX", tmp)) > ^ > 1 warning generated. > > usually this is just a missing header file, and man asprintf says, stdio.h > should be included, but I checked and that's already the case. > In stdio.h the declaration of asprintf function is surrounded with a #ifdef > __BSD_VISIBLE > But that's given on the command line, so I think clang should pick it up. > Googling told me to check for _GNU_SOURCE too, but that's also given on the > command line. > > So this may be a basic question, but I don't get it. Any other idea from > someone?
for the archives: I got a reply off-list reply that helped: >From sys/cdefs.h: /* * Finally deal with BSD-specific interfaces that are not covered * by any standards. We expose these when none of the POSIX or XPG * macros is defined or if the user explicitly asks for them. */ #if !defined(_BSD_SOURCE) && \ (defined(_ANSI_SOURCE) || defined(__XPG_VISIBLE) || defined(__POSIX_VISIBLE)) # define __BSD_VISIBLE 0 #endif (with __XPG_VISIBLE being defined if _XOPEN_SOURCE is defined). So what you want here is _BSD_SOURCE, not __BSD_VISIBLE. So, adding -D_BSD_SOURCE=1 helped. Sebastian
