Date: Mon, 14 Jan 2013 09:03:34 -0500 From: Rich Felker <dalias@...ifal.cx> To: musl@...ts.openwall.com Subject: Re: musl as a framework to test applications' compatibility with POSIX (was: NULL) On Mon, Jan 14, 2013 at 12:45:27PM +0400, Vasily Kulikov wrote: > Hi, > > On Mon, Jan 14, 2013 at 01:11 -0500, Rich Felker wrote: > > In any case, this thread has gotten WAY off-topic, going all over the > > place into territory about the merits and demerits of different > > languages and anti-FSF politics. Those topics may be worth discussing > > in some contexts, but it seems to have left everybody really confused > > about the issues at hand, which are: > > > > - whether we should work around broken programs that pass NULL to > > variadic functions > > > > - and if so, how > > > > The emerging consensus seems to be using > > > > #define NULL 0L > > > > unconditionally in both C and C++ mode. > > If such slick and unobvious places of C/POSIX/C++/gcc/etc. applications > are explicitly detected and handled, then probably it worth implementing > some checker in libc/toolchain which is detected (probably at runtime) > and warning is emitted at runtime/compile-time? gcc'isms, UBs, etc. > > In musl libc it can be implemented as -DI_WANT_TO_DETECT_GCCISMS. At the very least, this would have to be a macro in the reserved namespace. However, I'm skeptical of using musl as a tool for checking this, especially since the check only works on 64-bit systems and does not help the compiler produce a warning/error, but only causes random, hard-to-diagnose crashes. It looks like cppcheck is adding (or has already added?) a test for incorrectly passing NULL to variadic functions, which is probably where the check belongs. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.