From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 04EC63858C62; Tue, 4 Oct 2022 12:58:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04EC63858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664888280; bh=8gm4ptEMKzS1Gc8zXQeedpHicxYNdavtHEFlAV3ZEec=; h=From:To:Subject:Date:From; b=rndGRuBRrcjbEJmQu6kC3X1QRZrd4Gwh74mFyJQVbGSIc6ZusODFJFsd1LXnxOjGk +yqc5Mg2/2Ruvm2ygzkk8Tk0Mi0sO1SzKjQToPv3GAav8403iA883p0iUIDk2vXIeu FFvtXac0+uelGHcTv9kqg9XfaaPPYxpU1sBzp3Vw= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] elf: Supress clang -Wsometimes-uninitialized on _dl_debug_initialize X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 63c99ec9bc782da9c144d3f5713d3ada0d2b9b52 X-Git-Newrev: c98a787b61d9029f6d5c2d9f2be11e23338ff6c6 Message-Id: <20221004125800.04EC63858C62@sourceware.org> Date: Tue, 4 Oct 2022 12:58:00 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c98a787b61d9029f6d5c2d9f2be11e23338ff6c6 commit c98a787b61d9029f6d5c2d9f2be11e23338ff6c6 Author: Adhemerval Zanella Date: Wed Aug 24 12:25:05 2022 -0300 elf: Supress clang -Wsometimes-uninitialized on _dl_debug_initialize Clang issues an warning where variable 'r' is used uninitialized whenever 'if' condition is false. The _dl_debug_initialize is called for static case always with LM_ID_BASE (csu/libc-start.c and elf/dl-reloc-static-pie.c) and DL_NSS will be always larger than 1 for shared case. Diff: --- elf/dl-debug.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/elf/dl-debug.c b/elf/dl-debug.c index 538468dc0b..74aabeed0d 100644 --- a/elf/dl-debug.c +++ b/elf/dl-debug.c @@ -54,7 +54,15 @@ _dl_debug_update (Lmid_t ns) struct r_debug * _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns) { - struct r_debug_extended *r, **pp = NULL; + /* clang issues an warning where variable 'r' is used uninitialized whenever + 'if' condition is false. The _dl_debug_initialize is called for static + case always with LM_ID_BASE (csu/libc-start.c and + elf/dl-reloc-static-pie.c) and DL_NSS will be always larger than 1 for + shared case. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wsometimes-uninitialized"); + struct r_debug_extended *r; + struct r_debug_extended **pp = NULL; if (ns == LM_ID_BASE) { @@ -81,6 +89,7 @@ _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns) r->base.r_version = 2; } } + DIAG_POP_NEEDS_COMMENT_CLANG; if (r->base.r_brk == 0) {