Module Name: src Committed By: rillig Date: Sat Jun 3 20:58:00 UTC 2023
Modified Files: src/usr.bin/xlint/lint1: debug.c ops.def Log Message: lint: loosen assertion that unary operators have only a single operand To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/lint1/debug.c cvs rdiff -u -r1.29 -r1.30 src/usr.bin/xlint/lint1/ops.def 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.32 src/usr.bin/xlint/lint1/debug.c:1.33 --- src/usr.bin/xlint/lint1/debug.c:1.32 Sat Jun 3 20:40:28 2023 +++ src/usr.bin/xlint/lint1/debug.c Sat Jun 3 20:58:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.32 2023/06/03 20:40:28 rillig Exp $ */ +/* $NetBSD: debug.c,v 1.33 2023/06/03 20:58:00 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.32 2023/06/03 20:40:28 rillig Exp $"); +__RCSID("$NetBSD: debug.c,v 1.33 2023/06/03 20:58:00 rillig Exp $"); #endif #include <stdlib.h> @@ -220,7 +220,9 @@ debug_node(const tnode_t *tn) // NOLINT( debug_indent_inc(); lint_assert(tn->tn_left != NULL); debug_node(tn->tn_left); - lint_assert(is_binary(tn) == (tn->tn_right != NULL)); + if (op != INCBEF && op != INCAFT + && op != DECBEF && op != DECAFT) + lint_assert(is_binary(tn) == (tn->tn_right != NULL)); if (tn->tn_right != NULL) debug_node(tn->tn_right); debug_indent_dec(); Index: src/usr.bin/xlint/lint1/ops.def diff -u src/usr.bin/xlint/lint1/ops.def:1.29 src/usr.bin/xlint/lint1/ops.def:1.30 --- src/usr.bin/xlint/lint1/ops.def:1.29 Wed Jun 15 18:44:41 2022 +++ src/usr.bin/xlint/lint1/ops.def Sat Jun 3 20:58:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ops.def,v 1.29 2022/06/15 18:44:41 rillig Exp $ */ +/* $NetBSD: ops.def,v 1.30 2023/06/03 20:58:00 rillig Exp $ */ begin_ops() @@ -34,6 +34,11 @@ op( NOT, "!", ,1,1,1, , , ,1,1, , , , op( COMPL, "~", , , , , ,1, , ,1,1, , , , , , , , ,1,1) op( INC, "++", , , , , , , , , , , , , , , , , , , , ) op( DEC, "--", , , , , , , , , , , , , , , , , , , , ) +/* + * The '++' and '--' operators are conceptually unary operators, but lint + * implements them as binary operators due to the pre-multiplied pointer + * arithmetics, see build_prepost_incdec and build_plus_minus. + */ op( INCBEF, "++x", , , , , , , ,1, , , , ,1, , , , , ,1, ) op( DECBEF, "--x", , , , , , , ,1, , , , ,1, , , , , ,1, ) op( INCAFT, "x++", , , , , , , ,1, , , , ,1, , , , , ,1, )