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: rename getopname to op_name



details:   https://anonhg.NetBSD.org/src/rev/94a468410c92
branches:  trunk
changeset: 1020185:94a468410c92
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Apr 02 15:06:35 2021 +0000

description:
lint: rename getopname to op_name

There are several functions called 'get' that allocate memory.  Remove
this possible confusion.

No functional change.

diffstat:

 usr.bin/xlint/lint1/func.c |   6 +++---
 usr.bin/xlint/lint1/tree.c |  38 +++++++++++++++++++-------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

diffs (183 lines):

diff -r f47ff4fb2f8e -r 94a468410c92 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Fri Apr 02 14:50:47 2021 +0000
+++ b/usr.bin/xlint/lint1/func.c        Fri Apr 02 15:06:35 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: func.c,v 1.101 2021/04/02 12:16:50 rillig Exp $        */
+/*     $NetBSD: func.c,v 1.102 2021/04/02 15:06:35 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.101 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.102 2021/04/02 15:06:35 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -447,7 +447,7 @@
 
 #if 0 /* not yet ready, see msg_130.c */
        /* enum type mismatch: '%s' '%s' '%s' */
-       warning(130, type_name(ci->c_switch_type), getopname(EQ),
+       warning(130, type_name(ci->c_switch_type), op_name(EQ),
            type_name(tn->tn_type));
 #endif
 }
diff -r f47ff4fb2f8e -r 94a468410c92 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Fri Apr 02 14:50:47 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Fri Apr 02 15:06:35 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.259 2021/04/02 12:16:50 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.260 2021/04/02 15:06:35 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.259 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.260 2021/04/02 15:06:35 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -99,7 +99,7 @@
 extern sig_atomic_t fpe;
 
 static const char *
-getopname(op_t op)
+op_name(op_t op)
 {
        return modtab[op].m_name;
 }
@@ -118,7 +118,7 @@
        op = tn->tn_op;
        printf("%*s%s with type '%s'%s%s",
            2 * indent, "",
-           op == CVT && !tn->tn_cast ? "convert" : getopname(op),
+           op == CVT && !tn->tn_cast ? "convert" : op_name(op),
            type_name(tn->tn_type), tn->tn_lvalue ? ", lvalue" : "",
            tn->tn_parenthesized ? ", parenthesized" : "");
 
@@ -477,7 +477,7 @@
                        error(105, op == POINT ? "object" : "pointer");
                } else {
                        /* unacceptable operand of '%s' */
-                       error(111, getopname(op));
+                       error(111, op_name(op));
                }
        }
 
@@ -999,7 +999,7 @@
        const char *lx = lt == PTR ? "pointer" : "integer";
        const char *rx = rt == PTR ? "pointer" : "integer";
        /* illegal combination of %s (%s) and %s (%s), op %s */
-       warning(123, lx, type_name(ltp), rx, type_name(rtp), getopname(op));
+       warning(123, lx, type_name(ltp), rx, type_name(rtp), op_name(op));
        return true;
 }
 
@@ -1184,7 +1184,7 @@
                error(211, tspec_name(lt), tspec_name(rt));
        } else {
                /* operands of '%s' have incompatible types (%s != %s) */
-               error(107, getopname(op), tspec_name(lt), tspec_name(rt));
+               error(107, op_name(op), tspec_name(lt), tspec_name(rt));
        }
 
        return false;
@@ -1222,17 +1222,17 @@
 
                if (!binary && !lbool) {
                        /* operand of '%s' must be bool, not '%s' */
-                       error(330, getopname(op), tspec_name(lt));
+                       error(330, op_name(op), tspec_name(lt));
                        ok = false;
                }
                if (binary && !lbool) {
                        /* left operand of '%s' must be bool, not '%s' */
-                       error(331, getopname(op), tspec_name(lt));
+                       error(331, op_name(op), tspec_name(lt));
                        ok = false;
                }
                if (binary && op != QUEST && !is_typeok_bool_operand(rn)) {
                        /* right operand of '%s' must be bool, not '%s' */
-                       error(332, getopname(op), tspec_name(rt));
+                       error(332, op_name(op), tspec_name(rt));
                        ok = false;
                }
                return ok;
@@ -1245,17 +1245,17 @@
 
                if (!binary && lbool) {
                        /* operand of '%s' must not be bool */
-                       error(335, getopname(op));
+                       error(335, op_name(op));
                        ok = false;
                }
                if (binary && lbool) {
                        /* left operand of '%s' must not be bool */
-                       error(336, getopname(op));
+                       error(336, op_name(op));
                        ok = false;
                }
                if (binary && rn->tn_type->t_tspec == BOOL) {
                        /* right operand of '%s' must not be bool */
-                       error(337, getopname(op));
+                       error(337, op_name(op));
                        ok = false;
                }
                return ok;
@@ -1712,7 +1712,7 @@
        }
 
        /* dubious operation on enum, op %s */
-       warning(241, getopname(op));
+       warning(241, op_name(op));
 
 }
 
@@ -1790,7 +1790,7 @@
        default:
                /* combination of '%s' and '%s', op %s */
                warning(242, type_name(ln->tn_type), type_name(rn->tn_type),
-                   getopname(op));
+                   op_name(op));
                break;
        }
 }
@@ -2433,7 +2433,7 @@
                         */
                        if (nsz < osz && (v->v_quad & xmask) != 0) {
                                /* constant truncated by conv., op %s */
-                               warning(306, getopname(op));
+                               warning(306, op_name(op));
                        }
                } else if (op == ANDASS || op == BITAND) {
                        /*
@@ -2446,12 +2446,12 @@
                            (nv->v_quad & xmask) != xmask) {
                                /* extra bits set to 0 in conv. of '%s' ... */
                                warning(309, type_name(gettyp(ot)),
-                                   type_name(tp), getopname(op));
+                                   type_name(tp), op_name(op));
                        } else if (nsz < osz &&
                                   (v->v_quad & xmask) != xmask &&
                                   (v->v_quad & xmask) != 0) {
                                /* constant truncated by conv., op %s */
-                               warning(306, getopname(op));
+                               warning(306, op_name(op));
                        }
                } else if ((nt != PTR && is_uinteger(nt)) &&
                           (ot != PTR && !is_uinteger(ot)) &&
@@ -2953,7 +2953,7 @@
                                error(212);
                        } else {
                                /* unknown operand size, op %s */
-                               error(138, getopname(op));
+                               error(138, op_name(op));
                        }
                        return NULL;
                }



Home | Main Index | Thread Index | Old Index