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 Sun, 2024-03-24 at 11:40 +1300, Barry Song wrote:
> 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
[]
> I'll check if Xining has some approach to detect this kind of ifdef/else/endif,
> and remove those false positives.

checkpatch isn't expected to be perfect.

So I wouldn't worry about it, I just wondered if
the exception rate is near the warning rate.

I expect it's not, but if it is, then perhaps
the warning isn't useful.

Do you know how many existing cases there are in
the kernel that might trip this warning?






[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