qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] translate-all: wrapped map_exec() in #ifdef


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] translate-all: wrapped map_exec() in #ifdef
Date: Fri, 31 Oct 2014 18:30:21 +0000

On 31 October 2014 04:59, SeokYeon Hwang <address@hidden> wrote:
> Moved map_exec() and wrapped it in #ifdef to avoid "-Wunused-function" on 
> clang 3.4 or later.
>
> Signed-off-by: SeokYeon Hwang <address@hidden>

I had this kind of on my todo list too, but I didn't much like
the nested ifdefs which are really only because of what the
different implementations of alloc_code_gen_buffer() happen
to do. I think it would be more robust to just mark the
functions with the 'unused' attribute instead of relying on
'inline' to implicitly do this for us:

--- a/translate-all.c
+++ b/translate-all.c
@@ -270,14 +270,14 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr)
 }

 #ifdef _WIN32
-static inline void map_exec(void *addr, long size)
+static __attribute__((unused)) void map_exec(void *addr, long size)
 {
     DWORD old_protect;
     VirtualProtect(addr, size,
                    PAGE_EXECUTE_READWRITE, &old_protect);
 }
 #else
-static inline void map_exec(void *addr, long size)
+static __attribute__((unused)) void map_exec(void *addr, long size)
 {
     unsigned long start, end, page_size;

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]