Module Name:    src
Committed By:   rillig
Date:           Sun Mar 28 13:09:43 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: externs1.h init.c lex.c tree.c

Log Message:
lint: sprinkle const on function declarations

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.160 -r1.161 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.252 -r1.253 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.93 src/usr.bin/xlint/lint1/externs1.h:1.94
--- src/usr.bin/xlint/lint1/externs1.h:1.93	Sun Mar 28 10:09:34 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Sun Mar 28 13:09:43 2021
@@ -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	int64_t	xsign(int64_t, tspec_t, i
 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	is_typeok_bool_operand(const
 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	val_t	*constant(tnode_t *, bool);
 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

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.160 src/usr.bin/xlint/lint1/init.c:1.161
--- src/usr.bin/xlint/lint1/init.c:1.160	Sun Mar 28 11:08:01 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 13:09:43 2021
@@ -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 @@ check_non_constant_initializer(const tno
 	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;

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.20 src/usr.bin/xlint/lint1/lex.c:1.21
--- src/usr.bin/xlint/lint1/lex.c:1.20	Sat Mar 27 12:42:22 2021
+++ src/usr.bin/xlint/lint1/lex.c	Sun Mar 28 13:09:43 2021
@@ -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 @@ cleanup(void)
  * 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;

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.252 src/usr.bin/xlint/lint1/tree.c:1.253
--- src/usr.bin/xlint/lint1/tree.c:1.252	Sat Mar 27 11:08:00 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Mar 28 13:09:43 2021
@@ -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 @@ check_pointer_conversion(op_t op, tnode_
  * 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 @@ fold_float(tnode_t *tn)
  * 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 @@ build_sizeof(type_t *tp)
  * 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 @@ build_offsetof(type_t *tp, sym_t *sym)
 }
 
 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 @@ type_size_in_bits(type_t *tp)
 }
 
 tnode_t *
-build_alignof(type_t *tp)
+build_alignof(const type_t *tp)
 {
 	switch (tp->t_tspec) {
 	case ARRAY:
@@ -4241,9 +4241,9 @@ check_integer_comparison(op_t op, tnode_
  * 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;
 

Reply via email to