Always define something for required compiler extentions. Silence syntax errors that occur with TenDRA and GNUC's #warning. Index: cdefs.h =================================================================== RCS file: /work/repo/src/sys/sys/cdefs.h,v retrieving revision 1.68 diff -u -r1.68 cdefs.h --- cdefs.h 21 Oct 2002 20:50:30 -0000 1.68 +++ cdefs.h 5 Dec 2002 18:00:12 -0000 @@ -113,6 +113,11 @@ * in a different (wrong) way). If we do not provide an implementation * for a given compiler, let the compile fail if it is told to use * a feature that we cannot live without. + * + * XXX the check for lint here is incorrect, since either your lint supports + * GNUC or it doesn't. Some kernel source code is very GNUC-centric, so we + * need this hack here until those GNUCisms are fixed. In reality, having + * hacks like this usually extend the life of bugs. */ #ifdef lint #define __dead2 @@ -121,19 +126,10 @@ #define __packed #define __aligned(x) #define __section(x) -#else -#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5 -#define __dead2 -#define __pure2 -#define __unused -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 +#elif __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) -#define __unused -/* XXX Find out what to do for __packed, __aligned and __section */ -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3 +#elif __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3 #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused __attribute__((__unused__)) @@ -141,6 +137,25 @@ #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((__section__(x))) #endif + +/* Default to NOP for compiler-dependent extentions. */ +#ifndef __dead2 +#define __dead2 +#endif +#ifndef __pure2 +#define __pure2 +#endif +#ifndef __unused +#define __unused +#endif +#ifndef __packed +#define __packed +#endif +#ifndef __aligned +#define __aligned(x) +#endif +#ifndef __section +#define __section(x) #endif /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ @@ -226,6 +241,14 @@ * The alternative is: #define __IDSTRING(name,string) [nothing] */ #define __IDSTRING(name,string) static const char name[] __unused = string +#endif + +/* + * TenDRA looks inside conditionals that don't apply (ie. #if __GNUC__). + * #warning is the most likely cause of syntax errors, so work around this. + */ +#ifdef __TenDRA__ +#pragma TenDRA directive warning (ignore) allow #endif /*