1. 27 Nov, 2018 1 commit
  2. 31 Oct, 2018 1 commit
  3. 23 Aug, 2018 2 commits
  4. 06 Jul, 2018 1 commit
    • Paolo Bonzini's avatar
      checkpatch: handle token pasting better · e20122ff
      Paolo Bonzini authored
      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: 's avatarAleksandar Markovic <amarkovic@wavecomp.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
      e20122ff
  5. 02 Jul, 2018 1 commit
  6. 22 May, 2018 1 commit
  7. 10 May, 2018 5 commits
  8. 08 May, 2018 1 commit
  9. 26 Apr, 2018 1 commit
    • Ian Jackson's avatar
      checkpatch: Add xendevicemodel_handle to the list of types · 5ac067a2
      Ian Jackson authored
      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: 's avatarIan Jackson <Ian.Jackson@eu.citrix.com>
      Reviewed-by: 's avatarEric Blake <eblake@redhat.com>
      5ac067a2
  10. 05 Apr, 2018 1 commit
  11. 12 Mar, 2018 1 commit
  12. 06 Mar, 2018 2 commits
  13. 22 Jan, 2018 1 commit
  14. 16 Jan, 2018 1 commit
    • Eric Blake's avatar
      checkpatch: Enforce proper do/while (0) style · f4bdc13e
      Eric Blake authored
      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: 's avatarEric Blake <eblake@redhat.com>
      Message-Id: <20171201232433.25193-8-eblake@redhat.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
      f4bdc13e
  15. 21 Dec, 2017 1 commit
  16. 19 Oct, 2017 1 commit
  17. 12 Oct, 2017 1 commit
  18. 05 Oct, 2017 1 commit
  19. 19 Sep, 2017 2 commits
    • Greg Kurz's avatar
      checkpatch: add hwaddr to @typeList · 825bfa00
      Greg Kurz authored
      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: 's avatarGreg Kurz <groug@kaod.org>
      Message-Id: <150538015789.8149.10902725348939486674.stgit@bahia.lan>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
      825bfa00
    • Daniel P. Berrange's avatar
      scripts: let checkpatch.pl process an entire GIT branch · 8e1fe175
      Daniel P. Berrange authored
      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: 's avatarDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <20170913091000.9005-1-berrange@redhat.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
      8e1fe175
  20. 01 Aug, 2017 1 commit
  21. 13 Jul, 2017 2 commits
  22. 04 Jul, 2017 1 commit
  23. 10 May, 2017 1 commit
    • Kamil Rytarowski's avatar
      scripts: Switch to more portable Perl shebang · b7d5a9c2
      Kamil Rytarowski authored
      The default NetBSD package manager is pkgsrc and it installs Perl
      along other third party programs under custom and configurable prefix.
      The default prefix for binary prebuilt packages is /usr/pkg, and the
      Perl executable lands in /usr/pkg/bin/perl.
      
      This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's
      the most portable solution that should work for almost everybody.
      Perl's executable is detected automatically.
      
      This change switches -w option passed to the executable with more
      modern "use warnings;" approach. There is no functional change to the
      default behavior.
      Signed-off-by: 's avatarKamil Rytarowski <n54@gmx.com>
      Reviewed-by: 's avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: 's avatarMichael Tokarev <mjt@tls.msk.ru>
      b7d5a9c2
  24. 05 May, 2017 1 commit
    • Dr. David Alan Gilbert's avatar
      checkpatch: Disallow glib asserts in main code · 6e938956
      Dr. David Alan Gilbert authored
      Glib commit a6a875068779 (from 2013) made many of the glib assert
      macros non-fatal if a flag is set.
      This causes two problems:
        a) Compilers moan that your code is unsafe even though you've
           put an assert in before the point of use.
        b) Someone evil could, in a library, call
           g_test_set_nonfatal_assertions() and cause our assertions in
           important places not to fail and potentially allow memory overruns.
      
      Ban most of the glib assertion functions (basically everything except
      g_assert and g_assert_not_reached) except in tests/
      
      This makes checkpatch gives an error such as:
      
        ERROR: Use g_assert or g_assert_not_reached
        #77: FILE: vl.c:4725:
        +    g_assert_cmpstr("Chocolate", >, "Cheese");
      Signed-off-by: 's avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20170427165526.19836-1-dgilbert@redhat.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
      6e938956
  25. 02 Nov, 2016 1 commit
  26. 01 Nov, 2016 1 commit
  27. 27 Sep, 2016 1 commit
  28. 13 Sep, 2016 1 commit
  29. 10 Aug, 2016 4 commits