lint: rename type generic_association_types to generic_association
The word 'types' was misleading and unnecessary. No functional change.
This commit is contained in:
parent
37ce85c5f7
commit
a3946b7223
|
@ -1,5 +1,5 @@
|
|||
%{
|
||||
/* $NetBSD: cgram.y,v 1.252 2021/07/05 19:59:10 rillig Exp $ */
|
||||
/* $NetBSD: cgram.y,v 1.253 2021/07/06 04:44:20 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.252 2021/07/05 19:59:10 rillig Exp $");
|
||||
__RCSID("$NetBSD: cgram.y,v 1.253 2021/07/06 04:44:20 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
@ -139,7 +139,7 @@ anonymize(sym_t *s)
|
|||
strg_t *y_string;
|
||||
qual_ptr *y_qual_ptr;
|
||||
bool y_seen_statement;
|
||||
struct generic_association_types *y_types;
|
||||
struct generic_association *y_generic;
|
||||
};
|
||||
|
||||
%token T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPAREN T_RPAREN
|
||||
|
@ -341,8 +341,8 @@ anonymize(sym_t *s)
|
|||
%type <y_range> range
|
||||
%type <y_seen_statement> block_item_list
|
||||
%type <y_seen_statement> block_item
|
||||
%type <y_types> generic_assoc_list
|
||||
%type <y_types> generic_association
|
||||
%type <y_generic> generic_assoc_list
|
||||
%type <y_generic> generic_association
|
||||
|
||||
|
||||
%%
|
||||
|
@ -1648,7 +1648,7 @@ generic_selection: /* C11 6.5.1.1 */
|
|||
generic_assoc_list: /* C11 6.5.1.1 */
|
||||
generic_association
|
||||
| generic_assoc_list T_COMMA generic_association {
|
||||
$3->gat_prev = $1;
|
||||
$3->ga_prev = $1;
|
||||
$$ = $3;
|
||||
}
|
||||
;
|
||||
|
@ -1656,13 +1656,13 @@ generic_assoc_list: /* C11 6.5.1.1 */
|
|||
generic_association: /* C11 6.5.1.1 */
|
||||
type_name T_COLON assignment_expression {
|
||||
$$ = getblk(sizeof(*$$));
|
||||
$$->gat_arg = $1;
|
||||
$$->gat_result = $3;
|
||||
$$->ga_arg = $1;
|
||||
$$->ga_result = $3;
|
||||
}
|
||||
| T_DEFAULT T_COLON assignment_expression {
|
||||
$$ = getblk(sizeof(*$$));
|
||||
$$->gat_arg = NULL;
|
||||
$$->gat_result = $3;
|
||||
$$->ga_arg = NULL;
|
||||
$$->ga_result = $3;
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: externs1.h,v 1.114 2021/06/29 21:16:54 rillig Exp $ */
|
||||
/* $NetBSD: externs1.h,v 1.115 2021/07/06 04:44:20 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
@ -209,7 +209,7 @@ extern tnode_t *new_name_node(sym_t *, int);
|
|||
extern tnode_t *new_string_node(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_types *);
|
||||
struct generic_association *);
|
||||
|
||||
extern tnode_t *build(op_t, tnode_t *, tnode_t *);
|
||||
extern tnode_t *cconv(tnode_t *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lint1.h,v 1.111 2021/07/05 19:48:32 rillig Exp $ */
|
||||
/* $NetBSD: lint1.h,v 1.112 2021/07/06 04:44:20 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
|
@ -328,10 +328,10 @@ typedef struct tnode {
|
|||
#define tn_val tn_u._tn_val
|
||||
#define tn_string tn_u._tn_string
|
||||
|
||||
struct generic_association_types {
|
||||
type_t *gat_arg; /* NULL means default or error */
|
||||
tnode_t *gat_result; /* NULL means error */
|
||||
struct generic_association_types *gat_prev;
|
||||
struct generic_association {
|
||||
type_t *ga_arg; /* NULL means default or error */
|
||||
tnode_t *ga_result; /* NULL means error */
|
||||
struct generic_association *ga_prev;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tree.c,v 1.312 2021/07/04 17:28:05 rillig Exp $ */
|
||||
/* $NetBSD: tree.c,v 1.313 2021/07/06 04:44:20 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.312 2021/07/04 17:28:05 rillig Exp $");
|
||||
__RCSID("$NetBSD: tree.c,v 1.313 2021/07/06 04:44:20 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <float.h>
|
||||
|
@ -487,16 +487,16 @@ struct_or_union_member(tnode_t *tn, op_t op, sym_t *msym)
|
|||
|
||||
tnode_t *
|
||||
build_generic_selection(const tnode_t *expr,
|
||||
struct generic_association_types *sel)
|
||||
struct generic_association *sel)
|
||||
{
|
||||
tnode_t *default_result = NULL;
|
||||
|
||||
for (; sel != NULL; sel = sel->gat_prev)
|
||||
for (; sel != NULL; sel = sel->ga_prev)
|
||||
if (expr != NULL &&
|
||||
eqtype(sel->gat_arg, expr->tn_type, false, false, NULL))
|
||||
return sel->gat_result;
|
||||
else if (sel->gat_arg == NULL)
|
||||
default_result = sel->gat_result;
|
||||
eqtype(sel->ga_arg, expr->tn_type, false, false, NULL))
|
||||
return sel->ga_result;
|
||||
else if (sel->ga_arg == NULL)
|
||||
default_result = sel->ga_result;
|
||||
return default_result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue