From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2543 Path: news.gmane.org!not-for-mail From: John Spencer Newsgroups: gmane.linux.lib.musl.general Subject: Re: NULL Date: Wed, 09 Jan 2013 16:18:12 +0100 Message-ID: <50ED8A34.5070904@barfooze.de> References: <50ED4E45.6050801@barfooze.de> <50ED81BF.8030005@gentoo.org> <20130109144712.GY20323@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1357744743 32551 80.91.229.3 (9 Jan 2013 15:19:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Jan 2013 15:19:03 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2544-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jan 09 16:19:21 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TsxR2-0006Rw-3C for gllmg-musl@plane.gmane.org; Wed, 09 Jan 2013 16:19:20 +0100 Original-Received: (qmail 31884 invoked by uid 550); 9 Jan 2013 15:19:03 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 31876 invoked from network); 9 Jan 2013 15:19:03 -0000 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110221 SUSE/3.1.8 Mail/1.0 In-Reply-To: <20130109144712.GY20323@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:2543 Archived-At: On 01/09/2013 03:47 PM, Rich Felker wrote: > On Wed, Jan 09, 2013 at 03:42:07PM +0100, Luca Barbato wrote: >> On 09/01/13 12:02, John Spencer wrote: >>> 2) change musl so it is compatible with those apps. this would mean: >>> #if defined(__GNUC__)&& defined(__cplusplus__) >>> #define NULL __null >>> #elif defined (__cplusplus__) >>> #define NULL 0 >>> #else >>> #define NULL (void *) 0 /* for C code */ >>> #end >>> this change is the easiest solution: any problem will be magically fixed. >> I'm not sure if there is a way to warn properly at compile time for that >> specific usage. > __attribute__ ((sentinel)) may be used. Adding this to the appropriate > gtk headers (even just as a temporary debugging measure if it's not > desirable permanently) would catch all the bugs calling gtk variadic > functions. > indeed this does emit a warning. however, it will only detect sentinels, not other variadic arguments that are expected to be pointers but will be passed as int instead. i haven't tested, but it will most likely also cause crashes. >> IMHO going with 2+3 is the only safe way to grant musl more support > 2 is not appropriate as written (it's more complexity, and ugly, and > in multiple locations). 3 already exists; it's called GCC. > > If we decide something is needed at the musl level, in my opinion the > only acceptable solution is just replacing 0 with 0L unconditionally. > Actually I'd like to remove the special-case for C++ and make NULL > _always_ be defined to 0 or 0L, but I worry too many people would > complain... > yes, 0L is definitely nicer. regarding C code, it would infact be more consequent if you make it 0/0L there as well. what issues could arise in C code when (void* ) 0 is replaced with 0L ?