[PATCH dwarves 2/2] dwarves: Fix clang warning about unused variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With dwarves CI, clang builds give a legit warning:

/build/dwarves_fprintf.c:2102:9: error: variable 'printed' set but not used [-Werror,-Wunused-but-set-variable]
 2102 |         size_t printed = fprintf(fp, "namespace %s {\n", namespace__name(space));
      |                ^
1 error generated.

And in fact we accumulate values in printed but never use it
for the return value.  Add the printed count to the final fprintf().

Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
---
 dwarves_fprintf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c
index c3e7f3c..4407fd1 100644
--- a/dwarves_fprintf.c
+++ b/dwarves_fprintf.c
@@ -2110,7 +2110,7 @@ static size_t namespace__fprintf(const struct tag *tag, const struct cu *cu,
 		printed += fprintf(fp, "\n\n");
 	}
 
-	return fprintf(fp, "%.*s}", conf->indent, tabs);
+	return printed + fprintf(fp, "%.*s}", conf->indent, tabs);
 }
 
 size_t tag__fprintf(struct tag *tag, const struct cu *cu,
-- 
2.43.5





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux