From nobody Thu Apr 18 05:43:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538740096330608.9053455316149; Fri, 5 Oct 2018 04:48:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B17381101; Fri, 5 Oct 2018 11:48:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0394020155EF; Fri, 5 Oct 2018 11:48:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 99100180B5B7; Fri, 5 Oct 2018 11:48:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w95BmCLp013161 for ; Fri, 5 Oct 2018 07:48:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 716436A74A; Fri, 5 Oct 2018 11:48:12 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C361F60191 for ; Fri, 5 Oct 2018 11:48:11 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Fri, 5 Oct 2018 13:48:06 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] syntax-check: revert indentation checks X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 05 Oct 2018 11:48:14 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Recent patches added indentation checks that discovered some cosmetic issues at the cost of making this check last as long as the rest of syntax-check combined on my system. Also, they're moving closer to us implementing yet another C parser (docs/apibuild.py being the other one). Revert the following commits: commit 11e1f11dd34f2688169c63c13ea8d99a64724369 syntax-check: Check for incorrect indentation in function body commit 2585a79e32e8b0d994ab35fd7c641eb9b96632e3 build-aux:check-spacing: Introduce a new rule to check misaligned stuff= in parenthesises commit a033182f042a07ffbd4b9a50418670778ceddbf3 build-aux:check-spacing: Add wrapper function of CheckCurlyBrackets commit 6225626b6f0a4817d1f17de0bc5200c5d7986a3e build-aux:check-spacing: Add wrapper function of CheckWhiteSpaces commit c3875129d9bd094ffe90d54fbec86624ae88c40b build-aux:check-spacing: Add wrapper function of KillComments commit e995904c5691be3c21f4c6dbc1f067fe0c8e8515 build-aux:check-spacing: Add wrapper function of CheckFunctionBody commit 11e1f11dd34f2688169c63c13ea8d99a64724369 syntax-check: Check for incorrect indentation in function body This brings the speed of the script to a tolerable level and lets it focus on the more visible issues. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Erik Skultety --- build-aux/check-spacing.pl | 460 ++++++++++++++---------------------------= ---- 1 file changed, 142 insertions(+), 318 deletions(-) diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl index d36b004abf..ca8b434916 100755 --- a/build-aux/check-spacing.pl +++ b/build-aux/check-spacing.pl @@ -23,356 +23,180 @@ use strict; use warnings; =20 -# -# CheckFunctionBody: -# $_[0]: $data(in) -# $_[1]: $location(in), which format is file-path:line-num:line-code -# $_[2]: $fn_linenum(inout), maintains start line-num of function body -# Returns 0 in case of success or 1 on failure -# -# Check incorrect indentation and blank first line in function body. -# For efficiency, it only checks the first line of function body. -# But it's enough for most cases. -# (It could be better that we use *state* to declare @fn_linenum and -# move it into this subroutine. But *state* requires version >=3D v5.10.) -# -sub CheckFunctionBody { - my $ret =3D 0; - my ($data, $location, $fn_linenum) =3D @_; +my $ret =3D 0; +my $incomment =3D 0; =20 - # Check first line of function block - if ($$fn_linenum) { - if ($$data =3D~ /^\s*$/) { - print "Blank line before content in function body:\n$$location= "; - $ret =3D 1; - } elsif ($$data !~ /^[ ]{4}\S/) { - unless ($$data =3D~ /^[ ]\w+:$/ || $$data =3D~ /^}/) { - print "Incorrect indentation in function body:\n$$location= "; - $ret =3D 1; - } - } - $$fn_linenum =3D 0; - } +foreach my $file (@ARGV) { + # Per-file variables for multiline Curly Bracket (cb_) check + my $cb_linenum =3D 0; + my $cb_code =3D ""; + my $cb_scolon =3D 0; =20 - # Detect start of function block - if ($$data =3D~ /^{$/) { - $$fn_linenum =3D $.; - } + open FILE, $file; =20 - return $ret; -} + while (defined (my $line =3D )) { + my $data =3D $line; + # For temporary modifications + my $tmpdata; =20 -# -# KillComments: -# $_[0]: $data(inout) -# $_[1]: $incomment(inout) -# -# Remove all content of comments -# (Also, the @incomment could be declared with *state* and move it in.) -# -sub KillComments { - my ($data, $incomment) =3D @_; + # Kill any quoted , ; =3D or " + $data =3D~ s/'[";,=3D]'/'X'/g; =20 - # Kill contents of multi-line comments - # and detect end of multi-line comments - if ($$incomment) { - if ($$data =3D~ m,\*/,) { - $$incomment =3D 0; - $$data =3D~ s,^.*\*/,*/,; - } else { - $$data =3D ""; - } - } + # Kill any quoted strings + $data =3D~ s,"(?:[^\\\"]|\\.)*","XXX",g; =20 - # Kill single line comments, and detect - # start of multi-line comments - if ($$data =3D~ m,/\*.*\*/,) { - $$data =3D~ s,/\*.*\*/,/* */,; - } elsif ($$data =3D~ m,/\*,) { - $$incomment =3D 1; - $$data =3D~ s,/\*.*,/*,; - } + # Kill any C++ style comments + $data =3D~ s,//.*$,//,; =20 - return; -} + next if $data =3D~ /^#/; =20 -# -# CheckWhiteSpaces: -# $_[0]: $data(in) -# $_[1]: $location(in), which format is file-path:line-num:line-code -# Returns 0 in case of success or 1 on failure -# -# Check whitespaces according to code spec of libvirt. -# -sub CheckWhiteSpaces { - my $ret =3D 0; - my ($data, $location) =3D @_; + # Kill contents of multi-line comments + # and detect end of multi-line comments + if ($incomment) { + if ($data =3D~ m,\*/,) { + $incomment =3D 0; + $data =3D~ s,^.*\*/,*/,; + } else { + $data =3D ""; + } + } =20 - # We need to match things like - # - # int foo (int bar, bool wizz); - # foo (bar, wizz); - # - # but not match things like: - # - # typedef int (*foo)(bar wizz) - # - # we can't do this (efficiently) without - # missing things like - # - # foo (*bar, wizz); - # - # We also don't want to spoil the $data so it can be used - # later on. + # Kill single line comments, and detect + # start of multi-line comments + if ($data =3D~ m,/\*.*\*/,) { + $data =3D~ s,/\*.*\*/,/* */,; + } elsif ($data =3D~ m,/\*,) { + $incomment =3D 1; + $data =3D~ s,/\*.*,/*,; + } =20 - # For temporary modifications - my $tmpdata =3D $$data; - while ($tmpdata =3D~ /(\w+)\s\((?!\*)/) { - my $kw =3D $1; + # We need to match things like + # + # int foo (int bar, bool wizz); + # foo (bar, wizz); + # + # but not match things like: + # + # typedef int (*foo)(bar wizz) + # + # we can't do this (efficiently) without + # missing things like + # + # foo (*bar, wizz); + # + # We also don't want to spoil the $data so it can be used + # later on. + $tmpdata =3D $data; + while ($tmpdata =3D~ /(\w+)\s\((?!\*)/) { + my $kw =3D $1; + + # Allow space after keywords only + if ($kw =3D~ /^(?:if|for|while|switch|return)$/) { + $tmpdata =3D~ s/(?:$kw\s\()/XXX(/; + } else { + print "Whitespace after non-keyword:\n"; + print "$file:$.: $line"; + $ret =3D 1; + last; + } + } =20 - # Allow space after keywords only - if ($kw =3D~ /^(?:if|for|while|switch|return)$/) { - $tmpdata =3D~ s/(?:$kw\s\()/XXX(/; - } else { - print "Whitespace after non-keyword:\n$$location"; + # Require whitespace immediately after keywords + if ($data =3D~ /\b(?:if|for|while|switch|return)\(/) { + print "No whitespace after keyword:\n"; + print "$file:$.: $line"; $ret =3D 1; - last; } - } =20 - # Require whitespace immediately after keywords - if ($$data =3D~ /\b(?:if|for|while|switch|return)\(/) { - print "No whitespace after keyword:\n$$location"; - $ret =3D 1; - } - - # Forbid whitespace between )( of a function typedef - if ($$data =3D~ /\(\*\w+\)\s+\(/) { - print "Whitespace between ')' and '(':\n$$location"; - $ret =3D 1; - } - - # Forbid whitespace following ( or prior to ) - # but allow whitespace before ) on a single line - # (optionally followed by a semicolon) - if (($$data =3D~ /\s\)/ && not $$data =3D~ /^\s+\);?$/) || - $$data =3D~ /\((?!$)\s/) { - print "Whitespace after '(' or before ')':\n$$location"; - $ret =3D 1; - } - - # Forbid whitespace before ";" or ",". Things like below are allowed: - # - # 1) The expression is empty for "for" loop. E.g. - # for (i =3D 0; ; i++) - # - # 2) An empty statement. E.g. - # while (write(statuswrite, &status, 1) =3D=3D -1 && - # errno =3D=3D EINTR) - # ; - # - if ($$data =3D~ /\s[;,]/) { - unless ($$data =3D~ /\S; ; / || - $$data =3D~ /^\s+;/) { - print "Whitespace before semicolon or comma:\n$$location"; + # Forbid whitespace between )( of a function typedef + if ($data =3D~ /\(\*\w+\)\s+\(/) { + print "Whitespace between ')' and '(':\n"; + print "$file:$.: $line"; $ret =3D 1; } - } - - # Require EOL, macro line continuation, or whitespace after ";". - # Allow "for (;;)" as an exception. - if ($$data =3D~ /;[^ \\\n;)]/) { - print "Invalid character after semicolon:\n$$location"; - $ret =3D 1; - } - - # Require EOL, space, or enum/struct end after comma. - if ($$data =3D~ /,[^ \\\n)}]/) { - print "Invalid character after comma:\n$$location"; - $ret =3D 1; - } - - # Require spaces around assignment '=3D', compounds and '=3D=3D' - if ($$data =3D~ /[^ ]\b[!<>&|\-+*\/%\^=3D]?=3D/ || - $$data =3D~ /=3D[^=3D \\\n]/) { - print "Spacing around '=3D' or '=3D=3D':\n$$location"; - $ret =3D 1; - } - - return $ret; -} =20 -# -# CheckCurlyBrackets: -# $_[0]: $data(in) -# $_[1]: $file(in) -# $_[2]: $line(in) -# $_[3]: $cb_linenum(inout) -# $_[4]: $cb_code(inout) -# $_[5]: $cb_scolon(inout) -# Returns 0 in case of success or 1 on failure -# -# Check whitespaces according to code spec of libvirt. -# -sub CheckCurlyBrackets { - my $ret =3D 0; - my ($data, $file, $line, $cb_linenum, $cb_code, $cb_scolon) =3D @_; - - # One line conditional statements with one line bodies should - # not use curly brackets. - if ($$data =3D~ /^\s*(if|while|for)\b.*\{$/) { - $$cb_linenum =3D $.; - $$cb_code =3D $$line; - $$cb_scolon =3D 0; - } - - # We need to check for exactly one semicolon inside the body, - # because empty statements (e.g. with comment only) are - # allowed - if ($$cb_linenum =3D=3D $. - 1 && $$data =3D~ /^[^;]*;[^;]*$/) { - $$cb_code .=3D $$line; - $$cb_scolon =3D 1; - } - - if ($$data =3D~ /^\s*}\s*$/ && - $$cb_linenum =3D=3D $. - 2 && - $$cb_scolon) { - - print "Curly brackets around single-line body:\n"; - print "$$file:$$cb_linenum-$.:\n$$cb_code$$line"; - $ret =3D 1; - - # There _should_ be no need to reset the values; but to - # keep my inner peace... - $$cb_linenum =3D 0; - $$cb_scolon =3D 0; - $$cb_code =3D ""; - } - - return $ret; -} - -# -# CheckMisalignment: -# $_[0]: $data(in) -# $_[1]: $file(in) -# $_[2]: $line(in) -# $_[3]: @paren_stack(inout), which maintains information -# of the parenthesis -# Returns 0 in case of success or 1 on failure -# -# Check misaligned stuff in parenthesis: -# 1. For misaligned arguments of function -# 2. For misaligned conditions of [if|while|switch|...] -# -sub CheckMisalignment { - my $ret =3D 0; - my ($data, $file, $line, $paren_stack) =3D @_; - - # Check alignment based on @paren_stack - if (@$paren_stack) { - if ($$data =3D~ /(\S+.*$)/) { - my $pos =3D $$paren_stack[-1][0]; - my $linenum =3D $$paren_stack[-1][1]; - my $code =3D $$paren_stack[-1][2]; - if ($pos + 1 !=3D length($`)) { - my $pad =3D ""; - if ($. > $linenum + 1) { - $pad =3D " " x $pos . " ...\n"; - } - print "Misaligned line in parenthesis:\n"; - print "$$file:$linenum-$.:\n$code$pad$$line\n"; - $ret =3D 1; - } + # Forbid whitespace following ( or prior to ) + # but allow whitespace before ) on a single line + # (optionally followed by a semicolon) + if (($data =3D~ /\s\)/ && not $data =3D~ /^\s+\);?$/) || + $data =3D~ /\((?!$)\s/) { + print "Whitespace after '(' or before ')':\n"; + print "$file:$.: $line"; + $ret =3D 1; } - } =20 - # Maintain @paren_stack - if ($$data =3D~ /.*[()]/) { - my $pos =3D 0; - my $temp =3D $$data; - - # Kill the content between matched parenthesis and themselves - # within the current line. - $temp =3D~ s,(\((?:[^()]++|(?R))*+\)),"X" x (length $&),ge; - - # Pop a item for the open-paren when finding close-paren - while (($pos =3D index($temp, "\)", $pos)) >=3D 0) { - if (@$paren_stack) { - pop(@$paren_stack); - $pos++; - } else { - print "Warning: found unbalanced parenthesis:\n"; - print "$$file:$.:\n$$line\n"; + # Forbid whitespace before ";" or ",". Things like below are allow= ed: + # + # 1) The expression is empty for "for" loop. E.g. + # for (i =3D 0; ; i++) + # + # 2) An empty statement. E.g. + # while (write(statuswrite, &status, 1) =3D=3D -1 && + # errno =3D=3D EINTR) + # ; + # + if ($data =3D~ /\s[;,]/) { + unless ($data =3D~ /\S; ; / || + $data =3D~ /^\s+;/) { + print "Whitespace before semicolon or comma:\n"; + print "$file:$.: $line"; $ret =3D 1; - last; } } =20 - # Push the item for open-paren on @paren_stack - # @item =3D [ position of the open-paren, linenum, code-line ] - while (($pos =3D index($temp, "\(", $pos)) >=3D 0) { - push @$paren_stack, [$pos, $., $$line]; - $pos++; + # Require EOL, macro line continuation, or whitespace after ";". + # Allow "for (;;)" as an exception. + if ($data =3D~ /;[^ \\\n;)]/) { + print "Invalid character after semicolon:\n"; + print "$file:$.: $line"; + $ret =3D 1; } - } =20 - return $ret; -} - -my $ret =3D 0; - -foreach my $file (@ARGV) { - # Per-file variables for multiline Curly Bracket (cb_) check - my $cb_linenum =3D 0; - my $cb_code =3D ""; - my $cb_scolon =3D 0; - my $fn_linenum =3D 0; - my $incomment =3D 0; - my @paren_stack; - - open FILE, $file; - - while (defined (my $line =3D )) { - my $has_define =3D 0; - my $data =3D $line; - my $location =3D "$file:$.:\n$line"; - - # Kill any quoted , ; =3D or " - $data =3D~ s/'[";,=3D]'/'X'/g; - - # Kill any quoted strings. Replace with equal-length "XXXX..." - $data =3D~ s,"(([^\\\"]|\\.)*)","\"".'X'x(length $1)."\"",ge; - $data =3D~ s,'(([^\\\']|\\.)*)',"\'".'X'x(length $1)."\'",ge; + # Require EOL, space, or enum/struct end after comma. + if ($data =3D~ /,[^ \\\n)}]/) { + print "Invalid character after comma:\n"; + print "$file:$.: $line"; + $ret =3D 1; + } =20 - # Kill any C++ style comments - $data =3D~ s,//.*$,//,; + # Require spaces around assignment '=3D', compounds and '=3D=3D' + if ($data =3D~ /[^ ]\b[!<>&|\-+*\/%\^=3D]?=3D/ || + $data =3D~ /=3D[^=3D \\\n]/) { + print "Spacing around '=3D' or '=3D=3D':\n"; + print "$file:$.: $line"; + $ret =3D 1; + } =20 - $has_define =3D 1 if $data =3D~ /(?:^#\s*define\b)/; - if (not $has_define) { - # Ignore all macros except for #define - next if $data =3D~ /^#/; + # One line conditional statements with one line bodies should + # not use curly brackets. + if ($data =3D~ /^\s*(if|while|for)\b.*\{$/) { + $cb_linenum =3D $.; + $cb_code =3D $line; + $cb_scolon =3D 0; + } =20 - $ret =3D 1 if CheckFunctionBody(\$data, \$location, \$fn_linen= um); + # We need to check for exactly one semicolon inside the body, + # because empty statements (e.g. with comment only) are + # allowed + if ($cb_linenum =3D=3D $. - 1 && $data =3D~ /^[^;]*;[^;]*$/) { + $cb_code .=3D $line; + $cb_scolon =3D 1; + } =20 - KillComments(\$data, \$incomment); + if ($data =3D~ /^\s*}\s*$/ && + $cb_linenum =3D=3D $. - 2 && + $cb_scolon) { =20 - $ret =3D 1 if CheckWhiteSpaces(\$data, \$location); + print "Curly brackets around single-line body:\n"; + print "$file:$cb_linenum-$.:\n$cb_code$line"; + $ret =3D 1; =20 - $ret =3D 1 if CheckCurlyBrackets(\$data, \$file, \$line, - \$cb_linenum, \$cb_code, \$cb_s= colon); + # There _should_ be no need to reset the values; but to + # keep my inner peace... + $cb_linenum =3D 0; + $cb_scolon =3D 0; + $cb_code =3D ""; } - - ##################################################################= ### - # Temporary Filter for CheckMisalignment: - # Here we introduce a white-list of path, since there're - # too much misalignment. - # We _need_ fix these misalignment in batches. - # We _should_ remove it as soon as fixing all. - ##################################################################= ### - next unless $file =3D~ /^src\/util\//; - - $ret =3D 1 if CheckMisalignment(\$data, \$file, \$line, \@paren_st= ack); } close FILE; } --=20 2.16.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 18 05:43:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538740098933805.9233580962393; Fri, 5 Oct 2018 04:48:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 18F898046A; Fri, 5 Oct 2018 11:48:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD7A5308BDA1; Fri, 5 Oct 2018 11:48:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 75817180B5B7; Fri, 5 Oct 2018 11:48:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w95BmDjF013171 for ; Fri, 5 Oct 2018 07:48:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 476916A750; Fri, 5 Oct 2018 11:48:13 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C000760191 for ; Fri, 5 Oct 2018 11:48:12 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Fri, 5 Oct 2018 13:48:07 +0200 Message-Id: <51fbf180ba6d89c7f8aaaedf0550f905f4f057a6.1538739988.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] check-spacing: do not kill C++-style comments X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 05 Oct 2018 11:48:17 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Our HACKING guide forbids these. There's no point in exempting these from the spacing check if their existence is against our coding style. Note that the non-usage of these comments itself is not enforced by syntax check, probably because of the need to implement a C parser. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Erik Skultety --- build-aux/check-spacing.pl | 3 --- src/libvirt.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl index ca8b434916..a32e355be6 100755 --- a/build-aux/check-spacing.pl +++ b/build-aux/check-spacing.pl @@ -45,9 +45,6 @@ foreach my $file (@ARGV) { # Kill any quoted strings $data =3D~ s,"(?:[^\\\"]|\\.)*","XXX",g; =20 - # Kill any C++ style comments - $data =3D~ s,//.*$,//,; - next if $data =3D~ /^#/; =20 # Kill contents of multi-line comments diff --git a/src/libvirt.c b/src/libvirt.c index 0a738aefb1..7c379495ad 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -230,8 +230,8 @@ virWinsockInit(void) WSADATA winsock_data; =20 /* http://msdn2.microsoft.com/en-us/library/ms742213.aspx */ - winsock_version =3D MAKEWORD (2, 2); - err =3D WSAStartup (winsock_version, &winsock_data); + winsock_version =3D MAKEWORD(2, 2); + err =3D WSAStartup(winsock_version, &winsock_data); return err =3D=3D 0 ? 0 : -1; } #endif --=20 2.16.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list