summaryrefslogtreecommitdiff
path: root/include/linux/byteorder
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-01-18 18:43:54 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2004-01-18 18:43:54 -0800
commit0697fbd3f0d9083223de23ea16c1754de0d8c28b (patch)
tree19beafacc89818ad8ee889494f8922085e4b871e /include/linux/byteorder
parent477702e9c136022c858d8b4f59832c5a4eafe526 (diff)
[PATCH] const vs. __attribute__((const)) confusion
From: "H. Peter Anvin" <hpa@zytor.com> Declaring a function to return a const scalar value is pretty meaningless. These functions are really trying to say that they don't alter any external state. Fix that up by using __attribute__((const)), if the compiler supports that.
Diffstat (limited to 'include/linux/byteorder')
-rw-r--r--include/linux/byteorder/swab.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h
index 814b4519ff21..02ad0b5246e9 100644
--- a/include/linux/byteorder/swab.h
+++ b/include/linux/byteorder/swab.h
@@ -15,6 +15,8 @@
*
*/
+#include <linux/compiler.h>
+
/* casts are necessary for constants, because we never know how for sure
* how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
*/
@@ -128,7 +130,7 @@
#endif /* OPTIMIZE */
-static __inline__ __const__ __u16 __fswab16(__u16 x)
+static __inline__ __attribute_const__ __u16 __fswab16(__u16 x)
{
return __arch__swab16(x);
}
@@ -141,7 +143,7 @@ static __inline__ void __swab16s(__u16 *addr)
__arch__swab16s(addr);
}
-static __inline__ __const__ __u32 __fswab32(__u32 x)
+static __inline__ __attribute_const__ __u32 __fswab32(__u32 x)
{
return __arch__swab32(x);
}
@@ -155,7 +157,7 @@ static __inline__ void __swab32s(__u32 *addr)
}
#ifdef __BYTEORDER_HAS_U64__
-static __inline__ __const__ __u64 __fswab64(__u64 x)
+static __inline__ __attribute_const__ __u64 __fswab64(__u64 x)
{
# ifdef __SWAB_64_THRU_32__
__u32 h = x >> 32;