Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jun 2013 12:07:13 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Sergey Kandaurov <pluknet@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r251862 - in head: sys/dev/puc sys/dev/vxge usr.bin/csup usr.bin/sort
Message-ID:  <20130618114258.G1695@besplex.bde.org>
In-Reply-To: <201306172011.r5HKB4b0024888@svn.freebsd.org>
References:  <201306172011.r5HKB4b0024888@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 17 Jun 2013, Sergey Kandaurov wrote:

> Log:
>  Clean up -Wheader-guard warnings.

An interesting feature.  It seems to be missing warnings about style bugs
in header-guard names.

> Modified: head/sys/dev/puc/puc_bfe.h
> ==============================================================================
> --- head/sys/dev/puc/puc_bfe.h	Mon Jun 17 19:54:47 2013	(r251861)
> +++ head/sys/dev/puc/puc_bfe.h	Mon Jun 17 20:11:04 2013	(r251862)
> @@ -27,7 +27,7 @@
>  */
>
> #ifndef _DEV_PUC_BFE_H_
> -#define	_DEV_PUC_BFE_H
> +#define	_DEV_PUC_BFE_H_

Local headers shouldn't have or need header-guards, but the name and
formatting of this header-guard is in normal style.
>
> #define	PUC_PCI_BARS	6
>

The name and formatting at the end of the file were already correct, but
the comment on the #endif is still backwards.

> Modified: head/sys/dev/puc/puc_cfg.h

Similarly in other puc headers.

> Modified: head/sys/dev/vxge/vxge.h
> ==============================================================================
> --- head/sys/dev/vxge/vxge.h	Mon Jun 17 19:54:47 2013	(r251861)
> +++ head/sys/dev/vxge/vxge.h	Mon Jun 17 20:11:04 2013	(r251862)
> @@ -31,7 +31,7 @@
> /*$FreeBSD$*/
>
> #ifndef	_VXGE_H_
> -#define	__VXGE_H_
> +#define	_VXGE_H_

This one has more style bugs:
- tab instead of space after ifndef
- no path prefix in header name

>
> #include <dev/vxge/vxgehal/vxgehal.h>
> #include <dev/vxge/vxge-osdep.h>
>

And at the end of the file:
- tab instead of space after ifndef
- the comment is backwards of course.

> Modified: head/usr.bin/csup/updater.h
> ==============================================================================
> --- head/usr.bin/csup/updater.h	Mon Jun 17 19:54:47 2013	(r251861)
> +++ head/usr.bin/csup/updater.h	Mon Jun 17 20:11:04 2013	(r251862)
> @@ -26,7 +26,7 @@
>  * $FreeBSD$
>  */
> #ifndef _UPDATER_H_
> -#define _UPDATER_H
> +#define _UPDATER_H_
>
> void	*updater(void *);
>

Missing blank line before #define.  Space instead of tab after #define.
No path prefix, but application headers are much more local than dev
headers, so a path prefix is less useful for them.

Some dev headers are installed in /usr/include, but the puc ones aren't.

The style of the #endif is normal in this file, but the ifdef section
is so short that it breaks the style(9) rule about not commenting short
ifdefs.

This include file has 1 line of useful code, 5 lines of head-guard and
27 lines of copyright.  csup has header files like this that would be
tiny except for the copyright.  I don't like this organization.  The
1 useful line in this include file consists of a prototype, so it
doesn't need a header-guard.

> Modified: head/usr.bin/sort/vsort.h
> ==============================================================================
> --- head/usr.bin/sort/vsort.h	Mon Jun 17 19:54:47 2013	(r251861)
> +++ head/usr.bin/sort/vsort.h	Mon Jun 17 20:11:04 2013	(r251862)
> @@ -28,7 +28,7 @@
>  */
>
> #if !defined(__VSORT_H__)
> -#define _VSORT_H__
> +#define __VSORT_H__
>
> #include "bwstring.h"
>

#if !defined() instead of #ifdef.  Excessive underscores in header-guard
name (the old name was half correct).  Space instead of tab after #define.
No comment on the #endif, but this is another header that would be tiny
without its header-guard and copyright.

Bruce



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