Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/xlint lint: add parentheses after sizeof, as r...



details:   https://anonhg.NetBSD.org/src/rev/df5d24852dc1
branches:  trunk
changeset: 960913:df5d24852dc1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Apr 02 12:16:50 2021 +0000

description:
lint: add parentheses after sizeof, as required by share/misc/style

No functional change.

diffstat:

 tests/usr.bin/xlint/lint1/d_c99_init.c |   4 +-
 tests/usr.bin/xlint/lint1/msg_144.c    |   4 +-
 usr.bin/xlint/common/tyname.c          |  10 +++---
 usr.bin/xlint/lint1/cgram.y            |   8 ++--
 usr.bin/xlint/lint1/decl.c             |  32 +++++++++---------
 usr.bin/xlint/lint1/err.c              |   6 +-
 usr.bin/xlint/lint1/func.c             |  14 ++++----
 usr.bin/xlint/lint1/init.c             |  10 +++---
 usr.bin/xlint/lint1/lex.c              |  52 +++++++++++++++---------------
 usr.bin/xlint/lint1/main1.c            |   6 +-
 usr.bin/xlint/lint1/mem1.c             |  18 +++++-----
 usr.bin/xlint/lint1/tree.c             |  36 ++++++++++----------
 usr.bin/xlint/lint2/chk.c              |   6 +-
 usr.bin/xlint/lint2/emit2.c            |   6 +-
 usr.bin/xlint/lint2/hash.c             |  12 +++---
 usr.bin/xlint/lint2/main2.c            |   8 ++--
 usr.bin/xlint/lint2/read.c             |  56 +++++++++++++++++-----------------
 usr.bin/xlint/xlint/xlint.c            |  48 ++++++++++++++--------------
 18 files changed, 168 insertions(+), 168 deletions(-)

diffs (truncated from 1310 to 300 lines):

diff -r ffe2f427268f -r df5d24852dc1 tests/usr.bin/xlint/lint1/d_c99_init.c
--- a/tests/usr.bin/xlint/lint1/d_c99_init.c    Fri Apr 02 12:11:41 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.c    Fri Apr 02 12:16:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_init.c,v 1.30 2021/04/01 14:20:30 rillig Exp $   */
+/*     $NetBSD: d_c99_init.c,v 1.31 2021/04/02 12:16:50 rillig Exp $   */
 # 3 "d_c99_init.c"
 
 /*
@@ -185,7 +185,7 @@
                 * extend_if_array_of_unknown_size, setcomplete is called too
                 * early.
                 */
-               sizeof points,
+               sizeof(points),
                4
        }
 };
diff -r ffe2f427268f -r df5d24852dc1 tests/usr.bin/xlint/lint1/msg_144.c
--- a/tests/usr.bin/xlint/lint1/msg_144.c       Fri Apr 02 12:11:41 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_144.c       Fri Apr 02 12:16:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_144.c,v 1.3 2021/01/31 11:12:07 rillig Exp $       */
+/*     $NetBSD: msg_144.c,v 1.4 2021/04/02 12:16:50 rillig Exp $       */
 # 3 "msg_144.c"
 
 // Test for message: cannot take size/alignment of function [144]
@@ -6,5 +6,5 @@
 unsigned long
 example(void)
 {
-       return sizeof example;  /* expect: 144 */
+       return sizeof(example); /* expect: 144 */
 }
diff -r ffe2f427268f -r df5d24852dc1 usr.bin/xlint/common/tyname.c
--- a/usr.bin/xlint/common/tyname.c     Fri Apr 02 12:11:41 2021 +0000
+++ b/usr.bin/xlint/common/tyname.c     Fri Apr 02 12:16:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tyname.c,v 1.36 2021/03/27 12:42:22 rillig Exp $       */
+/*     $NetBSD: tyname.c,v 1.37 2021/04/02 12:16:50 rillig Exp $       */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.36 2021/03/27 12:42:22 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.37 2021/04/02 12:16:50 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -74,7 +74,7 @@
 {
        name_tree_node *n;
 
-       n = xmalloc(sizeof *n);
+       n = xmalloc(sizeof(*n));
        n->ntn_name = xstrdup(name);
        n->ntn_less = NULL;
        n->ntn_greater = NULL;
@@ -137,9 +137,9 @@
 static void
 buf_add_int(buffer *buf, int n)
 {
-       char num[1 + sizeof n * CHAR_BIT + 1];
+       char num[1 + sizeof(n) * CHAR_BIT + 1];
 
-       snprintf(num, sizeof num, "%d", n);
+       snprintf(num, sizeof(num), "%d", n);
        buf_add(buf, num);
 }
 
diff -r ffe2f427268f -r df5d24852dc1 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Fri Apr 02 12:11:41 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Fri Apr 02 12:16:50 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.210 2021/04/02 11:53:25 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.211 2021/04/02 12:16:50 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.210 2021/04/02 11:53:25 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.211 2021/04/02 12:16:50 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1197,7 +1197,7 @@
 
 asterisk:
          T_ASTERISK {
-               $$ = xcalloc(1, sizeof *$$);
+               $$ = xcalloc(1, sizeof(*$$));
                $$->p_pcnt = 1;
          }
        ;
@@ -1213,7 +1213,7 @@
 
 type_qualifier:
          T_QUAL {
-               $$ = xcalloc(1, sizeof *$$);
+               $$ = xcalloc(1, sizeof(*$$));
                if ($1 == CONST) {
                        $$->p_const = true;
                } else if ($1 == VOLATILE) {
diff -r ffe2f427268f -r df5d24852dc1 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Fri Apr 02 12:11:41 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Fri Apr 02 12:16:50 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.169 2021/04/02 11:53:25 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.170 2021/04/02 12:16:50 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.169 2021/04/02 11:53:25 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.170 2021/04/02 12:16:50 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -91,7 +91,7 @@
        int i;
 
        /* declaration stack */
-       dcs = xcalloc(1, sizeof *dcs);
+       dcs = xcalloc(1, sizeof(*dcs));
        dcs->d_ctx = EXTERN;
        dcs->d_ldlsym = &dcs->d_dlsyms;
 
@@ -99,7 +99,7 @@
        inittyp();
 
        /* shared type structures */
-       typetab = xcalloc(NTSPEC, sizeof *typetab);
+       typetab = xcalloc(NTSPEC, sizeof(*typetab));
        for (i = 0; i < NTSPEC; i++)
                typetab[i].t_tspec = NOTSPEC;
        typetab[BOOL].t_tspec = BOOL;
@@ -163,7 +163,7 @@
 {
        type_t  *ntp;
 
-       ntp = expr_zalloc(sizeof *ntp);
+       ntp = expr_zalloc(sizeof(*ntp));
        *ntp = *tp;
        return ntp;
 }
@@ -594,7 +594,7 @@
        dinfo_t *di;
 
        /* put a new element on the declaration stack */
-       di = xcalloc(1, sizeof *di);
+       di = xcalloc(1, sizeof(*di));
        di->d_next = dcs;
        dcs = di;
        di->d_ctx = sc;
@@ -1261,7 +1261,7 @@
 {
 
        if (dsym == NULL) {
-               dsym = getblk(sizeof *dsym);
+               dsym = getblk(sizeof(*dsym));
                dsym->s_name = unnamed;
                dsym->s_kind = FMEMBER;
                dsym->s_scl = MOS;
@@ -1333,7 +1333,7 @@
                return decl;
 
        while (pi != NULL) {
-               *tpp = tp = getblk(sizeof *tp);
+               *tpp = tp = getblk(sizeof(*tp));
                tp->t_tspec = PTR;
                tp->t_const = pi->p_const;
                tp->t_volatile = pi->p_volatile;
@@ -1360,7 +1360,7 @@
        if (*tpp == NULL)
            return decl;
 
-       *tpp = tp = getblk(sizeof *tp);
+       *tpp = tp = getblk(sizeof(*tp));
        tp->t_tspec = ARRAY;
        tp->t_subt = dcs->d_type;
        tp->t_dim = n;
@@ -1415,7 +1415,7 @@
        if (*tpp == NULL)
            return decl;
 
-       *tpp = tp = getblk(sizeof *tp);
+       *tpp = tp = getblk(sizeof(*tp));
        tp->t_tspec = FUNC;
        tp->t_subt = dcs->d_next->d_type;
        if ((tp->t_proto = dcs->d_proto) != false)
@@ -1669,19 +1669,19 @@
                }
                if (tag->s_scl == NOSCL) {
                        tag->s_scl = scl;
-                       tag->s_type = tp = getblk(sizeof *tp);
+                       tag->s_type = tp = getblk(sizeof(*tp));
                        tp->t_packed = dcs->d_packed;
                } else {
                        tp = tag->s_type;
                }
        } else {
-               tag = getblk(sizeof *tag);
+               tag = getblk(sizeof(*tag));
                tag->s_name = unnamed;
                UNIQUE_CURR_POS(tag->s_def_pos);
                tag->s_kind = FTAG;
                tag->s_scl = scl;
                tag->s_block_level = -1;
-               tag->s_type = tp = getblk(sizeof *tp);
+               tag->s_type = tp = getblk(sizeof(*tp));
                tp->t_packed = dcs->d_packed;
                dcs->d_next->d_nonempty_decl = true;
        }
@@ -1689,12 +1689,12 @@
        if (tp->t_tspec == NOTSPEC) {
                tp->t_tspec = kind;
                if (kind != ENUM) {
-                       tp->t_str = getblk(sizeof *tp->t_str);
+                       tp->t_str = getblk(sizeof(*tp->t_str));
                        tp->t_str->sou_align_in_bits = CHAR_SIZE;
                        tp->t_str->sou_tag = tag;
                } else {
                        tp->t_is_enum = true;
-                       tp->t_enum = getblk(sizeof *tp->t_enum);
+                       tp->t_enum = getblk(sizeof(*tp->t_enum));
                        tp->t_enum->en_tag = tag;
                }
                setcomplete(tp, false);
@@ -2862,7 +2862,7 @@
 
        lint_assert(dcs->d_ctx == ABSTRACT || dcs->d_ctx == PROTO_ARG);
 
-       sym = getblk(sizeof *sym);
+       sym = getblk(sizeof(*sym));
 
        sym->s_name = unnamed;
        sym->s_def = DEF;
diff -r ffe2f427268f -r df5d24852dc1 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Fri Apr 02 12:11:41 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Fri Apr 02 12:16:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.c,v 1.99 2021/03/30 15:18:19 rillig Exp $  */
+/*     $NetBSD: err.c,v 1.100 2021/04/02 12:16:50 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.99 2021/03/30 15:18:19 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.100 2021/04/02 12:16:50 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -405,7 +405,7 @@
 {
        size_t i;
 
-       for (i = 0; i < sizeof msgs / sizeof msgs[0]; i++)
+       for (i = 0; i < sizeof(msgs) / sizeof(msgs[0]); i++)
                printf("%zu\t%s\n", i, msgs[i]);
 }
 
diff -r ffe2f427268f -r df5d24852dc1 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Fri Apr 02 12:11:41 2021 +0000
+++ b/usr.bin/xlint/lint1/func.c        Fri Apr 02 12:16:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: func.c,v 1.100 2021/04/02 11:53:25 rillig Exp $        */
+/*     $NetBSD: func.c,v 1.101 2021/04/02 12:16:50 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.100 2021/04/02 11:53:25 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.101 2021/04/02 12:16:50 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -157,7 +157,7 @@
 {
        cstk_t  *ci;
 
-       ci = xcalloc(1, sizeof *ci);
+       ci = xcalloc(1, sizeof(*ci));
        ci->c_kind = kind;
        ci->c_surrounding = cstmt;



Home | Main Index | Thread Index | Old Index