]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Fix compile error with -DNDEBUG [BZ #18755]
authorQingqing Li <liqingqing3@huawei.com>
Thu, 21 Sep 2023 12:11:36 +0000 (20:11 +0800)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 27 Sep 2023 20:03:34 +0000 (17:03 -0300)
Compilation fails when building with -DNDEBUG after commit a3189f66a5f2fe86568286fa025fa153be04c6c0.
Here is the error:

dl-close.c: In function ‘_dl_close_worker’:
dl-close.c:140:22: error: unused variable ‘nloaded’ [-Werror=unused-variable]
  140 |   const unsigned int nloaded = ns->_ns_nloaded;

Add __attribute_maybe_unused__ for‘nloaded’to fix it.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
elf/dl-close.c

index c9a7d06577878e916c02e6e6494df51b9a2a4eef..24cc4750a5eeb6b30bb23888b29fad06269ea2ad 100644 (file)
@@ -137,7 +137,7 @@ _dl_close_worker (struct link_map *map, bool force)
   dl_close_state = pending;
 
   bool any_tls = false;
-  const unsigned int nloaded = ns->_ns_nloaded;
+  const unsigned int nloaded __attribute_maybe_unused__ = ns->_ns_nloaded;
 
   /* Run over the list and assign indexes to the link maps.  */
   int idx = 0;