Module Name: src Committed By: rillig Date: Mon Dec 28 19:38:54 UTC 2020
Modified Files: src/usr.bin/xlint/lint1: op.h tree.c Log Message: lint: rename fields in mod_t To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/lint1/op.h cvs rdiff -u -r1.92 -r1.93 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/op.h diff -u src/usr.bin/xlint/lint1/op.h:1.6 src/usr.bin/xlint/lint1/op.h:1.7 --- src/usr.bin/xlint/lint1/op.h:1.6 Sat Feb 5 17:14:14 2011 +++ src/usr.bin/xlint/lint1/op.h Mon Dec 28 19:38:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: op.h,v 1.6 2011/02/05 17:14:14 christos Exp $ */ +/* $NetBSD: op.h,v 1.7 2020/12/28 19:38:54 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -35,24 +35,24 @@ * Various information about operators */ typedef struct { - u_int m_binary : 1; /* binary op. */ - u_int m_logop : 1; /* logical op., result is int */ - u_int m_rqint : 1; /* operands must have integer type */ - u_int m_rqsclt : 1; /* operands must have scalar type */ - u_int m_rqatyp : 1; /* operands must have arithmetic type */ + u_int m_binary : 1; /* binary operator */ + u_int m_logical : 1; /* logical operator, result is int */ + u_int m_requires_integer : 1; + u_int m_requires_scalar : 1; + u_int m_requires_arith : 1; u_int m_fold : 1; /* operands should be folded */ u_int m_vctx : 1; /* value context for left operand */ u_int m_tctx : 1; /* test context for left operand */ - u_int m_balance : 1; /* op. requires balancing */ - u_int m_sideeff : 1; /* op. has side effect */ - u_int m_tlansiu : 1; /* warning if left op. is unsign. in ANSI C */ - u_int m_transiu : 1; /* warning if right op. is unsign. in ANSI C */ + u_int m_balance : 1; /* operator requires balancing */ + u_int m_sideeff : 1; /* operator has side effect */ + u_int m_tlansiu : 1; /* warn if left op. is unsign. in ANSI C */ + u_int m_transiu : 1; /* warn if right op. is unsign. in ANSI C */ u_int m_tpconf : 1; /* test possible precedence confusion */ - u_int m_comp : 1; /* op. performs comparison */ - u_int m_enumop : 1; /* valid operation on enums */ - u_int m_badeop : 1; /* dubious operation on enums */ + u_int m_comp : 1; /* operator performs comparison */ + u_int m_valid_on_enum : 1; /* valid operation on enums */ + u_int m_bad_on_enum : 1; /* dubious operation on enums */ u_int m_eqwarn : 1; /* warning if on operand stems from == */ - u_int m_rqintcomp : 1;/* operands must be integer or complex */ + u_int m_requires_integer_or_complex : 1; const char *m_name; /* name of op. */ } mod_t; Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.92 src/usr.bin/xlint/lint1/tree.c:1.93 --- src/usr.bin/xlint/lint1/tree.c:1.92 Mon Dec 28 19:07:43 2020 +++ src/usr.bin/xlint/lint1/tree.c Mon Dec 28 19:38:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.92 2020/12/28 19:07:43 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.93 2020/12/28 19:38:54 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.92 2020/12/28 19:07:43 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.93 2020/12/28 19:38:54 rillig Exp $"); #endif #include <float.h> @@ -591,7 +591,7 @@ build(op_t op, tnode_t *ln, tnode_t *rn) ntn = bldri(op, ln); break; default: - rtp = mp->m_logop ? gettyp(INT) : ln->tn_type; + rtp = mp->m_logical ? gettyp(INT) : ln->tn_type; if (!mp->m_binary && rn != NULL) LERROR("build()"); ntn = mktnode(op, rtp, ln, rn); @@ -712,29 +712,25 @@ typeok(op_t op, int arg, tnode_t *ln, tn rst = (rstp = rtp->t_subt)->t_tspec; } - if (mp->m_rqint) { - /* integer types required */ + if (mp->m_requires_integer) { if (!tspec_is_int(lt) || (mp->m_binary && !tspec_is_int(rt))) { incompat(op, lt, rt); return (0); } - } else if (mp->m_rqintcomp) { - /* integer or complex types required */ + } else if (mp->m_requires_integer_or_complex) { if ((!tspec_is_int(lt) && !tspec_is_complex(lt)) || (mp->m_binary && (!tspec_is_int(rt) && !tspec_is_complex(rt)))) { incompat(op, lt, rt); return (0); } - } else if (mp->m_rqsclt) { - /* scalar types required */ + } else if (mp->m_requires_scalar) { if (!tspec_is_scalar(lt) || (mp->m_binary && !tspec_is_scalar(rt))) { incompat(op, lt, rt); return (0); } - } else if (mp->m_rqatyp) { - /* arithmetic types required */ + } else if (mp->m_requires_arith) { if (!tspec_is_arith(lt) || (mp->m_binary && !tspec_is_arith(rt))) { incompat(op, lt, rt); @@ -1134,12 +1130,14 @@ typeok(op_t op, int arg, tnode_t *ln, tn break; } - if (mp->m_badeop && + if (mp->m_bad_on_enum && (ltp->t_isenum || (mp->m_binary && rtp->t_isenum))) { chkbeop(op, ln, rn); - } else if (mp->m_enumop && (ltp->t_isenum && rtp && rtp->t_isenum)) { + } else if (mp->m_valid_on_enum && + (ltp->t_isenum && rtp && rtp->t_isenum)) { chkeop2(op, arg, ln, rn); - } else if (mp->m_enumop && (ltp->t_isenum || (rtp && rtp->t_isenum))) { + } else if (mp->m_valid_on_enum && + (ltp->t_isenum || (rtp && rtp->t_isenum))) { chkeop1(op, arg, ln, rn); }