From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9052 invoked by alias); 4 Jul 2005 22:08:36 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 8939 invoked by uid 22791); 4 Jul 2005 22:08:28 -0000 Received: from romy.inter.net.il (HELO romy.inter.net.il) (192.114.186.66) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 04 Jul 2005 22:08:28 +0000 Received: from HOME-C4E4A596F7 (IGLD-84-228-241-110.inter.net.il [84.228.241.110]) by romy.inter.net.il (MOS 3.5.8-GR) with ESMTP id BTI09281 (AUTH halo1); Tue, 5 Jul 2005 01:08:23 +0300 (IDT) Date: Mon, 04 Jul 2005 22:08:00 -0000 Message-Id: From: Eli Zaretskii To: Mark Kettenis CC: gdb-patches@sourceware.org In-reply-to: <200507041336.j64Da5cE001221@jop31.nfra.nl> (message from Mark Kettenis on Mon, 4 Jul 2005 15:36:05 +0200) Subject: Re: [commit] Properly cast sentinels for concat() Reply-to: Eli Zaretskii References: <200507041336.j64Da5cE001221@jop31.nfra.nl> X-SW-Source: 2005-07/txt/msg00051.txt.bz2 > Date: Mon, 4 Jul 2005 15:36:05 +0200 > From: Mark Kettenis > > This fixes a few warnings with GCC 4.0 on OpenBSD. You'll probably > won't see them on other systems, since they only show up if NULL is > defined as an integer instead of a pointer constant (both are valid > according to C standard). The stddef.h that comes with GCC defines > NULL as (void *)NULL, but we don't use that one on OpenBSD. > > Anyway, I committed the attached patch as obvious. Actually, it's not at all obvious, it's IMNSHO simply wrong. Casting NULL to _anything_ should never be needed, unless NULL is abused (i.e. used in a place where a pointer cannot be). Let's not decide that a patch is ``obvious'' just because it happens to shut up the compiler! In this case, I'd say it's a bug in OpenBSD (it _should_ use stddef.h that comes with GCC when a program is compiled with GCC), coupled with the silly attitude of latest GCC versions to whine about more and more perfectly valid C code constructs. Since these are warnings, I urge you to undo the ugly casts, and instead ask the maintainers of the OpenBSD port of GCC to arrange for the right stddef.h to be used. With any luck, this will be fixed in GCC 4.01 or some such, and until then let there be warnings on OpenBSD. (FWIW, in DJGPP we went through the same ordeal a few years ago, and the solution was simple: let GCC use its stddef.h, and define NULL in our own headers conditionally on it still being undefined.)