public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <rguenther@suse.de>
To: Mike Stump <mikestump@comcast.net>
Cc: gcc-patches@gcc.gnu.org, bkorb@gnu.org
Subject: Re: [PATCH] Fix bootstrap on OpenBSD, PR48851
Date: Tue, 05 Jul 2011 08:33:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.00.1107051000170.810@zhemvz.fhfr.qr> (raw)
In-Reply-To: <817CFF6E-A750-4060-95BD-3A3624AB4C8E@comcast.net>

On Mon, 4 Jul 2011, Mike Stump wrote:

> On Jul 4, 2011, at 4:04 AM, Richard Guenther wrote:
> > It happens that OpenBSD suffers from a bogus fixinclude that changes
> > its perfectly valid NULL define from (void *)0 to 0.  The fix itself
> > appears to be very old and is completely bogus
> 
> I don't agree with the completely bogus part.  Why not replace it with:
> 
> #undef NULL
> #ifdef __GNUG__
> #define NULL __null
> #else   /* G++ */
> #ifndef __cplusplus
> #define NULL ((void *)0)
> #else   /* C++ */
> #define NULL 0
> #endif  /* C++ */
> #endif  /* G++ */
> 
> ?

Because I don't know how to do that?

> This is C++ friendly, C friendly and modern.  It should be very safe and should work just about everywhere.
> 
> > - it replaces
> > (void *)0 with 0 under the assumption the former is invalid for C++ - 
> > which is true - but 0 is inappropriate for C which is much worse.
> 
> A #define to 0 is, for the C language, last I checked valid.  You may not like it, but welcome to C.

0 may be valid, but it doesn't work for variadic arguments.

> > Thus, I propose to remove the fix altogether.
> 
> Breaking all systems that are broken, isn't a good tradeoff.
> 
> Now, looking at the PR, in this case, one could add a bypass __GNUG__ to this fix, and avoid the change on OpenBSD.  This would also fix the problem.  I do not think removing the fix is a good idea.

Sure.

As you are objecting please take the PR and do a more proper fix then.
I don't really care about OpenBSD or AIX or Interix - I just tried to
be helpful.  So, now it's yours ;)

Thanks,
Richard.

      reply	other threads:[~2011-07-05  8:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 11:04 Richard Guenther
2011-07-04 12:46 ` Bruce Korb
2011-07-04 12:51   ` Richard Guenther
2011-07-04 14:35     ` David Edelsohn
2011-07-04 19:08 ` Mike Stump
2011-07-05  8:33   ` Richard Guenther [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1107051000170.810@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=bkorb@gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mikestump@comcast.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).