diff options
author | peter <peter@FreeBSD.org> | 2002-09-23 06:37:48 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-09-23 06:37:48 +0000 |
commit | 6e5f1c19df4a632da74ed26d74bf8676938467a3 (patch) | |
tree | 4ffb271615efcec44008d62871bcc6be57646fa7 /sys | |
parent | 2b5b784b491d192ab46d1b726f8360853845b3df (diff) | |
download | FreeBSD-src-6e5f1c19df4a632da74ed26d74bf8676938467a3.zip FreeBSD-src-6e5f1c19df4a632da74ed26d74bf8676938467a3.tar.gz |
Alfred got me thinking. Provide stubs for lint, and let the compilers
themselves cause a failure if it is told to use a __widget that there is
no implementation for them. missing an implementation for __unused etc is
harmless. But not having a __packed implementation when the kernel code
really needs it is a big deal.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/cdefs.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 7983d45..6d46224 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -110,23 +110,28 @@ * pure (no side effects) functions, and unused variables. They are * null except for versions of gcc that are known to support the features * properly (old versions of gcc-2 supported the dead and pure features - * in a different (wrong) way). + * 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. */ -#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5 +#ifdef lint #define __dead2 #define __pure2 #define __unused #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 #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused -#define __packed /* XXX find this out, if we care */ -#define __aligned(x) /* XXX find this out, if we care */ -#define __section(x) /* XXX find this out, if we care */ +/* XXX Find out what to do for __packed, __aligned and __section */ #endif #if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3 #define __dead2 __attribute__((__noreturn__)) @@ -136,6 +141,7 @@ #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((__section__(x))) #endif +#endif /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ #if !(__GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3) |