From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id EBD113881D38; Wed, 30 Aug 2023 12:34:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EBD113881D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693398876; bh=WBz4lY2huoXtaObt5fqn/x2B+2jyAtykwCLQBP6md8s=; h=From:To:Subject:Date:From; b=WsPlxxS/nE5xM+uuEs9TDgbQrTNvvlgt0hYAKBwa+XGo+3963SHqvZSp4W7QEm3wY l6R6fypzYpF3+mSJgtQ8cKCgiODv11fKDIVX/f7GkEcGOZdaAJ/kM/4G5n2en+p8/6 HtYfm2PiLQvRvPxTpW172qKHzbn1s7FtarxHOT1Q= 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: db2f4c393fab892293e816c55492d9249bbdd7e6 X-Git-Newrev: af9eb0d987147ab8272cb2fd8cbd18009f84675e Message-Id: <20230830123436.EBD113881D38@sourceware.org> Date: Wed, 30 Aug 2023 12:34:36 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=af9eb0d987147ab8272cb2fd8cbd18009f84675e commit af9eb0d987147ab8272cb2fd8cbd18009f84675e 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 0356b622be..06dbb2b853 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -1867,6 +1867,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 @@ -1890,6 +1894,7 @@ add_prefixlist (struct prefixlist **listp, size_t *lenp, bool *nullbitsp, ++*lenp; *nullbitsp |= bits == 0; } + DIAG_POP_NEEDS_COMMENT_CLANG; return true; } @@ -2028,6 +2033,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 @@ -2049,6 +2059,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