[Mesa-dev] [PATCH 09/12] intel: aubinator: mark *res as MAYBE_UNUSED in get_ppgtt_batch_bo

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


Only used, when asserts are enabled.

Fixes an unused-variable warning with GCC 8:
 ../../../src/intel/tools/aubinator.c: In function 'get_ppgtt_batch_bo':
 ../../../src/intel/tools/aubinator.c:383:13: warning: unused variable 'res' [-Wunused-variable]
        void *res = mmap((uint8_t *)bo.map + (page - bo.addr), 4096, PROT_READ,
              ^~~

Signed-off-by: Kai Wasserbäch <kai at dev.carbon-project.org>
---
 src/intel/tools/aubinator.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 96ac39248d..abdebba53a 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -381,8 +381,9 @@ get_ppgtt_batch_bo(void *user_data, uint64_t address)
    for (uint64_t page = address; page < end; page += 4096) {
       struct phys_mem *phys_mem = ppgtt_walk(pml4, page);
 
-      void *res = mmap((uint8_t *)bo.map + (page - bo.addr), 4096, PROT_READ,
-                       MAP_SHARED | MAP_FIXED, mem_fd, phys_mem->fd_offset);
+      MAYBE_UNUSED void *res = mmap((uint8_t *)bo.map + (page - bo.addr), 4096,
+                       PROT_READ, MAP_SHARED | MAP_FIXED, mem_fd,
+                       phys_mem->fd_offset);
       assert(res != MAP_FAILED);
    }
 
-- 
2.18.0



More information about the mesa-dev mailing list