qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC v2] checkpatch: detect missing changes to trace-events


From: Claudio Fontana
Subject: Re: [RFC v2] checkpatch: detect missing changes to trace-events
Date: Wed, 12 Aug 2020 18:08:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 8/12/20 5:51 PM, Stefan Hajnoczi wrote:
> On Fri, Aug 07, 2020 at 01:14:47PM +0200, Claudio Fontana wrote:
>>  # Check for added, moved or deleted files
>> -            if (!$reported_maintainer_file && !$in_commit_log &&
>> +            if (!$in_commit_log &&
>>                  ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
>>                   $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
>>                   ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ 
>> &&
>>                    (defined($1) || defined($2))))) {
>> -                    $reported_maintainer_file = 1;
>> -                    WARN("added, moved or deleted file(s), does MAINTAINERS 
>> need updating?\n" . $herecurr);
>> +                    if (!$reported_maintainer_file) {
>> +                            $reported_maintainer_file = 1;
>> +                            WARN("added, moved or deleted file(s), does 
>> MAINTAINERS need updating?\n" . $herecurr);
>> +                    }
>> +                    if (!$reported_trace_events_file) {
>> +                            if (`grep -F -s -e trace.h -e trace-root.h 
>> ${fromfile} ${realfile}` ne '') {
> 
> Are there false positives on non-C files (e.g. Makefiles)?
> 
> The search expressions can be tightened to avoid false positives (at the
> cost of possible false negatives): -e '#include "trace.h"' -e '#include
> "trace-root.h"'. This way a C file containing "strace.handler" will not
> cause a false positive.
> 

Yep good point.

> I wonder if there is a native Perl way to do this search instead of
> forking grep :). Nevermind though.
> 

If only all the speedups from GNU grep would be available as a libgrep..

I had to post an RFC v3 of this one, because there is an issue in the order 
in_commit_log is set and checked (in my understanding).

https://lists.gnu.org/archive/html/qemu-devel/2020-08/msg01953.html

This is actually potentially an issue in upstream (kernel) checkpatch.pl as 
well, but it does not bite until you try to use
realfile variable (or in this case fromfile also).

Ciao,

Claudio








reply via email to

[Prev in Thread] Current Thread [Next in Thread]