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: use consistent naming scheme for f...
details: https://anonhg.NetBSD.org/src/rev/4329bb604b58
branches: trunk
changeset: 984739:4329bb604b58
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Jul 20 19:44:36 2021 +0000
description:
lint: use consistent naming scheme for functions that build nodes
No functional change.
diffstat:
usr.bin/xlint/lint1/cgram.y | 22 +++++++++---------
usr.bin/xlint/lint1/externs1.h | 12 +++++-----
usr.bin/xlint/lint1/init.c | 6 ++--
usr.bin/xlint/lint1/tree.c | 48 +++++++++++++++++++++---------------------
4 files changed, 44 insertions(+), 44 deletions(-)
diffs (truncated from 344 to 300 lines):
diff -r b7a86b6d6ba4 -r 4329bb604b58 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Tue Jul 20 19:35:53 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Tue Jul 20 19:44:36 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.329 2021/07/20 19:35:53 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.330 2021/07/20 19:44:36 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.329 2021/07/20 19:35:53 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.330 2021/07/20 19:44:36 rillig Exp $");
#endif
#include <limits.h>
@@ -412,13 +412,13 @@
/* XXX really necessary? */
if (yychar < 0)
yychar = yylex();
- $$ = new_name_node(getsym($1), yychar);
+ $$ = build_name(getsym($1), yychar);
}
| T_CON {
- $$ = expr_new_constant(gettyp($1->v_tspec), $1);
+ $$ = build_constant(gettyp($1->v_tspec), $1);
}
| string {
- $$ = new_string_node($1);
+ $$ = build_string($1);
}
| T_LPAREN expression T_RPAREN {
if ($2 != NULL)
@@ -473,10 +473,10 @@
$$ = build_unary(INDIR, build_binary($1, PLUS, $3));
}
| postfix_expression T_LPAREN T_RPAREN {
- $$ = new_function_call_node($1, NULL);
+ $$ = build_function_call($1, NULL);
}
| postfix_expression T_LPAREN argument_expression_list T_RPAREN {
- $$ = new_function_call_node($1, $3);
+ $$ = build_function_call($1, $3);
}
| postfix_expression point_or_arrow T_NAME {
$$ = build_member_access($1, $2, $3);
@@ -492,7 +492,7 @@
if (!Sflag)
/* compound literals are a C9X/GCC extension */
gnuism(319);
- $$ = new_name_node(*current_initsym(), 0);
+ $$ = build_name(*current_initsym(), 0);
end_initialization();
}
| T_LPAREN compound_statement_lbrace gcc_statement_expr_list {
@@ -504,7 +504,7 @@
/* ({ }) is a GCC extension */
gnuism(320);
} compound_statement_rbrace T_RPAREN {
- $$ = new_name_node(*current_initsym(), 0);
+ $$ = build_name(*current_initsym(), 0);
end_initialization();
}
;
@@ -564,10 +564,10 @@
/* K&R 7.1, C90 ???, C99 6.5.2, C11 6.5.2 */
argument_expression_list:
assignment_expression {
- $$ = new_function_argument_node(NULL, $1);
+ $$ = build_function_argument(NULL, $1);
}
| argument_expression_list T_COMMA assignment_expression {
- $$ = new_function_argument_node($1, $3);
+ $$ = build_function_argument($1, $3);
}
;
diff -r b7a86b6d6ba4 -r 4329bb604b58 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h Tue Jul 20 19:35:53 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h Tue Jul 20 19:44:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: externs1.h,v 1.119 2021/07/20 19:35:53 rillig Exp $ */
+/* $NetBSD: externs1.h,v 1.120 2021/07/20 19:44:36 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -204,9 +204,9 @@
extern const tnode_t *before_conversion(const tnode_t *);
extern type_t *derive_type(type_t *, tspec_t);
extern type_t *expr_derive_type(type_t *, tspec_t);
-extern tnode_t *expr_new_constant(type_t *, val_t *);
-extern tnode_t *new_name_node(sym_t *, int);
-extern tnode_t *new_string_node(strg_t *);
+extern tnode_t *build_constant(type_t *, val_t *);
+extern tnode_t *build_name(sym_t *, int);
+extern tnode_t *build_string(strg_t *);
extern sym_t *struct_or_union_member(tnode_t *, op_t, sym_t *);
extern tnode_t *build_generic_selection(const tnode_t *,
struct generic_association *);
@@ -224,8 +224,8 @@
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 *);
+extern tnode_t *build_function_argument(tnode_t *, tnode_t *);
+extern tnode_t *build_function_call(tnode_t *, tnode_t *);
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,
diff -r b7a86b6d6ba4 -r 4329bb604b58 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c Tue Jul 20 19:35:53 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c Tue Jul 20 19:44:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.202 2021/07/20 19:35:53 rillig Exp $ */
+/* $NetBSD: init.c,v 1.203 2021/07/20 19:44:36 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.202 2021/07/20 19:35:53 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.203 2021/07/20 19:44:36 rillig Exp $");
#endif
#include <stdlib.h>
@@ -899,7 +899,7 @@
debug_step0("handing over to ASSIGN");
- ln = new_name_node(in->in_sym, 0);
+ ln = build_name(in->in_sym, 0);
ln->tn_type = expr_dup_type(ln->tn_type);
ln->tn_type->t_const = false;
diff -r b7a86b6d6ba4 -r 4329bb604b58 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Tue Jul 20 19:35:53 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Tue Jul 20 19:44:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.317 2021/07/20 19:35:53 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.318 2021/07/20 19:44:36 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.317 2021/07/20 19:35:53 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.318 2021/07/20 19:44:36 rillig Exp $");
#endif
#include <float.h>
@@ -50,7 +50,7 @@
#include "lint1.h"
#include "cgram.h"
-static tnode_t *expr_new_integer_constant(tspec_t, int64_t);
+static tnode_t *build_integer_constant(tspec_t, int64_t);
static void check_pointer_comparison(op_t,
const tnode_t *, const tnode_t *);
static bool check_assign_types_compatible(op_t, int,
@@ -174,7 +174,7 @@
* Create a node for a constant.
*/
tnode_t *
-expr_new_constant(type_t *tp, val_t *v)
+build_constant(type_t *tp, val_t *v)
{
tnode_t *n;
@@ -190,7 +190,7 @@
}
static tnode_t *
-expr_new_integer_constant(tspec_t t, int64_t q)
+build_integer_constant(tspec_t t, int64_t q)
{
tnode_t *n;
@@ -245,7 +245,7 @@
* follow_token is the token which follows the name.
*/
tnode_t *
-new_name_node(sym_t *sym, int follow_token)
+build_name(sym_t *sym, int follow_token)
{
tnode_t *n;
@@ -295,7 +295,7 @@
}
tnode_t *
-new_string_node(strg_t *strg)
+build_string(strg_t *strg)
{
size_t len;
tnode_t *n;
@@ -706,7 +706,7 @@
ln = cconv(ln);
}
msym = struct_or_union_member(ln, op, getsym(member));
- return build_binary(ln, op, new_name_node(msym, 0));
+ return build_binary(ln, op, build_name(msym, 0));
}
/*
@@ -2590,7 +2590,7 @@
ln = convert(NOOP, 0, expr_derive_type(gettyp(VOID), PTR), ln);
}
- ctn = expr_new_integer_constant(PTRDIFF_TSPEC,
+ ctn = build_integer_constant(PTRDIFF_TSPEC,
rn->tn_sym->s_value.v_quad / CHAR_SIZE);
ntn = new_tnode(PLUS, expr_derive_type(rn->tn_type, PTR), ln, ctn);
@@ -2622,7 +2622,7 @@
if (ln->tn_type->t_tspec == PTR) {
cn = plength(ln->tn_type);
} else {
- cn = expr_new_integer_constant(INT, (int64_t)1);
+ cn = build_integer_constant(INT, (int64_t)1);
}
ntn = new_tnode(op, ln->tn_type, ln, cn);
@@ -2651,15 +2651,15 @@
switch (ln->tn_type->t_tspec) {
case LCOMPLEX:
/* XXX: integer and LDOUBLE don't match. */
- cn = expr_new_integer_constant(LDOUBLE, (int64_t)1);
+ cn = build_integer_constant(LDOUBLE, (int64_t)1);
break;
case DCOMPLEX:
/* XXX: integer and DOUBLE don't match. */
- cn = expr_new_integer_constant(DOUBLE, (int64_t)1);
+ cn = build_integer_constant(DOUBLE, (int64_t)1);
break;
case FCOMPLEX:
/* XXX: integer and FLOAT don't match. */
- cn = expr_new_integer_constant(FLOAT, (int64_t)1);
+ cn = build_integer_constant(FLOAT, (int64_t)1);
break;
default:
/* __%s__ is illegal for type %s */
@@ -2947,7 +2947,7 @@
if (elsz == 0)
elsz = CHAR_SIZE;
- return expr_new_integer_constant(PTRDIFF_TSPEC,
+ return build_integer_constant(PTRDIFF_TSPEC,
(int64_t)(elem * elsz / CHAR_SIZE));
}
@@ -3097,7 +3097,7 @@
v->v_quad = convert_integer(q, t, -1);
- cn = expr_new_constant(tn->tn_type, v);
+ cn = build_constant(tn->tn_type, v);
if (tn->tn_left->tn_system_dependent)
cn->tn_system_dependent = true;
if (modtab[tn->tn_op].m_binary && tn->tn_right->tn_system_dependent)
@@ -3140,7 +3140,7 @@
lint_assert(/*CONSTCOND*/false);
}
- return expr_new_constant(tn->tn_type, v);
+ return build_constant(tn->tn_type, v);
}
/*
@@ -3237,7 +3237,7 @@
fpe = 0;
}
- return expr_new_constant(tn->tn_type, v);
+ return build_constant(tn->tn_type, v);
}
@@ -3248,7 +3248,7 @@
build_sizeof(const type_t *tp)
{
int64_t size_in_bytes = type_size_in_bits(tp) / CHAR_SIZE;
- tnode_t *tn = expr_new_integer_constant(SIZEOF_TSPEC, size_in_bytes);
+ tnode_t *tn = build_integer_constant(SIZEOF_TSPEC, size_in_bytes);
tn->tn_system_dependent = true;
return tn;
}
@@ -3266,7 +3266,7 @@
// XXX: wrong size, no checking for sym fixme
int64_t offset_in_bytes = type_size_in_bits(tp) / CHAR_SIZE;
- tnode_t *tn = expr_new_integer_constant(SIZEOF_TSPEC, offset_in_bytes);
+ tnode_t *tn = build_integer_constant(SIZEOF_TSPEC, offset_in_bytes);
Home |
Main Index |
Thread Index |
Old Index