Module Name: src Committed By: rillig Date: Sat Mar 20 20:15:37 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: op.h oper.c ops.def Log Message: lint: fix argument names and table headings for operator definitions The abbreviations in the table of operator properties had been wrong since ops.def 1.10 from 2021-01-12, when strict bool mode was added. In an earlier working draft, I had named that column 'takes_others' instead of 'requires_bool', that's where the 'o' came from. The names of the macro arguments had been wrong since op.h 1.11 from 2021-01-09, when the order of the columns changed and the macros were not adjusted accordingly. Since all the properties of the operator table are uniform, this didn't result in any bugs, it was just confusing for human readers. Clang-tidy suggests to enclose the macro arguments in oper.c in parentheses but that is not possible since the arguments are either empty or 1, and the syntactical ambiguity of the '+ 0' being either a unary or a binary operator is needed here. No change to the resulting binary. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint1/op.h cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/lint1/oper.c cvs rdiff -u -r1.17 -r1.18 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/op.h diff -u src/usr.bin/xlint/lint1/op.h:1.13 src/usr.bin/xlint/lint1/op.h:1.14 --- src/usr.bin/xlint/lint1/op.h:1.13 Sun Jan 17 12:23:01 2021 +++ src/usr.bin/xlint/lint1/op.h Sat Mar 20 20:15:37 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: op.h,v 1.13 2021/01/17 12:23:01 rillig Exp $ */ +/* $NetBSD: op.h,v 1.14 2021/03/20 20:15:37 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -64,8 +64,12 @@ extern mod_t modtab[]; #define begin_ops() typedef enum { #define op(name, repr, \ - bi, lo, tb, to, in, sc, ar, fo, va, ts, ba, se, \ - lu, ru, pc, cm, ve, de, ew, ic, active) \ + bi, lo, tb, rb, \ + in, ic, ar, sc, \ + fo, va, ts, ba, \ + se, lu, ru, pc, \ + cm, ve, de, ew, \ + active) \ name, #define end_ops() } op_t; #include "ops.def" Index: src/usr.bin/xlint/lint1/oper.c diff -u src/usr.bin/xlint/lint1/oper.c:1.6 src/usr.bin/xlint/lint1/oper.c:1.7 --- src/usr.bin/xlint/lint1/oper.c:1.6 Sat Mar 20 19:33:25 2021 +++ src/usr.bin/xlint/lint1/oper.c Sat Mar 20 20:15:37 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: oper.c,v 1.6 2021/03/20 19:33:25 rillig Exp $ */ +/* $NetBSD: oper.c,v 1.7 2021/03/20 20:15:37 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -41,15 +41,19 @@ static const struct { } imods[] = #define begin_ops() { #define op(name, repr, \ - bi, lo, tb, to, in, sc, ar, fo, va, ts, ba, se, \ - lu, ru, pc, cm, ve, de, ew, ic, active) \ + bi, lo, tb, rb, \ + in, ic, ar, sc, \ + fo, va, ts, ba, \ + se, lu, ru, pc, \ + cm, ve, de, ew, \ + active) \ { { \ - bi + 0 > 0, lo + 0 > 0, tb + 0 > 0, to + 0 > 0, \ - in + 0 > 0, sc + 0 > 0, ar + 0 > 0, fo + 0 > 0, \ - va + 0 > 0, ts + 0 > 0, ba + 0 > 0, se + 0 > 0, \ - lu + 0 > 0, ru + 0 > 0, pc + 0 > 0, cm + 0 > 0, \ - ve + 0 > 0, de + 0 > 0, ew + 0 > 0, ic + 0 > 0, \ - repr }, active > 0 \ + bi + 0 > 0, lo + 0 > 0, tb + 0 > 0, rb + 0 > 0, \ + in + 0 > 0, ic + 0 > 0, ar + 0 > 0, sc + 0 > 0, \ + fo + 0 > 0, va + 0 > 0, ts + 0 > 0, ba + 0 > 0, \ + se + 0 > 0, lu + 0 > 0, ru + 0 > 0, pc + 0 > 0, \ + cm + 0 > 0, ve + 0 > 0, de + 0 > 0, ew + 0 > 0, \ + repr }, (active) > 0 \ }, #define end_ops(n) }; #include "ops.def" Index: src/usr.bin/xlint/lint1/ops.def diff -u src/usr.bin/xlint/lint1/ops.def:1.17 src/usr.bin/xlint/lint1/ops.def:1.18 --- src/usr.bin/xlint/lint1/ops.def:1.17 Thu Mar 18 21:56:34 2021 +++ src/usr.bin/xlint/lint1/ops.def Sat Mar 20 20:15:37 2021 @@ -1,10 +1,10 @@ -/* $NetBSD: ops.def,v 1.17 2021/03/18 21:56:34 rillig Exp $ */ +/* $NetBSD: ops.def,v 1.18 2021/03/20 20:15:37 rillig Exp $ */ begin_ops() /* See mod_t in op.h for the definition of the table columns. */ -/* name repr b l b o i c a s f v t b s l r p c e e = act */ +/* name repr b l b B i c a s f v t b s l r p c e e = act */ op( NOOP, "no-op", , , , , , , , , , , , , , , , , , , , ,0) op( ARROW, "->", 1, ,1, , , , , , ,1, , , , , , , , , , ,1) op( POINT, ".", 1, ,1, , , , , , , , , , , , , , , , , ,1) @@ -22,7 +22,7 @@ op( INDIR, "*", , , , , , , , , ,1, , op( ADDR, "&", , ,1, , , , , , , , , , , , , , , , , ,1) /* the operator 'arr[ind]' is translated to '*(arr + ind)' during parsing. */ -/* name repr b l b o i c a s f v t b s l r p c e e = act */ +/* name repr b l b B i c a s f v t b s l r p c e e = act */ op( MULT, "*", 1, , , , , ,1, ,1,1, ,1, , ,1, , , ,1,1,1) op( DIV, "/", 1, , , , , ,1, ,1,1, ,1, ,1,1, , , ,1,1,1) op( MOD, "%", 1, , , ,1, , , ,1,1, ,1, ,1,1, , , ,1,1,1) @@ -31,7 +31,7 @@ op( MINUS, "-", 1, , , , , , ,1,1,1, ,1 op( SHL, "<<", 1, , , ,1, , , ,1,1, , , , , ,1, , ,1,1,1) op( SHR, ">>", 1, , , ,1, , , ,1,1, , , ,1, ,1, , ,1,1,1) -/* name repr b l b o i c a s f v t b s l r p c e e = act */ +/* name repr b l b B i c a s f v t b s l r p c e e = act */ op( LT, "<", 1,1, , , , , ,1,1,1, ,1, ,1,1, ,1,1, ,1,1) op( LE, "<=", 1,1, , , , , ,1,1,1, ,1, ,1,1, ,1,1, ,1,1) op( GT, ">", 1,1, , , , , ,1,1,1, ,1, ,1,1, ,1,1, ,1,1) @@ -39,7 +39,7 @@ op( GE, ">=", 1,1, , , , , ,1,1,1, ,1, op( EQ, "==", 1,1,1, , , , ,1,1,1, ,1, , , , ,1,1, ,1,1) op( NE, "!=", 1,1,1, , , , ,1,1,1, ,1, , , , ,1,1, ,1,1) -/* name repr b l b o i c a s f v t b s l r p c e e = act */ +/* name repr b l b B i c a s f v t b s l r p c e e = act */ op( BITAND, "&", 1, ,1, ,1, , , ,1,1, ,1, , , ,1, , ,1, ,1) op( BITXOR, "^", 1, ,1, ,1, , , ,1,1, ,1, , , ,1, , ,1, ,1) op( BITOR, "|", 1, ,1, ,1, , , ,1,1, ,1, , , ,1, , ,1, ,1) @@ -48,7 +48,7 @@ op( LOGOR, "||", 1,1,1,1, , , ,1,1, ,1, op( QUEST, "?", 1, , , , , , , ,1, ,1, , , , , , , , , ,1) op( COLON, ":", 1, ,1, , , , , , ,1, ,1, , , , , ,1, , ,1) -/* name repr b l b o i c a s f v t b s l r p c e e = act */ +/* name repr b l b B i c a s f v t b s l r p c e e = act */ op( ASSIGN, "=", 1, ,1, , , , , , , , , ,1, , , , ,1, , ,1) op( MULASS, "*=", 1, , , , , ,1, , , , , ,1, , , , , ,1, ,1) op( DIVASS, "/=", 1, , , , , ,1, , , , , ,1, ,1, , , ,1, ,1) @@ -61,7 +61,7 @@ op( ANDASS, "&=", 1, ,1, ,1, , , , , , op( XORASS, "^=", 1, ,1, ,1, , , , , , , ,1, , , , , ,1, ,1) op( ORASS, "|=", 1, ,1, ,1, , , , , , , ,1, , , , , ,1, ,1) -/* name repr b l b o i c a s f v t b s l r p c e e = act */ +/* name repr b l b B i c a s f v t b s l r p c e e = act */ op( NAME, "name", , , , , , , , , , , , , , , , , , , , ,1) op( CON, "constant", , , , , , , , , , , , , , , , , , , , ,1) op( STRING, "string", , , , , , , , , , , , , , , , , , , , ,1) @@ -77,7 +77,7 @@ op( REAL, "real", , , , , , , , , , , op( IMAG, "imag", , , , , , , , , , , , , , , , , , , , ,0) /* INIT, CASE and FARG are pseudo operators that don't appear in the tree. */ -/* name repr b l b o i c a s f v t b s l r p c e e = act */ +/* name repr b l b B i c a s f v t b s l r p c e e = act */ op( INIT, "init", 1, ,1, , , , , , , , , , , , , , ,1, , ,1) op( CASE, "case", , , , , , , , , , , , , , , , , , , , ,0) op( FARG, "farg", 1, ,1, , , , , , , , , , , , , , ,1, , ,1)