Module Name: src
Committed By: rillig
Date: Sat Jan 9 17:36:10 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: op.h ops.def
Log Message:
lint: reorder table of operator properties
The 4 "requires" properties are now listed together, in descending
strictness.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint1/op.h
cvs rdiff -u -r1.7 -r1.8 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.10 src/usr.bin/xlint/lint1/op.h:1.11
--- src/usr.bin/xlint/lint1/op.h:1.10 Tue Jan 5 23:50:29 2021
+++ src/usr.bin/xlint/lint1/op.h Sat Jan 9 17:36:10 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: op.h,v 1.10 2021/01/05 23:50:29 rillig Exp $ */
+/* $NetBSD: op.h,v 1.11 2021/01/09 17:36:10 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -40,8 +40,9 @@ typedef struct {
bool m_binary : 1; /* binary operator */
bool m_logical : 1; /* logical operator, result is int */
bool m_requires_integer : 1;
- bool m_requires_scalar : 1;
+ bool m_requires_integer_or_complex : 1;
bool m_requires_arith : 1;
+ bool m_requires_scalar : 1;
bool m_fold : 1; /* operands should be folded */
bool m_vctx : 1; /* value context for left operand */
bool m_tctx : 1; /* test context for left operand */
@@ -54,7 +55,6 @@ typedef struct {
bool m_valid_on_enum : 1; /* valid operation on enums */
bool m_bad_on_enum : 1; /* dubious operation on enums */
bool m_eqwarn : 1; /* warning if on operand stems from == */
- bool m_requires_integer_or_complex : 1;
const char *m_name; /* name of op. */
} mod_t;
Index: src/usr.bin/xlint/lint1/ops.def
diff -u src/usr.bin/xlint/lint1/ops.def:1.7 src/usr.bin/xlint/lint1/ops.def:1.8
--- src/usr.bin/xlint/lint1/ops.def:1.7 Tue Jan 5 23:50:29 2021
+++ src/usr.bin/xlint/lint1/ops.def Sat Jan 9 17:36:10 2021
@@ -1,71 +1,71 @@
-/* $NetBSD: ops.def,v 1.7 2021/01/05 23:50:29 rillig Exp $ */
+/* $NetBSD: ops.def,v 1.8 2021/01/09 17:36:10 rillig Exp $ */
begin_ops()
-/* name repr b l i s a f v t b s l r p c e e q c act */
+/* name repr b l i c a s f v t b s l r p c e e = act */
op( NOOP, "no-op", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0)
-op( ARROW, "->", 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 1)
+op( ARROW, "->", 1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 1)
op( POINT, ".", 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1)
-op( NOT, "!", 0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,0, 1)
-op( COMPL, "~", 0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,1, 1)
+op( NOT, "!", 0,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,1,0, 1)
+op( COMPL, "~", 0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,1, 1)
op( INC, "++", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0)
op( DEC, "--", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0)
-op( INCBEF, "++x", 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0, 1)
-op( DECBEF, "--x", 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0, 1)
-op( INCAFT, "x++", 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0, 1)
-op( DECAFT, "x--", 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0, 1)
-op( UPLUS, "+", 0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,0, 1)
-op( UMINUS, "-", 0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,1,1,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)
+op( COLON, ":", 1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0, 1)
+op( ASSIGN, "=", 1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0, 1)
+op( MULASS, "*=", 1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0, 1)
+op( DIVASS, "/=", 1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0, 1)
+op( MODASS, "%=", 1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0, 1)
+op( ADDASS, "+=", 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0, 1)
+op( SUBASS, "-=", 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0, 1)
+op( SHLASS, "<<=", 1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0, 1)
+op( SHRASS, ">>=", 1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0, 1)
+op( ANDASS, "&=", 1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0, 1)
+op( XORASS, "^=", 1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0, 1)
+op( ORASS, "|=", 1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0, 1)
op( NAME, "name", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1)
op( CON, "const", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1)
op( STRING, "string", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1)
op( FSEL, "fsel", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1)
-op( CALL, "call", 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 1)
-op( COMMA, ",", 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 1)
-op( CVT, "convert", 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 1)
-op( ICALL, "icall", 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 1)
+op( CALL, "call", 1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 1)
+op( COMMA, ",", 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1)
+op( CVT, "convert", 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 1)
+op( ICALL, "icall", 1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 1)
op( LOAD, "load", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1)
-op( PUSH, "push", 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 1)
-op( RETURN, "return", 1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0, 1)
+op( PUSH, "push", 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 1)
+op( RETURN, "return", 1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0, 1)
op( REAL, "real", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0)
op( IMAG, "imag", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0)
/* INIT, CASE and FARG are pseudo operators that don't appear in the tree. */
-op( INIT, "init", 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 1)
+op( INIT, "init", 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, 1)
op( CASE, "case", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0)
-op( FARG, "farg", 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 1)
-/* name repr b l i s a f v t b s l r p c e e q c act */
+op( FARG, "farg", 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, 1)
+/* name repr b l i c a s f v t b s l r p c e e = act */
end_ops()
#ifndef NOPS