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 length to length_in_bits



details:   https://anonhg.NetBSD.org/src/rev/ab7c095d1789
branches:  trunk
changeset: 365128:ab7c095d1789
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Apr 09 13:22:05 2022 +0000

description:
lint: rename length to length_in_bits

No functional change.

diffstat:

 usr.bin/xlint/lint1/decl.c     |  33 +++++++++++++++++----------------
 usr.bin/xlint/lint1/externs1.h |   4 ++--
 usr.bin/xlint/lint1/tree.c     |  10 +++++-----
 3 files changed, 24 insertions(+), 23 deletions(-)

diffs (165 lines):

diff -r 976398e2046e -r ab7c095d1789 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sat Apr 09 12:49:36 2022 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sat Apr 09 13:22:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.269 2022/04/08 21:48:19 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.270 2022/04/09 13:22:05 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.269 2022/04/08 21:48:19 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.270 2022/04/09 13:22:05 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -836,11 +836,11 @@
  * Return the length of a type in bits.
  *
  * Printing a message if the outermost dimension of an array is 0 must
- * be done by the caller. All other problems are reported by length()
+ * be done by the caller. All other problems are reported by this function
  * if name is not NULL.
  */
 int
-length(const type_t *tp, const char *name)
+length_in_bits(const type_t *tp, const char *name)
 {
        unsigned int elem, elsz;
 
@@ -991,7 +991,7 @@
                                /* illegal use of 'void' */
                                error(18);
                                *tpp = gettyp(INT);
-#if 0  /* errors are produced by length() */
+#if 0  /* errors are produced by length_in_bits */
                        } else if (is_incomplete(tp)) {
                                /* array of incomplete type */
                                if (sflag) {
@@ -1150,11 +1150,11 @@
        }
 
        /*
-        * bit-fields of length 0 are not warned about because length()
+        * bit-fields of length 0 are not warned about because length_in_bits
         * does not return the length of the bit-field but the length
         * of the type the bit-field is packed in (it's ok)
         */
-       if ((sz = length(dsym->s_type, dsym->s_name)) == 0) {
+       if ((sz = length_in_bits(dsym->s_type, dsym->s_name)) == 0) {
                if (t == ARRAY && dsym->s_type->t_dim == 0) {
                        /* zero sized array in struct is a C99 extension: %s */
                        c99ism(39, dsym->s_name);
@@ -2483,12 +2483,12 @@
                warning(269, sym->s_name);
 
        /*
-        * Arguments must have complete types. length() prints the needed
-        * error messages (null dimension is impossible because arrays are
-        * converted to pointers).
+        * Arguments must have complete types. length_in_bits prints the
+        * needed error messages (null dimension is impossible because arrays
+        * are converted to pointers).
         */
        if (sym->s_type->t_tspec != VOID)
-               (void)length(sym->s_type, sym->s_name);
+               (void)length_in_bits(sym->s_type, sym->s_name);
 
        sym->s_used = dcs->d_used;
        mark_as_set(sym);
@@ -2983,7 +2983,7 @@
        if (dsym->s_type->t_tspec == FUNC)
                return;
 
-       if (length(dsym->s_type, dsym->s_name) == 0 &&
+       if (length_in_bits(dsym->s_type, dsym->s_name) == 0 &&
            dsym->s_type->t_tspec == ARRAY && dsym->s_type->t_dim == 0) {
                if (tflag) {
                        /* empty array declaration: %s */
@@ -3291,7 +3291,7 @@
 check_global_variable_size(const sym_t *sym)
 {
        pos_t cpos;
-       int length_in_bits;
+       int len_in_bits;
 
        if (sym->s_def != TDEF)
                return;
@@ -3302,14 +3302,15 @@
                 */
                return;
        if (sym->s_def == TDEF && sym->s_type->t_tspec == VOID)
-               return;         /* prevent internal error in length() below */
+               return;         /* prevent internal error in length_in_bits
+                                * below */
 
        cpos = curr_pos;
        curr_pos = sym->s_def_pos;
-       length_in_bits = length(sym->s_type, sym->s_name);
+       len_in_bits = length_in_bits(sym->s_type, sym->s_name);
        curr_pos = cpos;
 
-       if (length_in_bits == 0 &&
+       if (len_in_bits == 0 &&
            sym->s_type->t_tspec == ARRAY && sym->s_type->t_dim == 0) {
                if (tflag || (sym->s_scl == EXTERN && !sflag)) {
                        /* empty array declaration: %s */
diff -r 976398e2046e -r ab7c095d1789 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h    Sat Apr 09 12:49:36 2022 +0000
+++ b/usr.bin/xlint/lint1/externs1.h    Sat Apr 09 13:22:05 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: externs1.h,v 1.152 2022/04/02 17:28:06 rillig Exp $    */
+/*     $NetBSD: externs1.h,v 1.153 2022/04/09 13:22:05 rillig Exp $    */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -191,7 +191,7 @@
 extern void    setasm(void);
 extern void    begin_type(void);
 extern void    end_type(void);
-extern int     length(const type_t *, const char *);
+extern int     length_in_bits(const type_t *, const char *);
 extern unsigned int alignment_in_bits(const type_t *);
 extern sym_t   *lnklst(sym_t *, sym_t *);
 extern void    check_type(sym_t *);
diff -r 976398e2046e -r ab7c095d1789 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sat Apr 09 12:49:36 2022 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sat Apr 09 13:22:05 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.418 2022/04/03 00:39:32 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.419 2022/04/09 13:22:05 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.418 2022/04/03 00:39:32 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.419 2022/04/09 13:22:05 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -3084,8 +3084,8 @@
 }
 
 /*
- * Get length of type tp->t_subt, as a constant expression of type ptrdiff_t
- * as seen from the target platform.
+ * Get length_in_bits of type tp->t_subt, as a constant expression of type
+ * ptrdiff_t as seen from the target platform.
  */
 static tnode_t *
 plength(type_t *tp)
@@ -4254,7 +4254,7 @@
                return;
 
        /* Get the size of one array element */
-       if ((elsz = length(ln->tn_type->t_subt, NULL)) == 0)
+       if ((elsz = length_in_bits(ln->tn_type->t_subt, NULL)) == 0)
                return;
        elsz /= CHAR_SIZE;
 



Home | Main Index | Thread Index | Old Index