Module Name:    src
Committed By:   rillig
Date:           Fri Mar 26 21:05:28 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: err.c

Log Message:
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'.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/xlint/lint1/err.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.93 src/usr.bin/xlint/lint1/err.c:1.94
--- src/usr.bin/xlint/lint1/err.c:1.93	Fri Mar 26 20:31:07 2021
+++ src/usr.bin/xlint/lint1/err.c	Fri Mar 26 21:05:27 2021
@@ -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 @@ lerror(const char *file, int line, const
 	va_list	ap;
 	const	char *fn;
 
-	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)fprintf(stderr, "lint: internal error in %s:%d near %s:%d: ",
+	    file, line, fn, curr_pos.p_line);
+	va_start(ap, msg);
 	(void)vfprintf(stderr, msg, ap);
-	(void)fprintf(stderr, "\n");
 	va_end(ap);
+	(void)fprintf(stderr, "\n");
 	abort();
 }
 

Reply via email to