Re: + scripts-checkpatch-check-unused-parameters-for-function-like-macro.patch added to mm-nonmm-unstable branch

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

 



On Sat, Mar 23, 2024 at 7:16 PM Joe Perches <joe@xxxxxxxxxxx> wrote:
>
> On Sat, 2024-03-23 at 17:14 +1300, Barry Song wrote:
> > > > The patch titled
> > > >      Subject: scripts: checkpatch: check unused parameters for function-like macro
> > > > has been added to the -mm mm-nonmm-unstable branch.  Its filename is
> > > >      scripts-checkpatch-check-unused-parameters-for-function-like-macro.patch
> > >
> > > Conceptually I don't disagree but I wonder what the false
> > > positive rate is.
> >
> > Hi Joe,
> >
> > If your concern is whether this script might produce inaccurate reports, I'm confident that
> > the false positive rate is 0%. Xining, please correct me if I'm mistaken.
>
> I presume it's low but non-zero.
>
> I think the false positives are going to be
> in some cases where a type is used as a macro
> argument in #ifdef/#else blocks
>
> #ifdef CONFIG_<FOO>
>
> #define foo(bar, baz, ...)              \
> static inline func##bar(baz, ...)       \
> {                                       \
>         bar baz = ...                   \
>         ...                             \
> }
>
> #else
>
> #define foo(bar, baz, ...)
>
> #endif
>
> where it's not reasonably possible to use a
> static inline.

I do find some exceptions such as include/uapi/linux/const.h

#ifdef __ASSEMBLY__
#define _AC(X,Y)        X
#define _AT(T,X)        X
#else
#define __AC(X,Y)       (X##Y)
#define _AC(X,Y)        __AC(X,Y)
#define _AT(T,X)        ((T)(X))
#endif


And include/video/trident.h

#if TRIDENTFB_DEBUG
#define debug(f, a...)  printk("%s:" f,  __func__ , ## a);
#else
#define debug(f, a...)
#endif


I'll check if Xining has some approach to detect this kind of ifdef/else/endif,
and remove those false positives.





[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux