git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: daemon.c broken on OpenBSD

From
HAH. Peter Anvin <hpa@zytor.com>
Date
Oct 24, 2005, 17:26 UTC
Message-ID
<435D1963.8070205@zytor.com>
In-Reply-To
<Pine.LNX.4.64.0510241002180.10477@g5.osdl.org>
Linus Torvalds wrote:
Show 14 quoted lines
> 
> 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.

Show 5 quoted lines
> 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
Previous: Linus TorvaldsNext: Linus Torvalds
Message 12 of 16 in “daemon.c broken on OpenBSD”
  1. Randal L. SchwartzOct 24, 2005
  2. Junio C HamanoOct 24, 2005
  3. Matthias UrlichsOct 24, 2005
  4. Randal L. SchwartzOct 25, 2005
  5. Randal L. SchwartzOct 25, 2005
  6. Randal L. SchwartzOct 25, 2005
  7. Linus TorvaldsOct 24, 2005
  8. Randal L. SchwartzOct 24, 2005
  9. Linus TorvaldsOct 24, 2005
  10. H. Peter AnvinOct 24, 2005
  11. Linus TorvaldsOct 24, 2005
  12. H. Peter AnvinOct 24, 2005
  13. Linus TorvaldsOct 24, 2005
  14. H. Peter AnvinOct 24, 2005
  15. Morten WelinderOct 24, 2005
  16. Junio C HamanoOct 24, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.