Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Feb 2019 12:56:42 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Tom Jones <thj@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r344292 - head/sys/dev/acpica
Message-ID:  <20190220123807.E1184@besplex.bde.org>
In-Reply-To: <201902191904.x1JJ4qIh036879@repo.freebsd.org>
References:  <201902191904.x1JJ4qIh036879@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 19 Feb 2019, Tom Jones wrote:

> Log:
>  Fix style after r340832
>
>  Reported by:	jhb
>  Reviewed by:	jhb, jtl
>  Approved by:	jtl (mentor)

Unfortunately, acpi (even the FreeBSD dev/acpica part) has a very
non-KNF style.  It is unclear even what this style is, so it is hard to
write changes consistent with it.  But it is clear that this style isn't
the one one used in the line after the one touched by this commit.

> Modified: head/sys/dev/acpica/acpi_battery.c
> ==============================================================================
> --- head/sys/dev/acpica/acpi_battery.c	Tue Feb 19 18:50:20 2019	(r344291)
> +++ head/sys/dev/acpica/acpi_battery.c	Tue Feb 19 19:04:52 2019	(r344292)
> @@ -172,7 +172,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
> 	 * Be sure we can get various info from the battery.
> 	 */
> 	if (ACPI_BATT_GET_STATUS(batt_dev, &bst[i]) != 0 ||
> -		ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
> +	    ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
> 		continue;
>
> 	/* If a battery is not installed, we sometimes get strange values. */

acpica uses 4-column indents, especially in this file, so the 'continue' line
is clearly misindented here.

acpica's indentation for continued lines is unclear.  The KNF 4-column
continuation indent works very badly when the main indent is also 4-column.
But it is used in similar code (including a 'continue' just 5 lines after
here).  So it is consistently bad here.

Elsewhere, acpica seems to use gnu style (-lp).  Here and 5 lines later,
that accidentally gives the 4-column indent by lining up with the
parentheses of 'if (',

A quick look at some other files shows many examples of gnu style (-lp)
for long function parameter lists, and many similar regressions towards
KNF style.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190220123807.E1184>