[Mesa-dev] [PATCH 4/4] amd/addrlib: mark returnCode as MAYBE_UNUSED in ElemGetExportNorm

Kai Wasserb├Ąch kai at dev.carbon-project.org
Fri Aug 17 14:32:34 UTC 2018


Only used, when asserts are enabled.

Fixes an unused-but-set-variable warning with GCC 8:
 ../../../src/amd/addrlib/addrinterface.cpp: In function 'int ElemGetExportNorm(ADDR_HANDLE, const ELEM_GETEXPORTNORM_INPUT*)':
 ../../../src/amd/addrlib/addrinterface.cpp:835:23: warning: variable 'returnCode' set but not used [-Wunused-but-set-variable]
      ADDR_E_RETURNCODE returnCode = ADDR_OK;
                        ^~~~~~~~~~

Signed-off-by: Kai Wasserb├Ąch <kai at dev.carbon-project.org>
---
 src/amd/Makefile.addrlib.am       | 1 +
 src/amd/addrlib/addrinterface.cpp | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/amd/Makefile.addrlib.am b/src/amd/Makefile.addrlib.am
index 75ff7fbcf7..af0daf907d 100644
--- a/src/amd/Makefile.addrlib.am
+++ b/src/amd/Makefile.addrlib.am
@@ -24,6 +24,7 @@ ADDRLIB_LIBS = addrlib/libamdgpu_addrlib.la
 addrlib_libamdgpu_addrlib_la_CPPFLAGS = \
 	$(DEFINES) \
 	-I$(top_srcdir)/src/ \
+	-I$(top_srcdir)/include \
 	-I$(srcdir)/common \
 	-I$(srcdir)/addrlib \
 	-I$(srcdir)/addrlib/core \
diff --git a/src/amd/addrlib/addrinterface.cpp b/src/amd/addrlib/addrinterface.cpp
index 112431e2cb..9cbeba41d9 100644
--- a/src/amd/addrlib/addrinterface.cpp
+++ b/src/amd/addrlib/addrinterface.cpp
@@ -36,6 +36,8 @@
 
 #include "addrcommon.h"
 
+#include "util/macros.h"
+
 using namespace Addr;
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -832,7 +834,7 @@ BOOL_32 ADDR_API ElemGetExportNorm(
     Addr::Lib* pLib = Lib::GetLib(hLib);
     BOOL_32 enabled = FALSE;
 
-    ADDR_E_RETURNCODE returnCode = ADDR_OK;
+    MAYBE_UNUSED ADDR_E_RETURNCODE returnCode = ADDR_OK;
 
     if (pLib != NULL)
     {
-- 
2.18.0



More information about the mesa-dev mailing list