From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlDkg-00065g-4K for qemu-devel@nongnu.org; Mon, 03 Nov 2014 04:16:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlDkZ-0007wa-Gm for qemu-devel@nongnu.org; Mon, 03 Nov 2014 04:16:42 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:58644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlDkZ-0007wW-9i for qemu-devel@nongnu.org; Mon, 03 Nov 2014 04:16:35 -0500 Message-ID: <545747F2.4050403@msgid.tls.msk.ru> Date: Mon, 03 Nov 2014 12:16:34 +0300 From: Michael Tokarev MIME-Version: 1.0 References: <1414731561-13391-1-git-send-email-syeon.hwang@samsung.com> <00d701cff73e$c395a130$4ac0e390$@samsung.com> In-Reply-To: <00d701cff73e$c395a130$4ac0e390$@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] translate-all: wrapped map_exec() in #ifdef List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: SeokYeon Hwang , 'Peter Maydell' Cc: 'QEMU Developers' 03.11.2014 11:18, SeokYeon Hwang wrote: >> -----Original Message----- >> From: Peter Maydell [mailto:peter.maydell@linaro.org] >> Sent: Saturday, November 01, 2014 3:30 AM >> To: SeokYeon Hwang >> Cc: QEMU Developers >> Subject: Re: [Qemu-devel] [PATCH] translate-all: wrapped map_exec() in >> #ifdef >> >> On 31 October 2014 04:59, SeokYeon Hwang wrote: >>> Moved map_exec() and wrapped it in #ifdef to avoid "-Wunused-function" >> on clang 3.4 or later. >>> >>> Signed-off-by: SeokYeon Hwang >> >> 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); } In which case this function isn't used on windows? I mean, is it really necessary to mark it as unused for win32 case? >> #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; How about this instead: --- a/translate-all.c +++ b/translate-all.c @@ -276,7 +276,7 @@ static inline void map_exec(void *addr, long size) VirtualProtect(addr, size, PAGE_EXECUTE_READWRITE, &old_protect); } -#else +#elif !defined(USE_MMAP) static inline void map_exec(void *addr, long size) { unsigned long start, end, page_size; ? (Untested, but just to show an idea)... ;) Thanks, /mjt