bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature Branch Solaris Build Broken - lib/glob.c errors


From: Derek Price
Subject: Re: Feature Branch Solaris Build Broken - lib/glob.c errors
Date: Fri, 20 May 2005 12:42:47 -0400
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Conrad T. Pino wrote:

>>From: Derek Price [mailto:derek@ximbiot.com]
>>
>>I think I just checked in fixes for both Solaris compile problems, this
>>one and one with getpwnam_r.  Could you let me know if they work?  I
>>have no way to test here.
>>    
>>
>
>The compile completes but we have warnings (see below).  Problem may
>be "struct stat" definition and I've include this platform's definition.
>  
>

This should be irrelevant, since all reference to "struct stat" should
be made using the Solaris definition.  Our code never attempts to define
it and I am fairly certain that the "struct stat;" line in glob_.h only
declares the existance of said structure.

> 719:         ? ((*pglob->gl_stat) (dirname, &st) == 0
>1066:    ? (*pglob->gl_stat) (fullname, &st) == 0 && S_ISDIR (st.st_mode)
>1116:     ? (*pglob->gl_stat) (fullname, &st)
>
>gcc -DHAVE_CONFIG_H -I. -I. -I..    -Ino/include  -g -O2 -c glob.c
>glob.c: In function `rpl_glob':
>glob.c:719: warning: passing arg 2 of pointer to function from incompatible 
>pointer type
>glob.c: In function `is_dir_p':
>glob.c:1066: warning: passing arg 2 of pointer to function from incompatible 
>pointer type
>glob.c: In function `glob_in_dir':
>glob.c:1116: warning: passing arg 2 of pointer to function from incompatible 
>pointer type
>  
>

I am more suspicious of the __restrict keyword.  "restrict" should not
cause this sort of warning by my understanding of the C99 spec, but is
it possible that this is doing something we don't understand on
Solaris?  Here's the prototype of those function calls:

#ifdef __USE_GNU
    int (*gl_lstat) (__const char *__restrict, struct stat *__restrict);
    int (*gl_stat) (__const char *__restrict, struct stat *__restrict);
#else
    int (*gl_lstat) (__const char *__restrict, void *__restrict);
    int (*gl_stat) (__const char *__restrict, void *__restrict);
#endif

So, I am guessing that the problem is here.  ST is definitately a
"struct stat" in all three of the calls your compiler is warning about. 
We should also be able to assume __USE_GNU is set by the line at the
beginning of glob_.h.  Even if this wasn't so, by C89 any pointer type
should be castable to void *, so the problem should still be with the
restrict keyword.

Regards,

Derek





reply via email to

[Prev in Thread] Current Thread [Next in Thread]