@@ -1363,7 +1363,7 @@ sub process {
# Check for incorrect file permissions
if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) {
my $permhere = $here . "FILE: $realfile\n";
- if ($realfile =~ /(Makefile|Kconfig|\.c|\.cpp|\.h|\.S|\.tmpl)$/) {
+ if ($realfile =~ /(Makefile|Kconfig|\.c|\.cc|\.cpp|\.h|\.S|\.tmpl)$/) {
ERROR("do not set execute permissions for source files\n" . $permhere);
}
}
@@ -1460,7 +1460,7 @@ sub process {
}
# check we are in a valid source file if not then ignore this hunk
- next if ($realfile !~ /\.(h|c|cpp|s|S|pl|sh)$/);
+ next if ($realfile !~ /\.(h|c|cc|cpp|s|S|pl|sh)$/);
#80 column limit
if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
@@ -1495,7 +1495,7 @@ sub process {
}
# check we are in a valid source file C or perl if not then ignore this hunk
- next if ($realfile !~ /\.(h|c|cpp|pl)$/);
+ next if ($realfile !~ /\.(h|c|cc|cpp|pl)$/);
# in QEMU, no tabs are allowed
if ($rawline =~ /^\+.*\t/) {
@@ -1505,7 +1505,7 @@ sub process {
}
# check we are in a valid C source file if not then ignore this hunk
- next if ($realfile !~ /\.(h|c|cpp)$/);
+ next if ($realfile !~ /\.(h|c|cc|cpp)$/);
# check for RCS/CVS revision markers
if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) {
@@ -1792,7 +1792,7 @@ sub process {
}
# no C99 // comments
- if ($line =~ m{//}) {
+ if (($line =~ m{//}) && !($realfile =~ /(\.cc|\.cpp)$/)) {
ERROR("do not use C99 // comments\n" . $herecurr);
}
# Remove C99 comments.
@@ -1970,7 +1970,7 @@ sub process {
{
# Ignore 'catch (...)' in C++
- } elsif ($name =~ /^catch$/ && $realfile =~ /(\.cpp|\.h)$/) {
+ } elsif ($name =~ /^catch$/ && $realfile =~ /(\.cc|\.cpp|\.h)$/) {
# cpp #define statements have non-optional spaces, ie
# if there is a space between the name and the open
@@ -2067,7 +2067,7 @@ sub process {
# Ignore : used in class declaration in C++
} elsif ($opv eq ':B' && $ctx =~ /Wx[WE]/ &&
- $line =~ /class/ && $realfile =~ /(\.cpp|\.h)$/) {
+ $line =~ /class/ && $realfile =~ /(\.cc|\.cpp|\.h)$/) {
# No spaces for:
# ->
@@ -2095,7 +2095,7 @@ sub process {
} elsif ($op eq '!' || $op eq '~' ||
$opv eq '*U' || $opv eq '-U' ||
$opv eq '&U' || $opv eq '&&U') {
- if ($op eq '~' && $ca =~ /::$/ && $realfile =~ /(\.cpp|\.h)$/) {
+ if ($op eq '~' && $ca =~ /::$/ && $realfile =~ /(\.cc|\.cpp|\.h)$/) {
# '~' used as a name of Destructor
} elsif ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
@@ -2145,7 +2145,7 @@ sub process {
} elsif ($ctx !~ /[EWC]x[CWE]/) {
my $ok = 0;
- if ($realfile =~ /\.cpp|\.h$/) {
+ if ($realfile =~ /\.cc|\.cpp|\.h$/) {
# Ignore template arguments <...> in C++
if (($op eq '<' || $op eq '>') && $line =~ /<.*>/) {
$ok = 1;
QEMU uses both *.cc and *.cpp for some files with C++ code: disas/libvixl/utils.cc disas/libvixl/a64/disasm-a64.cc disas/libvixl/a64/instructions-a64.cc disas/libvixl/a64/decoder-a64.cc disas/arm-a64.cc qga/vss-win32/provider.cpp qga/vss-win32/install.cpp qga/vss-win32/requester.cpp *.cpp files were already checked. Add the cc pattern, so *.cc are checked now, too. Comments with // are quite common in C++ code, so don't forbid them. Signed-off-by: Stefan Weil <sw@weilnetz.de> --- The current *.cc files now trigger several warnings and errors, but that's not a good reason why they should be suppressed. Regards, Stefan Weil scripts/checkpatch.pl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)