From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id AA6A538337B1 for ; Tue, 28 Jun 2022 08:32:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AA6A538337B1 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-454-cejzvTr7MgiEFTbTLg2QEA-1; Tue, 28 Jun 2022 04:32:03 -0400 X-MC-Unique: cejzvTr7MgiEFTbTLg2QEA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6D431C01B38; Tue, 28 Jun 2022 08:32:02 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.0]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7594140CF8E4; Tue, 28 Jun 2022 08:32:01 +0000 (UTC) From: Florian Weimer To: Yang Yanchao Cc: , Carlos O'Donell , , , Subject: Re: [PATCH v5] elf: fixes compile error when both enable -Werror and -DNDEBUG References: <32fcdf7272e74ec894876227b00c8e3d@huawei.com> Date: Tue, 28 Jun 2022 10:31:59 +0200 In-Reply-To: (Yang Yanchao's message of "Tue, 28 Jun 2022 16:10:21 +0800") Message-ID: <875ykli3y8.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2022 08:32:09 -0000 * Yang Yanchao: > On 2022/4/15 15:36, Yang Yanchao wrote: >> Use -Werror and -DNDEBUG at the same time will causes the following >> compilation errors: >> cache.c: In function 'save_cache': >> cache.c:758:15: error: unused variable 'old_offset' [-Werror=unused-variable] >> 758 | off64_t old_offset = lseek64 (fd, extension_offset, SEEK_SET); >> | ^~~~~~~~~~ >> -DNDEBUG will disables the assertion. >> Therefore, only the variables used by assertions do not take effect. >> use __attribute__ ((unused)) to disable this warning. >> --- >> elf/cache.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> diff --git a/elf/cache.c b/elf/cache.c index dbf4c83a7a..e92860023c >> 100644 >> --- a/elf/cache.c >> +++ b/elf/cache.c >> @@ -754,7 +754,8 @@ save_cache (const char *cache_name) >> if (opt_format != opt_format_old) >> { >> /* Align file position to 4. */ >> - off64_t old_offset = lseek64 (fd, extension_offset, SEEK_SET); >> + __attribute__ ((unused)) off64_t old_offset >> + = lseek64 (fd, extension_offset, SEEK_SET); >> assert ((unsigned long long int) (extension_offset - old_offset) < 4); >> write_extensions (fd, str_offset, extension_offset); >> } >> > > ping again Sorry for the delay. I've reworded the commit message slightly and pushed your change. Thanks, Florian