From patchwork Sat Dec 21 22:34:24 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: 852749 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp2746578wrq; Sat, 21 Dec 2024 14:35:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVvUBl5xvHRpKKQ0vwcBDQydPSaTmwr5UEEvp27lttWa5eokycja7Pc0iY31VZHCrzM67AWXw==@linaro.org X-Google-Smtp-Source: AGHT+IHQYKxeNQV+5Gyw0In+vxQIL9OE1XBK5pT5rz8KFCfmUIqiDG3sta5GmJLHmQVNEBtINZBt X-Received: by 2002:a05:622a:1206:b0:46a:3176:f787 with SMTP id d75a77b69052e-46a4a970231mr130336271cf.37.1734820530129; Sat, 21 Dec 2024 14:35:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1734820530; cv=pass; d=google.com; s=arc-20240605; b=YSG9QGwVPgAOJd7DqLW8wVkcPeVXo0J1HF2ALwNg1rymk2kM7kxI0Bq2X8Mg8f9OWH 72bl6DViTZUJ3/eNUTyRDONKPLT/LFFJywRDfQ8DHc1IXpyDPSw1GKlEMafxzwIYAyHc G17AXki6vc7xy7oQQR7eTqsiYE8OEgQb2NdTjmXqzzG6IqOhipJC0+1SoCvH85zdIgpf uotjfHksI/J0TqiqozHkGIQ6BDvljc3IsF9RhOxrxSwTcPwih+a3Uco0Fnv66RNfL1kM M/S0fx8Ba/NUST2WSLpjm64YfSoVqYt+4+PEgD4ITPG7lo4cced2cH5BqS/+HlnHky9f oSWQ== 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:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter:arc-filter:dmarc-filter:delivered-to:dkim-filter; bh=/eoQG2VwCdm3jrQmhGROqbPOjaFcULIkd6yr8nvjpIw=; fh=rJtIiWzkCr5V2GvQGQWdJX+wkLY3kEXmUtQZbZqt0f0=; b=cZkZI5sd83FhE1ZmQHU62z8zW8LQG4AWiCWaZGGXsDo1geGXsNPzp9Zrc0L1W3C1rf Y2YM3OhcfoAaXAwF+RTf7eo928e7Pn3Tbv1bpY/T5ptCRfANLDNpk+10jBkKCIGSt1e1 NTx3hN8MQjny8u9L+GgGKaBDeDsFcpi7RC11qvd20OVW61tRGmKeeHxnvl9GFolS2FQP 2lGDOPNSijeuhTkFo7Nis5byiROMOx8VExuTzSvoRZv5h9i6pDfrXEEDxAdfDRdIQkZk s7cPjUYycuhC3nG7gIl4Hr+2lxJ0S+3BqIgCZw6/eAPQDgIexNE4DABvaF2DtL666F5C Ee8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ta4AOQi+; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d75a77b69052e-46a3ec052f5si46202721cf.690.2024.12.21.14.35.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2024 14:35:30 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ta4AOQi+; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 B1216385840E for ; Sat, 21 Dec 2024 22:35:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B1216385840E 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=Ta4AOQi+ X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 51E8B3858C54 for ; Sat, 21 Dec 2024 22:34:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 51E8B3858C54 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 51E8B3858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::431 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734820472; cv=none; b=wYtheSseE0jhRI4R8FlnqkMdXJ4G8kjEj3OUwKFvHHhdlH8a07OGdWvSt70k+RvG3l/1Gh0w9lmHprdT60lVp7fzGOsky63fkcr2suZvIhWKONZLFP/9fcAs0WrL7IOyqOiWd7lg9ahdIMKPY0ITi33ZVYgw8oeJToF5JXCXAFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734820472; c=relaxed/simple; bh=dqecXDurbaU1EBRtbrVLgH6cejlBLKSUTvyJied0Rak=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=i8GGUp08godUKcaDxBz29pukYNGCYblyK+Ry4AOlfEdv64dtnnne3Un5hgc5aSkEZOJ/LMJ/h+15iMASNXISPii7iEx6+g9gs4QIHtK1CLgtQJ5DeQL5jXmUJ2htjSJtQG4q74NG8YtvVl7tdz3zwTGwHRA/mIPLHPc3wWv4A/U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51E8B3858C54 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-728ea1573c0so2610599b3a.0 for ; Sat, 21 Dec 2024 14:34:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734820471; x=1735425271; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/eoQG2VwCdm3jrQmhGROqbPOjaFcULIkd6yr8nvjpIw=; b=Ta4AOQi+qbtRa32PwcFplPcw5I+phOV4ZNFy2xY+RMud+B9iTWUrTbdFtvBomBEZJc Q9OZwAQBMQE5qehA3UgUsWtUoehWAf0lDK/kBZkJopcrW73oIotZ8oJS0PbIE1vbgMXf WryFD3ec6d/YfN9pqKbAQ/ULWinaOr85xWXF8E6SD8RhsN8K3u3BrzJhDA1ar2ZkCwlI dba5qrl8W4inbFd7th99EXXTx4xw2NzkvrPinHqFY+Vebi7BjQHWAvBQ0RBbwU/6PqwX uqL+t7Tt473y6IiuTJYIIKBsU97NWSFUCUKtinbKqfMwc08P2Il5VEtwMoTlO3H5OLZA INBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734820471; x=1735425271; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/eoQG2VwCdm3jrQmhGROqbPOjaFcULIkd6yr8nvjpIw=; b=a0H+DV3hKQWkgDQNYblLFy+oBD9W0lwDk6v+Kv00SboMK6Ubv9YsgAqVSPAe/V18b7 algX/GOYObrEU0jeDy4fIFm/qZ89II9ieEnn0f84baKeeB5862diMPZ30JZBkH01+wwj VjtMHfl6/psRo+++kFCaLh+jkxfIZtzYFpf7zGVXXnjyIrpmvNnVBDNItpt93kr8QkZ0 Ay7DSeAp+sJrlqxv02R+yrHuJDgmuFJIpHuz/KXomblFk4e6C9aGItry1Vn0spkDMJol 9BfdiGVtcAsi7L2jn+v4n5P5J7j4EqDCACICwSG/RsxZQHehSNDa3aCjE3Oc7KnmEFOJ jz/g== X-Gm-Message-State: AOJu0Yzwgnde2YQ6aQaPSuCCvamOQTJz3a7nGkNVj2brI3A4PTXJ9kh9 /8IsrbTpST4NcSCfoboXfJW8UtrFprKvdjiox/Pufl3f3RchWs6S12HFLMDPzZgcFQ== X-Gm-Gg: ASbGncsake+dSAq8ClV9Z/JsaAwydtK1fp1bEt2+0/GNf+IRkbwn+Fkq4tkHEfx8g3y 1fmp/FbLkpbSbBdO6jeYTp8oO+NQ1cCVsv289Jvxak2k09tL/4Tq3HyKxS9jhbGxOGyZxYQodSZ GkuPrhwPH51M/XDJ8UbprFswzCWg+kbwzJKcaDPT0CVQeGPOMofGZ9bybgdEHbp5+OL0pdy/MLH iDou9PIxirVXmHGV5VzZt6oM8ecruRM1wY9S37ry0hmrFqmon111HPZZtcIsO/JCFavnBk= X-Received: by 2002:a05:6a20:9144:b0:1e0:d1db:4d8a with SMTP id adf61e73a8af0-1e5e047801cmr13316717637.10.1734820471218; Sat, 21 Dec 2024 14:34:31 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.181]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad816540sm5378477b3a.22.2024.12.21.14.34.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2024 14:34:30 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 747B3C028A; Sun, 22 Dec 2024 06:34:26 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: Adhemerval Zanella Subject: [PATCH] stdio: Suppress clang warnings for tst-unlockedio.c Date: Sun, 22 Dec 2024 06:34:24 +0800 Message-ID: <20241221223424.754104-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 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 the following -Wgnu-folding-constant and -Wliteral-conversion warnings from Clang: tst-unlockedio.c:35:12: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant] 35 | char buf[strlen (blah) + 1]; | ^~~~~~~~~~~~~~~~~ tst-unlockedio.c:63:36: error: implicit conversion from 'double' to 'size_t' (aka 'unsigned long') changes value from -0 to 0 [-Werror,-Wliteral-conversion] || fwrite_unlocked (blah, 0, -0.0, fp) != 0 ~~~~~~~~~~~~~~~ ^~~~ tst-unlockedio.c:61:33: error: implicit conversion from 'double' to 'size_t' (aka 'unsigned long') changes value from 0.25 to 0 [-Werror,-Wliteral-conversion] || fwrite_unlocked (--cp, 0.25, 16, fp) != 0 ~~~~~~~~~~~~~~~ ^~~~ tst-unlockedio.c:59:37: error: implicit conversion from 'double' to 'size_t' (aka 'unsigned long') changes value from 0.25 to 0 [-Werror,-Wliteral-conversion] || fwrite_unlocked (cp++, 16, 0.25, fp) != 0 ~~~~~~~~~~~~~~~ ^~~~ tst-unlockedio.c:116:34: error: implicit conversion from 'double' to 'size_t' (aka 'unsigned long') changes value from -0 to 0 [-Werror,-Wliteral-conversion] || fread_unlocked (buf, 0, -0.0, fp) != 0 ~~~~~~~~~~~~~~ ^~~~ tst-unlockedio.c:114:32: error: implicit conversion from 'double' to 'size_t' (aka 'unsigned long') changes value from 0.25 to 0 [-Werror,-Wliteral-conversion] || fread_unlocked (--wp, 0.25, 16, fp) != 0 ~~~~~~~~~~~~~~ ^~~~ tst-unlockedio.c:112:36: error: implicit conversion from 'double' to 'size_t' (aka 'unsigned long') changes value from 0.25 to 0 [-Werror,-Wliteral-conversion] || fread_unlocked (wp++, 16, 0.25, fp) != 0 ~~~~~~~~~~~~~~ ^~~~ Co-Authored-By: H.J. Lu --- stdio-common/tst-unlockedio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stdio-common/tst-unlockedio.c b/stdio-common/tst-unlockedio.c index 8ff6b074b0..7f156b3c11 100644 --- a/stdio-common/tst-unlockedio.c +++ b/stdio-common/tst-unlockedio.c @@ -32,7 +32,10 @@ static int do_test (void) { const char blah[] = "BLAH"; + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (3.4, "-Wgnu-folding-constant"); char buf[strlen (blah) + 1]; + DIAG_POP_NEEDS_COMMENT_CLANG; FILE *fp, *f; const char *cp; char *wp; @@ -51,6 +54,9 @@ do_test (void) fread_unlocked below as well. */ DIAG_PUSH_NEEDS_COMMENT; DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdiv-by-zero"); + /* clang warns about the implicit conversion from double to size_t, + which is required by this tests. */ + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wliteral-conversion"); if (ftello (fp) != 0 || fwrite_unlocked (blah, blah - blah, strlen (blah), f++) != 0 || f != fp + 1 @@ -104,6 +110,7 @@ do_test (void) /* See explanation above. */ DIAG_PUSH_NEEDS_COMMENT; DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdiv-by-zero"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wliteral-conversion"); if (ftello (fp) != 0 || fread_unlocked (buf, buf - buf, strlen (blah), f++) != 0 || f != fp + 1