Hi,

Does this actually help? I kind of doubt it.

At Tue, 1 Nov 2011 20:30:40 -0500,
Jonathan Nieder wrote:
> 
> Source: cowdancer
> Version: 0.65
> Tags: patch
> 
> Hi,
> 
> Trying to build cowdancer on kfreebsd-amd64, I get:
> 
>       cowdancer.c: In function 'open64':
>       cowdancer.c:447:10: warning: 'mode_t' is promoted to 'int' when passed 
> through '...' [enabled by default]
>       cowdancer.c:447:10: note: (so you should pass 'int' not 'mode_t' to 
> 'va_arg')
>       cowdancer.c:447:10: note: if this code is reached, the program will 
> abort
> 
> Later, when running the test suite, some programs do abort, though I
> think that's for another reason. :)
> 
> Unfortunately, POSIX does not tell us anything about the width of
> mode_t --- it just says that it is an integer type and historical
> BSD- and Sys-V-derived systems used "unsigned short".  glibc on
> linux-amd64 uses uint32_t.
> 
> $(getconf POSIX_V7_WIDTH_RESTRICTED_ENVS) is a list of programming
> environments (i.e., sets of build flags) in which certain types,
> including mode_t, are no wider than a "long".  There must be at least
> one such environment, but not all environments have to be that way.
> 
> Anyway, in practice (by which I mean "on the two systems I tried") it
> seems safe enough to assume it's promoted to "int".  How about this
> patch?
> ---
>  cowdancer.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git i/cowdancer.c w/cowdancer.c
> index 6285ec46..cf347291 100644
> --- i/cowdancer.c
> +++ w/cowdancer.c
> @@ -411,7 +411,7 @@ int open(const char * a, int flags, ...)
>    mode_t mode;
>    va_list args;
>    va_start(args, flags);
> -  mode = va_arg(args, mode_t);
> +  mode = va_arg(args, int);
>    va_end(args);
>    if (initialize_functions())
>      {
> @@ -444,7 +444,7 @@ int open64(const char * a, int flags, ...)
>    mode_t mode;
>    va_list args;
>    va_start(args, flags);
> -  mode = va_arg(args, mode_t);
> +  mode = va_arg(args, int);
>    va_end(args);
>    if (initialize_functions())
>      {
> -- 
> 
> 



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to