[Mesa-dev] [PATCH] gallium: silence __builtin_frame_address nonzero argument is unsafe warning

Timothy Arceri tarceri at itsqueeze.com
Fri Mar 9 00:00:55 UTC 2018


Calling __builtin_frame_address with a nonzero argument is unsafe
but is sometimes done for debugging purposes. Since this code is
part of some debug util code I'm assuming that is the case here
and using GCC pragma to silence the warning.

Cc: José Fonseca <jfonseca at vmware.com>
---
 src/gallium/auxiliary/util/u_debug_stack.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c
index 6ddacdb362..974e639e89 100644
--- a/src/gallium/auxiliary/util/u_debug_stack.c
+++ b/src/gallium/auxiliary/util/u_debug_stack.c
@@ -265,7 +265,10 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace,
 #endif
 
 #if defined(PIPE_CC_GCC)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wframe-address"
    frame_pointer = ((const void **)__builtin_frame_address(1));
+#pragma GCC diagnostic pop
 #elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
    __asm {
       mov frame_pointer, ebp
-- 
2.14.3



More information about the mesa-dev mailing list