[splint-discuss] Patch for splint to compile on mac os x

Marian Such toxygen1 at gmail.com
Thu Aug 7 02:55:03 PDT 2008


On Aug 7, 2008, at 4:02 AM, Richard A. O'Keefe wrote:

>
> On 7 Aug 2008, at 6:59 am, Marian Such wrote:
>
>> Hello,
>> here is patch to make splint compile without error on Mac OS X.
>>
>> # diff -u src/osd.c src/osd_new.c
>
> Err, I have splint building in another window on a Mac OS X machine
> right now.  osd.c *did* compile without error, without needing any
> patch. ... Yup, the whole thing built straight out of the box without
> needing any changes at all.

I was getting the very same error:
http://www.cs.virginia.edu/pipermail/splint-discuss/2007-August/ 
001027.html

>
>> --- src/osd.c   2007-07-14 00:18:20.000000000 +0200
>> +++ src/osd_new.c       2008-08-06 20:41:21.000000000 +0200
>> @@ -515,6 +515,8 @@
>>  {
>>  # if defined (WIN32) || defined (OS2) && defined (__IBMC__)
>>    int pid = _getpid ();
>> +# elif __APPLE__
>> +  __darwin_pid_t pid = getpid ();
>>  # else
>>    __pid_t pid = getpid ();
>>  # endif
>
> The code I see in a straight-out-of-the-box 3.1.2 distro is
>
> # if defined (WIN32) || defined (OS2) && defined (__IBMC__)
> int
> # else
> int /* pid_t */
> # endif
> osd_getPid ()
> {
> # if defined (WIN32) || defined (OS2) && defined (__IBMC__)
>    int pid = _getpid ();
> # else
>    pid_t pid = getpid ();
> # endif
>
>    return (int) pid;
> }
>
there is some culprit because I have different code after  
uncompressing source distribution (http://www.splint.org/downloads/ 
splint-3.1.2.src.tgz).
this is what I have:

# if defined (WIN32) || defined (OS2) && defined (__IBMC__)
int
# else
int /* pid_t */
# endif
osd_getPid ()
{
# if defined (WIN32) || defined (OS2) && defined (__IBMC__)
   int pid = _getpid ();
# else
   __pid_t pid = getpid ();                   <----- this is different
# endif

   return (int) pid;
}

any idea? maybe it's fixed it cvs already?

> The *right* name for the type is indeed 'pid_t', not
> '__pid_t', as the Mac OS X 'man getpid' says (and as
> POSIX says also).
>
> Which version of SPlint?    [for me, 3.1.2]
the same
> Which version of Mac OS X?  [for me, 10.5.4]
10.4.11 - this could be the cause
> Which version of XCode?     [for me, 3.0]
xcode doesn't matter really. I have 2.4.1
compiler: gcc version 4.0.1 (Apple Computer, Inc. build 5367)


Marian


More information about the splint-discuss mailing list