diff options
author | Dov Murik <dovmurik@linux.vnet.ibm.com> | 2020-09-14 17:26:23 +0000 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-09-30 19:11:36 +0200 |
commit | bfac6d1933a5fd8198e622dfd19196c2cc6cf74b (patch) | |
tree | 319e49fc2bc73b5ee2ee317ab204df3e797d1c7e /target | |
parent | c8ed1cd7843c17a264dd578b3220c6398904858a (diff) |
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>
Diffstat (limited to 'target')
0 files changed, 0 insertions, 0 deletions