[Mesa-dev] [PATCH] util: Silence GCC unused-but-set-variable warning.
Jose Fonseca
jfonseca at vmware.com
Mon Jan 16 10:05:10 PST 2012
----- Original Message -----
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 16.01.2012 08:13, Vinson Lee wrote:
> > Fix this GCC 4.6 warning with 64-bit builds. u_debug_stack.c: In
> > function ‘debug_backtrace_capture’: u_debug_stack.c:45:17: warning:
> > variable ‘frame_pointer’ set but not used
> > [-Wunused-but-set-variable]
> >
> > Signed-off-by: Vinson Lee <vlee at freedesktop.org> ---
> > src/gallium/auxiliary/util/u_debug_stack.c | 2 ++ 1 files
> > changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/src/gallium/auxiliary/util/u_debug_stack.c
> > b/src/gallium/auxiliary/util/u_debug_stack.c index 24e039f..558b911
> > 100644 --- a/src/gallium/auxiliary/util/u_debug_stack.c +++
> > b/src/gallium/auxiliary/util/u_debug_stack.c @@ -86,6 +86,8 @@
> > debug_backtrace_capture(struct debug_stack_frame *backtrace,
> >
> > frame_pointer = next_frame_pointer; } +#else + (void)
> > frame_pointer; #endif
> >
> > while(nr_frames) {
Looks good Vinson.
> Why not just move the definition of frame_pointer into the
> #ifdef PIPE_ARCH_X86 ?
It would be cleaner, but it would require C99 as the declaration would appear after code, which would break MSVC. I think it's better to commit Vinson's patch as is.
Jose
More information about the mesa-dev
mailing list