From patchwork Fri May 24 17:46:30 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: 1939052 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=X9vdYh+F; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VmCCY6lV5z1ynR for ; Sat, 25 May 2024 03:46:49 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B4384385E827 for ; Fri, 24 May 2024 17:46:47 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 1B2873858D29 for ; Fri, 24 May 2024 17:46:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1B2873858D29 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 1B2873858D29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716572795; cv=none; b=PRrZlR/K2BPUs4oDCL/7NslFg/cEXVb4lMPF37wTYsG4FFDUTpXJrAvTyvm7FhY/gmCb3Qpy+UoQCEvPGcbNoGSZD5GLcRCODB/60Dlb6ZNLyjtd23UKy1nDyW3f4ms7OfPuCIRIh3fau0mtechIuFyMGOGY/drnLRWdMSqkcmU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716572795; c=relaxed/simple; bh=nmiBxUzEzWZRS+/dWqbGimxWnBbFB5T7+I1Jz0jzUPg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=EtUGa3yLXkYLj0AirVzPYXTVOsWJqJwS600WxPW+7ML5fBc6TESBEkgOoq4MRnQiM+aaoT2FDEnJ7gKYDvmsuztJuTWz205zsqMdbesRZm2QBMRol8U+z0BdD+rT4Z/5IdxVbitz1a/CLjlxlcPfmf34joLUs2GktXtE89fh9ug= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6f8ecafd661so1050669b3a.3 for ; Fri, 24 May 2024 10:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716572792; x=1717177592; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=sPNgeinY7gUbY1IfS02iRGLKCW2UmEFGot3WKaVdvvw=; b=X9vdYh+F3+RmULLqPrr9tqC3Z/ymgBkrJ33BU17QnvcHcJCOda2Z8g6VLto0fzx9ec oVdHaC4RA0MCMZzZ/Pl2w+700GyT+sz/EHwnl+WKZI9nMJ8SW+GcxOFLIUwwaExMB3NL xogIEvxi1YO2GdEEJaLUCneOQJ04T5Pk9R13l24e0ospotAGf2Ikmb4TJf2itaGIiV/+ z8T9N1IBl4j7sMsVFlJAXlzfoRs4v/15J6HCED0IwkjjWI5IBzfNdnuajmbRabpfnLii aGZuRDRZ6WBv+98lUbNglEFBeuoEjd1pG3K/JzZoxqh8vVJfru5RMKf/AWQ5mHLXIXI+ O7xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716572792; x=1717177592; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sPNgeinY7gUbY1IfS02iRGLKCW2UmEFGot3WKaVdvvw=; b=p1znBVujeCeNFq19WDKrAeFkFBZ/zd/gg0/dX4OWT6UW13wNDkJqyuwxA93WE42+Os rjmvKc5aenZNh7vFmqnWuJqN4mCEmgsgAYaRkO1zQpQzyRXNuL8nx2n8cBPj9qwVud2N 3VTYP1xXM+8Uuq3jYRPrbPD6iY+iQuxnMwB4ycelFwF3WsCqfPkEfizxSnrIGkKRWHKB vxVFe8SyDNkhHyL3iz8ShQdkc3BE/ljWsV7yRBc4Ois+k2UXuuJ8hFZ0jSDfh9QFdVtR 04wQmyezQVyT+CqMz13DS0LJM11I4h0Xm3BsS/EVh1+lucAnCpdaw3VqAWMLnno9+vGP S1kg== X-Gm-Message-State: AOJu0YywJlZrhay1nGu1DiQpl3jAdTuLIXGvsFePBJc9giX1zSabQtPH UbKAf4Xou168vKGCyoann6bsF/XG8Tx08oi86Pz+llnnDEBkZtjSwOtBeA== X-Google-Smtp-Source: AGHT+IH5lveiDPpU1vrvx+BhPeoTb2/+hvy1UBTe9Hdhn60hjD79wHE2ABS1KWVGYvfIA+N8s+gY6Q== X-Received: by 2002:a05:6a20:dca0:b0:1af:8c2f:5f5e with SMTP id adf61e73a8af0-1b212d360c5mr2984495637.28.1716572791779; Fri, 24 May 2024 10:46:31 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.59.129.178]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-682219872desm1425988a12.30.2024.05.24.10.46.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 10:46:31 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 2CF707407BD for ; Fri, 24 May 2024 10:46:30 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH] Add scanf/vfscanf/vscanf tests of long double without Date: Fri, 24 May 2024 10:46:30 -0700 Message-ID: <20240524174630.3169757-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3022.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+incoming=patchwork.ozlabs.org@sourceware.org Update test-fscanf.c to add scanf/vfscanf/vscanf tests of long double without including . Signed-off-by: H.J. Lu --- stdio-common/test-fscanf.c | 41 +++++++++++++++++++++++++++++++++- stdio-common/test-fscanf.input | 3 +++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/stdio-common/test-fscanf.c b/stdio-common/test-fscanf.c index f2c4250b51..446d4a307d 100644 --- a/stdio-common/test-fscanf.c +++ b/stdio-common/test-fscanf.c @@ -1,4 +1,4 @@ -/* Test fscanf of long double without . +/* Test fscanf/scanf/vfscanf/vscanf of long double without . Copyright (C) 2024 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,11 +16,35 @@ License along with the GNU C Library; if not, see . */ +#include #include struct FILE; extern struct FILE *stdin; extern int fscanf (struct FILE *, const char *, ...); +extern int scanf (const char *, ...); +extern int vfscanf (struct FILE *, const char *, va_list); +extern int vscanf (const char *, va_list); + +static int +wrap_vfscanf (struct FILE *fp, const char *format, ...) +{ + va_list ap; + va_start (ap, format); + int ret = vfscanf (fp, format, ap); + va_end (ap); + return ret; +} + +static int +wrap_vscanf (const char *format, ...) +{ + va_list ap; + va_start (ap, format); + int ret = vscanf (format, ap); + va_end (ap); + return ret; +} int main (void) @@ -30,6 +54,21 @@ main (void) char name[50]; n = fscanf (stdin, "%d%Lf%s", &i, &x, name); + if (n != 3 || i != 25 || x != 24.5 || strcmp (name, "thompson")) + return 1; + + n = scanf ("%d%Lf%s", &i, &x, name); + + if (n != 3 || i != 25 || x != 24.5 || strcmp (name, "thompson")) + return 1; + + n = wrap_vfscanf (stdin, "%d%Lf%s", &i, &x, name); + + if (n != 3 || i != 25 || x != 24.5 || strcmp (name, "thompson")) + return 1; + + n = wrap_vscanf ("%d%Lf%s", &i, &x, name); + if (n != 3 || i != 25 || x != 24.5 || strcmp (name, "thompson")) return 1; diff --git a/stdio-common/test-fscanf.input b/stdio-common/test-fscanf.input index 69322cc51a..20859d314a 100644 --- a/stdio-common/test-fscanf.input +++ b/stdio-common/test-fscanf.input @@ -1 +1,4 @@ 25 24.5 thompson +25 24.5 thompson +25 24.5 thompson +25 24.5 thompson