xref: /titanic_41/usr/src/tools/scripts/hdrchk.1 (revision 37714ae43602c675f9dc59b070bfdf9fa702872c)
CDDL HEADER START

The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.

You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.

When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]

CDDL HEADER END

Copyright 2008 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.

ident "%Z%%M% %I% %E% SMI"

hdrchk 1 "02 July 2008"
NAME
hdrchk - check that header files conform to ON standards
SYNOPSIS
hdrchk [-a] file [file ...]

DESCRIPTION
"OS-Net build tools" "hdrchk" "" "hdrchk"

hdrchk verifies that C header files (*.h) conform to the standards of the ON consolidation. See HEADER STANDARDS for details.

OPTIONS

10 -a Apply (more lenient) application header rules.

HEADER STANDARDS

Standards for all header files:

4 1. Begin with a comment containing a copyright message.

4 2. Enclosed in a guard of the form:

 #ifndef GUARD
 #define GUARD
 #endif /* [!]GUARD */

The preferred form is without the bang character, but either is acceptable.

4 3. Has a valid ident declaration.

Additional standards for system header files:

4 1. The file guard must take the form '_FILENAME_H[_]', where FILENAME matches the basename of the file. If it is installed in a subdirectory, it should be of the form '_DIR_FILENAME_H[_]', though this is not currently enforced. The form without the trailing underscore is preferred in both cases.

4 2. All #include directives must use the <> form.

4 3. If the header file contains anything besides comments and preprocessor directives, then it must be enclosed in a C++ guard of the form:

 #ifdef __cplusplus
 extern "C" {
 #endif

 #ifdef __cplusplus
 }
 #endif