[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 11/25: [pic]: Fix "unused result" compiler warning.
From: |
G. Branden Robinson |
Subject: |
[groff] 11/25: [pic]: Fix "unused result" compiler warning. |
Date: |
Wed, 2 Mar 2022 05:12:06 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit caa10102c9f4333a471a7a1779319e5b18dcce52
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Feb 24 02:01:19 2022 +1100
[pic]: Fix "unused result" compiler warning.
* src/preproc/pic/pic.ypp (placeless_element) <SH>: Check return value
of `system()` to quieten `-Wunused-result` warning; if it is less than
zero, report it to the standard error stream.
Also bump copyright year and add editor aid comments.
---
ChangeLog | 8 ++++++++
src/preproc/pic/pic.ypp | 16 +++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 27f6c333..0dbb0971 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-02-24 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [pic]: Fix "unused result" compiler warning.
+
+ * src/preproc/pic/pic.ypp (placeless_element) <SH>: Check return
+ value of `system()` to quieten `-Wunused-result` warning; if it
+ is less than zero, report it to the standard error stream.
+
2022-02-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/safer.tmac: Drop file from distribution. It contained
diff --git a/src/preproc/pic/pic.ypp b/src/preproc/pic/pic.ypp
index 0cbf556a..3fec08e9 100644
--- a/src/preproc/pic/pic.ypp
+++ b/src/preproc/pic/pic.ypp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2022 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -360,8 +360,12 @@ placeless_element:
delim_flag = 0;
if (safer_flag)
lex_error("unsafe to run command '%1'", $3);
- else
- system($3);
+ else {
+ int retval = system($3);
+ if (retval < 0)
+ lex_error("error running command '%1': system()"
+ " returned %2", $3, retval);
+ }
delete[] $3;
}
| COPY TEXT
@@ -1934,3 +1938,9 @@ char *do_sprintf(const char *form, const double *v, int
nv)
result += '\0';
return strsave(result.contents());
}
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 11/25: [pic]: Fix "unused result" compiler warning.,
G. Branden Robinson <=