Module Name: src Committed By: rillig Date: Tue Sep 24 19:58:06 UTC 2024
Modified Files: src/usr.bin/xlint/lint1: debug.c externs1.h main1.c Log Message: lint: exclude the GCC builtins from debug logging Their source code is parsed for simplicity, and since the text is fixed, there is nothing surprising to be expected there. Instead, start debugging when the actual code begins. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/usr.bin/xlint/lint1/debug.c cvs rdiff -u -r1.231 -r1.232 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.83 -r1.84 src/usr.bin/xlint/lint1/main1.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/debug.c diff -u src/usr.bin/xlint/lint1/debug.c:1.79 src/usr.bin/xlint/lint1/debug.c:1.80 --- src/usr.bin/xlint/lint1/debug.c:1.79 Sat May 11 16:12:28 2024 +++ src/usr.bin/xlint/lint1/debug.c Tue Sep 24 19:58:06 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.79 2024/05/11 16:12:28 rillig Exp $ */ +/* $NetBSD: debug.c,v 1.80 2024/09/24 19:58:06 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: debug.c,v 1.79 2024/05/11 16:12:28 rillig Exp $"); +__RCSID("$NetBSD: debug.c,v 1.80 2024/09/24 19:58:06 rillig Exp $"); #endif #include <stdlib.h> @@ -47,6 +47,7 @@ __RCSID("$NetBSD: debug.c,v 1.79 2024/05 #ifdef DEBUG +bool debug_enabled; static int debug_indentation = 0; static bool did_indentation; @@ -65,6 +66,9 @@ static void debug_vprintf(const char *fmt, va_list va) { + if (!debug_enabled) + return; + if (!did_indentation) { did_indentation = true; fprintf(debug_file(), "%s%*s", Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.231 src/usr.bin/xlint/lint1/externs1.h:1.232 --- src/usr.bin/xlint/lint1/externs1.h:1.231 Wed Sep 4 04:15:30 2024 +++ src/usr.bin/xlint/lint1/externs1.h Tue Sep 24 19:58:06 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.231 2024/09/04 04:15:30 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.232 2024/09/24 19:58:06 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -131,6 +131,7 @@ void expr_restore_memory(memory_pool); */ #ifdef DEBUG +extern bool debug_enabled; const char *decl_level_kind_name(decl_level_kind); const char *scl_name(scl_t); const char *symbol_kind_name(symbol_kind); Index: src/usr.bin/xlint/lint1/main1.c diff -u src/usr.bin/xlint/lint1/main1.c:1.83 src/usr.bin/xlint/lint1/main1.c:1.84 --- src/usr.bin/xlint/lint1/main1.c:1.83 Sun May 12 18:00:58 2024 +++ src/usr.bin/xlint/lint1/main1.c Tue Sep 24 19:58:06 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main1.c,v 1.83 2024/05/12 18:00:58 rillig Exp $ */ +/* $NetBSD: main1.c,v 1.84 2024/09/24 19:58:06 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: main1.c,v 1.83 2024/05/12 18:00:58 rillig Exp $"); +__RCSID("$NetBSD: main1.c,v 1.84 2024/09/24 19:58:06 rillig Exp $"); #endif #include <sys/types.h> @@ -214,14 +214,6 @@ main(int argc, char *argv[]) /* initialize output */ outopen(argv[1]); -#ifdef DEBUG - setvbuf(stdout, NULL, _IONBF, 0); -#endif -#if YYDEBUG - if (yflag) - yydebug = 1; -#endif - (void)signal(SIGFPE, sigfpe); init_decl(); init_lex(); @@ -236,6 +228,15 @@ main(int argc, char *argv[]) (void)fclose(yyin); } +#ifdef DEBUG + debug_enabled = true; + setvbuf(stdout, NULL, _IONBF, 0); +#endif +#if YYDEBUG + if (yflag) + yydebug = 1; +#endif + /* open the input file */ if ((yyin = fopen(argv[0], "r")) == NULL) err(1, "cannot open '%s'", argv[0]);