Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: improve output format for internal...



details:   https://anonhg.NetBSD.org/src/rev/b45ae4be4a67
branches:  trunk
changeset: 953974:b45ae4be4a67
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Mar 26 21:05:27 2021 +0000

description:
lint: improve output format for internal errors

The new format follows the common conventions for file locations and
allows quick navigation in IDEs.

To trigger an internal error, it suffices to have 2 tokens in lint1's
input, after preprocessing: 'void __pure'.

diffstat:

 usr.bin/xlint/lint1/err.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (36 lines):

diff -r c9433aea0a20 -r b45ae4be4a67 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Fri Mar 26 20:51:34 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Fri Mar 26 21:05:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.c,v 1.93 2021/03/26 20:31:07 rillig Exp $  */
+/*     $NetBSD: err.c,v 1.94 2021/03/26 21:05:27 rillig Exp $  */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.93 2021/03/26 20:31:07 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.94 2021/03/26 21:05:27 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -485,13 +485,13 @@
        va_list ap;
        const   char *fn;
 
+       fn = lbasename(curr_pos.p_file);
+       (void)fprintf(stderr, "lint: internal error in %s:%d near %s:%d: ",
+           file, line, fn, curr_pos.p_line);
        va_start(ap, msg);
-       fn = lbasename(curr_pos.p_file);
-       (void)fprintf(stderr, "%s(%d): lint error: %s, %d: ",
-           fn, curr_pos.p_line, file, line);
        (void)vfprintf(stderr, msg, ap);
+       va_end(ap);
        (void)fprintf(stderr, "\n");
-       va_end(ap);
        abort();
 }
 



Home | Main Index | Thread Index | Old Index