From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 808E23858422; Tue, 4 Oct 2022 12:57:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 808E23858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664888244; bh=C06bD4kON5cg+O7uKJfok72E7eB+wAqqxrREt242K3U=; h=From:To:Subject:Date:From; b=pMCakwPehQxapH6I+5MQgXUb5ebi6vlkE5vzDdHQcSBkb8OjWIKCCnBTK9C0nv1+Q 6j/Sv7nBXk6N9gBw2hSfKasOhhmEpIxZ9WaJH789+CqFuIRWOU8i4sj+YUTqDPDyID oebiz4phz5X+7WS2By0BZ1fLe4N6bO00mcjSE6R0= 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: 82c0cadf4572f07c4db20c3818088fa45e15e564 X-Git-Newrev: 796c43648a537dda012e0f5355ebbbc946ccb616 Message-Id: <20221004125724.808E23858422@sourceware.org> Date: Tue, 4 Oct 2022 12:57:24 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=796c43648a537dda012e0f5355ebbbc946ccb616 commit 796c43648a537dda012e0f5355ebbbc946ccb616 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