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 functions for duplicating t...



details:   https://anonhg.NetBSD.org/src/rev/4a1b6e4adab2
branches:  trunk
changeset: 982142:4a1b6e4adab2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Apr 02 11:53:25 2021 +0000

description:
lint: rename functions for duplicating types

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y    |   6 +++---
 usr.bin/xlint/lint1/decl.c     |  35 ++++++++++++++++++-----------------
 usr.bin/xlint/lint1/externs1.h |   6 +++---
 usr.bin/xlint/lint1/func.c     |   6 +++---
 usr.bin/xlint/lint1/init.c     |  10 +++++-----
 usr.bin/xlint/lint1/tree.c     |  18 +++++++++---------
 6 files changed, 41 insertions(+), 40 deletions(-)

diffs (truncated from 332 to 300 lines):

diff -r d2ffead03b0a -r 4a1b6e4adab2 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Fri Apr 02 10:39:22 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Fri Apr 02 11:53:25 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.209 2021/04/02 10:13:03 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.210 2021/04/02 11:53:25 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.209 2021/04/02 10:13:03 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.210 2021/04/02 11:53:25 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1889,7 +1889,7 @@
            expr_statement_list {
                block_level--;
                mem_block_level--;
-               begin_initialization(mktempsym(duptyp($4->tn_type)));
+               begin_initialization(mktempsym(dup_type($4->tn_type)));
                mem_block_level++;
                block_level++;
                /* ({ }) is a GCC extension */
diff -r d2ffead03b0a -r 4a1b6e4adab2 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Fri Apr 02 10:39:22 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Fri Apr 02 11:53:25 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.168 2021/04/02 10:13:03 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.169 2021/04/02 11:53:25 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.168 2021/04/02 10:13:03 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.169 2021/04/02 11:53:25 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -133,8 +133,9 @@
 /*
  * Returns a shared type structure for arithmetic types and void.
  *
- * It's important to duplicate this structure (using duptyp() or tduptyp())
- * if it is to be modified (adding qualifiers or anything else).
+ * It's important to duplicate this structure (using dup_type() or
+ * expr_dup_type()) if it is to be modified (adding qualifiers or anything
+ * else).
  */
 type_t *
 gettyp(tspec_t t)
@@ -144,7 +145,7 @@
 }
 
 type_t *
-duptyp(const type_t *tp)
+dup_type(const type_t *tp)
 {
        type_t  *ntp;
 
@@ -154,11 +155,11 @@
 }
 
 /*
- * Use tduptyp() instead of duptyp() inside expressions (if the
+ * Use expr_dup_type() instead of dup_type() inside expressions (if the
  * allocated memory should be freed after the expr).
  */
 type_t *
-tduptyp(const type_t *tp)
+expr_dup_type(const type_t *tp)
 {
        type_t  *ntp;
 
@@ -394,7 +395,7 @@
                        if (!tflag)
                                /* modifying typedef with '%s'; only ... */
                                warning(5, ttab[t].tt_name);
-                       td = duptyp(gettyp(merge_type_specifiers(t2, t)));
+                       td = dup_type(gettyp(merge_type_specifiers(t2, t)));
                        td->t_typedef = true;
                        return td;
                }
@@ -403,7 +404,7 @@
                if (t2 == INT || t2 == UINT) {
                        /* modifying typedef with '%s'; only qualifiers ... */
                        warning(5, "short");
-                       td = duptyp(gettyp(t2 == INT ? SHORT : USHORT));
+                       td = dup_type(gettyp(t2 == INT ? SHORT : USHORT));
                        td->t_typedef = true;
                        return td;
                }
@@ -428,7 +429,7 @@
                        } else if (t2 == DCOMPLEX) {
                                td = gettyp(LCOMPLEX);
                        }
-                       td = duptyp(td);
+                       td = dup_type(td);
                        td->t_typedef = true;
                        return td;
                }
@@ -857,7 +858,7 @@
        }
 
        if (dcs->d_const || dcs->d_volatile) {
-               dcs->d_type = duptyp(dcs->d_type);
+               dcs->d_type = dup_type(dcs->d_type);
                dcs->d_type->t_const |= dcs->d_const;
                dcs->d_type->t_volatile |= dcs->d_volatile;
        }
@@ -1123,7 +1124,7 @@
                        /* illegal bit-field type '%s' */
                        warning(35, type_name(tp));
                        int sz = tp->t_flen;
-                       dsym->s_type = tp = duptyp(gettyp(t = INT));
+                       dsym->s_type = tp = dup_type(gettyp(t = INT));
                        if ((tp->t_flen = sz) > size_in_bits(t))
                                tp->t_flen = size_in_bits(t);
                }
@@ -1267,7 +1268,7 @@
                dsym->s_type = gettyp(UINT);
                dsym->s_block_level = -1;
        }
-       dsym->s_type = duptyp(dsym->s_type);
+       dsym->s_type = dup_type(dsym->s_type);
        dsym->s_type->t_bitfield = true;
        dsym->s_type->t_flen = len;
        dsym->s_bitfield = true;
@@ -2016,7 +2017,7 @@
        }
 
        if (dsym->s_scl == TYPEDEF) {
-               dsym->s_type = duptyp(dsym->s_type);
+               dsym->s_type = dup_type(dsym->s_type);
                dsym->s_type->t_typedef = true;
                settdsym(dsym->s_type, dsym);
        }
@@ -2368,13 +2369,13 @@
                lint_assert(dst->t_tspec == src->t_tspec);
                if (dst->t_tspec == ARRAY) {
                        if (dst->t_dim == 0 && src->t_dim != 0) {
-                               *dstp = dst = duptyp(dst);
+                               *dstp = dst = dup_type(dst);
                                dst->t_dim = src->t_dim;
                                setcomplete(dst, true);
                        }
                } else if (dst->t_tspec == FUNC) {
                        if (!dst->t_proto && src->t_proto) {
-                               *dstp = dst = duptyp(dst);
+                               *dstp = dst = dup_type(dst);
                                dst->t_proto = true;
                                dst->t_args = src->t_args;
                        }
@@ -2753,7 +2754,7 @@
        }
 
        if (dsym->s_scl == TYPEDEF) {
-               dsym->s_type = duptyp(dsym->s_type);
+               dsym->s_type = dup_type(dsym->s_type);
                dsym->s_type->t_typedef = true;
                settdsym(dsym->s_type, dsym);
        }
diff -r d2ffead03b0a -r 4a1b6e4adab2 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h    Fri Apr 02 10:39:22 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h    Fri Apr 02 11:53:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: externs1.h,v 1.98 2021/04/02 10:13:03 rillig Exp $     */
+/*     $NetBSD: externs1.h,v 1.99 2021/04/02 11:53:25 rillig Exp $     */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -138,8 +138,8 @@
 
 extern void    initdecl(void);
 extern type_t  *gettyp(tspec_t);
-extern type_t  *duptyp(const type_t *);
-extern type_t  *tduptyp(const type_t *);
+extern type_t  *dup_type(const type_t *);
+extern type_t  *expr_dup_type(const type_t *);
 extern bool    is_incomplete(const type_t *);
 extern void    setcomplete(type_t *, bool);
 extern void    add_storage_class(scl_t);
diff -r d2ffead03b0a -r 4a1b6e4adab2 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Fri Apr 02 10:39:22 2021 +0000
+++ b/usr.bin/xlint/lint1/func.c        Fri Apr 02 11:53:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: func.c,v 1.99 2021/04/02 10:13:03 rillig Exp $ */
+/*     $NetBSD: func.c,v 1.100 2021/04/02 11:53:25 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.99 2021/04/02 10:13:03 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.100 2021/04/02 11:53:25 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -1051,7 +1051,7 @@
                /* Create a temporary node for the left side */
                ln = expr_zalloc(sizeof *ln);
                ln->tn_op = NAME;
-               ln->tn_type = tduptyp(funcsym->s_type->t_subt);
+               ln->tn_type = expr_dup_type(funcsym->s_type->t_subt);
                ln->tn_type->t_const = false;
                ln->tn_lvalue = true;
                ln->tn_sym = funcsym;           /* better than nothing */
diff -r d2ffead03b0a -r 4a1b6e4adab2 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c        Fri Apr 02 10:39:22 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c        Fri Apr 02 11:53:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.188 2021/04/02 10:13:03 rillig Exp $        */
+/*     $NetBSD: init.c,v 1.189 2021/04/02 11:53:25 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.188 2021/04/02 10:13:03 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.189 2021/04/02 11:53:25 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -321,7 +321,7 @@
 {
        type_t *tp;
 
-       tp = duptyp(sym->s_type);
+       tp = dup_type(sym->s_type);
        tp->t_dim = (int)size;
        tp->t_incomplete_array = false;
        sym->s_type = tp;
@@ -385,7 +385,7 @@
        /* Create a temporary node for the left side. */
        ln = expr_zalloc(sizeof *ln);
        ln->tn_op = NAME;
-       ln->tn_type = tduptyp(tp);
+       ln->tn_type = expr_dup_type(tp);
        ln->tn_type->t_const = false;
        ln->tn_lvalue = true;
        ln->tn_sym = sym;
@@ -880,7 +880,7 @@
        debug_step0("handing over to ASSIGN");
 
        ln = new_name_node(in->in_sym, 0);
-       ln->tn_type = tduptyp(ln->tn_type);
+       ln->tn_type = expr_dup_type(ln->tn_type);
        ln->tn_type->t_const = false;
 
        tn = build(ASSIGN, ln, rn);
diff -r d2ffead03b0a -r 4a1b6e4adab2 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Fri Apr 02 10:39:22 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Fri Apr 02 11:53:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.257 2021/04/02 10:13:03 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.258 2021/04/02 11:53:25 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.257 2021/04/02 10:13:03 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.258 2021/04/02 11:53:25 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -711,7 +711,7 @@
 
        /* lvalue to rvalue */
        if (tn->tn_lvalue) {
-               tp = tduptyp(tn->tn_type);
+               tp = expr_dup_type(tn->tn_type);
                tp->t_const = tp->t_volatile = false;
                tn = new_tnode(LOAD, tp, tn, NULL);
        }
@@ -1932,7 +1932,7 @@
        }
 
        if (t != tn->tn_type->t_tspec) {
-               ntp = tduptyp(tn->tn_type);
+               ntp = expr_dup_type(tn->tn_type);
                ntp->t_tspec = t;
                /*
                 * Keep t_is_enum so we are later able to check compatibility
@@ -2018,12 +2018,12 @@
        }
 



Home | Main Index | Thread Index | Old Index