1. 05 9月, 2019 1 次提交
  2. 16 7月, 2019 1 次提交
    • P
      checkpatch: detect doubly-encoded UTF-8 · 874acb6f
      Paolo Bonzini 提交于
      Copy and pasting from Thunderbird's "view source" window results in double
      encoding of multibyte UTF-8 sequences.  The appearance of those sequences is
      very peculiar, so detect it and give an error despite the (low) possibility
      of false positives.
      
      As the major offender, I am also adding the same check to my applypatch-msg
      and commit-msg hooks, but this will also cause patchew to croak loudly when
      this mistake happens.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1558099140-53240-1-git-send-email-pbonzini@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      874acb6f
  3. 06 7月, 2019 1 次提交
  4. 03 6月, 2019 1 次提交
  5. 29 1月, 2019 1 次提交
    • P
      checkpatch: Don't emit spurious warnings about block comments · b94e809d
      Peter Maydell 提交于
      In checkpatch we attempt to check for and warn about
      block comments which start with /* or /** followed by a
      non-blank. Unfortunately a bug in the regex meant that
      we would incorrectly warn about comments starting with
      "/**" with no following text:
      
        git show 9813dc6a|./scripts/checkpatch.pl -
        WARNING: Block comments use a leading /* on a separate line
        #34: FILE: tests/libqtest.h:233:
        +/**
      
      The sequence "/\*\*?" was intended to match either "/*" or "/**",
      but Perl's semantics for '?' allow it to backtrack and try the
      "matches 0 chars" option if the "matches 1 char" choice leads to
      a failure of the rest of the regex to match.  Switch to "/\*\*?+"
      which uses what perlre(1) calls the "possessive" quantifier form:
      this means that if it matches the "/**" string it will not later
      backtrack to matching just the "/*" prefix.
      
      The other end of the regex is also wrong: it is attempting
      to check for "/* or /** followed by something that isn't
      just whitespace", but [ \t]*.+[ \t]* will match on pure
      whitespace. This is less significant but means that a line
      with just a comment-starter followed by trailing whitespace
      will generate an incorrect warning about block comment style
      as well as the correct error about trailing whitespace which
      a different checkpatch test emits.
      
      Fixes: 8c06fbdf ("scripts/checkpatch.pl: Enforce multiline comment syntax")
      Reported-by: NThomas Huth <thuth@redhat.com>
      Reported-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 20190118165050.22270-1-peter.maydell@linaro.org
      b94e809d
  6. 11 1月, 2019 5 次提交
  7. 14 12月, 2018 1 次提交
    • P
      scripts/checkpatch.pl: Enforce multiline comment syntax · 8c06fbdf
      Peter Maydell 提交于
      We now require Linux-kernel-style multiline comments:
          /*
           * line one
           * line two
           */
      
      Enforce this in checkpatch.pl, by backporting the relevant
      parts of the Linux kernel's checkpatch.pl. (The only changes
      needed are that Linux's checkpatch.pl WARN() function takes
      an extra argument that ours does not, and the kernel has a
      special case for networking code we don't want.)"
      
      The kernel's checkpatch does not enforce "leading /* on
      a line of its own, so that part is unique to QEMU's checkpatch.
      
      Sample warning output:
      
      WARNING: Block comments use a leading /* on a separate line
      #34: FILE: hw/intc/arm_gicv3_common.c:39:
      +    /* Older versions of QEMU had a bug in the handling of state save/restore
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Acked-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      8c06fbdf
  8. 12 12月, 2018 1 次提交
  9. 27 11月, 2018 1 次提交
  10. 31 10月, 2018 1 次提交
  11. 24 8月, 2018 1 次提交
  12. 23 8月, 2018 1 次提交
  13. 07 7月, 2018 1 次提交
    • P
      checkpatch: handle token pasting better · e20122ff
      Paolo Bonzini 提交于
      The mechanism to find possible type tokens can sometimes be confused and go into an
      infinite loop.  This happens for example in QEMU for a line that looks like
      
               uint## BITS ##_t S = _S, T = _T;                            \
               uint## BITS ##_t as, at, xs, xt, xd;                        \
      
      Because the token pasting operator does not have a space before _t, it does not
      match $notPermitted.  However, (?x) is turned on in the regular expression for
      modifiers, and thus ##_t matches the empty string.  As a result, annotate_values
      goes in an infinite loop.
      
      The solution is simply to remove token pasting operators from the string before
      looking for modifiers.  In the example above, the string uintBITS_t will be
      evaluated as a candidate modifier.  This is not optimal, but it works as long
      as people do not write things like a##s##m, and it fits nicely into sub
      possible.
      
      For a similar reason, \# should be rejected always, even if it is not
      at end of line or followed by whitespace.
      
      The same patch was sent to the Linux kernel mailing list.
      Reported-by: NAleksandar Markovic <amarkovic@wavecomp.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e20122ff
  14. 02 7月, 2018 1 次提交
  15. 23 5月, 2018 1 次提交
  16. 10 5月, 2018 5 次提交
  17. 09 5月, 2018 1 次提交
  18. 26 4月, 2018 1 次提交
    • I
      checkpatch: Add xendevicemodel_handle to the list of types · 5ac067a2
      Ian Jackson 提交于
      This avoids checkpatch misparsing (as statements) long function
      definitions or declarations, which sometimes start with constructs
      like this:
      
        static inline int xendevicemodel_relocate_memory(
            xendevicemodel_handle *dmod, domid_t domid, ...
      
      The type xendevicemodel_handle does not conform to Qemu CODING_STYLE,
      which would suggest CamelCase.  However, it is a type defined by the
      Xen Project in xen.git.  It would be possible to introduce a typedef
      to allow the qemu code to refer to it by a differently-spelled name,
      but that would obfuscate more than it would clarify.
      
      CC: Eric Blake <eblake@redhat.com>
      CC: Paolo Bonzini <pbonzini@redhat.com>
      CC: Daniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NIan Jackson <Ian.Jackson@eu.citrix.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      5ac067a2
  19. 05 4月, 2018 1 次提交
  20. 12 3月, 2018 1 次提交
  21. 06 3月, 2018 2 次提交
  22. 22 1月, 2018 1 次提交
  23. 16 1月, 2018 1 次提交
    • E
      checkpatch: Enforce proper do/while (0) style · f4bdc13e
      Eric Blake 提交于
      Use of a loop construct for code that is not intended to repeat
      does not make much idiomatic sense, except in one place: it is a
      common usage in macros in order to wrap arbitrary code with
      single-statement semantics.  But when used in a macro, it is more
      typical for the caller to supply the trailing ';' when calling
      the macro.
      
      Although qemu coding style frowns on bare:
        if (cond)
          statement1;
        else
          statement2;
      where extra semicolons actually cause syntax errors, we still
      want our macro styles to be easily copied to other projects.
      Thus, declare it an error if we encounter any form of 'while (0)'
      with a semicolon in the same line.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20171201232433.25193-8-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f4bdc13e
  24. 21 12月, 2017 1 次提交
  25. 19 10月, 2017 1 次提交
  26. 12 10月, 2017 1 次提交
  27. 05 10月, 2017 1 次提交
  28. 19 9月, 2017 2 次提交
    • G
      checkpatch: add hwaddr to @typeList · 825bfa00
      Greg Kurz 提交于
      The script doesn't know about all possible types and learn them as
      it parses the code. If it reaches a line with a type cast but the
      type isn't known yet, it is misinterpreted as an identifier.
      
      For example the following line:
      
          foo = (hwaddr) -1;
      
      results in the following false-positive to be reported:
      
      ERROR: spaces required around that '-' (ctx:VxV)
      
      Let's add this standard QEMU type to the list of pre-known types.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Message-Id: <150538015789.8149.10902725348939486674.stgit@bahia.lan>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      825bfa00
    • D
      scripts: let checkpatch.pl process an entire GIT branch · 8e1fe175
      Daniel P. Berrange 提交于
      Currently before submitting a series, devs should run checkpatch.pl
      across each patch to be submitted. This can be automated using a
      command such as:
      
        git rebase -i master -x 'git show | ./scripts/checkpatch.pl -'
      
      This is rather long winded to type, so this patch introduces a way
      to tell checkpatch.pl to validate a series of GIT revisions.
      
      There are now three modes it can operate in 1) check a patch 2) check a source
      file, or 3) check a git branch.
      
      If no flags are given, the mode is determined by checking the args passed to
      the command. If the args contain a literal ".." it is treated as a GIT revision
      list. If the args end in ".patch" or equal "-" it is treated as a patch file.
      Otherwise it is treated as a source file.
      
      This automatic guessing can be overridden using --[no-]patch --[no-]file or
      --[no-]branch
      
      For example to check a GIT revision list:
      
          $ ./scripts/checkpatch.pl master..
          total: 0 errors, 0 warnings, 297 lines checked
      
          b886d352a2bf58f0996471fb3991a138373a2957 has no obvious style problems and is ready for submission.
          total: 0 errors, 0 warnings, 182 lines checked
      
          2a731f9a9ce145e0e0df6d42dd2a3ce4dfc543fa has no obvious style problems and is ready for submission.
          total: 0 errors, 0 warnings, 102 lines checked
      
          11844169bcc0c8ed4449eb3744a69877ed329dd7 has no obvious style problems and is ready for submission.
      
      If a genuine patch filename contains the characters '..' it is
      possible to force interpretation of the arg as a patch
      
        $ ./scripts/checkpatch.pl --patch master..
      
      will force it to load a patch file called "master..", or equivalently
      
        $ ./scripts/checkpatch.pl --no-branch master..
      
      will simply turn off guessing of GIT revision lists.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <20170913091000.9005-1-berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      8e1fe175
  29. 01 8月, 2017 1 次提交
  30. 13 7月, 2017 1 次提交