* [PATCH] Replace __attribute_pure__ with __pure
@ 2007-10-05 13:13 Ralf Baechle
2007-10-05 13:23 ` Mauro Carvalho Chehab
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Ralf Baechle @ 2007-10-05 13:13 UTC (permalink / raw)
To: Andrew Morton, Russell King, Mauro Carvalho Chehab, aubrey.li,
bernd.schmidt, bryan.wu, grace.pan, marc.hoffman,
michael.hennerich, michael.frysinger, jerry.zeng, jie.zhang,
robin.getz, roy.huang, sonic.zhang, vivi.li, yi.li, paulus
Cc: linux-kernel
To be consistent with the use of attributes in the rest of the kernel
replace all use of __attribute_pure__ with __pure and delete the
definition of __attribute_pure__.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
Patch against v2.6.23-rc8-mm2.
And btw why does Analog list half their employees in the MAINTAINERS entry?
Seems a little over the top ...
Ralf
diff --git a/arch/arm/nwfpe/fpopcode.h b/arch/arm/nwfpe/fpopcode.h
index ec78e35..0090b19 100644
--- a/arch/arm/nwfpe/fpopcode.h
+++ b/arch/arm/nwfpe/fpopcode.h
@@ -369,20 +369,20 @@ TABLE 5
#define getRoundingMode(opcode) ((opcode & MASK_ROUNDING_MODE) >> 5)
#ifdef CONFIG_FPE_NWFPE_XP
-static inline __attribute_pure__ floatx80 getExtendedConstant(const unsigned int nIndex)
+static inline floatx80 __pure getExtendedConstant(const unsigned int nIndex)
{
extern const floatx80 floatx80Constant[];
return floatx80Constant[nIndex];
}
#endif
-static inline __attribute_pure__ float64 getDoubleConstant(const unsigned int nIndex)
+static inline float64 __pure getDoubleConstant(const unsigned int nIndex)
{
extern const float64 float64Constant[];
return float64Constant[nIndex];
}
-static inline __attribute_pure__ float32 getSingleConstant(const unsigned int nIndex)
+static inline float32 __pure getSingleConstant(const unsigned int nIndex)
{
extern const float32 float32Constant[];
return float32Constant[nIndex];
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c
index 9eac65f..dcf22a3 100644
--- a/drivers/media/video/v4l1-compat.c
+++ b/drivers/media/video/v4l1-compat.c
@@ -144,7 +144,7 @@ const static unsigned int palette2pixelformat[] = {
[VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P,
};
-static unsigned int __attribute_pure__
+static unsigned int __pure
palette_to_pixelformat(unsigned int palette)
{
if (palette < ARRAY_SIZE(palette2pixelformat))
diff --git a/include/asm-blackfin/processor.h b/include/asm-blackfin/processor.h
index 6bb3e0d..c571e95 100644
--- a/include/asm-blackfin/processor.h
+++ b/include/asm-blackfin/processor.h
@@ -104,13 +104,13 @@ unsigned long get_wchan(struct task_struct *p);
#define cpu_relax() barrier()
/* Get the Silicon Revision of the chip */
-static inline __attribute_pure__ uint32_t bfin_revid(void)
+static inline uint32_t __pure bfin_revid(void)
{
/* stored in the upper 4 bits */
return bfin_read_CHIPID() >> 28;
}
-static inline __attribute_pure__ uint32_t bfin_compiled_revid(void)
+static inline uint32_t __pure bfin_compiled_revid(void)
{
#if defined(CONFIG_BF_REV_0_0)
return 0;
diff --git a/include/asm-ppc/time.h b/include/asm-ppc/time.h
index f7eadf6..81dbcd4 100644
--- a/include/asm-ppc/time.h
+++ b/include/asm-ppc/time.h
@@ -57,7 +57,7 @@ static __inline__ void set_dec(unsigned int val)
/* Accessor functions for the timebase (RTC on 601) registers. */
/* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
#ifdef CONFIG_6xx
-extern __inline__ int __attribute_pure__ __USE_RTC(void) {
+extern __inline__ int __pure __USE_RTC(void) {
return (mfspr(SPRN_PVR)>>16) == 1;
}
#else
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index acd5833..fe23792 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -36,10 +36,20 @@
#define __weak __attribute__((weak))
#define __naked __attribute__((naked))
#define __noreturn __attribute__((noreturn))
+
+/*
+ * From the GCC manual:
+ *
+ * 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.
+ * [...]
+ */
#define __pure __attribute__((pure))
#define __aligned(x) __attribute__((aligned(x)))
#define __printf(a,b) __attribute__((format(printf,a,b)))
#define noinline __attribute__((noinline))
-#define __attribute_pure__ __attribute__((pure))
#define __attribute_const__ __attribute__((__const__))
#define __maybe_unused __attribute__((unused))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 2165cc9..53354e1 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -167,20 +167,6 @@ extern int do_check_likely(struct likeliness *likeliness, int exp);
# define __maybe_unused /* unimplemented */
#endif
-/*
- * From the GCC manual:
- *
- * 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.
- * [...]
- */
-#ifndef __attribute_pure__
-# define __attribute_pure__ /* unimplemented */
-#endif
-
#ifndef noinline
#define noinline
#endif
diff --git a/lib/crc32.c b/lib/crc32.c
index bfc3331..d2c2f25 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -49,7 +49,7 @@ MODULE_LICENSE("GPL");
* @p: pointer to buffer over which CRC is run
* @len: length of buffer @p
*/
-u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len);
+u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len);
#if CRC_LE_BITS == 1
/*
@@ -57,7 +57,7 @@ u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len);
* simplified by inlining the table in ?: form.
*/
-u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
+u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len)
{
int i;
while (len--) {
@@ -69,7 +69,7 @@ u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
}
#else /* Table-based approach */
-u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
+u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len)
{
# if CRC_LE_BITS == 8
const u32 *b =(u32 *)p;
@@ -145,7 +145,7 @@ u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
* @p: pointer to buffer over which CRC is run
* @len: length of buffer @p
*/
-u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len);
+u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len);
#if CRC_BE_BITS == 1
/*
@@ -153,7 +153,7 @@ u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len);
* simplified by inlining the table in ?: form.
*/
-u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
+u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len)
{
int i;
while (len--) {
@@ -167,7 +167,7 @@ u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
}
#else /* Table-based approach */
-u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
+u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len)
{
# if CRC_BE_BITS == 8
const u32 *b =(u32 *)p;
diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c
index 60f4680..802f11f 100644
--- a/lib/libcrc32c.c
+++ b/lib/libcrc32c.c
@@ -66,7 +66,7 @@ EXPORT_SYMBOL(crc32c_le);
* loop below with crc32 and vary the POLY if we don't find value in terms
* of space and maintainability in keeping the two modules separate.
*/
-u32 __attribute_pure__
+u32 __pure
crc32c_le(u32 crc, unsigned char const *p, size_t len)
{
int i;
@@ -160,7 +160,7 @@ static const u32 crc32c_table[256] = {
* crc using table.
*/
-u32 __attribute_pure__
+u32 __pure
crc32c_le(u32 seed, unsigned char const *data, size_t length)
{
u32 crc = __cpu_to_le32(seed);
@@ -177,7 +177,7 @@ crc32c_le(u32 seed, unsigned char const *data, size_t length)
EXPORT_SYMBOL(crc32c_be);
#if CRC_BE_BITS == 1
-u32 __attribute_pure__
+u32 __pure
crc32c_be(u32 crc, unsigned char const *p, size_t len)
{
int i;
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] Replace __attribute_pure__ with __pure
2007-10-05 13:13 [PATCH] Replace __attribute_pure__ with __pure Ralf Baechle
@ 2007-10-05 13:23 ` Mauro Carvalho Chehab
2007-10-05 15:35 ` Mike Frysinger
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2007-10-05 13:23 UTC (permalink / raw)
To: Ralf Baechle
Cc: Andrew Morton, Russell King, aubrey.li, bernd.schmidt, bryan.wu,
grace.pan, marc.hoffman, michael.hennerich, michael.frysinger,
jerry.zeng, jie.zhang, robin.getz, roy.huang, sonic.zhang,
vivi.li, yi.li, paulus, linux-kernel
Em Sex, 2007-10-05 às 14:13 +0100, Ralf Baechle escreveu:
> To be consistent with the use of attributes in the rest of the kernel
> replace all use of __attribute_pure__ with __pure and delete the
> definition of __attribute_pure__.
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Cheers,
Mauro
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Replace __attribute_pure__ with __pure
2007-10-05 13:13 [PATCH] Replace __attribute_pure__ with __pure Ralf Baechle
2007-10-05 13:23 ` Mauro Carvalho Chehab
@ 2007-10-05 15:35 ` Mike Frysinger
2007-10-05 22:36 ` Robin Getz
2007-10-06 0:51 ` H. Peter Anvin
3 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2007-10-05 15:35 UTC (permalink / raw)
To: Ralf Baechle
Cc: Andrew Morton, Russell King, Mauro Carvalho Chehab, aubrey.li,
bernd.schmidt, bryan.wu, grace.pan, marc.hoffman,
michael.hennerich, michael.frysinger, jerry.zeng, jie.zhang,
robin.getz, roy.huang, sonic.zhang, vivi.li, yi.li, paulus,
linux-kernel
On 10/5/07, Ralf Baechle <ralf@linux-mips.org> wrote:
> To be consistent with the use of attributes in the rest of the kernel
> replace all use of __attribute_pure__ with __pure and delete the
> definition of __attribute_pure__.
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
doesnt matter one way or the other to me, so:
Acked-by: Michael Frysinger <michael.frysinger@analog.com>
> And btw why does Analog list half their employees in the MAINTAINERS entry?
> Seems a little over the top ...
this is supposed to be replaced with just the mailing list
-mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Replace __attribute_pure__ with __pure
2007-10-05 13:13 [PATCH] Replace __attribute_pure__ with __pure Ralf Baechle
2007-10-05 13:23 ` Mauro Carvalho Chehab
2007-10-05 15:35 ` Mike Frysinger
@ 2007-10-05 22:36 ` Robin Getz
2007-10-06 0:51 ` H. Peter Anvin
3 siblings, 0 replies; 6+ messages in thread
From: Robin Getz @ 2007-10-05 22:36 UTC (permalink / raw)
To: Andrew Morton, Ralf Baechle; +Cc: linux-kernel, Bryan Wu
On Fri 5 Oct 2007 09:13, Ralf Baechle pondered:
> And btw why does Analog list half their employees in the MAINTAINERS
> entry?
> Seems a little over the top ...
Yeah, the original submission got a little carried away...
We can cut that down to just Bryan and the mailing list I think.
-Robin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Replace __attribute_pure__ with __pure
2007-10-05 13:13 [PATCH] Replace __attribute_pure__ with __pure Ralf Baechle
` (2 preceding siblings ...)
2007-10-05 22:36 ` Robin Getz
@ 2007-10-06 0:51 ` H. Peter Anvin
2007-10-06 18:49 ` Kyle Moffett
3 siblings, 1 reply; 6+ messages in thread
From: H. Peter Anvin @ 2007-10-06 0:51 UTC (permalink / raw)
To: Ralf Baechle
Cc: Andrew Morton, Russell King, Mauro Carvalho Chehab, aubrey.li,
bernd.schmidt, bryan.wu, grace.pan, marc.hoffman,
michael.hennerich, michael.frysinger, jerry.zeng, jie.zhang,
robin.getz, roy.huang, sonic.zhang, vivi.li, yi.li, paulus,
linux-kernel
Ralf Baechle wrote:
> To be consistent with the use of attributes in the rest of the kernel
> replace all use of __attribute_pure__ with __pure and delete the
> definition of __attribute_pure__.
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Concern: __attribute_pure__ is very similar to __attribute_const__,
which is almost completely, but not totally unlike the keyword "const"...
-hpa
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Replace __attribute_pure__ with __pure
2007-10-06 0:51 ` H. Peter Anvin
@ 2007-10-06 18:49 ` Kyle Moffett
0 siblings, 0 replies; 6+ messages in thread
From: Kyle Moffett @ 2007-10-06 18:49 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Ralf Baechle, Andrew Morton, Russell King, Mauro Carvalho Chehab,
bryan.wu, michael.frysinger, robin.getz, Paul Mackerras,
LKML Kernel
Trimmed the CC list a bit
On Oct 05, 2007, at 20:51:21, H. Peter Anvin wrote:
> Ralf Baechle wrote:
>> To be consistent with the use of attributes in the rest of the
>> kernel replace all use of __attribute_pure__ with __pure and
>> delete the definition of __attribute_pure__.
>
> Concern: __attribute_pure__ is very similar to __attribute_const__,
> which is almost completely, but not totally unlike the keyword
> "const"...
Yes, there's also the fact that __pure is a reserved GCC keyword.
Essentially according to GCC docs all of the GCC-specific keywords
are equivalently defined as "keyword", "__keyword", and
"__keyword__", with only the latter two defined in strict-ANSI mode.
The following is valid according to GCC docs:
static int __attribute__((__pure)) my_strlen(const char *str);
With the proposed definition of __pure, that becomes a noticeably
invalid __attribute__((__attribute__((__pure__))))
Cheers,
Kyle Moffett
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-10-06 18:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-05 13:13 [PATCH] Replace __attribute_pure__ with __pure Ralf Baechle
2007-10-05 13:23 ` Mauro Carvalho Chehab
2007-10-05 15:35 ` Mike Frysinger
2007-10-05 22:36 ` Robin Getz
2007-10-06 0:51 ` H. Peter Anvin
2007-10-06 18:49 ` Kyle Moffett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox