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: fix argument names and table headi...



details:   https://anonhg.NetBSD.org/src/rev/95c8aa9d10d9
branches:  trunk
changeset: 953784:95c8aa9d10d9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 20 20:15:37 2021 +0000

description:
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.

diffstat:

 usr.bin/xlint/lint1/op.h    |  10 +++++++---
 usr.bin/xlint/lint1/oper.c  |  22 +++++++++++++---------
 usr.bin/xlint/lint1/ops.def |  16 ++++++++--------
 3 files changed, 28 insertions(+), 20 deletions(-)

diffs (131 lines):

diff -r a842be1dbb71 -r 95c8aa9d10d9 usr.bin/xlint/lint1/op.h
--- a/usr.bin/xlint/lint1/op.h  Sat Mar 20 19:33:25 2021 +0000
+++ b/usr.bin/xlint/lint1/op.h  Sat Mar 20 20:15:37 2021 +0000
@@ -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 @@
 
 #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"
diff -r a842be1dbb71 -r 95c8aa9d10d9 usr.bin/xlint/lint1/oper.c
--- a/usr.bin/xlint/lint1/oper.c        Sat Mar 20 19:33:25 2021 +0000
+++ b/usr.bin/xlint/lint1/oper.c        Sat Mar 20 20:15:37 2021 +0000
@@ -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 @@
 } 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"
diff -r a842be1dbb71 -r 95c8aa9d10d9 usr.bin/xlint/lint1/ops.def
--- a/usr.bin/xlint/lint1/ops.def       Sat Mar 20 19:33:25 2021 +0000
+++ b/usr.bin/xlint/lint1/ops.def       Sat Mar 20 20:15:37 2021 +0000
@@ -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(    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(    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(    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(    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(    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(    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)



Home | Main Index | Thread Index | Old Index