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: sprinkle const on function declara...



details:   https://anonhg.NetBSD.org/src/rev/a4c8b572ba5f
branches:  trunk
changeset: 960759:a4c8b572ba5f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 28 13:09:43 2021 +0000

description:
lint: sprinkle const on function declarations

No functional change.

diffstat:

 usr.bin/xlint/lint1/externs1.h |  16 ++++++++--------
 usr.bin/xlint/lint1/init.c     |   6 +++---
 usr.bin/xlint/lint1/lex.c      |   6 +++---
 usr.bin/xlint/lint1/tree.c     |  18 +++++++++---------
 4 files changed, 23 insertions(+), 23 deletions(-)

diffs (174 lines):

diff -r 43ca6bad0feb -r a4c8b572ba5f usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h    Sun Mar 28 11:13:24 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h    Sun Mar 28 13:09:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: externs1.h,v 1.93 2021/03/28 10:09:34 rillig Exp $     */
+/*     $NetBSD: externs1.h,v 1.94 2021/03/28 13:09:43 rillig Exp $     */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -82,7 +82,7 @@
 extern void    clear_warn_flags(void);
 extern sym_t   *getsym(sbuf_t *);
 extern void    cleanup(void);
-extern sym_t   *pushdown(sym_t *);
+extern sym_t   *pushdown(const sym_t *);
 extern sym_t   *mktempsym(type_t *);
 extern void    rmsym(sym_t *);
 extern void    rmsyms(sym_t *);
@@ -208,10 +208,10 @@
 extern bool    typeok(op_t, int, const tnode_t *, const tnode_t *);
 extern tnode_t *promote(op_t, bool, tnode_t *);
 extern tnode_t *convert(op_t, int, type_t *, tnode_t *);
-extern void    convert_constant(op_t, int, type_t *, val_t *, val_t *);
-extern tnode_t *build_sizeof(type_t *);
-extern tnode_t *build_offsetof(type_t *, sym_t *);
-extern tnode_t *build_alignof(type_t *);
+extern void    convert_constant(op_t, int, const type_t *, val_t *, val_t *);
+extern tnode_t *build_sizeof(const type_t *);
+extern tnode_t *build_offsetof(const type_t *, const sym_t *);
+extern tnode_t *build_alignof(const type_t *);
 extern tnode_t *cast(tnode_t *, type_t *);
 extern tnode_t *new_function_argument_node(tnode_t *, tnode_t *);
 extern tnode_t *new_function_call_node(tnode_t *, tnode_t *);
@@ -219,9 +219,9 @@
 extern void    expr(tnode_t *, bool, bool, bool, bool);
 extern void    check_expr_misc(const tnode_t *, bool, bool, bool,
                    bool, bool, bool);
-extern bool    constant_addr(const tnode_t *, sym_t **, ptrdiff_t *);
+extern bool    constant_addr(const tnode_t *, const sym_t **, ptrdiff_t *);
 extern strg_t  *cat_strings(strg_t *, strg_t *);
-extern  int64_t type_size_in_bits(type_t *);
+extern  int64_t type_size_in_bits(const type_t *);
 #ifdef DEBUG
 extern void    debug_node(const tnode_t *, int);
 #else
diff -r 43ca6bad0feb -r a4c8b572ba5f usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c        Sun Mar 28 11:13:24 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c        Sun Mar 28 13:09:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.160 2021/03/28 11:08:01 rillig Exp $        */
+/*     $NetBSD: init.c,v 1.161 2021/03/28 13:09:43 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.160 2021/03/28 11:08:01 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.161 2021/03/28 13:09:43 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -341,7 +341,7 @@
        if (tn == NULL || tn->tn_op == CON)
                return;
 
-       sym_t *sym;
+       const sym_t *sym;
        ptrdiff_t offs;
        if (constant_addr(tn, &sym, &offs))
                return;
diff -r 43ca6bad0feb -r a4c8b572ba5f usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sun Mar 28 11:13:24 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sun Mar 28 13:09:43 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.20 2021/03/27 12:42:22 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.21 2021/03/28 13:09:43 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: lex.c,v 1.20 2021/03/27 12:42:22 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.21 2021/03/28 13:09:43 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -1577,7 +1577,7 @@
  * Create a new symbol with the name of an existing symbol.
  */
 sym_t *
-pushdown(sym_t *sym)
+pushdown(const sym_t *sym)
 {
        int     h;
        sym_t   *nsym;
diff -r 43ca6bad0feb -r a4c8b572ba5f usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Mar 28 11:13:24 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Mar 28 13:09:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.252 2021/03/27 11:08:00 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.253 2021/03/28 13:09:43 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.252 2021/03/27 11:08:00 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.253 2021/03/28 13:09:43 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2298,7 +2298,7 @@
  * v           old constant
  */
 void
-convert_constant(op_t op, int arg, type_t *tp, val_t *nv, val_t *v)
+convert_constant(op_t op, int arg, const type_t *tp, val_t *nv, val_t *v)
 {
        tspec_t ot, nt;
        ldbl_t  max = 0.0, min = 0.0;
@@ -3339,7 +3339,7 @@
  * Create a constant node for sizeof.
  */
 tnode_t *
-build_sizeof(type_t *tp)
+build_sizeof(const type_t *tp)
 {
        int64_t size_in_bytes = type_size_in_bits(tp) / CHAR_SIZE;
        tnode_t *tn = new_integer_constant_node(SIZEOF_TSPEC, size_in_bytes);
@@ -3351,7 +3351,7 @@
  * Create a constant node for offsetof.
  */
 tnode_t *
-build_offsetof(type_t *tp, sym_t *sym)
+build_offsetof(const type_t *tp, const sym_t *sym)
 {
        tspec_t t = tp->t_tspec;
        if (t != STRUCT && t != UNION)
@@ -3366,7 +3366,7 @@
 }
 
 int64_t
-type_size_in_bits(type_t *tp)
+type_size_in_bits(const type_t *tp)
 {
        int     elem, elsz;
        bool    flex;
@@ -3427,7 +3427,7 @@
 }
 
 tnode_t *
-build_alignof(type_t *tp)
+build_alignof(const type_t *tp)
 {
        switch (tp->t_tspec) {
        case ARRAY:
@@ -4241,9 +4241,9 @@
  * representation (including width).
  */
 bool
-constant_addr(const tnode_t *tn, sym_t **symp, ptrdiff_t *offsp)
+constant_addr(const tnode_t *tn, const sym_t **symp, ptrdiff_t *offsp)
 {
-       sym_t   *sym;
+       const sym_t *sym;
        ptrdiff_t offs1, offs2;
        tspec_t t, ot;
 



Home | Main Index | Thread Index | Old Index