From: George Koehler Date: Tue, 17 Jan 2017 03:39:44 +0000 (-0500) Subject: Delay inclusion of when compiling comm2.y X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=916d270534fb154d15f0633911bb223a190bf48a;p=ack.git Delay inclusion of when compiling comm2.y See issue #1 (https://github.com/davidgiven/ack/issues/1). The file mach/proto/as/comm2.y goes through cpp twice. The _include macro, defined in comm2.y and used in comm0.h, delays the inclusion of system header files. The inclusion of wasn't delayed. This caused multiple inclusions of in FreeBSD and in OpenBSD. Use _include to delay . Also use _include for "arch.h" and "out.h", because h/out.h includes and h/arch.h might include it in the future. Sort the system includes in comm0.h by moving them up to be with . Must include before "mach0.c", because mach/powerpc/as/mach0.c needs it. Must include "mach0.c" before checking ASLD. --- diff --git a/mach/proto/as/comm0.h b/mach/proto/as/comm0.h index dedafa4c7..2d00c8e45 100644 --- a/mach/proto/as/comm0.h +++ b/mach/proto/as/comm0.h @@ -8,7 +8,21 @@ * All preprocessor based options/constants/functions */ -#include +#ifdef _include +_include +_include +_include +_include +_include +_include +#else +#include +#include +#include +#include +#include +#include +#endif /* ========== ON/OFF options (use #define in mach0.c) ========== */ @@ -80,23 +94,16 @@ separate linker only possible if relocation info produced /* ========== Machine independent type declarations ========== */ #ifdef _include -_include -_include -_include -_include -_include -#else -#include -#include -#include -#include -#include +#ifdef ASLD +_include "arch.h" #endif - +_include "out.h" +#else #ifdef ASLD #include "arch.h" #endif #include "out.h" +#endif #if DEBUG == 0 #define assert(ex) /* nothing */ @@ -265,6 +272,3 @@ typedef struct sect_t sect_t; #define MACHREL_BWR (0) #endif #endif - -extern FILE *fopen(); /* some systems don't have this in stdio.h */ -