HDRCHK(1ONBLD) illumos Build Tools HDRCHK(1ONBLD)

NAME

hdrchk - check that header files conform to ON standards

SYNOPSIS


hdrchk [-a] file [file ...]

DESCRIPTION

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

OPTIONS

-a
Apply (more lenient) application header rules.

HEADER STANDARDS

Standards for all header files:
1.
Begin with a comment containing a copyright message.
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.
3.
Has a valid ident declaration.

Additional standards for system header files:

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.
2.
All #include directives must use the <> form.
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

 
July 2, 2008