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.
This commit is contained in:
Peter Wemm 2002-09-23 06:37:48 +00:00
parent 744ae3e66a
commit fe4f1dfc8f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103845

View File

@ -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)