* [Qemu-devel] [PATCH] linux-user: fix compile failure if !CONFIG_USE_GUEST_BASE
@ 2011-02-10 16:53 Peter Maydell
2011-02-21 16:53 ` Peter Maydell
2011-03-03 22:48 ` Aurelien Jarno
0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2011-02-10 16:53 UTC (permalink / raw)
To: qemu-devel; +Cc: patches
If CONFIG_USE_GUEST_BASE is not defined, gcc complains:
linux-user/mmap.c:235: error: comparison of unsigned expression >= 0 is always true
because RESERVED_VA is #defined to 0. Since mmap_find_vma_reserved()
will never be called anyway if RESERVED_VA is always 0, fix this by
simply #ifdef'ing away the function and its callsite.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
I'm not a great fan of introducing #ifdefs, but I couldn't come
up with a cleaner way of shutting gcc up...
linux-user/mmap.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index abf21f6..0cf22f8 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -216,6 +216,7 @@ static abi_ulong mmap_next_start = TASK_UNMAPPED_BASE;
unsigned long last_brk;
+#ifdef CONFIG_USE_GUEST_BASE
/* Subroutine of mmap_find_vma, used when we have pre-allocated a chunk
of guest address space. */
static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size)
@@ -249,6 +250,7 @@ static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size)
mmap_next_start = addr;
return last_addr;
}
+#endif
/*
* Find and reserve a free memory area of size 'size'. The search
@@ -271,9 +273,11 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
size = HOST_PAGE_ALIGN(size);
+#ifdef CONFIG_USE_GUEST_BASE
if (RESERVED_VA) {
return mmap_find_vma_reserved(start, size);
}
+#endif
addr = start;
wrapped = repeat = 0;
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: fix compile failure if !CONFIG_USE_GUEST_BASE
2011-02-10 16:53 [Qemu-devel] [PATCH] linux-user: fix compile failure if !CONFIG_USE_GUEST_BASE Peter Maydell
@ 2011-02-21 16:53 ` Peter Maydell
2011-03-03 22:48 ` Aurelien Jarno
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2011-02-21 16:53 UTC (permalink / raw)
To: qemu-devel; +Cc: patches
Ping?
On 10 February 2011 16:53, Peter Maydell <peter.maydell@linaro.org> wrote:
> If CONFIG_USE_GUEST_BASE is not defined, gcc complains:
> linux-user/mmap.c:235: error: comparison of unsigned expression >= 0 is always true
>
> because RESERVED_VA is #defined to 0. Since mmap_find_vma_reserved()
> will never be called anyway if RESERVED_VA is always 0, fix this by
> simply #ifdef'ing away the function and its callsite.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I'm not a great fan of introducing #ifdefs, but I couldn't come
> up with a cleaner way of shutting gcc up...
>
> linux-user/mmap.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index abf21f6..0cf22f8 100644
> --- a/linux-user/mmap.c
> +++ b/linux-user/mmap.c
> @@ -216,6 +216,7 @@ static abi_ulong mmap_next_start = TASK_UNMAPPED_BASE;
>
> unsigned long last_brk;
>
> +#ifdef CONFIG_USE_GUEST_BASE
> /* Subroutine of mmap_find_vma, used when we have pre-allocated a chunk
> of guest address space. */
> static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size)
> @@ -249,6 +250,7 @@ static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size)
> mmap_next_start = addr;
> return last_addr;
> }
> +#endif
>
> /*
> * Find and reserve a free memory area of size 'size'. The search
> @@ -271,9 +273,11 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
>
> size = HOST_PAGE_ALIGN(size);
>
> +#ifdef CONFIG_USE_GUEST_BASE
> if (RESERVED_VA) {
> return mmap_find_vma_reserved(start, size);
> }
> +#endif
>
> addr = start;
> wrapped = repeat = 0;
> --
> 1.7.1
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: fix compile failure if !CONFIG_USE_GUEST_BASE
2011-02-10 16:53 [Qemu-devel] [PATCH] linux-user: fix compile failure if !CONFIG_USE_GUEST_BASE Peter Maydell
2011-02-21 16:53 ` Peter Maydell
@ 2011-03-03 22:48 ` Aurelien Jarno
1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2011-03-03 22:48 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches
On Thu, Feb 10, 2011 at 04:53:04PM +0000, Peter Maydell wrote:
> If CONFIG_USE_GUEST_BASE is not defined, gcc complains:
> linux-user/mmap.c:235: error: comparison of unsigned expression >= 0 is always true
>
> because RESERVED_VA is #defined to 0. Since mmap_find_vma_reserved()
> will never be called anyway if RESERVED_VA is always 0, fix this by
> simply #ifdef'ing away the function and its callsite.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I'm not a great fan of introducing #ifdefs, but I couldn't come
> up with a cleaner way of shutting gcc up...
>
> linux-user/mmap.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
Thanks, applied.
> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index abf21f6..0cf22f8 100644
> --- a/linux-user/mmap.c
> +++ b/linux-user/mmap.c
> @@ -216,6 +216,7 @@ static abi_ulong mmap_next_start = TASK_UNMAPPED_BASE;
>
> unsigned long last_brk;
>
> +#ifdef CONFIG_USE_GUEST_BASE
> /* Subroutine of mmap_find_vma, used when we have pre-allocated a chunk
> of guest address space. */
> static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size)
> @@ -249,6 +250,7 @@ static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size)
> mmap_next_start = addr;
> return last_addr;
> }
> +#endif
>
> /*
> * Find and reserve a free memory area of size 'size'. The search
> @@ -271,9 +273,11 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
>
> size = HOST_PAGE_ALIGN(size);
>
> +#ifdef CONFIG_USE_GUEST_BASE
> if (RESERVED_VA) {
> return mmap_find_vma_reserved(start, size);
> }
> +#endif
>
> addr = start;
> wrapped = repeat = 0;
> --
> 1.7.1
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-03 22:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-10 16:53 [Qemu-devel] [PATCH] linux-user: fix compile failure if !CONFIG_USE_GUEST_BASE Peter Maydell
2011-02-21 16:53 ` Peter Maydell
2011-03-03 22:48 ` Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).