Re: [PATCH 2/2] parse-options: use and require int pointer for OPT_CMDMODE

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

 



René Scharfe <l.s.r@xxxxxx> writes:

> Some uses of OPT_CMDMODE provide a pointer to an enum.  It is
> dereferenced as an int pointer in parse-options.c::get_value().  These
> two types are incompatible, though -- the storage size of an enum can
> vary between platforms.  C23 would allow us to specify the underlying
> type of the different enums, making them compatible, but with C99 the
> easiest safe option is to actually use int as the value type.
>
> Convert the offending OPT_CMDMODE users and use the typed value_int
> point in the macro's definition to enforce that type for future ones.

Interesting.  I wondered if this means that applying [1/2] alone
will immediately break these places that [2/2] fixes, but the answer
is no, as the previous step did not make these places use the typed
pointer.  But it also means that with this step alone to use "int",
instead of various "enum" types that can have representations that
are different from "int", would already "fix" the current code
while still casing back and forth from (void *)?

In any case, the two-patch series looks good, and it does not break
bisectability, either.

Thanks.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux