From 1e817245783307fd30de71d9e3dc74df6ad20b05 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 7 Jan 2024 09:14:13 -0700 Subject: [PATCH] checkstyle9: Remove irrelevant stuff from qemu Remove some qemu project specific things we don't care about o Remove python interpreter check o Remove linux header check o Remove trace file specail treatment o Add $FreeBSD$ tag additions o Remove some experiemntal code we won't need o Remove commented out initializer code that we don't explicitly have a rule for. Sponsored by: Netflix --- tools/build/checkstyle9.pl | 64 ++------------------------------------ 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/tools/build/checkstyle9.pl b/tools/build/checkstyle9.pl index aadf6ee152c5..d2c6ea77868d 100755 --- a/tools/build/checkstyle9.pl +++ b/tools/build/checkstyle9.pl @@ -170,8 +170,6 @@ if ($color =~ /^always$/i) { my $dbg_values = 0; my $dbg_possible = 0; -my $dbg_type = 0; -my $dbg_attr = 0; my $dbg_adv_dcs = 0; my $dbg_adv_checking = 0; my $dbg_adv_apw = 0; @@ -1436,17 +1434,12 @@ sub process { } } -# Only allow Python 3 interpreter - if ($realline == 1 && - $line =~ /^\+#!\ *\/usr\/bin\/(?:env )?python$/) { - ERROR("please use python3 interpreter\n" . $herecurr); - } - # Accept git diff extended headers as valid patches if ($line =~ /^(?:rename|copy) (?:from|to) [\w\/\.\-]+\s*$/) { $is_patch = 1; } +# Filter out bad email addresses. if ($line =~ /^(Author|From): .*noreply.*/) { ERROR("Real email adress is needed\n" . $herecurr); } @@ -1512,9 +1505,6 @@ sub process { # ignore non-hunk lines and lines being removed next if (!$hunk_line || $line =~ /^-/); -# ignore files that are being periodically imported from Linux - next if ($realfile =~ /^(linux-headers|include\/standard-headers)\//); - #trailing whitespace if ($line =~ /^\+.*\015/) { my $herevet = "$here\n" . cat_vet($rawline) . "\n"; @@ -1536,26 +1526,6 @@ sub process { $rpt_cleaners = 1; } -# checks for trace-events files - if ($realfile =~ /trace-events$/ && $line =~ /^\+/) { - if ($rawline =~ /%[-+ 0]*#/) { - ERROR("Don't use '#' flag of printf format ('%#') in " . - "trace-events, use '0x' prefix instead\n" . $herecurr); - } else { - my $hex = - qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/; - - # don't consider groups splitted by [.:/ ], like 2A.20:12ab - my $tmpline = $rawline; - $tmpline =~ s/($hex[.:\/ ])+$hex//g; - - if ($tmpline =~ /(? 1 && $line =~ /^.+($Declare)/) { - ERROR("TEST: is not type ($1 is)\n". $herecurr); - } - next; - } -# TEST: allow direct testing of the attribute matcher. - if ($dbg_attr) { - if ($line =~ /^.\s*$Modifier\s*$/) { - ERROR("TEST: is attr\n" . $herecurr); - } elsif ($dbg_attr > 1 && $line =~ /^.+($Modifier)/) { - ERROR("TEST: is not attr ($1 is)\n". $herecurr); - } - next; - } - # check for initialisation to aggregates open brace on the next line if ($line =~ /^.\s*\{/ && $prevline =~ /(?:^|[^=])=\s*$/) { @@ -1928,17 +1879,6 @@ sub process { $line =~ s@//.*@@; $opline =~ s@//.*@@; -# check for global initialisers. -# if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { -# ERROR("do not initialise globals to 0 or NULL\n" . -# $herecurr); -# } -# check for static initialisers. -# if ($line =~ /\bstatic\s.*=\s*(0|NULL|false)\s*;/) { -# ERROR("do not initialise statics to 0 or NULL\n" . -# $herecurr); -# } - # * goes on variable not on type # (char*[ const]) if ($line =~ m{\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\)}) {