Subject: Re: multiple inclusion protection for kernel files
To: Christos Zoulas <christos@zoulas.com>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 12/04/2005 21:10:55
Christos Zoulas wrote:

> On Dec 4, 11:29am, tsutsui@ceres.dti.ne.jp (Izumi Tsutsui) wrote:
> -- Subject: Re: multiple inclusion protection for kernel files
> 
> | In article <20051203215935.3D7C7564FA@rebar.astron.com>
> | christos@zoulas.com wrote:
> | 
> | > 1. For files that get installed in /usr/include:
> | >    All the code in the include file is bracketed by:
> | > 
> | >    #ifndef _[<DIR>_...]<FILENAME>_H_
> | >    #define _[<DIR>_...]<FILENAME>_H_
> | >    .... code ....
> | >    #endif /* _[<DIR>_...]<FILENAME>_H_ */
> | 
> | Some files under include/machine/ use _MACHINE_FOO_H_
> | but others use own ${MACHINE} names, like _HP300_FOO_H_.
> | Which is better?
> 
> Since machine is a symlink, I would say that the real path is better.
> So _HP300_FOO_H_.

In some cases I think it's better to leave as _MACHINE_FOO_H_.  Let's
pick the 68k ports <machine/elf_machdep.h> as an example, which looks
like:

	#ifndef _MACHINE_ELF_MACHDEP_H_
	#define _MACHINE_ELF_MACHDEP_H_

	#include <m68k/elf_machdep.h>

	#endif

If you're doing a diff of two different m68k ports, I think it's a win
to have these two show up the same.  I haven't thought too much if it's
always better to use _MACHINE_FOO_H_ or not though...

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/