Thread (7 messages) flat view 7 messages, 5 authors, 2005-08-04

Re: [PATCH] fix gcc4 warning in asm-ppc/time.h

From: Andrew Morton <hidden>
Date: 2005-08-04 05:16:30

Christoph Hellwig [off-list ref] wrote:
quoted hunk ↗ jump to hunk
A function must not return a const value, instead use
__attribute_const__.


Index: linux-2.6/include/asm/time.h
===================================================================
--- linux-2.6.orig/include/asm/time.h	2005-04-30 10:17:19.000000000 +0200
+++ linux-2.6/include/asm/time.h	2005-08-01 11:57:12.000000000 +0200
@@ -10,6 +10,7 @@
 #define __ASM_TIME_H__
 
 #include <linux/config.h>
+#include <linux/compiler.h>
 #include <linux/types.h>
 #include <linux/rtc.h>
 #include <linux/threads.h>
@@ -58,7 +59,7 @@
 /* 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 const __USE_RTC(void) {
+extern __inline__ int __attribute_const__ __USE_RTC(void) {
 	return (mfspr(SPRN_PVR)>>16) == 1;
 }
 #else
Do we really want to do this?  The above implies that mfspr(SPRN_PVR) will
return the same value across the entire uptime of the kernel.  Is that
true?

Why is this function paying with const anyway?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help