From patchwork Sun Dec 22 00:04:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 852903 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp2776623wrq; Sat, 21 Dec 2024 16:44:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVrCHavywLFaGrkWxl05VKgP7Td17zm04wd9+cqkt8w2CJq5YgMOlUG8d+qc0xaaKH7D4p2Yw==@linaro.org X-Google-Smtp-Source: AGHT+IFRGawIFNKOskpNxdHy75AywcOpCSBVXFrjZLtofLmNPxzNo9xcmNd7cJTtEewm+tYZlUd3 X-Received: by 2002:a05:620a:394a:b0:7b6:e20c:1a0e with SMTP id af79cd13be357-7b9ba804d47mr1359950885a.51.1734828249455; Sat, 21 Dec 2024 16:44:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1734828249; cv=pass; d=google.com; s=arc-20240605; b=ZqsjnEsQujRRpoS+5UhEzoPqVqgtnq7yYnohIwR3qQO6ia54URePDeb/n/YSyFF8jW hbbSawNSLs/tvp3rZ4KGWp6fw8C31MwTAycrNzzOrSo2a/PN5AFmhmhbWjgWLkjZidLP dUACBMRCUi/UlosknPBtH62hNnX9yLzLQgFqEG5Hb3c5K4X8QCjad8cWf6YdcB/A6/7y W+1vLUlZ0bEc0w5i7ZmMJD3v1RiH9ONQ41VzizDonEb9u2kj6qddWapdfXNjaz3jpAmJ FHflKzbeGu3xudaRKs/oHjhL/jgxxdx0VA4OlqCQkNTLjDHf19vKrEDq8jiKuZSZq8Lh 3ANQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter:arc-filter:dmarc-filter :delivered-to:dkim-filter; bh=DfIiNkxVEtz1YHI63P8kuC+tiCY5aQQKXa6yFVmBY9g=; fh=uKlFkH9AUukvL1xmvBA9M7Oe4ntiJIR8HCR4+3TPd4w=; b=HkHZYp+QvEmgIYeRXMBgEu8g3S49RYjkfUPzRj3lRoa2wUeqTjSurfCydAXlWM0/CQ oITCHsK2WoEJiOeN1zCLbes1PMdmOFiuA4z1cLr8W/Axfll2X6x7ZLCKbdX57B3V9hmj ebHBJkRdRHMGx9C7qrehXK/ESz548g2lKzkgi9Yh7eFu993r1+GfGQlhyP7ZR1QOoc+k S7+3p37cQ4Fk+MM2uckyM1V9T1FAR77TpJcTJ3xflyfQJqQX3olotFKb56cntkM9Ryyi 9wFnx6fexMmac8RUUdKR+b73aFbNGmK2a1cG/072qSLBI+uShC13CnUPHo5A4X0dTv7H SgSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XHi8E1Dg; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id af79cd13be357-7b9ac2ab79asi750370085a.97.2024.12.21.16.44.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2024 16:44:09 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XHi8E1Dg; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0D413385840D for ; Sun, 22 Dec 2024 00:44:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D413385840D Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=XHi8E1Dg X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 95160385843F for ; Sun, 22 Dec 2024 00:05:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 95160385843F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 95160385843F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734825930; cv=none; b=N48vhP90h09T+YRg/4Xi/lyYlG02dS77s+V8RVWK9E8tnQEQqFD4IDHZBiZmz63Vug40OjscLleqrxPSHcBwog+GGyNMJy7Dy7EiZwR29e1bjEHh2+G+Y2Zqbf9Y5+eNuqbseYPzLZiVSK5LvLUWU0QTMvMXsIiHkicHbPWWzh8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734825930; c=relaxed/simple; bh=522axCwMyQCu4yy8uJ6DeFigrKCRqH/44DipZhCOhnQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=v6y3JG5s36Hb7dEiuiTOH5T9swxYM2wlg5sGq3eiIHHmdCXuR2ppKQK0UDX1zkbmATLsyntLh9Z5+nijZ3XFzVcq/7Lk6BNXeVArURR9+oalKLivkvnhSEJvJV9ZoiJviTgiAradOa9evpjEzfPYN8vsAImoKLYZ7F3UMlaQB08= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95160385843F Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2165448243fso33376405ad.1 for ; Sat, 21 Dec 2024 16:05:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734825924; x=1735430724; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DfIiNkxVEtz1YHI63P8kuC+tiCY5aQQKXa6yFVmBY9g=; b=XHi8E1DgtvhvTRxNA8wee0H77zrE4sUy88gUPd8xSAHg6S/4dHaYJ+kY7ryGGnKdzy J/7a2dasrmcGoRtU73UF1UE9OJh7gdX6B56KffibmM1zr9wjXqG6CzM9UkSgG+w3LSpN G1v8+2bI5UWF8+bvQSvwSD5SKnotx6AbivVqBJImL16EEm06HM+p0MAosGOvzH7GnbqJ I/46Q6LGCsGGs7fiL9mxpxp6q8fkFdfxH+8zoa0SgjbrswelyGO4Lvv96e8rsKN9T11c 32ugC86e1KXv4YTR6vAjc+328KKzUmN0S2VCtSOf0iOoYsIB9vCXFnQOk20+C9rClymL a7QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734825924; x=1735430724; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DfIiNkxVEtz1YHI63P8kuC+tiCY5aQQKXa6yFVmBY9g=; b=rwdqSCtm84FieMR9N6lKnEVvDehx+9gAlUOieh+xJ0f/17OzZNB75tBTfqfHiBwfsL bB/rZmeFNsg1w+jXxzr+MgwMXhgohziVliCZQviieMXxzp/r+0mnIckMuQ16m/cal2Cr TvYrKS0tfnuj+tFCWvbGiq2wH2bMVoL6/WTdAxEo0UUwMlUHVWurSLZNCOcwIlhoZUSu GwrABcZ+rS6RNohb2KlXw/tsPGPrXqtz+Zgs5nyeJs/4ciBlwB7FXxvkly4vBxOoQ/nl KOFWnsu6NZ5AOuumo7nTElaCkHPl+R7LU2xtrBt4EMjhVLcz8iShr8fZ+oBE6WWNOIIx tRFQ== X-Gm-Message-State: AOJu0YzHRhwsLd7XJ5w3IUHXYbA62n64cjXbJtrWlKV3hp7Wp9bX3UX0 1hmlhYMj5j6h08/eDUcYnXXd17AG0TGjhs75XRNdh+FXH+Adj1cfoHH9sF8FdWb+OQ== X-Gm-Gg: ASbGnctyTk+klio20Z1RN8AXsO4pXhEp06xLTLpMhRPVUftijRAE+WbEps7xzSVSIN+ 4KgIyaoFHozDQ0KrJ4nHbOAOatoIKIaRtjSP9CO20WOcuS/UactZcfGCAI5+sjskmaMRJK9bsDT +/AqerXsDj+y7JK5oy/zLCRI7T9A2dHtQLClRKoTSjX7nYGFv/To4BRVRyEzaOmeP5TnKx68Ih9 txZLPnyigPPOBeg/JJOmuaEb3yO5VBFgfHGxksqUAyU3o6AhdHELMVP8ifLsvWN76K51gk= X-Received: by 2002:a17:902:ec88:b0:216:57a6:28b5 with SMTP id d9443c01a7336-219e6f3ab09mr105701855ad.56.1734825924285; Sat, 21 Dec 2024 16:05:24 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.181]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f50dasm48772285ad.182.2024.12.21.16.05.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2024 16:05:23 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 63B3CC0B49; Sun, 22 Dec 2024 08:05:15 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org, Adhemerval Zanella Subject: [PATCH 28/39] Suppress Clang warning on adding an integer to a string Date: Sun, 22 Dec 2024 08:04:51 +0800 Message-ID: <20241222000509.2205895-29-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222000509.2205895-1-hjl.tools@gmail.com> References: <20241222000509.2205895-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org From: Adhemerval Zanella Suppress Clang warning on adding an integer to a string, like: tst-iconv-sticky-input-error.c:125:42: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int] 125 | expected_output = "ABXY" + skip; | ~~~~~~~^~~~~~ tst-iconv-sticky-input-error.c:125:42: note: use array indexing to silence this warning 125 | expected_output = "ABXY" + skip; | ^ | & [ ] Co-Authored-By: H.J. Lu Reviewed-by: Sam James --- dirent/tst-readdir-long.c | 4 ++++ dirent/tst-rewinddir.c | 4 ++++ iconv/tst-iconv-sticky-input-error.c | 4 ++++ posix/bug-regex24.c | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/dirent/tst-readdir-long.c b/dirent/tst-readdir-long.c index 409318fa52..2a9db5901d 100644 --- a/dirent/tst-readdir-long.c +++ b/dirent/tst-readdir-long.c @@ -26,6 +26,7 @@ #include #include #include +#include /* If positive, at this length an EMSGSIZE error is injected. */ static _Atomic int inject_error_at_length; @@ -59,7 +60,10 @@ add_directory_entry (struct support_fuse_dirstream *d, uint64_t offset) if (offset <= 1) { type = DT_DIR; + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int"); name = ".." + !offset; /* "." or "..". */ + DIAG_POP_NEEDS_COMMENT_CLANG; ino = 1; } else if (length == 1000) diff --git a/dirent/tst-rewinddir.c b/dirent/tst-rewinddir.c index 1479766ebe..891c7e7e48 100644 --- a/dirent/tst-rewinddir.c +++ b/dirent/tst-rewinddir.c @@ -24,17 +24,21 @@ #include #include #include +#include /* Return the file name at the indicated directory offset. */ static char * name_at_offset (unsigned int offset) { + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int"); if (offset <= 1) return xstrdup (".." + !offset); /* "." or "..". */ else /* Pad the name with a lot of zeros, so that the dirent buffer gets filled more quickly. */ return xasprintf ("file%0240u", offset); + DIAG_POP_NEEDS_COMMENT_CLANG; } /* This many directory entries, including "." and "..". */ diff --git a/iconv/tst-iconv-sticky-input-error.c b/iconv/tst-iconv-sticky-input-error.c index 34a245f185..68698646ae 100644 --- a/iconv/tst-iconv-sticky-input-error.c +++ b/iconv/tst-iconv-sticky-input-error.c @@ -26,6 +26,7 @@ #include #include #include +#include /* FROM is the input character set, TO the output character set. If IGNORE is true, the iconv descriptor is set up in the same way as @@ -121,12 +122,15 @@ do_test (void) for (int skip = 0; skip < 3; ++skip) { const char *expected_output; + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int"); if (do_ignore || strstr (charsets[to_idx], "//IGNORE") != NULL) expected_output = "ABXY" + skip; else expected_output = "AB" + skip; one_direction (charsets[from_idx], charsets[to_idx], do_ignore, "AB\xffXY" + skip, expected_output, limit); + DIAG_POP_NEEDS_COMMENT_CLANG; } return 0; diff --git a/posix/bug-regex24.c b/posix/bug-regex24.c index 97c5c3508a..72f3d76afe 100644 --- a/posix/bug-regex24.c +++ b/posix/bug-regex24.c @@ -1,6 +1,7 @@ #include #include #include +#include #define str "civic" @@ -45,11 +46,14 @@ do_test (void) { int len = m[i].rm_eo - m[i].rm_so; + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int"); printf ("m[%d] = \"%.*s\"\n", i, len, str + m[i].rm_so); if (strlen (expected[i]) != len || memcmp (expected[i], str + m[i].rm_so, len) != 0) result = 1; + DIAG_POP_NEEDS_COMMENT_CLANG; } return result;