From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 5D43A3858CDB; Fri, 28 Oct 2022 17:39:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D43A3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666978773; bh=vNTwZ4Z7GEZDgSiUicXPD6C5GCaY8hjGyMHHFA6siqU=; h=From:To:Subject:Date:From; b=A7wW8oQcpULuCReZIloRQ9Q4pdi0euIZMzzxX6Snag+P0lO7r52CBFx1XoFHsfEO0 yPW8gSTjSGGb2/4LdGz4kYppoJ73O8FEAxEdGwjyvIxx+VW9EJyLJqvuSW28u+Ozxl gvCUYxQESqjN4PHEQecf3ExL0JvbxEueHaP7nINc= 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] resolv: Handle -Wsometimes-uninitialized on getaddrinfo X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 790040c07bf6180087979056216bae260257b494 X-Git-Newrev: fb05ebde058816e3476f346a5bef9ae987dd5661 Message-Id: <20221028173933.5D43A3858CDB@sourceware.org> Date: Fri, 28 Oct 2022 17:39:33 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fb05ebde058816e3476f346a5bef9ae987dd5661 commit fb05ebde058816e3476f346a5bef9ae987dd5661 Author: Adhemerval Zanella Date: Tue Mar 22 16:01:34 2022 -0300 resolv: Handle -Wsometimes-uninitialized on getaddrinfo Diff: --- sysdeps/posix/getaddrinfo.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 5cda9bb072..ceb236996e 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -1866,6 +1866,10 @@ add_prefixlist (struct prefixlist **listp, size_t *lenp, bool *nullbitsp, if (cp != NULL) *cp++ = '\0'; *pos = cp; + /* clang warns that endp is used uninitialized whenever '||' condition + is true, however it will be evaluated after strtoul call. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wsometimes-uninitialized"); if (inet_pton (AF_INET6, val1, &prefix) && (cp == NULL || (bits = strtoul (cp, &endp, 10)) != ULONG_MAX @@ -1889,6 +1893,7 @@ add_prefixlist (struct prefixlist **listp, size_t *lenp, bool *nullbitsp, ++*lenp; *nullbitsp |= bits == 0; } + DIAG_POP_NEEDS_COMMENT_CLANG; return true; } @@ -2027,6 +2032,11 @@ gaiconf_init (void) if (inet_pton (AF_INET6, val1, &prefix)) { bits = 128; + /* clang warns that endp is used uninitialized whenever '||' + condition is true, however it will be evaluated after + strtoul call. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wsometimes-uninitialized"); if (IN6_IS_ADDR_V4MAPPED (&prefix) && (cp == NULL || (bits = strtoul (cp, &endp, 10)) != ULONG_MAX @@ -2048,6 +2058,7 @@ gaiconf_init (void) goto no_file; } } + DIAG_POP_NEEDS_COMMENT_CLANG; } else if (inet_pton (AF_INET, val1, &prefix.s6_addr32[3]) && (cp == NULL