]> Git Repo - J-linux.git/commitdiff
Merge tag 'kconfig-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
authorLinus Torvalds <[email protected]>
Fri, 14 Aug 2020 18:04:45 +0000 (11:04 -0700)
committerLinus Torvalds <[email protected]>
Fri, 14 Aug 2020 18:04:45 +0000 (11:04 -0700)
Pull Kconfig updates from Masahiro Yamada:

 - remove '---help---' keyword support

 - fix mouse events for 'menuconfig' symbols in search view of qconf

 - code cleanups of qconf

* tag 'kconfig-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (24 commits)
  kconfig: qconf: move setOptionMode() to ConfigList from ConfigView
  kconfig: qconf: do not limit the pop-up menu to the first row
  kconfig: qconf: refactor icon setups
  kconfig: qconf: remove unused voidPix, menuInvPix
  kconfig: qconf: remove ConfigItem::text/setText
  kconfig: qconf: remove ConfigList::addColumn/removeColumn
  kconfig: qconf: remove ConfigItem::pixmap/setPixmap
  kconfig: qconf: drop more localization code
  kconfig: qconf: remove 'parent' from ConfigList::updateMenuList()
  kconfig: qconf: remove unused argument from ConfigView::updateList()
  kconfig: qconf: remove unused argument from ConfigList::updateList()
  kconfig: qconf: omit parent to QHBoxLayout()
  kconfig: qconf: remove name from ConfigSearchWindow constructor
  kconfig: qconf: remove unused ConfigList::listView()
  kconfig: qconf: overload addToolBar() to create and insert toolbar
  kconfig: qconf: remove toolBar from ConfigMainWindow members
  kconfig: qconf: use 'menu' variable for (QMenu *)
  kconfig: qconf: do not use 'menu' variable for (QMenuBar *)
  kconfig: qconf: remove ->addSeparator() to menuBar
  kconfig: add 'static' to some file-local data
  ...

1  2 
scripts/checkpatch.pl

diff --combined scripts/checkpatch.pl
index 2cbeae6d9aee86312467a881d776c33935e111ad,1351e052eb99c4b007cc1bb0210fcf136f9ade62..60d4a79674b6efd5f82d5f5ac052e9c3bdba8796
@@@ -59,7 -59,7 +59,7 @@@ my $spelling_file = "$D/spelling.txt"
  my $codespell = 0;
  my $codespellfile = "/usr/share/codespell/dictionary.txt";
  my $conststructsfile = "$D/const_structs.checkpatch";
 -my $typedefsfile = "";
 +my $typedefsfile;
  my $color = "auto";
  my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
  # git output parsing needs US English output, so first set backtick child process LANGUAGE
@@@ -588,8 -588,6 +588,8 @@@ our @mode_permission_funcs = 
        ["__ATTR", 2],
  );
  
 +my $word_pattern = '\b[A-Z]?[a-z]{2,}\b';
 +
  #Create a search pattern for all these functions to speed up a loop below
  our $mode_perms_search = "";
  foreach my $entry (@mode_permission_funcs) {
@@@ -758,7 -756,7 +758,7 @@@ sub read_words 
                                next;
                        }
  
 -                      $$wordsRef .= '|' if ($$wordsRef ne "");
 +                      $$wordsRef .= '|' if (defined $$wordsRef);
                        $$wordsRef .= $line;
                }
                close($file);
        return 0;
  }
  
 -my $const_structs = "";
 -read_words(\$const_structs, $conststructsfile)
 -    or warn "No structs that should be const will be found - file '$conststructsfile': $!\n";
 +my $const_structs;
 +if (show_type("CONST_STRUCT")) {
 +      read_words(\$const_structs, $conststructsfile)
 +          or warn "No structs that should be const will be found - file '$conststructsfile': $!\n";
 +}
  
 -my $typeOtherTypedefs = "";
 -if (length($typedefsfile)) {
 +if (defined($typedefsfile)) {
 +      my $typeOtherTypedefs;
        read_words(\$typeOtherTypedefs, $typedefsfile)
            or warn "No additional types will be considered - file '$typedefsfile': $!\n";
 +      $typeTypedefs .= '|' . $typeOtherTypedefs if (defined $typeOtherTypedefs);
  }
 -$typeTypedefs .= '|' . $typeOtherTypedefs if ($typeOtherTypedefs ne "");
  
  sub build_types {
        my $mods = "(?x:  \n" . join("|\n  ", (@modifierList, @modifierListFile)) . "\n)";
@@@ -844,6 -840,7 +844,6 @@@ our $FuncArg = qr{$Typecast{0,1}($LvalO
  our $declaration_macros = qr{(?x:
        (?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\s*\(|
        (?:$Storage\s+)?[HLP]?LIST_HEAD\s*\(|
 -      (?:$Storage\s+)?${Type}\s+uninitialized_var\s*\(|
        (?:SKCIPHER_REQUEST|SHASH_DESC|AHASH_REQUEST)_ON_STACK\s*\(
  )};
  
@@@ -3045,11 -3042,7 +3045,7 @@@ sub process 
  
                                if ($lines[$ln - 1] =~ /^\+\s*(?:bool|tristate|prompt)\s*["']/) {
                                        $is_start = 1;
-                               } elsif ($lines[$ln - 1] =~ /^\+\s*(?:help|---help---)\s*$/) {
-                                       if ($lines[$ln - 1] =~ "---help---") {
-                                               WARN("CONFIG_DESCRIPTION",
-                                                    "prefer 'help' over '---help---' for new help texts\n" . $herecurr);
-                                       }
+                               } elsif ($lines[$ln - 1] =~ /^\+\s*(?:---)?help(?:---)?$/) {
                                        $length = -1;
                                }
  
                        }
                }
  
 +# check for repeated words separated by a single space
 +              if ($rawline =~ /^\+/) {
 +                      while ($rawline =~ /\b($word_pattern) (?=($word_pattern))/g) {
 +
 +                              my $first = $1;
 +                              my $second = $2;
 +
 +                              if ($first =~ /(?:struct|union|enum)/) {
 +                                      pos($rawline) += length($first) + length($second) + 1;
 +                                      next;
 +                              }
 +
 +                              next if ($first ne $second);
 +                              next if ($first eq 'long');
 +
 +                              if (WARN("REPEATED_WORD",
 +                                       "Possible repeated word: '$first'\n" . $herecurr) &&
 +                                  $fix) {
 +                                      $fixed[$fixlinenr] =~ s/\b$first $second\b/$first/;
 +                              }
 +                      }
 +
 +                      # if it's a repeated word on consecutive lines in a comment block
 +                      if ($prevline =~ /$;+\s*$/ &&
 +                          $prevrawline =~ /($word_pattern)\s*$/) {
 +                              my $last_word = $1;
 +                              if ($rawline =~ /^\+\s*\*\s*$last_word /) {
 +                                      if (WARN("REPEATED_WORD",
 +                                               "Possible repeated word: '$last_word'\n" . $hereprev) &&
 +                                          $fix) {
 +                                              $fixed[$fixlinenr] =~ s/(\+\s*\*\s*)$last_word /$1/;
 +                                      }
 +                              }
 +                      }
 +              }
 +
  # check for space before tabs.
                if ($rawline =~ /^\+/ && $rawline =~ / \t/) {
                        my $herevet = "$here\n" . cat_vet($rawline) . "\n";
                        my ($s, $c) = ($stat, $cond);
  
                        if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) {
 -                              ERROR("ASSIGN_IN_IF",
 -                                    "do not use assignment in if condition\n" . $herecurr);
 +                              if (ERROR("ASSIGN_IN_IF",
 +                                        "do not use assignment in if condition\n" . $herecurr) &&
 +                                  $fix && $perl_version_ok) {
 +                                      if ($rawline =~ /^\+(\s+)if\s*\(\s*(\!)?\s*\(\s*(($Lval)\s*=\s*$LvalOrFunc)\s*\)\s*(?:($Compare)\s*($FuncArg))?\s*\)\s*(\{)?\s*$/) {
 +                                              my $space = $1;
 +                                              my $not = $2;
 +                                              my $statement = $3;
 +                                              my $assigned = $4;
 +                                              my $test = $8;
 +                                              my $against = $9;
 +                                              my $brace = $15;
 +                                              fix_delete_line($fixlinenr, $rawline);
 +                                              fix_insert_line($fixlinenr, "$space$statement;");
 +                                              my $newline = "${space}if (";
 +                                              $newline .= '!' if defined($not);
 +                                              $newline .= '(' if (defined $not && defined($test) && defined($against));
 +                                              $newline .= "$assigned";
 +                                              $newline .= " $test $against" if (defined($test) && defined($against));
 +                                              $newline .= ')' if (defined $not && defined($test) && defined($against));
 +                                              $newline .= ')';
 +                                              $newline .= " {" if (defined($brace));
 +                                              fix_insert_line($fixlinenr + 1, $newline);
 +                                      }
 +                              }
                        }
  
                        # Find out what is on the end of the line after the
                my $barriers = qr{
                        mb|
                        rmb|
 -                      wmb|
 -                      read_barrier_depends
 +                      wmb
                }x;
                my $barrier_stems = qr{
                        mb__before_atomic|
                        }
                }
  
 -# check for smp_read_barrier_depends and read_barrier_depends
 -              if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
 -                      WARN("READ_BARRIER_DEPENDS",
 -                           "$1read_barrier_depends should only be used in READ_ONCE or DEC Alpha code\n" . $herecurr);
 -              }
 -
  # check of hardware specific defines
                if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) {
                        CHK("ARCH_DEFINES",
                        if (defined $cond) {
                                substr($s, 0, length($cond), '');
                        }
 -                      if ($s =~ /^\s*;/ &&
 -                          $function_name ne 'uninitialized_var')
 +                      if ($s =~ /^\s*;/)
                        {
                                WARN("AVOID_EXTERNS",
                                     "externs should be avoided in .c files\n" .  $herecurr);
                }
  
  # check for function declarations that have arguments without identifier names
 -# while avoiding uninitialized_var(x)
                if (defined $stat &&
 -                  $stat =~ /^.\s*(?:extern\s+)?$Type\s*(?:($Ident)|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s &&
 -                  (!defined($1) ||
 -                   (defined($1) && $1 ne "uninitialized_var")) &&
 -                   $2 ne "void") {
 -                      my $args = trim($2);
 +                  $stat =~ /^.\s*(?:extern\s+)?$Type\s*(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s &&
 +                  $1 ne "void") {
 +                      my $args = trim($1);
                        while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
                                my $arg = trim($1);
 -                              if ($arg =~ /^$Type$/ &&
 -                                      $arg !~ /enum\s+$Ident$/) {
 +                              if ($arg =~ /^$Type$/ && $arg !~ /enum\s+$Ident$/) {
                                        WARN("FUNCTION_ARGUMENTS",
                                             "function definition argument '$arg' should also have an identifier name\n" . $herecurr);
                                }
                        }
                }
  
 +# check for IS_ENABLED() without CONFIG_<FOO> ($rawline for comments too)
 +              if ($rawline =~ /\bIS_ENABLED\s*\(\s*(\w+)\s*\)/ && $1 !~ /^CONFIG_/) {
 +                      WARN("IS_ENABLED_CONFIG",
 +                           "IS_ENABLED($1) is normally used as IS_ENABLED(CONFIG_$1)\n" . $herecurr);
 +              }
 +
  # check for #if defined CONFIG_<FOO> || defined CONFIG_<FOO>_MODULE
                if ($line =~ /^\+\s*#\s*if\s+defined(?:\s*\(?\s*|\s+)(CONFIG_[A-Z_]+)\s*\)?\s*\|\|\s*defined(?:\s*\(?\s*|\s+)\1_MODULE\s*\)?\s*$/) {
                        my $config = $1;
                        }
                }
  
 -# check for case / default statements not preceded by break/fallthrough/switch
 -              if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*|default):/) {
 -                      my $has_break = 0;
 -                      my $has_statement = 0;
 -                      my $count = 0;
 -                      my $prevline = $linenr;
 -                      while ($prevline > 1 && ($file || $count < 3) && !$has_break) {
 -                              $prevline--;
 -                              my $rline = $rawlines[$prevline - 1];
 -                              my $fline = $lines[$prevline - 1];
 -                              last if ($fline =~ /^\@\@/);
 -                              next if ($fline =~ /^\-/);
 -                              next if ($fline =~ /^.(?:\s*(?:case\s+(?:$Ident|$Constant)[\s$;]*|default):[\s$;]*)*$/);
 -                              $has_break = 1 if ($rline =~ /fall[\s_-]*(through|thru)/i);
 -                              next if ($fline =~ /^.[\s$;]*$/);
 -                              $has_statement = 1;
 -                              $count++;
 -                              $has_break = 1 if ($fline =~ /\bswitch\b|\b(?:break\s*;[\s$;]*$|exit\s*\(\b|return\b|goto\b|continue\b)/);
 -                      }
 -                      if (!$has_break && $has_statement) {
 -                              WARN("MISSING_BREAK",
 -                                   "Possible switch case/default not preceded by break or fallthrough comment\n" . $herecurr);
 -                      }
 -              }
 -
  # check for /* fallthrough */ like comment, prefer fallthrough;
                my @fallthroughs = (
                        'fallthrough',
  
  # check for various structs that are normally const (ops, kgdb, device_tree)
  # and avoid what seem like struct definitions 'struct foo {'
 -              if ($line !~ /\bconst\b/ &&
 +              if (defined($const_structs) &&
 +                  $line !~ /\bconst\b/ &&
                    $line =~ /\bstruct\s+($const_structs)\b(?!\s*\{)/) {
                        WARN("CONST_STRUCT",
                             "struct $1 should normally be const\n" . $herecurr);
This page took 0.06372 seconds and 4 git commands to generate.