On 3/4/12 3:46 PM, Alistair Crooks wrote:
On Sun, Mar 04, 2012 at 03:35:27PM -0500, Julio Merino wrote:Except that the code lives in external/bsd/atf/ and is shipped in other systems that do not have __printflike. __printflike is a NetBSD-ism, right? If so, why do you think NetBSD is more important than any other system and thus __printflike has to be used?What I usually do in circumstances like this is to reproduce the definition from<sys/cdefs.h> in my own sources, and add a cpp check to only define them if they're not already defined:
Yeah, and this would be granting that the way NetBSD does this is the only way to do it and therefore what the code does is just provide compatibility hacks to work on other platforms. This is very reasonable for code that is maintained within the NetBSD tree only and later exported somewhere else, but in this case it's the other way around. As such, why is NetBSD more special than any other platform-isms to achieve this same thing?
I can also see all sorts of things going wrong if non-system code redefines things starting with __. It's not guaranteed that your preprocessor checks will work everywhere because you don't know if the __ thing you are overriding is a preprocessor macro.
What you could do is go to external/bsd/atf/lib/libatf-c/Makefile and change:
-e 's|@ATTRIBUTE_FORMAT_PRINTF@|__attribute__((__format__(__printf__, a, b)))|g'
with: -e 's|@ATTRIBUTE_FORMAT_PRINTF@|__printflike(a, b)|g' and remove any source of duplication of logic.