On Tue, 23 Jun 2020 at 17:48, Joe Perches <[email protected]> wrote: > > Hi again. > > On Tue, 2020-06-23 at 11:37 +0100, Quentin Monnet wrote: > > Checkpatch reports warnings when some specific structs are not declared > > as const in the code. The list of structs to consider was initially > > defined in the checkpatch.pl script itself, but it was later moved to an > > external file (scripts/const_structs.checkpatch), in commit bf1fa1dae68e > > ("checkpatch: externalize the structs that should be const"). This > > introduced two minor issues: > [] > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > [] > > @@ -770,7 +770,7 @@ sub read_words { > > next; > > } > > > > - $$wordsRef .= '|' if ($$wordsRef ne ""); > > + $$wordsRef .= '|' if (defined($$wordsRef) && > > $$wordsRef ne ""); > > perl is a weird language and the $$wordsRef ne "" test > isn't required as the append will work even if the > thing being appended to isn't defined. > > You can read the perlsyn docs > http://perldoc.perl.org/perlsyn.html > or > https://stackoverflow.com/questions/2166575/when-is-it-ok-to-use-an-undefined-variable-in-perl-with-warnings-enabled
I didn't want to touch $typeOtherTypedefs in v2, and I thought I needed that « $$wordsRef ne "" » for the "read_words(\$typeOtherTypedefs, $typedefsfile)" where the variable was defined but possibly empty? Anyway, thanks for the lore and the links :). > > so perhaps remove the test and improve the additional > $typedefsfile use too Agreed, your version looks better. I'll resubmit a v3 with your suggestions, please feel free to comment and add a "Co-authored-by:" tag if you feel this is appropriate. Thank you, Quentin

