1 HDRCHK(1ONBLD)                illumos Build Tools               HDRCHK(1ONBLD)
   2 
   3 
   4 
   5 NAME
   6        hdrchk - check that header files conform to ON standards
   7 
   8 SYNOPSIS
   9        hdrchk [-a] file [file ...]
  10 
  11 DESCRIPTION
  12        hdrchk verifies that C header files (*.h) conform to the standards of
  13        the ON consolidation.  See HEADER STANDARDS for details.
  14 
  15 OPTIONS
  16        -a        Apply (more lenient) application header rules.
  17 
  18 HEADER STANDARDS
  19        Standards for all header files:
  20 
  21        1.  Begin with a comment containing a copyright message.
  22 
  23        2.  Enclosed in a guard of the form:
  24 
  25             #ifndef GUARD
  26             #define GUARD
  27             #endif /* [!]GUARD */
  28 
  29            The preferred form is without the bang character, but either is
  30            acceptable.
  31 
  32        3.  Has a valid ident declaration.
  33 
  34        Additional standards for system header files:
  35 
  36        1.  The file guard must take the form '_FILENAME_H[_]', where FILENAME
  37            matches the basename of the file.  If it is installed in a
  38            subdirectory, it should be of the form '_DIR_FILENAME_H[_]', though
  39            this is not currently enforced.  The form without the trailing
  40            underscore is preferred in both cases.
  41 
  42        2.  All #include directives must use the <> form.
  43 
  44        3.  If the header file contains anything besides comments and
  45            preprocessor directives, then it must be enclosed in a C++ guard of
  46            the form:
  47 
  48             #ifdef __cplusplus
  49             extern "C" {
  50             #endif
  51 
  52             #ifdef __cplusplus
  53             }
  54             #endif
  55 
  56 
  57 
  58 
  59                                  July 2, 2008                   HDRCHK(1ONBLD)