Bernhard Beschow and Peter Maydell
9a86e023aa
checkpatch: Ensure that TypeInfos are const
...
Now that all static TypeInfo instances are declared const, prevent that
new non-const instances are created.
Signed-off-by: Bernhard Beschow <shentey@gmail.com >
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org >
Message-id: 20220117145805.173070-3-shentey@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2022-02-21 13:30:20 +00:00
Michael Tokarev and Alex Bennée
9e8be4c546
drop libxml2 checks since libxml is not actually used (for parallels)
...
For a long time, we assumed that libxml2 is necessary for parallels
block format support (block/parallels*). However, this format actually
does not use libxml [*]. Since this is the only user of libxml2 in
whole QEMU tree, we can drop all libxml2 checks and dependencies too.
It is even more: --enable-parallels configure option was the only
option which was silently ignored when it's (fake) dependency
(libxml2) isn't installed.
Drop all mentions of libxml2.
[*] Actually the basis for libxml use were introduced in commit
ed279a06c5 ("configure: add dependency") but the implementation
was never merged:
https://lore.kernel.org/qemu-devel/70227bbd-a517-70e9-714f-e6e0ec431be9@openvz.org/
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru >
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com >
Message-Id: <20220119090423.149315-1-mjt@msgid.tls.msk.ru >
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org >
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org >
[PMD: Updated description and adapted to use lcitool]
Reviewed-by: Thomas Huth <thuth@redhat.com >
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20220121154134.315047-5-f4bug@amsat.org >
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com >
Message-Id: <20220204204335.1689602-9-alex.bennee@linaro.org >
2022-02-09 12:08:42 +00:00
Philippe Mathieu-Daudé and Laurent Vivier
ce2ff9cccf
checkpatch: Do not allow deprecated g_memdup()
...
g_memdup() is insecure and as been deprecated in GLib 2.68.
QEMU provides the safely equivalent g_memdup2() wrapper.
Do not allow more g_memdup() calls in the repository, provide
a hint to use g_memdup2().
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com >
Reviewed-by: Eric Blake <eblake@redhat.com >
Message-Id: <20210903174510.751630-29-philmd@redhat.com >
Signed-off-by: Laurent Vivier <laurent@vivier.eu >
2021-12-17 11:57:35 +01:00
Alex Bennée
66cf70149a
scripts/checkpatch: roll diff tweaking into checkpatch itself
...
Rather than relying on external tweaks lets just do it inside
checkpatch's direct commitish handling which is QEMU specific code
anyway.
Suggested-by: Daniel P. Berrangé <berrange@redhat.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com >
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
Reviewed-by: Willian Rampazzo <willianr@redhat.com >
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com >
Message-Id: <20210623102749.25686-4-alex.bennee@linaro.org >
2021-06-25 10:08:33 +01:00
Matheus Ferst and Alex Bennée
72205289a0
scripts/checkpatch.pl: process .c.inc and .h.inc files as C source
...
Change the regex used to determine whether a file should be processed as
C source to include .c.inc and .h.inc extensions.
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br >
Reviewed-by: Luis Pires <luis.pires@eldorado.org.br >
Message-Id: <20210520195142.941261-1-matheus.ferst@eldorado.org.br >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
2021-06-07 14:49:30 +01:00
Greg Kurz and Michael S. Tsirkin
43bea44357
checkpatch: Fix use of uninitialized value
...
checkfilename() doesn't always set $acpi_testexpected. Fix the following
warning:
Use of uninitialized value $acpi_testexpected in string eq at
./scripts/checkpatch.pl line 1529.
Fixes: d2f1af0e41 ("checkpatch: don't emit warning on newly created acpi data files")
Cc: isaku.yamahata@intel.com
Signed-off-by: Greg Kurz <groug@kaod.org >
Message-Id: <161786467973.295167.5612704777283969903.stgit@bahia.lan >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-05-14 10:26:18 -04:00
Isaku Yamahata and Michael S. Tsirkin
d2f1af0e41
checkpatch: don't emit warning on newly created acpi data files
...
Newly created acpi data files(tests/data/acpi/) cause false positive
warning.
If file names are acpi expected file, don't emit warning.
Fixes: e625ba2a41 ("checkpatch: fix acpi check with multiple file name")
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com >
Message-Id: <6899f9ad54cab8e7deca94ff0eeab641680e2b5e.1613615732.git.isaku.yamahata@intel.com >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2021-02-23 10:58:42 -05:00
Thomas Huth
7b59d10e23
scripts/checkpatch: Improve the check for authors mangled by the mailing list
...
There were recently some patches on the list which had their "From:"
line mangled like this:
From: qemu_oss--- via <qemu-devel@nongnu.org >
Since our test in the checkpatch.pl script did not trigger here, the
patches finally also ended up in a pull request, with the wrong author
set. So let's improve the regular expression to also complain on
these new patterns, too.
Message-Id: <20210216071512.1199827-1-thuth@redhat.com >
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com >
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com >
Signed-off-by: Thomas Huth <thuth@redhat.com >
2021-02-19 06:29:05 +01:00
Alex Bennée
9e5acb373d
scripts/checkpatch.pl: fix git-show invocation to include diffstat
...
Without this checkpatch keeps complaining about new/changed files even
when MAINTAINERS has been updated. Normal invocations of checkpatch on
patch files rather than commit IDs are unaffected.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com >
Reviewed-by: Willian Rampazzo <willianr@redhat.com >
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com >
Message-Id: <20210114165730.31607-13-alex.bennee@linaro.org >
2021-01-18 10:04:31 +00:00
Daniel P. Berrangé and Alex Bennée
2d4274d6fe
scripts: fix error from checkpatch.pl when no commits are found
...
The error message was supposed to mention the input revision list start
point, not the branch flag.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20201019143537.283094-3-berrange@redhat.com >
Message-Id: <20201021163136.27324-6-alex.bennee@linaro.org >
2020-10-27 09:53:50 +00:00
Dov Murik and Paolo Bonzini
bfac6d1933
checkpatch: Detect '%#' or '%0#' in printf-style format strings
...
According to the coding style document, we should use literal '0x' prefix
instead of printf's '#' flag (which appears as '%#' or '%0#' in the format
string). Add a checkpatch rule to enforce that.
Note that checkpatch already had a similar rule for trace-events files.
Example usage:
$ scripts/checkpatch.pl --file chardev/baum.c
...
ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead
#366 : FILE: chardev/baum.c:366:
+ DPRINTF("Broken packet %#2x, tossing\n", req); \
...
ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead
#472 : FILE: chardev/baum.c:472:
+ DPRINTF("unrecognized request %0#2x\n", req);
...
Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com >
Message-Id: <20200914172623.72955-1-dovmurik@linux.vnet.ibm.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com >
2020-09-30 19:11:36 +02:00
Stefano Garzarella and Paolo Bonzini
fb4176d0e8
checkpatch: avoid error on cover letter files
...
Running checkpatch on a directory that contains a cover letter reports
this error:
Checking /tmp/tmpbnngauy3/0000-cover-letter.patch...
ERROR: Does not appear to be a unified-diff format patch
total: 1 errors, 0 warnings, 0 lines checked
Let's skip cover letter as it is already done in the Linux kernel
commits 06330fc40e3f ("checkpatch: avoid NOT_UNIFIED_DIFF errors
on cover-letter.patch files") and a08ffbef4ab7 ("checkpatch: fix
ignoring cover-letter logic").
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com >
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com >
Message-Id: <20200917170212.92672-1-sgarzare@redhat.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2020-09-30 19:11:36 +02:00
Peter Maydell and Markus Armbruster
7a470a37b0
scripts/texi2pod: Delete unused script
...
We no longer need the texi2pod script, so we can delete it, and
the special-casing it had in the checkpatch script.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
Message-Id: <20200925162316.21205-19-peter.maydell@linaro.org >
Reviewed-by: Markus Armbruster <armbru@redhat.com >
Signed-off-by: Markus Armbruster <armbru@redhat.com >
2020-09-29 17:55:39 +02:00
zhaolichang and Laurent Vivier
65fdb3cc2e
scripts/: fix some comment spelling errors
...
I found that there are many spelling errors in the comments of qemu,
so I used the spellcheck tool to check the spelling errors
and finally found some spelling errors in the scripts folder.
Signed-off-by: zhaolichang <zhaolichang@huawei.com >
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Message-Id: <20200917075029.313-5-zhaolichang@huawei.com >
Signed-off-by: Laurent Vivier <laurent@vivier.eu >
2020-09-17 20:37:55 +02:00
Aleksandar Markovic and Paolo Bonzini
143a768c57
checkpatch: Change occurences of 'kernel' to 'qemu' in user messages
...
It is odd that we inform user that, for example, his current working
directory is not kernel root, when, in face, we mean qemu root.
Replace that and few other similar odd user messages.
Signed-off-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com >
Message-Id: <20200620133207.26849-3-aleksandar.qemu.devel@gmail.com >
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2020-07-10 18:02:23 -04:00
Michael S. Tsirkin and Paolo Bonzini
2046811c66
checkpatch: reversed logic with acpi test checks
...
Logic reversed: allowed list should just be ignored. Instead we
only take that into account :(
Fixes: e11b06a880 ("checkpatch: ignore allowed diff list")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Message-Id: <20200602053614.54745-1-mst@redhat.com >
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org >
Reviewed-by: Eric Auger <eric.auger@redhat.com >
Tested-by: Eric Auger <eric.auger@redhat.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2020-06-12 11:20:14 -04:00
Michael S. Tsirkin
e11b06a880
checkpatch: ignore allowed diff list
...
Allow changing allowed diff list at any point:
- when changing code under test
- when adding expected files
It's just a list of files so easy to review and merge anyway.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-05-04 10:25:02 -04:00
Michael S. Tsirkin
e625ba2a41
checkpatch: fix acpi check with multiple file name
...
Using global expected/nonexpected values causes
false positives when testing multiple patches in one
checkpatch run: one patch can change expected,
another one non-expected.
Use local variables within process() to fix that.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-05-04 10:25:02 -04:00
Michael S. Tsirkin
1c3c9a8c5a
checkpatch: enforce process for expected files
...
If the process documented in tests/qtest/bios-tables-test.c
is followed, then same patch never touches both expected
files and code. Teach checkpatch to enforce this rule.
Tested-by: Igor Mammedov <imammedo@redhat.com >
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2020-03-29 06:33:47 -04:00
Alexander Bulekov and Stefan Hajnoczi
bac068e064
softmmu: move vl.c to softmmu/
...
Move vl.c to a separate directory, similar to linux-user/
Update the chechpatch and get_maintainer scripts, since they relied on
/vl.c for top_of_tree checks.
Signed-off-by: Alexander Bulekov <alxndr@bu.edu >
Reviewed-by: Darren Kenny <darren.kenny@oracle.com >
Message-id: 20200220041118.23264-2-alxndr@bu.edu
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com >
2020-02-22 08:26:47 +00:00
Philippe Mathieu-Daudé and Laurent Vivier
ee0f3c09e0
scripts/checkpatch.pl: Detect superfluous semicolon in C code
...
Display error when a commit contains superfluous semicolon:
$ git show 6663a0a337 | scripts/checkpatch.pl -q -
ERROR: superfluous trailing semicolon
#276 : FILE: block/io_uring.c:186:
+ ret = -ENOSPC;;
total: 1 errors, 1 warnings, 485 lines checked
Reported-by: Luc Michel <luc.michel@greensocs.com >
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com >
Acked-by: Paolo Bonzini <pbonzini@redhat.com >
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com >
Reviewed-by: Juan Quintela <quintela@redhat.com >
Reviewed-by: Luc Michel <luc.michel@greensocs.com >
Message-Id: <20200218094402.26625-2-philmd@redhat.com >
Signed-off-by: Laurent Vivier <laurent@vivier.eu >
2020-02-18 20:20:49 +01:00
Philippe Mathieu-Daudé
bc7f3b0b0d
scripts/checkpatch.pl: Only allow Python 3 interpreter
...
Since commit ddf9069963 QEMU requires Python >= 3.5.
PEP 0394 [*] states that 'python3' should be available and
that 'python' is optional.
To avoid problem with unsupported versions, enforce the
shebang interpreter to Python 3.
[*] https://www.python.org/dev/peps/pep-0394/
Reported-by: John Snow <jsnow@redhat.com >
Acked-by: Paolo Bonzini <pbonzini@redhat.com >
Message-Id: <20200130163232.10446-2-philmd@redhat.com >
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com >
2020-02-07 15:12:48 +01:00
Alex Bennée
ca68668d27
scripts/checkpatch.pl: don't complain about (foo, /* empty */)
...
It's quite common to have a mini comment inside braces to acknowledge
we know it's empty. Expand the inline detection to allow closing
braces before the end of line.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Aaron Lindsay <aaron@os.amperecomputing.com >
2019-10-28 15:12:38 +00:00
Wei Yang and Paolo Bonzini
e31db8aabe
checkpatch: suggest qemu_real_host_page_size instead of getpagesize() or sysconf(_SC_PAGESIZE)
...
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com >
CC: Richard Henderson <richard.henderson@linaro.org >
CC: Stefan Hajnoczi <stefanha@redhat.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com >
Message-Id: <20191017004633.13229-1-richardw.yang@linux.intel.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
2019-10-23 17:50:27 +02:00
Daniel P. Berrangé
336a7451e8
docs: convert README, CODING_STYLE and HACKING to RST syntax
...
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com >
2019-09-05 14:27:06 +01:00