diff options
author | H. Peter Anvin <hpa@zytor.com> | 2004-02-10 02:06:18 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2004-02-10 02:06:18 +0000 |
commit | 06765402ccfb517d757c5b8d3fce4c7421f1fd4a (patch) | |
tree | 53f2a5d4773e907c5892bf488eb66a47d8322179 | |
parent | c98da2cb895cfeaba2639ab37caac616926f1ef8 (diff) | |
download | klibc-06765402ccfb517d757c5b8d3fce4c7421f1fd4a.tar.gz |
Update to deal with attribute handling in recent kernelsklibc-0.107
-rw-r--r-- | include/endian.h | 1 | ||||
-rw-r--r-- | include/klibc/compiler.h | 34 | ||||
-rw-r--r-- | klibc/include/endian.h | 1 | ||||
-rw-r--r-- | klibc/include/klibc/compiler.h | 34 | ||||
-rw-r--r-- | nfsmount/main.c | 3 |
5 files changed, 72 insertions, 1 deletions
diff --git a/include/endian.h b/include/endian.h index 10dbbd8a89e9a..44f89ccbbc940 100644 --- a/include/endian.h +++ b/include/endian.h @@ -5,6 +5,7 @@ #ifndef _ENDIAN_H #define _ENDIAN_H +#include <klibc/compiler.h> #include <asm/byteorder.h> /* Linux' asm/byteorder.h defines either __LITTLE_ENDIAN or diff --git a/include/klibc/compiler.h b/include/klibc/compiler.h index 64b8c541588be..49872b89d4c24 100644 --- a/include/klibc/compiler.h +++ b/include/klibc/compiler.h @@ -65,4 +65,38 @@ # define __unusedfunc #endif +/* "pure" function: + + Many functions have no effects except the return value and their + return value depends only on the parameters and/or global + variables. Such a function can be subject to common subexpression + elimination and loop optimization just as an arithmetic operator + would be. These functions should be declared with the attribute + `pure'. +*/ +#ifdef __GNUC__ +# define __attribute_pure__ __attribute__((pure)) +#else +# define __attribute_pure__ +#endif + +/* "const" function: + + Many functions do not examine any values except their arguments, + and have no effects except the return value. Basically this is + just slightly more strict class than the `pure' attribute above, + since function is not allowed to read global memory. + + Note that a function that has pointer arguments and examines the + data pointed to must _not_ be declared `const'. Likewise, a + function that calls a non-`const' function usually must not be + `const'. It does not make sense for a `const' function to return + `void'. +*/ +#ifdef __GNUC__ +# define __attribute_const__ __attribute__((const)) +#else +# define __attribute_const__ +#endif + #endif diff --git a/klibc/include/endian.h b/klibc/include/endian.h index 10dbbd8a89e9a..44f89ccbbc940 100644 --- a/klibc/include/endian.h +++ b/klibc/include/endian.h @@ -5,6 +5,7 @@ #ifndef _ENDIAN_H #define _ENDIAN_H +#include <klibc/compiler.h> #include <asm/byteorder.h> /* Linux' asm/byteorder.h defines either __LITTLE_ENDIAN or diff --git a/klibc/include/klibc/compiler.h b/klibc/include/klibc/compiler.h index 64b8c541588be..49872b89d4c24 100644 --- a/klibc/include/klibc/compiler.h +++ b/klibc/include/klibc/compiler.h @@ -65,4 +65,38 @@ # define __unusedfunc #endif +/* "pure" function: + + Many functions have no effects except the return value and their + return value depends only on the parameters and/or global + variables. Such a function can be subject to common subexpression + elimination and loop optimization just as an arithmetic operator + would be. These functions should be declared with the attribute + `pure'. +*/ +#ifdef __GNUC__ +# define __attribute_pure__ __attribute__((pure)) +#else +# define __attribute_pure__ +#endif + +/* "const" function: + + Many functions do not examine any values except their arguments, + and have no effects except the return value. Basically this is + just slightly more strict class than the `pure' attribute above, + since function is not allowed to read global memory. + + Note that a function that has pointer arguments and examines the + data pointed to must _not_ be declared `const'. Likewise, a + function that calls a non-`const' function usually must not be + `const'. It does not make sense for a `const' function to return + `void'. +*/ +#ifdef __GNUC__ +# define __attribute_const__ __attribute__((const)) +#else +# define __attribute_const__ +#endif + #endif diff --git a/nfsmount/main.c b/nfsmount/main.c index 76ed8066d9c6f..a1bf3471490cd 100644 --- a/nfsmount/main.c +++ b/nfsmount/main.c @@ -5,13 +5,14 @@ #include <errno.h> #include <sys/types.h> #include <sys/stat.h> -#include <linux/nfs_mount.h> #include <arpa/inet.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <linux/nfs_mount.h> + #include "nfsmount.h" #include "sunrpc.h" |