From bf725a29a3f86b6ffd46c369604a1fabb99fcc02 Mon Sep 17 00:00:00 2001 From: Costa Shulyupin Date: Sun, 3 Apr 2022 11:10:56 +0300 Subject: [PATCH] squash warning in mm_read_unsymmetric_sparse MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result] On success, these functions return the number of input items successfully matched and assigned; this can be fewer than provided for, or even zero, in the event of an early matching failure. --- cmd/tools/mmio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/tools/mmio.c b/cmd/tools/mmio.c index cc3677882..92ac65b3e 100644 --- a/cmd/tools/mmio.c +++ b/cmd/tools/mmio.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "mmio.h" @@ -81,7 +82,9 @@ int mm_read_unsymmetric_sparse(const char *fname, int *M_, int *N_, /* (ANSI C X3.159-1989, Sec. 4.9.6.2, p. 136 lines 13-15) */ for (i = 0; i < nz; i++) { - fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i]); + int num = fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i]); + (void)num; + assert(num == 3); I[i]--; /* adjust from 1-based to 0-based */ J[i]--; } -- 2.40.0