From e2b28d048de97e7007086f4b50617060b6690d76 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 1 Aug 2002 16:49:25 +0000 Subject: [PATCH] 2002-08-01 Andrew Cagney * gdbint.texinfo (Coding): Revise section "Include Files". --- gdb/doc/ChangeLog | 4 ++++ gdb/doc/gdbint.texinfo | 29 ++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 3cbd58c3185..a6e1afe345a 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2002-08-01 Andrew Cagney + + * gdbint.texinfo (Coding): Revise section "Include Files". + 2002-07-24 Andrew Cagney * gdbint.texinfo: Obsolete references to m88k. diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index cd7a4eb25e4..0336015a172 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -5065,19 +5065,30 @@ For other files @samp{-} is used as the separator. @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 -declarations they refer to. They should not rely on files being -included indirectly. +A @file{.c} file should directly include the @code{.h} file of every +declaration and/or definition it directly refers to. It cannot rely on +indirect inclusion. -With the exception of the global definitions supplied by @file{defs.h}, -a header file should explicitly include the header declaring any -@code{typedefs} et.al.@: it refers to. +A @file{.h} file should directly include the @code{.h} file of every +declaration and/or definition it directly refers to. It cannot rely on +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 #ifndef INCLUDE_FILE_NAME_H -- 2.30.2