Re: kernel-doc bug?

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

 



-Darrick as email seems to bounce.
On 19:07-20130306, Rob Landley wrote:
> On 03/06/2013 11:57:07 AM, Nishanth Menon wrote:
> >Synopsys section might be interesting here:
> >Before: http://pastebin.com/bVt3RWKZ
> >u32 __pure crc32_le_generic (u32 crc,
> >                             unsigned char const * p,
> >                             size_t len,
> >                             const u32 ( * tab)[256],
> >                             u32 polynomial);
> >After: http://pastebin.com/z0NNWHtw
> >u32 __pure crc32_le_generic (u32 crc,
> >                             unsigned char const * p,
> >                             size_t len,
> >                             const u32 * tab,
> >                             u32 polynomial);
> >Not sure if we like that.
> 
> *blink* *blink*
Yep. It is wrong.
> 
> commit 836e2af92503f1642dbc3c3281ec68ec1dd39d2e
> Author: Joakim Tjernlund <Joakim.Tjernlund@xxxxxxxxxxxx>
> Date:   Mon May 24 14:33:31 2010 -0700
> 
> --- a/lib/crc32.c
> +++ b/lib/crc32.c
> @@ -48,12 +48,20 @@ MODULE_LICENSE("GPL");
>  #if CRC_LE_BITS == 8 || CRC_BE_BITS == 8
> 
>  static inline u32
> -crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32
> *tab)
> +crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32
> (*tab)[256]
>  {
> 
> That's a crazy type to have a in a prototype. (It looks like
> function pointers but isn't, I _think_ it's an array of pointers?)
> 
> Reading the code, it's a pointer to a series of arrays. It's basically:
> 
>   const u32 tab[][256];
> 
> Defined in a really weird way.
> 
> So the first form and the second form are not equivalent. The first
> form is highly unusual but the compiler accepts it, so...
> 
> Rob
yes, I agree - I agree the definition is weird, but kernel-doc script
is kind of expected to handle these as well. (*tab)[256] or tab[][256]
should be described by
* @tab: something.
And kernel-doc should be able to convert that into:
Synopsis: original prototype
u32 __pure crc32_le_generic (u32 crc,
                             unsigned char const * p,
                             size_t len,
                             const u32 ( * tab)[256],
                             u32 polynomial);
Arguments:
tab 
	something

The problem we probably have is that:
$args{'parameterlist'} is used to create the synopsis for the function
and to print out argument list.
If we cleanup the parameter for "Arguments" then Synopsis suffers and
viceversa.

I got interested in this specific definition as it kind of caught an
corner case in kernel-doc script.

An alternate solution *might* be to have $args{'parameterlistorig'} which could
be used to store the original prototype(for Synopsis) while $args{'parameterlist'}
is used elsewhere - but it kinda feels hackish.
-- 
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux