Re: const from include/asm-i386/byteorder.h

William Lee Irwin III (wli@holomorphy.com)
Mon, 2 Jun 2003 05:14:57 -0700


On Mon, Jun 02, 2003 at 03:51:39PM +0400, Nikita Danilov wrote:
> Gcc info page:
> `const'
> 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.
> So, it seems byte swapping functions should be __attribute__((const))
> Here is a patch:

I'm very skeptical, in particular, about these hunks:

On Mon, Jun 02, 2003 at 03:51:39PM +0400, Nikita Danilov wrote:
> #include <linux/thread_info.h>
> -static inline struct task_struct *get_current(void) __attribute__ (( __const__ ));
> +static inline struct task_struct *get_current(void) __attribute_const;
> static inline struct task_struct *get_current(void)
> {
> ===== include/asm-arm/thread_info.h 1.6 vs edited =====
> --- 1.6/include/asm-arm/thread_info.h Sat Dec 28 19:26:45 2002
> +++ edited/include/asm-arm/thread_info.h Mon Jun 2 14:44:24 2003
> @@ -74,7 +74,7 @@
> /*
> * how to get the thread information struct from C
> */
> -static inline struct thread_info *current_thread_info(void) __attribute__ (( __const__ ));
> +static inline struct thread_info *current_thread_info(void) __attribute_const;
>
> static inline struct thread_info *current_thread_info(void)
> {

Someone needs to doublecheck whether this actually works. Last I heard,
it did not, but that could have changed since. It vaguely appears some
assumption about it working was made recently since __const__ was there.

-- wli
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/