lint: narrow down parameter of build_name
Passing an arbitrary tokenizer symbol left too much freedom and uncertainty to the caller, and 0 was a magic number in this context. No functional change.
This commit is contained in:
parent
4edad2cfab
commit
3d9a4093f0
|
@ -1,5 +1,5 @@
|
|||
%{
|
||||
/* $NetBSD: cgram.y,v 1.374 2021/12/15 15:20:51 christos Exp $ */
|
||||
/* $NetBSD: cgram.y,v 1.375 2021/12/16 23:46:21 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.374 2021/12/15 15:20:51 christos Exp $");
|
||||
__RCSID("$NetBSD: cgram.y,v 1.375 2021/12/16 23:46:21 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
@ -432,7 +432,7 @@ primary_expression:
|
|||
yychar = yylex();
|
||||
sys_next = in_system_header;
|
||||
in_system_header = sys_name;
|
||||
$$ = build_name(getsym($1), yychar);
|
||||
$$ = build_name(getsym($1), yychar == T_LPAREN);
|
||||
in_system_header = sys_next;
|
||||
}
|
||||
| T_CON {
|
||||
|
@ -513,7 +513,7 @@ postfix_expression:
|
|||
if (!Sflag)
|
||||
/* compound literals are a C9X/GCC extension */
|
||||
gnuism(319);
|
||||
$$ = build_name(*current_initsym(), 0);
|
||||
$$ = build_name(*current_initsym(), false);
|
||||
end_initialization();
|
||||
}
|
||||
| T_LPAREN compound_statement_lbrace gcc_statement_expr_list {
|
||||
|
@ -525,7 +525,7 @@ postfix_expression:
|
|||
/* ({ }) is a GCC extension */
|
||||
gnuism(320);
|
||||
} compound_statement_rbrace T_RPAREN {
|
||||
$$ = build_name(*current_initsym(), 0);
|
||||
$$ = build_name(*current_initsym(), false);
|
||||
end_initialization();
|
||||
}
|
||||
;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: externs1.h,v 1.141 2021/12/15 00:44:05 rillig Exp $ */
|
||||
/* $NetBSD: externs1.h,v 1.142 2021/12/16 23:46:21 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
@ -235,7 +235,7 @@ extern type_t *derive_type(type_t *, tspec_t);
|
|||
extern type_t *expr_derive_type(type_t *, tspec_t);
|
||||
extern bool is_compiler_builtin(const char *);
|
||||
extern tnode_t *build_constant(type_t *, val_t *);
|
||||
extern tnode_t *build_name(sym_t *, int);
|
||||
extern tnode_t *build_name(sym_t *, bool);
|
||||
extern tnode_t *build_string(strg_t *);
|
||||
extern tnode_t *build_generic_selection(const tnode_t *,
|
||||
struct generic_association *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: init.c,v 1.210 2021/11/16 21:01:05 rillig Exp $ */
|
||||
/* $NetBSD: init.c,v 1.211 2021/12/16 23:46:21 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.210 2021/11/16 21:01:05 rillig Exp $");
|
||||
__RCSID("$NetBSD: init.c,v 1.211 2021/12/16 23:46:21 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -829,7 +829,7 @@ initialization_expr_using_op(struct initialization *in, tnode_t *rn)
|
|||
|
||||
debug_step("handing over to INIT");
|
||||
|
||||
ln = build_name(in->in_sym, 0);
|
||||
ln = build_name(in->in_sym, false);
|
||||
ln->tn_type = expr_unqualified_type(ln->tn_type);
|
||||
|
||||
tn = build_binary(ln, INIT, false /* XXX */, rn);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tree.c,v 1.398 2021/12/15 00:44:05 rillig Exp $ */
|
||||
/* $NetBSD: tree.c,v 1.399 2021/12/16 23:46:21 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.398 2021/12/15 00:44:05 rillig Exp $");
|
||||
__RCSID("$NetBSD: tree.c,v 1.399 2021/12/16 23:46:21 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <float.h>
|
||||
|
@ -275,18 +275,17 @@ build_name_call(sym_t *sym)
|
|||
* follow_token is the token which follows the name.
|
||||
*/
|
||||
tnode_t *
|
||||
build_name(sym_t *sym, int follow_token)
|
||||
build_name(sym_t *sym, bool is_funcname)
|
||||
{
|
||||
tnode_t *n;
|
||||
|
||||
if (sym->s_scl == NOSCL) {
|
||||
sym->s_scl = EXTERN;
|
||||
sym->s_def = DECL;
|
||||
if (follow_token == T_LPAREN) {
|
||||
if (is_funcname)
|
||||
build_name_call(sym);
|
||||
} else {
|
||||
else
|
||||
fallback_symbol(sym);
|
||||
}
|
||||
}
|
||||
|
||||
lint_assert(sym->s_kind == FVFT || sym->s_kind == FMEMBER);
|
||||
|
@ -723,7 +722,7 @@ build_member_access(tnode_t *ln, op_t op, bool sys, sbuf_t *member)
|
|||
ln = cconv(ln);
|
||||
}
|
||||
msym = struct_or_union_member(ln, op, getsym(member));
|
||||
return build_binary(ln, op, sys, build_name(msym, 0));
|
||||
return build_binary(ln, op, sys, build_name(msym, false));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue