libgomp: avoid unused-variable-error when configured with CFLAGS=-DNDEBUG

Message ID SA1PR01MB66062A5DF684FA5CA98D2E78D7132@SA1PR01MB6606.prod.exchangelabs.com
State New
Headers
Series libgomp: avoid unused-variable-error when configured with CFLAGS=-DNDEBUG |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed

Commit Message

shynur . Jan. 9, 2025, 6:16 a.m. UTC
  From 929fb2091ffe50a35a1b2dae1f1ce20357bc435b Mon Sep 17 00:00:00 2001
From: shynur <one.last.kiss@outlook.com>
Date: Thu, 9 Jan 2025 14:11:38 +0800
Subject: [PATCH] Avoid unused-variable-error when configured with
 'CFLAGS=-DNDEBUG'

---
 libgomp/target.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Patch

diff --git a/libgomp/target.c b/libgomp/target.c
index 9fc51b160f0..dbc4535b96f 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -2092,8 +2092,9 @@  gomp_unmap_vars_internal (struct target_mem_desc *tgt, bool do_copyfrom,
 			    tgt->list[i].length);
       if (do_remove)
 	{
-	  struct target_mem_desc *k_tgt = k->tgt;
-	  bool is_tgt_unmapped = gomp_remove_var (devicep, k);
+	  struct target_mem_desc *k_tgt __attribute__((unused)) = k->tgt;
+	  bool is_tgt_unmapped __attribute__((unused))
+	    = gomp_remove_var (devicep, k);
 	  /* It would be bad if TGT got unmapped while we're still iterating
 	     over its LIST_COUNT, and also expect to use it in the following
 	     code.  */