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: make debug logging compatible with...



details:   https://anonhg.NetBSD.org/src/rev/c0d687c2ae7b
branches:  trunk
changeset: 960901:c0d687c2ae7b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Apr 02 08:38:44 2021 +0000

description:
lint: make debug logging compatible with C90

The previous code used the GCC-style varargs macros, which did not even
conform to C99.

No functional change.

diffstat:

 usr.bin/xlint/lint1/init.c |  23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diffs (88 lines):

diff -r 98f3a938864f -r c0d687c2ae7b usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c        Fri Apr 02 07:17:56 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c        Fri Apr 02 08:38:44 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.185 2021/04/01 14:20:30 rillig Exp $        */
+/*     $NetBSD: init.c,v 1.186 2021/04/02 08:38:44 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.185 2021/04/01 14:20:30 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.186 2021/04/02 08:38:44 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -192,6 +192,9 @@
        va_end(va);
        printf("\n");
 }
+#define debug_step0            debug_step
+#define debug_step1            debug_step
+#define debug_step2            debug_step
 
 static void
 debug_leave(const char *func)
@@ -205,11 +208,11 @@
 
 #else
 
-/* TODO: This is C99 */
-#define debug_printf(fmt, ...) do { } while (false)
 #define debug_indent()         do { } while (false)
 #define debug_enter()          do { } while (false)
-#define debug_step(fmt, ...)   do { } while (false)
+#define debug_step0(msg)       do { } while (false)
+#define debug_step1(fmt, arg0) do { } while (false)
+#define debug_step2(fmt, arg1, arg2) do { } while (false)
 #define debug_leave()          do { } while (false)
 
 #endif
@@ -392,7 +395,7 @@
        lt = ln->tn_type->t_tspec;
        rt = tn->tn_type->t_tspec;
 
-       debug_step("typeok '%s', '%s'",
+       debug_step2("typeok '%s', '%s'",
            type_name(ln->tn_type), type_name(tn->tn_type));
        if (!typeok(INIT, 0, ln, tn))
                return;
@@ -874,7 +877,7 @@
        if (in->in_sym->s_type->t_tspec == ARRAY)
                return false;
 
-       debug_step("handing over to ASSIGN");
+       debug_step0("handing over to ASSIGN");
 
        ln = new_name_node(in->in_sym, 0);
        ln->tn_type = tduptyp(ln->tn_type);
@@ -976,7 +979,7 @@
                goto done;
        }
 
-       debug_step("expecting '%s', expression has '%s'",
+       debug_step2("expecting '%s', expression has '%s'",
            type_name(tp), type_name(tn->tn_type));
        check_init_expr(tp, in->in_sym, tn);
 
@@ -1015,7 +1018,7 @@
 {
        struct initialization *in;
 
-       debug_step("begin initialization of '%s'", type_name(sym->s_type));
+       debug_step1("begin initialization of '%s'", type_name(sym->s_type));
 #ifdef DEBUG
        debug_indentation++;
 #endif
@@ -1037,7 +1040,7 @@
 #ifdef DEBUG
        debug_indentation--;
 #endif
-       debug_step("end initialization");
+       debug_step0("end initialization");
 }
 
 void



Home | Main Index | Thread Index | Old Index