Subject: Re: Porting question: __P
To: None <marsmail@globegate.utm.edu>
From: Ken Nakata <kenn@synap.ne.jp>
List: port-mac68k
Date: 08/23/1998 09:10:46
On Sat, 22 Aug 1998 16:17:59 -0500 (CDT), David A. Gatwood wrote:
> 
> In attempting to port the sbc driver to the Mach Kernel (heaven help me),
> and I've run into something that I'm not familiar with, and which I can't
> find anywhere in Mach's sources except a commented out chunk of headers
> from FreeBSD in the ata driver, specifically, __P.

A snippet from src/sys/sys/cdefs.h:

#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos)     protos          /* full-blown ANSI C */
[snip snip]
#else   /* !(__STDC__ || __cplusplus) */
#define __P(protos)     ()              /* traditional C preprocessor */
[snip snip]
#endif

Basically, __P() is used to control type of function declarations; if
your compiler understands prototype, "void foo __P((int));" will be
"void foo (int);" and if not, it will be "void foo ();" instead.
The white space between the function name and the left paren is legal,
if you are worried about it.

Take care,

Ken