Re: [PATCH] read-cache.c: fix a sparse warning

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

 



On Fri, Sep 14, 2018 at 7:29 PM Ramsay Jones
<ramsay@xxxxxxxxxxxxxxxxxxxx> wrote:
> At one time, the POSIX standard required the type used to represent
> a thread handle (pthread_t) be an arithmetic type. This is no longer
> the case, probably because different platforms used to regularly
> ignore that requirement.  For example, on cygwin a pthread_t is a
> pointer to a structure (a quite common choice), whereas on Linux it
> is defined as an 'unsigned long int'.
>
> On cygwin, but not on Linux, 'sparse' currently complains about an
> initialiser used on a 'struct load_index_extensions' variable, whose
> first field may be a pthread handle (if not compiled with NO_PTHREADS
> set).
>
> In order to fix the warning, move the (conditional) pthread field to
> the end of the struct and change the initialiser to use a NULL, since
> the new (unconditional) first field is a pointer type.
>
> Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
> ---
> If you need to re-roll your 'bp/read-cache-parallel' branch, could you
> please squash this into the relevant patch (commit a090af334,
> "read-cache: load cache extensions on a worker thread", 2018-09-12).

The information contained in this commit message is so useful that it
might make sense to plop this patch at the end of the series rather
than merely squashing it in. (Or, if it is squashed, include the above
explanation in the commit message of the appropriate patch.)



[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