2002-08-01 Andrew Cagney <ac131313@redhat.com>

* gdbint.texinfo (Coding): Revise section "Include Files".
This commit is contained in:
Andrew Cagney 2002-08-01 16:49:25 +00:00
parent 08df23795b
commit e2b28d048d
2 changed files with 24 additions and 9 deletions

View file

@ -1,3 +1,7 @@
2002-08-01 Andrew Cagney <ac131313@redhat.com>
* gdbint.texinfo (Coding): Revise section "Include Files".
2002-07-24 Andrew Cagney <cagney@redhat.com> 2002-07-24 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo: Obsolete references to m88k. * gdbint.texinfo: Obsolete references to m88k.

View file

@ -5065,19 +5065,30 @@ For other files @samp{-} is used as the separator.
@subsection Include Files @subsection Include Files
All @file{.c} files should include @file{defs.h} first. A @file{.c} file should include @file{defs.h} first.
All @file{.c} files should explicitly include the headers for any A @file{.c} file should directly include the @code{.h} file of every
declarations they refer to. They should not rely on files being declaration and/or definition it directly refers to. It cannot rely on
included indirectly. indirect inclusion.
With the exception of the global definitions supplied by @file{defs.h}, A @file{.h} file should directly include the @code{.h} file of every
a header file should explicitly include the header declaring any declaration and/or definition it directly refers to. It cannot rely on
@code{typedefs} et.al.@: it refers to. indirect inclusion. Exception: The file @file{defs.h} does not need to
be directly included.
@code{extern} declarations should never appear in @code{.c} files. An external declaration should only appear in one include file.
All include files should be wrapped in: An external declaration should never appear in a @code{.c} file.
Exception: a declaration for the @code{_initialize} function that
pacifies @option{-Wmissing-declaration}.
A @code{typedef} definition should only appear in one include file.
An opaque @code{struct} declaration can appear in multiple @file{.h}
files. Where possible, a @file{.h} file should use an opaque
@code{struct} declaration instead of an include.
All @file{.h} files should be wrapped in:
@smallexample @smallexample
#ifndef INCLUDE_FILE_NAME_H #ifndef INCLUDE_FILE_NAME_H