Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/xlint lint: allow to keep the preprocessor out...



details:   https://anonhg.NetBSD.org/src/rev/cefb3a97149d
branches:  trunk
changeset: 376683:cefb3a97149d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jun 28 13:50:47 2023 +0000

description:
lint: allow to keep the preprocessor output on success as well

diffstat:

 usr.bin/xlint/xlint/lint.1  |  12 ++++++++----
 usr.bin/xlint/xlint/xlint.c |   9 ++++++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diffs (63 lines):

diff -r af38c0d98e27 -r cefb3a97149d usr.bin/xlint/xlint/lint.1
--- a/usr.bin/xlint/xlint/lint.1        Wed Jun 28 11:08:47 2023 +0000
+++ b/usr.bin/xlint/xlint/lint.1        Wed Jun 28 13:50:47 2023 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: lint.1,v 1.58 2023/05/22 19:36:13 rillig Exp $
+.\" $NetBSD: lint.1,v 1.59 2023/06/28 13:50:47 rillig Exp $
 .\"
 .\" Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
 .\" Copyright (c) 1994, 1995 Jochen Pohl
@@ -30,7 +30,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 22, 2023
+.Dd June 28, 2023
 .Dt LINT 1
 .Os
 .Sh NAME
@@ -594,8 +594,12 @@ option must exist.
 If this environment variable is undefined, then the default path
 .Pa /usr/libdata/lint
 will be used to search for the libraries.
-.It Ev LINT_KEEP_CPPOUT_ON_ERROR
-If
+.It Ev LINT_KEEP_CPPOUT
+If set to
+.Sq Li yes ,
+or if set to
+.Sq Li on-error
+and
 .Nm
 exits unsuccessfully, do no delete the output from the C preprocessor,
 allowing for manual inspection.
diff -r af38c0d98e27 -r cefb3a97149d usr.bin/xlint/xlint/xlint.c
--- a/usr.bin/xlint/xlint/xlint.c       Wed Jun 28 11:08:47 2023 +0000
+++ b/usr.bin/xlint/xlint/xlint.c       Wed Jun 28 13:50:47 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.111 2023/06/09 13:31:11 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.112 2023/06/28 13:50:47 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: xlint.c,v 1.111 2023/06/09 13:31:11 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.112 2023/06/28 13:50:47 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -211,7 +211,10 @@ terminate(int signo)
        if (cpp.outfd != -1)
                (void)close(cpp.outfd);
        if (cpp.outfile != NULL) {
-               if (signo != 0 && getenv("LINT_KEEP_CPPOUT_ON_ERROR") != NULL)
+               const char *keep_env = getenv("LINT_KEEP_CPPOUT");
+               bool keep = keep_env != NULL && (strcmp(keep_env, "yes") == 0
+                   || (strcmp(keep_env, "on-error") == 0 && signo != 0));
+               if (keep)
                        (void)printf("lint: preprocessor output kept in %s\n",
                            cpp.outfile);
                else



Home | Main Index | Thread Index | Old Index