From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 1EAE63858407; Fri, 9 Feb 2024 17:30:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1EAE63858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707499800; bh=DJ7qzslWBuexqBrfajoyiIZ4zig5IxMAIYStC40YmsE=; h=From:To:Subject:Date:From; b=r8WSpbzxsCtXCCpEefK2cPdJ9nxMVqC23BGcahCL6OP6B+LaP9SpAO+Ww0xzifwm0 EPvt3kvqJLDt0ZK2AXUjV7+TlzbkrZXBuZ5a8W4moXxENs/9yr5akBGuw23AJVi1Nb xH9O83cKF3jSXkS63j+5LWx1U6T6mVUd/listCb8= 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: aaeb500a73424099bd42ed3243ba58b75809767b X-Git-Newrev: 3a806ebbb180a7bd5741b3873db464c38e044340 Message-Id: <20240209173000.1EAE63858407@sourceware.org> Date: Fri, 9 Feb 2024 17:30:00 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3a806ebbb180a7bd5741b3873db464c38e044340 commit 3a806ebbb180a7bd5741b3873db464c38e044340 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/elf/dl-debug.c b/elf/dl-debug.c index ef56de7a29..abd199da0f 100644 --- a/elf/dl-debug.c +++ b/elf/dl-debug.c @@ -17,6 +17,7 @@ . */ #include +#include /* These are the members in the public `struct link_map' type. @@ -54,7 +55,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 +90,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) {