From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by sourceware.org (Postfix) with ESMTPS id 1C2D23858C27 for ; Thu, 21 Sep 2023 12:11:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1C2D23858C27 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=huawei.com Received: from canpemm500005.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RrvKy4zWVzNnQt; Thu, 21 Sep 2023 20:07:50 +0800 (CST) Received: from [10.174.176.57] (10.174.176.57) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 21 Sep 2023 20:11:37 +0800 To: Adhemerval Zanella , "libc-alpha@sourceware.org" , "fweimer@redhat.com" , "carlos@redhat.com" CC: Yang Yanchao , , , Qingqing Li From: Qingqing Li Subject: [PATCH v2] elf: Fix compile error with -DNDEBUG [BZ #18755] Message-ID: <0073b7dd-94dd-7561-88f8-f12cbca5a1a6@huawei.com> Date: Thu, 21 Sep 2023 20:11:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.176.57] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --- elf/dl-close.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elf/dl-close.c b/elf/dl-close.c index c9a7d06577..24cc4750a5 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -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; -- 2.27.0