lint: sprinkle const on function declarations

No functional change.
This commit is contained in:
rillig 2021-03-28 13:09:43 +00:00
parent 665875b486
commit 3bd18ec06c
4 changed files with 23 additions and 23 deletions

View File

@ -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 * Copyright (c) 1994, 1995 Jochen Pohl
@ -82,7 +82,7 @@ extern int64_t xsign(int64_t, tspec_t, int);
extern void clear_warn_flags(void); extern void clear_warn_flags(void);
extern sym_t *getsym(sbuf_t *); extern sym_t *getsym(sbuf_t *);
extern void cleanup(void); extern void cleanup(void);
extern sym_t *pushdown(sym_t *); extern sym_t *pushdown(const sym_t *);
extern sym_t *mktempsym(type_t *); extern sym_t *mktempsym(type_t *);
extern void rmsym(sym_t *); extern void rmsym(sym_t *);
extern void rmsyms(sym_t *); extern void rmsyms(sym_t *);
@ -208,10 +208,10 @@ extern bool is_typeok_bool_operand(const tnode_t *);
extern bool typeok(op_t, int, const tnode_t *, const tnode_t *); extern bool typeok(op_t, int, const tnode_t *, const tnode_t *);
extern tnode_t *promote(op_t, bool, tnode_t *); extern tnode_t *promote(op_t, bool, tnode_t *);
extern tnode_t *convert(op_t, int, type_t *, 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 void convert_constant(op_t, int, const type_t *, val_t *, val_t *);
extern tnode_t *build_sizeof(type_t *); extern tnode_t *build_sizeof(const type_t *);
extern tnode_t *build_offsetof(type_t *, sym_t *); extern tnode_t *build_offsetof(const type_t *, const sym_t *);
extern tnode_t *build_alignof(type_t *); extern tnode_t *build_alignof(const type_t *);
extern tnode_t *cast(tnode_t *, 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_argument_node(tnode_t *, tnode_t *);
extern tnode_t *new_function_call_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 expr(tnode_t *, bool, bool, bool, bool);
extern void check_expr_misc(const tnode_t *, bool, bool, bool, extern void check_expr_misc(const tnode_t *, bool, bool, bool,
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 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 #ifdef DEBUG
extern void debug_node(const tnode_t *, int); extern void debug_node(const tnode_t *, int);
#else #else

View File

@ -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 * Copyright (c) 1994, 1995 Jochen Pohl
@ -37,7 +37,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint) #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 #endif
#include <stdlib.h> #include <stdlib.h>
@ -341,7 +341,7 @@ check_non_constant_initializer(const tnode_t *tn, scl_t sclass)
if (tn == NULL || tn->tn_op == CON) if (tn == NULL || tn->tn_op == CON)
return; return;
sym_t *sym; const sym_t *sym;
ptrdiff_t offs; ptrdiff_t offs;
if (constant_addr(tn, &sym, &offs)) if (constant_addr(tn, &sym, &offs))
return; return;

View File

@ -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. * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint) #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 #endif
#include <ctype.h> #include <ctype.h>
@ -1577,7 +1577,7 @@ cleanup(void)
* Create a new symbol with the name of an existing symbol. * Create a new symbol with the name of an existing symbol.
*/ */
sym_t * sym_t *
pushdown(sym_t *sym) pushdown(const sym_t *sym)
{ {
int h; int h;
sym_t *nsym; sym_t *nsym;

View File

@ -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 * Copyright (c) 1994, 1995 Jochen Pohl
@ -37,7 +37,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint) #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 #endif
#include <float.h> #include <float.h>
@ -2298,7 +2298,7 @@ check_pointer_conversion(op_t op, tnode_t *tn, type_t *tp)
* v old constant * v old constant
*/ */
void 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; tspec_t ot, nt;
ldbl_t max = 0.0, min = 0.0; ldbl_t max = 0.0, min = 0.0;
@ -3339,7 +3339,7 @@ fold_float(tnode_t *tn)
* Create a constant node for sizeof. * Create a constant node for sizeof.
*/ */
tnode_t * 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; int64_t size_in_bytes = type_size_in_bits(tp) / CHAR_SIZE;
tnode_t *tn = new_integer_constant_node(SIZEOF_TSPEC, size_in_bytes); 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. * Create a constant node for offsetof.
*/ */
tnode_t * 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; tspec_t t = tp->t_tspec;
if (t != STRUCT && t != UNION) if (t != STRUCT && t != UNION)
@ -3366,7 +3366,7 @@ build_offsetof(type_t *tp, sym_t *sym)
} }
int64_t int64_t
type_size_in_bits(type_t *tp) type_size_in_bits(const type_t *tp)
{ {
int elem, elsz; int elem, elsz;
bool flex; bool flex;
@ -3427,7 +3427,7 @@ type_size_in_bits(type_t *tp)
} }
tnode_t * tnode_t *
build_alignof(type_t *tp) build_alignof(const type_t *tp)
{ {
switch (tp->t_tspec) { switch (tp->t_tspec) {
case ARRAY: case ARRAY:
@ -4241,9 +4241,9 @@ check_integer_comparison(op_t op, tnode_t *ln, tnode_t *rn)
* representation (including width). * representation (including width).
*/ */
bool 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; ptrdiff_t offs1, offs2;
tspec_t t, ot; tspec_t t, ot;