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: add debug logging for type declara...



details:   https://anonhg.NetBSD.org/src/rev/b89e68eaf100
branches:  trunk
changeset: 364631:b89e68eaf100
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Apr 01 20:38:37 2022 +0000

description:
lint: add debug logging for type declarators

This will help in fixing the wrong type in msg_347.c, as well as the
assertion failure for 'sizeof(int())'.

diffstat:

 usr.bin/xlint/lint1/decl.c |  22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diffs (81 lines):

diff -r 83f6dda01cea -r b89e68eaf100 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Fri Apr 01 20:29:37 2022 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Fri Apr 01 20:38:37 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.254 2022/04/01 20:29:37 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.255 2022/04/01 20:38:37 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.254 2022/04/01 20:29:37 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.255 2022/04/01 20:38:37 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1306,8 +1306,11 @@
        tpp = &decl->s_type;
        while (*tpp != NULL && *tpp != dcs->d_type)
                tpp = &(*tpp)->t_subt;
-       if (*tpp == NULL)
+       if (*tpp == NULL) {
+               debug_step("add_pointer: unchanged '%s'",
+                   type_name(decl->s_type));
                return decl;
+       }
 
        while (p != NULL) {
                *tpp = tp = block_zero_alloc(sizeof(*tp));
@@ -1319,6 +1322,7 @@
                free(p);
                p = next;
        }
+       debug_step("add_pointer: '%s'", type_name(decl->s_type));
        return decl;
 }
 
@@ -1334,8 +1338,11 @@
        tpp = &decl->s_type;
        while (*tpp != NULL && *tpp != dcs->d_type)
                tpp = &(*tpp)->t_subt;
-       if (*tpp == NULL)
+       if (*tpp == NULL) {
+               debug_step("add_array: unchanged '%s'",
+                   type_name(decl->s_type));
                return decl;
+       }
 
        *tpp = tp = block_zero_alloc(sizeof(*tp));
        tp->t_tspec = ARRAY;
@@ -1353,6 +1360,7 @@
                setcomplete(tp, false);
        }
 
+       debug_step("add_array: '%s'", type_name(decl->s_type));
        return decl;
 }
 
@@ -1397,8 +1405,11 @@
                 * may even be guaranteed to be NULL.
                 */
                tpp = &(*tpp)->t_subt;
-       if (*tpp == NULL)
+       if (*tpp == NULL) {
+               debug_step("add_function: unchanged '%s'",
+                   type_name(decl->s_type));
                return decl;    /* see msg_347 */
+       }
 
        *tpp = tp = block_zero_alloc(sizeof(*tp));
        tp->t_tspec = FUNC;
@@ -1407,6 +1418,7 @@
                tp->t_args = args;
        tp->t_vararg = dcs->d_vararg;
 
+       debug_step("add_function: '%s'", type_name(decl->s_type));
        return decl;
 }
 



Home | Main Index | Thread Index | Old Index