Module Name: src Committed By: joerg Date: Sat Oct 8 20:30:55 UTC 2016
Modified Files: src/sys/arch/sparc/include: cpuconf.h Log Message: Macros expanding to defined() expression is not actually correct ISO C behavior. Since it is not clear whether someone might decide to define the macros to random non-1 values, introduce a level of indirection and count the same of the helper macros. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc/include/cpuconf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sparc/include/cpuconf.h diff -u src/sys/arch/sparc/include/cpuconf.h:1.4 src/sys/arch/sparc/include/cpuconf.h:1.5 --- src/sys/arch/sparc/include/cpuconf.h:1.4 Sun Dec 11 12:19:05 2005 +++ src/sys/arch/sparc/include/cpuconf.h Sat Oct 8 20:30:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuconf.h,v 1.4 2005/12/11 12:19:05 christos Exp $ */ +/* $NetBSD: cpuconf.h,v 1.5 2016/10/08 20:30:54 joerg Exp $ */ /* * Copyright (c) 1992, 1993 @@ -76,8 +76,28 @@ extern int cputyp; * Step 1: Count the number of CPU types configured into the kernel. */ #if defined(_KERNEL_OPT) -#define CPU_NTYPES (defined(SUN4) + defined(SUN4C) + \ - defined(SUN4M) + defined(SUN4D)) +#ifdef SUN4 +#define _CPU_NTYPES_SUN4 1 +#else +#define _CPU_NTYPES_SUN4 0 +#endif +#ifdef SUN4C +#define _CPU_NTYPES_SUN4C 1 +#else +#define _CPU_NTYPES_SUN4C 0 +#endif +#ifdef SUN4M +#define _CPU_NTYPES_SUN4M 1 +#else +#define _CPU_NTYPES_SUN4M 0 +#endif +#ifdef SUN4D +#define _CPU_NTYPES_SUN4D 1 +#else +#define _CPU_NTYPES_SUN4D 0 +#endif +#define CPU_NTYPES (_CPU_NTYPES_SUN4 + _CPU_NTYPES_SUN4C + \ + _CPU_NTYPES_SUN4M + _CPU_NTYPES_SUN4D) #else #define CPU_NTYPES 0 #endif