[Mesa-dev] [PATCH 07/12] intel: aubinator: mark ftruncate_res as MAYBE_UNUSED in ensure_phys_mem

Kai Wasserb├Ąch kai at dev.carbon-project.org
Sat Aug 18 11:16:11 UTC 2018


Only used, when asserts are enabled.

Fixes an unused-variable warning with GCC 8:
 ../../../src/intel/tools/aubinator.c: In function 'ensure_phys_mem':
 ../../../src/intel/tools/aubinator.c:209:11: warning: unused variable 'ftruncate_res' [-Wunused-variable]
        int ftruncate_res = ftruncate(mem_fd, mem_fd_len += 4096);
            ^~~~~~~~~~~~~

Signed-off-by: Kai Wasserb├Ąch <kai at dev.carbon-project.org>
---
 src/intel/tools/aubinator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 9a3b1d1ef1..66a7db1043 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -206,7 +206,7 @@ ensure_phys_mem(uint64_t phys_addr)
       new_mem->phys_addr = phys_addr;
       new_mem->fd_offset = mem_fd_len;
 
-      int ftruncate_res = ftruncate(mem_fd, mem_fd_len += 4096);
+      MAYBE_UNUSED int ftruncate_res = ftruncate(mem_fd, mem_fd_len += 4096);
       assert(ftruncate_res == 0);
 
       new_mem->data = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED,
-- 
2.18.0



More information about the mesa-dev mailing list