git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: "Randal L. Schwartz" <merlyn@stonehenge.com>, git@vger.kernel.org
Subject: Re: daemon.c broken on OpenBSD
Date: Mon, 24 Oct 2005 10:26:59 -0700	[thread overview]
Message-ID: <435D1963.8070205@zytor.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0510241002180.10477@g5.osdl.org>

Linus Torvalds wrote:
> 
> Side note: "safe in practice" isn't necessarily the same as "safe in 
> theory".
> 
> I think that strictly speaking, if you include <ctype.h>, the "isxxxx()" 
> format is always reserved (where "x" is lowercase letters), and in theory 
> you could have a compiler that recognizes them even before the 
> pre-processor as being something built-in.
> 
> In _practice_, such a compiler would be incredibly broken (it would have 
> to do the recognition after preprocessing too), and I doubt you'd ever see 
> such a thing, but from a pure language-lawyer standpoint it might 
> technically be possible.
> 

A much more likely cause for problems would be system headers that use 
the isxxx() macros as part of other macros.  That would be in violation 
of POSIX, but is reasonably common.

> However, I'm surprised that you see <ctype.h> at all. The OpenBSD headers 
> seem to be including <ctype.h> from <sys/poll.h>, which doesn't make any 
> sense. It may not be strictly against POSIX, but it's definitely strange 
> and bad form to do unnecessary name pollution that the user didn't ask 
> for.

It is strictly against POSIX, but again, fairly common.

> So git actually tries to be pretty good about things. Not only does it try 
> to handle any existing system <ctype.h> by doing the #undef, it actually 
> doesn't include the system ctype.h at _all_ when it includes "cache.h". 
> And OpenBSD is being a bit strange.

I think there is another good reason for doing the renaming bit: we're 
creating new macros with different semantics; in particular, the git 
macros handle signed char input and don't guarantee anything w.r.t. EOF.

	-hpa

  reply	other threads:[~2005-10-24 17:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-24  4:06 daemon.c broken on OpenBSD Randal L. Schwartz
2005-10-24  5:20 ` Junio C Hamano
2005-10-24 14:03   ` Matthias Urlichs
2005-10-25 23:29   ` Randal L. Schwartz
2005-10-25 23:32     ` Randal L. Schwartz
2005-10-25 23:40       ` Randal L. Schwartz
2005-10-24 16:02 ` Linus Torvalds
2005-10-24 16:06   ` Randal L. Schwartz
2005-10-24 16:43     ` Linus Torvalds
2005-10-24 17:04       ` H. Peter Anvin
2005-10-24 17:14       ` Linus Torvalds
2005-10-24 17:26         ` H. Peter Anvin [this message]
2005-10-24 17:58           ` Linus Torvalds
2005-10-24 18:03             ` H. Peter Anvin
2005-10-24 18:25               ` Morten Welinder
2005-10-24 20:59           ` Junio C Hamano

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=435D1963.8070205@zytor.com \
    --to=hpa@zytor.com \
    --cc=git@vger.kernel.org \
    --cc=merlyn@stonehenge.com \
    --cc=torvalds@osdl.org \
    /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 NNTP newsgroup(s).