Re: [PATCH V2] sparse: Allow override of sizeof(bool) warning

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

 



On Thu, 2014-02-27 at 12:55 -0800, Christopher Li wrote:
> On Thu, Feb 27, 2014 at 12:39 PM, Joe Perches <joe@xxxxxxxxxxx> wrote:

> > Maybe the evaluate.c "size = bits_in_char;" assignment
> >
> >         if (size == 1 && is_bool_type(type)) {
> > -               warning(expr->pos, "expression using sizeof bool");
> > +               if (Wsizeof_bool)
> > +                       warning(expr->pos, "expression using sizeof bool");
> >                 size = bits_in_char;
> >         }
> >
> > should be
> >
> >         size = sizeof(_Bool) * 8;
> 
> The reason to use bits_in_xxxx is to allow sparse application to over write
> the size of int etc. If you don't like the bits_in_char here. You can introduce
> bits_in_bool and set that to sizeof(Bool)*8 by default. That way you don't
> hard code it.

There already is a bits_in_bool and it's default 1.

$ git grep -E "\bbits_in_\w+\s*=[^=]"
lib.c:          bits_in_long = 64;
lib.c:          bits_in_pointer = 64;
target.c:int bits_in_bool = 1;
target.c:int bits_in_char = 8;
target.c:int bits_in_short = 16;
target.c:int bits_in_int = 32;
target.c:int bits_in_long = 32;
target.c:int bits_in_longlong = 64;
target.c:int bits_in_longlonglong = 128;
target.c:int bits_in_float = 32;
target.c:int bits_in_double = 64;
target.c:int bits_in_longdouble = 80;
target.c:int bits_in_pointer = 32;
target.c:int bits_in_enum = 32;

> > And also, in sparse.1, Josh Triplett is shown as
> > the maintainer.  Maybe that should be changed to
> > Christopher Li
> 
> Maybe a separate patch.

That's fine with me too.  If you're the maintainer,
I think you should do that patch.  I don't see a need
for me to send any more right now though.

cheers, Joe

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux