tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ansi.h include guards



In article <20180202163221.GA2086%SDF.ORG@localhost>,  <coypu%sdf.org@localhost> wrote:
>Hi folks
>
>trying to make gcc work for netbsd/arm it turned out that gcc is relying
>on the choice of include guards:
>https://github.com/gcc-mirror/gcc/blob/master/gcc/ginclude/stddef.h#L59-L65
>
>(if there is a better way to do it please mention..)
>
>we haven't been very consistent in a per arch manner:
>
>$ grep -H ifndef sys/arch/*/include/ansi.h
>sys/arch/alpha/include/ansi.h:#ifndef   _ANSI_H_
>sys/arch/amd64/include/ansi.h:#ifndef   _X86_64_ANSI_H_
>sys/arch/amiga/include/ansi.h:#ifndef _MACHINE_ANSI_H_
>sys/arch/arm/include/ansi.h:#ifndef _ARM_ANSI_H_
>sys/arch/atari/include/ansi.h:#ifndef _MACHINE_ANSI_H_
>sys/arch/dreamcast/include/ansi.h:#ifndef _DREAMCAST_ANSI_H_
>sys/arch/evbsh3/include/ansi.h:#ifndef _EVBSH3_ANSI_H_
>sys/arch/hpcsh/include/ansi.h:#ifndef _HPCSH_ANSI_H_
>sys/arch/hppa/include/ansi.h:#ifndef    _ANSI_H_
>sys/arch/ia64/include/ansi.h:#ifndef    _ANSI_H_
>sys/arch/landisk/include/ansi.h:#ifndef _LANDISK_ANSI_H_
>sys/arch/m68k/include/ansi.h:#ifndef    _ANSI_H_
>sys/arch/mips/include/ansi.h:#ifndef    _ANSI_H_
>sys/arch/mips/include/ansi.h:#ifndef __mips_o32
>sys/arch/powerpc/include/ansi.h:#ifndef _ANSI_H_
>sys/arch/sh3/include/ansi.h:#ifndef     _ANSI_H_
>sys/arch/sparc/include/ansi.h:#ifndef   _ANSI_H_
>sys/arch/sparc64/include/ansi.h:#ifndef _ANSI_H_
>sys/arch/usermode/include/ansi.h:#ifndef _ARCH_USERMODE_INCLUDE_ANSI_H
>sys/arch/vax/include/ansi.h:#ifndef _ANSI_H_
>
>any reason not to turn those all into #ifndef _ANSI_H_ ?

Because what happens if we want to create <ansi.h>?
I think that the correct way is:

    >sys/arch/i386/include/ansi.h:#ifndef    _I386_ANSI_H_

So you can potentially have:

    >sys/arch/x86/include/ansi.h:#ifndef   _X86_ANSI_H_

And:

    >sys/ansi.h:#ifndef   _SYS_ANSI_H_

and have it all work...

christos



Home | Main Index | Thread Index | Old Index