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: document wrong location informatio...



details:   https://anonhg.NetBSD.org/src/rev/1e34d7037127
branches:  trunk
changeset: 961767:1e34d7037127
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Apr 18 07:31:47 2021 +0000

description:
lint: document wrong location information in diagnostics

diffstat:

 tests/usr.bin/xlint/lint1/msg_260.c   |  28 +++++++++++++++++++++++++---
 tests/usr.bin/xlint/lint1/msg_260.exp |   7 ++++++-
 usr.bin/xlint/lint1/lint1.h           |   7 ++++++-
 3 files changed, 37 insertions(+), 5 deletions(-)

diffs (68 lines):

diff -r 167a496c3ac4 -r 1e34d7037127 tests/usr.bin/xlint/lint1/msg_260.c
--- a/tests/usr.bin/xlint/lint1/msg_260.c       Sun Apr 18 01:28:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_260.c       Sun Apr 18 07:31:47 2021 +0000
@@ -1,7 +1,29 @@
-/*     $NetBSD: msg_260.c,v 1.2 2021/02/21 09:07:58 rillig Exp $       */
+/*     $NetBSD: msg_260.c,v 1.3 2021/04/18 07:31:47 rillig Exp $       */
 # 3 "msg_260.c"
 
 // Test for message: previous declaration of %s [260]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-extra-flags: -r */
+
+# 100 "header.h" 1
+struct s {             /* expect: 260 */
+    int member;
+};
+# 13 "msg_260.c" 2
+
+# 200 "header.h" 1
+union s {              /* expect: tag redeclared *//* expect: 260 */
+    int member;
+};
+/*
+ * FIXME: the stack trace for the 260 is wrong, as the 260 is included from
+ * line 8, not from line 14.
+ */
+# 19 "msg_160.c" 2
+
+union s {              /* expect: tag redeclared */
+    int member;
+};
+/*
+ * FIXME: the stack trace for the 260 is missing.
+ */
diff -r 167a496c3ac4 -r 1e34d7037127 tests/usr.bin/xlint/lint1/msg_260.exp
--- a/tests/usr.bin/xlint/lint1/msg_260.exp     Sun Apr 18 01:28:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_260.exp     Sun Apr 18 07:31:47 2021 +0000
@@ -1,1 +1,6 @@
-msg_260.c(6): error: syntax error ':' [249]
+header.h(200): error: (struct) tag redeclared [46]
+       included from msg_260.c(14)
+header.h(100): previous declaration of s [260]
+       included from msg_260.c(14)
+msg_160.c(20): error: (union) tag redeclared [46]
+header.h(200): previous declaration of s [260]
diff -r 167a496c3ac4 -r 1e34d7037127 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Sun Apr 18 01:28:50 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Sun Apr 18 07:31:47 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.95 2021/04/14 18:35:40 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.96 2021/04/18 07:31:47 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -57,6 +57,11 @@
 
 /*
  * Describes the position of a declaration or anything else.
+ *
+ * FIXME: Just a single file:lineno pair is not enough to accurately describe
+ *  the position of a symbol.  The whole inclusion path at that point must be
+ *  stored as well.  This makes a difference for symbols from included
+ *  headers, see print_stack_trace.
  */
 typedef struct {
        const   char *p_file;



Home | Main Index | Thread Index | Old Index