[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Warnings to be fixed
From: |
Jim Meyering |
Subject: |
Re: Warnings to be fixed |
Date: |
Thu, 16 Oct 2008 14:54:05 +0200 |
Reuben Thomas <address@hidden> wrote:
> Compiling with the Debian gnulib snapshot of 20081001, I am delighted
> that I no longer get warnings about #include_next. (Un?)fortunately,
> this enables me more easily to spot "real" warnings:
...
> open-safer.c: In function ‘open_safer’:
> open-safer.c:43: warning: signed and unsigned type in conditional expression
This one is perhaps a good reason to turn off or ignore that warning,
at least for this particular case:
int
open_safer (char const *file, int flags, ...)
{
mode_t mode = 0;
if (flags & O_CREAT)
{
va_list ap;
va_start (ap, flags);
/* Assume mode_t promotes to int if and only if it is smaller.
This assumption isn't guaranteed by the C standard, but we
don't know of any real-world counterexamples. */
mode = (sizeof (mode_t) < sizeof (int)
? va_arg (ap, int)
: va_arg (ap, mode_t)); <<<============ line 43
va_end (ap);
}
return fd_safer (open (file, flags, mode));
}
IMHO, adding casts here just to avoid that warning would be
counterproductive.