From ceb0d0c4f2141c6393b92a0721634b03a4c567fe Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Wed, 16 Feb 2005 21:50:00 +0000 Subject: [PATCH] Add __pure as attribute. A __pure function can only depend on the arguments, not on global memory. A __pure2 function in contrast just has to return the same value for the same arguments. It can use a hash table or similiar means. For GCC before 3.0 __pure is mapped to __pure2. Inspired-by: FreeBSD --- sys/sys/cdefs.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index a8eedfe429..21b64b253f 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -35,7 +35,7 @@ * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 * $FreeBSD: src/sys/sys/cdefs.h,v 1.28.2.8 2002/09/18 04:05:13 mikeh Exp $ - * $DragonFly: src/sys/sys/cdefs.h,v 1.14 2005/02/04 22:28:23 joerg Exp $ + * $DragonFly: src/sys/sys/cdefs.h,v 1.15 2005/02/16 21:50:00 joerg Exp $ */ #ifndef _SYS_CDEFS_H_ @@ -141,6 +141,7 @@ #ifdef lint #define __dead2 +#define __pure #define __pure2 #define __unused #define __packed @@ -166,6 +167,12 @@ #define __section(x) __attribute__((__section__(x))) #endif +#if __GNUC_PREREQ__(3, 0) +#define __pure __attribute__((__pure__)) +#else +#define __pure __pure2 +#endif + #if __GNUC_PREREQ__(3, 1) #define __always_inline __attribute__((__always_inline__)) #else -- 2.41.0