Building 0.22.1 on OS X 10.8, I get two warnings about implicit function declarations: common/test-message.c:53:6: warning: implicit declaration of function 'asprintf' is invalid in C99 [-Wimplicit-function-declaration] if (asprintf (&expected, "Details: value: %s", strerror (ENOENT)) < 0) ^ common/compat.c:820:12: warning: implicit declaration of function 'issetugid' is invalid in C99 [-Wimplicit-function-declaration] secure = issetugid (); ^ This type of warning is usually a missing #include. It's sometimes platform-specific (other platforms might get them implicitly via other explicitly #included ones), but rarely a problem to do them explicitly on all platforms (especially given how universal these specific cases are). According to my manpages for these functions, asprintf() is declared via stdio.h and issetugid() via unistd.h
Adding #include <stdio.h> to common/test-message.c solves asprintf(). issetugid() is weird...I need to set -D_DARWIN_C_SOURCE in order for unistd.h (which already *was* being included implicitly/indirectly) to actually supply the prototype for it. Chalk it up to darwin being weird, I guess?
A patch would be welcome. I don't have a Mac at my disposal to test such a fix. I could include the patch in 0.22.2
Created attachment 115512 [details] [review] fix implicit decl on BSD Hi Stef. I see the same issue on OpenBSD. Here's a patch that fixes all implicit decl for me.
Comment on attachment 115512 [details] [review] fix implicit decl on BSD Sorry for the delay reviewing this. This causes build problems on Linux: In file included from /usr/include/sys/types.h:25:0, from /data/src/p11-kit/x86_64/../common/compat.h:40, from /data/src/p11-kit/x86_64/../common/compat.c:48: /usr/include/features.h:148:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.