[BACK]Return to ops.def CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.bin / xlint / lint1

Annotation of src/usr.bin/xlint/lint1/ops.def, Revision 1.26

1.26    ! rillig      1: /*     $NetBSD: ops.def,v 1.25 2021/09/10 20:02:50 rillig Exp $ */
1.7       rillig      2:
                      3: begin_ops()
1.9       rillig      4:
1.21      rillig      5: /*
                      6:  * Operator properties; see mod_t in op.h.
                      7:  *
1.25      rillig      8:  *     warn if operand '='                                           x
1.21      rillig      9:  *     bad on enum                                                 x
                     10:  *     valid on enum                                             x
                     11:  *     comparison              - - - - - - - - - - - - - - - - x
                     12:  *     possible precedence confusion                         x |
                     13:  *     warn if right operand unsigned                      x   |
                     14:  *     warn if left operand unsigned                     x     |
                     15:  *     has side effects        - - - - - - - - - - - - x       |
                     16:  *     balance operands                              x |       |
1.26    ! rillig     17:  *     test context                                x   |       |
        !            18:  *     value context                             x     |       |
1.21      rillig     19:  *     fold constant operands  - - - - - - - - x       |       |
                     20:  *     requires scalar                       x |       |       |
                     21:  *     requires arithmetic                 x   |       |       |
                     22:  *     requires integer or complex       x     |       |       |
                     23:  *     requires integer        - - - - x       |       |       |
                     24:  *     requires _Bool                x |       |       |       |
                     25:  *     takes _Bool                 x   |       |       |       |
                     26:  *     logical                   x     |       |       |       |
                     27:  *     binary                  x       |       |       |       |
                     28:  */
1.19      rillig     29: /*     name    repr            b l b B i c a s f v t b s l r p c e e = */
1.20      rillig     30: op(    NOOP,   "no-op",        -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
                     31: op(    ARROW,  "->",           1,-,1,-,-,-,-,-,-,1,-,-,-,-,-,-,-,-,-,-)
                     32: op(    POINT,  ".",            1,-,1,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
                     33: op(    NOT,    "!",            -,1,1,1,-,-,-,1,1,-,1,-,-,-,-,-,-,-,1,-)
                     34: op(    COMPL,  "~",            -,-,-,-,-,1,-,-,1,1,-,-,-,-,-,-,-,-,1,1)
                     35: op(    INC,    "++",           -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
                     36: op(    DEC,    "--",           -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
                     37: op(    INCBEF, "++x",          -,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
                     38: op(    DECBEF, "--x",          -,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
                     39: op(    INCAFT, "x++",          -,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
                     40: op(    DECAFT, "x--",          -,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
                     41: op(    UPLUS,  "+",            -,-,-,-,-,-,1,-,1,1,-,-,-,-,-,-,-,-,1,1)
                     42: op(    UMINUS, "-",            -,-,-,-,-,-,1,-,1,1,-,-,-,1,-,-,-,-,1,1)
                     43: op(    INDIR,  "*",            -,-,-,-,-,-,-,-,-,1,-,-,-,-,-,-,-,-,-,-)
                     44: op(    ADDR,   "&",            -,-,1,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
1.16      rillig     45: /* the operator 'arr[ind]' is translated to '*(arr + ind)' during parsing. */
1.10      rillig     46:
1.19      rillig     47: /*     name    repr            b l b B i c a s f v t b s l r p c e e = */
1.20      rillig     48: op(    MULT,   "*",            1,-,-,-,-,-,1,-,1,1,-,1,-,-,1,-,-,-,1,1)
                     49: op(    DIV,    "/",            1,-,-,-,-,-,1,-,1,1,-,1,-,1,1,-,-,-,1,1)
                     50: op(    MOD,    "%",            1,-,-,-,1,-,-,-,1,1,-,1,-,1,1,-,-,-,1,1)
                     51: op(    PLUS,   "+",            1,-,-,-,-,-,-,1,1,1,-,1,-,-,-,-,-,-,1,-)
                     52: op(    MINUS,  "-",            1,-,-,-,-,-,-,1,1,1,-,1,-,-,-,-,-,-,1,-)
                     53: op(    SHL,    "<<",           1,-,-,-,1,-,-,-,1,1,-,-,-,-,-,1,-,-,1,1)
                     54: op(    SHR,    ">>",           1,-,-,-,1,-,-,-,1,1,-,-,-,1,-,1,-,-,1,1)
                     55:
                     56: /*     name    repr            b l b B i c a s f v t b s l r p c e e = */
                     57: op(    LT,     "<",            1,1,-,-,-,-,-,1,1,1,-,1,-,1,1,-,1,1,-,1)
                     58: op(    LE,     "<=",           1,1,-,-,-,-,-,1,1,1,-,1,-,1,1,-,1,1,-,1)
                     59: op(    GT,     ">",            1,1,-,-,-,-,-,1,1,1,-,1,-,1,1,-,1,1,-,1)
                     60: op(    GE,     ">=",           1,1,-,-,-,-,-,1,1,1,-,1,-,1,1,-,1,1,-,1)
                     61: op(    EQ,     "==",           1,1,1,-,-,-,-,1,1,1,-,1,-,-,-,-,1,1,-,1)
                     62: op(    NE,     "!=",           1,1,1,-,-,-,-,1,1,1,-,1,-,-,-,-,1,1,-,1)
                     63:
                     64: /*     name    repr            b l b B i c a s f v t b s l r p c e e = */
                     65: op(    BITAND, "&",            1,-,1,-,1,-,-,-,1,1,-,1,-,-,-,1,-,-,1,-)
                     66: op(    BITXOR, "^",            1,-,1,-,1,-,-,-,1,1,-,1,-,-,-,1,-,-,1,-)
                     67: op(    BITOR,  "|",            1,-,1,-,1,-,-,-,1,1,-,1,-,-,-,1,-,-,1,-)
                     68: op(    LOGAND, "&&",           1,1,1,1,-,-,-,1,1,-,1,-,-,-,-,-,-,-,1,-)
                     69: op(    LOGOR,  "||",           1,1,1,1,-,-,-,1,1,-,1,-,-,-,-,1,-,-,1,-)
                     70: op(    QUEST,  "?",            1,-,-,-,-,-,-,-,1,-,1,-,-,-,-,-,-,-,-,-)
                     71: op(    COLON,  ":",            1,-,1,-,-,-,-,-,-,1,-,1,-,-,-,-,-,1,-,-)
                     72:
                     73: /*     name    repr            b l b B i c a s f v t b s l r p c e e = */
                     74: op(    ASSIGN, "=",            1,-,1,-,-,-,-,-,-,-,-,-,1,-,-,-,-,1,-,-)
                     75: op(    MULASS, "*=",           1,-,-,-,-,-,1,-,-,-,-,-,1,-,-,-,-,-,1,-)
                     76: op(    DIVASS, "/=",           1,-,-,-,-,-,1,-,-,-,-,-,1,-,1,-,-,-,1,-)
                     77: op(    MODASS, "%=",           1,-,-,-,1,-,-,-,-,-,-,-,1,-,1,-,-,-,1,-)
                     78: op(    ADDASS, "+=",           1,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
                     79: op(    SUBASS, "-=",           1,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
                     80: op(    SHLASS, "<<=",          1,-,-,-,1,-,-,-,-,-,-,-,1,-,-,-,-,-,1,-)
                     81: op(    SHRASS, ">>=",          1,-,-,-,1,-,-,-,-,-,-,-,1,-,-,-,-,-,1,-)
                     82: op(    ANDASS, "&=",           1,-,1,-,1,-,-,-,-,-,-,-,1,-,-,-,-,-,1,-)
                     83: op(    XORASS, "^=",           1,-,1,-,1,-,-,-,-,-,-,-,1,-,-,-,-,-,1,-)
                     84: op(    ORASS,  "|=",           1,-,1,-,1,-,-,-,-,-,-,-,1,-,-,-,-,-,1,-)
                     85:
                     86: /*     name    repr            b l b B i c a s f v t b s l r p c e e = */
                     87: op(    NAME,   "name",         -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
                     88: op(    CON,    "constant",     -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
                     89: op(    STRING, "string",       -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
                     90: op(    FSEL,   "fsel",         -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
                     91: op(    CALL,   "call",         1,-,-,-,-,-,-,-,-,-,-,-,1,-,-,-,-,-,-,-)
                     92: op(    COMMA,  ",",            1,-,1,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,1)
                     93: op(    CVT,    "convert",      -,-,-,-,-,-,-,-,-,1,-,-,-,-,-,-,-,-,-,-)
                     94: op(    ICALL,  "icall",        1,-,-,-,-,-,-,-,-,-,-,-,1,-,-,-,-,-,-,-)
                     95: op(    LOAD,   "load",         -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
1.23      rillig     96: /*
                     97:  * PUSH is a virtual node that is used to concatenate arguments in a function
                     98:  * call expression.  The PUSH nodes are ordered from right to left.  For
                     99:  * example, the function call f(17, 23) is represented as
                    100:  * CALL(f, PUSH(23, PUSH(17, NULL))).
                    101:  */
1.20      rillig    102: op(    PUSH,   "push",         -,-,-,-,-,-,-,-,-,1,-,-,-,-,-,-,-,-,-,-)
                    103: op(    RETURN, "return",       1,-,1,-,-,-,-,-,-,-,-,-,1,-,-,-,-,1,-,-)
                    104: op(    REAL,   "real",         -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
                    105: op(    IMAG,   "imag",         -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
1.9       rillig    106:
1.7       rillig    107: /* INIT, CASE and FARG are pseudo operators that don't appear in the tree. */
1.19      rillig    108: /*     name    repr            b l b B i c a s f v t b s l r p c e e = */
1.24      rillig    109: op(    INIT,   "init",         1,-,1,-,-,-,-,-,-,-,-,-,1,-,-,-,-,1,-,-)
1.20      rillig    110: op(    CASE,   "case",         -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
1.22      rillig    111: /*
1.23      rillig    112:  * FARG is only used temporarily in check_prototype_argument to check type
                    113:  * compatibility and conversion for function arguments.
1.22      rillig    114:  */
1.23      rillig    115: op(    FARG,   "farg",         1,-,1,-,-,-,-,-,-,-,-,-,-,-,-,-,-,1,-,-)
1.22      rillig    116:
1.7       rillig    117: end_ops()
                    118:
                    119: #ifndef NOPS
                    120: #  define NOPS ((int)FARG + 1)
                    121: #endif
                    122:
                    123: #undef begin_ops
                    124: #undef op
                    125: #undef end_ops

CVSweb <webmaster@jp.NetBSD.org>