public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/clang] elf: Supress clang -Wsometimes-uninitialized on _dl_debug_initialize
Date: Thu,  9 Feb 2023 19:47:07 +0000 (GMT)	[thread overview]
Message-ID: <20230209194707.E8E9C3857BB3@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=230f8759ce295d5d3d598658333e0898c3aa7497

commit 230f8759ce295d5d3d598658333e0898c3aa7497
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 bd7b1cc8f7..db25438256 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)
     {

             reply	other threads:[~2023-02-09 19:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09 19:47 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-17 20:05 Adhemerval Zanella
2024-04-02 15:51 Adhemerval Zanella
2024-02-09 17:30 Adhemerval Zanella
2024-02-07 14:05 Adhemerval Zanella
2024-01-29 17:55 Adhemerval Zanella
2023-12-21 18:52 Adhemerval Zanella
2023-09-28 17:50 Adhemerval Zanella
2023-08-30 12:35 Adhemerval Zanella
2022-10-28 17:40 Adhemerval Zanella
2022-10-04 12:58 Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230209194707.E8E9C3857BB3@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).