diff options
author | bde <bde@FreeBSD.org> | 1998-08-24 06:17:01 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-08-24 06:17:01 +0000 |
commit | 4ce525c0fd15056ead6463b1dcd8b5a242506b71 (patch) | |
tree | 61e0bae59da379e6f789bb2666f6c5287488290b /sys | |
parent | 9db9cf0feb6f131f50c8487ed9ad9f0f67d68538 (diff) | |
download | FreeBSD-src-4ce525c0fd15056ead6463b1dcd8b5a242506b71.zip FreeBSD-src-4ce525c0fd15056ead6463b1dcd8b5a242506b71.tar.gz |
Removed support for the gcc-2.[0-4] keywords __dead and __pure. They
stopped being used in /usr/src almost 2 years ago.
Don't pretend to support gcc-[3-infinity].
Added __printf0like(). Feature tests for the __printf0__ feature
are problematic, so this can't be used for the err() family yet
- it's only in recent versions of FreeBSD's hacked version of gcc.
Added comments about __unused and __*like().
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/cdefs.h | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 4e9882f..0e7a397 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 - * $Id: cdefs.h,v 1.19 1998/07/13 06:45:13 bde Exp $ + * $Id: cdefs.h,v 1.20 1998/07/25 14:37:37 dfr Exp $ */ #ifndef _SYS_CDEFS_H_ @@ -106,48 +106,43 @@ #endif /* !(__STDC__ || __cplusplus) */ /* - * GCC1 and some versions of GCC2 declare dead (non-returning) and - * pure (no side effects) functions using "volatile" and "const"; - * unfortunately, these then cause warnings under "-ansi -pedantic". - * GCC2.5 uses a new, peculiar __attribute__((attrs)) style. All of - * these work for GNU C++ (modulo a slight glitch in the C++ grammar - * in the distribution version of 2.5.5). + * Compiler-dependent macros to help declare dead (non-returning) and + * 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). */ -#if __GNUC__ < 2 -#define __dead +#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5 #define __dead2 -#define __pure -#define __pure2 -#define __unused -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ < 5 -#define __dead __volatile -#define __dead2 -#define __pure __const #define __pure2 #define __unused #endif #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 -#define __dead #define __dead2 __attribute__((__noreturn__)) -#define __pure #define __pure2 __attribute__((__const__)) #define __unused #endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3 -#define __dead +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 #define __dead2 __attribute__((__noreturn__)) -#define __pure #define __pure2 __attribute__((__const__)) #define __unused __attribute__((__unused__)) #endif +/* + * Compiler-dependent macros to declare that functions take printf-like + * or scanf-like arguments. They are null except for versions of gcc + * that are known to support the features properly (old versions of gcc-2 + * didn't permit keeping the keywords out of the application namespace). + */ #if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 7 #define __printflike(fmtarg, firstvararg) +#define __printf0like(fmtarg, firstvararg) #define __scanflike(fmtarg, firstvararg) #else #define __printflike(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) +#define __printf0like(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) #define __scanflike(fmtarg, firstvararg) \ __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) #endif |