On Sun, Oct 7, 2012 at 7:20 PM, Richard Henderson <r...@twiddle.net> wrote:
> On 10/07/2012 09:34 AM, Blue Swirl wrote:
>>> > +#ifdef USE_MMAP
>>> > +    code_gen_buffer = mmap((void *)start, code_gen_buffer_size,
>>> > +                           PROT_WRITE | PROT_READ | PROT_EXEC,
>>> > +                           flags, -1, 0);
>>> > +    if (code_gen_buffer == MAP_FAILED) {
>>> > +        fprintf(stderr, "Could not allocate dynamic translator 
>>> > buffer\n");
>>> > +        exit(1);
>>> >      }
>>> >  #else
>>> >      code_gen_buffer = g_malloc(code_gen_buffer_size);
>>> >      map_exec(code_gen_buffer, code_gen_buffer_size);
>> In this branch (e.g. mingw32), 'start' is unused:
>> /src/qemu/exec.c: In function 'code_gen_alloc':
>> /src/qemu/exec.c:531: warning: unused variable 'start'
>
> Well, I've rearranged the code to handle this, and it does avoid the warning.
> But I'm not sure I like the two separate blocks.  Especially for the x86_64
> MAP32 case.  Perhaps we're better off with an __attribute__((unused)) there?

How about splitting the function into three: common part, mmap case
and non-mmap case? It could improve readability.

>
>
> r~
>
>
>
>

Reply via email to