Module Name: src Committed By: rillig Date: Tue Dec 21 15:24:28 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: mem1.c tree.c Log Message: lint: invert condition in build_name No functional change. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/usr.bin/xlint/lint1/mem1.c cvs rdiff -u -r1.400 -r1.401 src/usr.bin/xlint/lint1/tree.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/mem1.c diff -u src/usr.bin/xlint/lint1/mem1.c:1.55 src/usr.bin/xlint/lint1/mem1.c:1.56 --- src/usr.bin/xlint/lint1/mem1.c:1.55 Tue Nov 16 21:01:05 2021 +++ src/usr.bin/xlint/lint1/mem1.c Tue Dec 21 15:24:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mem1.c,v 1.55 2021/11/16 21:01:05 rillig Exp $ */ +/* $NetBSD: mem1.c,v 1.56 2021/12/21 15:24:28 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: mem1.c,v 1.55 2021/11/16 21:01:05 rillig Exp $"); +__RCSID("$NetBSD: mem1.c,v 1.56 2021/12/21 15:24:28 rillig Exp $"); #endif #include <sys/param.h> @@ -354,6 +354,9 @@ str_endswith(const char *haystack, const /* * Return a freshly allocated tree node that is freed at the end of the * current expression. + * + * The node records whether it comes from a system file, which makes strict + * bool mode less restrictive. */ tnode_t * expr_zalloc_tnode(void) Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.400 src/usr.bin/xlint/lint1/tree.c:1.401 --- src/usr.bin/xlint/lint1/tree.c:1.400 Fri Dec 17 00:05:24 2021 +++ src/usr.bin/xlint/lint1/tree.c Tue Dec 21 15:24:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.400 2021/12/17 00:05:24 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.401 2021/12/21 15:24:28 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.400 2021/12/17 00:05:24 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.401 2021/12/21 15:24:28 rillig Exp $"); #endif #include <float.h> @@ -282,15 +282,15 @@ build_name(sym_t *sym, bool is_funcname) n = expr_zalloc_tnode(); n->tn_type = sym->s_type; - if (sym->s_scl != CTCONST) { + if (sym->s_scl == CTCONST) { + n->tn_op = CON; + n->tn_val = expr_zalloc(sizeof(*n->tn_val)); + *n->tn_val = sym->s_value; + } else { n->tn_op = NAME; n->tn_sym = sym; if (sym->s_kind == FVFT && sym->s_type->t_tspec != FUNC) n->tn_lvalue = true; - } else { - n->tn_op = CON; - n->tn_val = expr_zalloc(sizeof(*n->tn_val)); - *n->tn_val = sym->s_value; } return n;