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: fix member lookup after GCC statem...
details: https://anonhg.NetBSD.org/src/rev/d5796ddc6247
branches: trunk
changeset: 377515:d5796ddc6247
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jul 15 14:54:31 2023 +0000
description:
lint: fix member lookup after GCC statement expression
diffstat:
tests/usr.bin/xlint/lint1/gcc_statement_expression.c | 8 +-------
usr.bin/xlint/lint1/tree.c | 14 +++++++-------
2 files changed, 8 insertions(+), 14 deletions(-)
diffs (64 lines):
diff -r cb5c38b78006 -r d5796ddc6247 tests/usr.bin/xlint/lint1/gcc_statement_expression.c
--- a/tests/usr.bin/xlint/lint1/gcc_statement_expression.c Sat Jul 15 14:50:47 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_statement_expression.c Sat Jul 15 14:54:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gcc_statement_expression.c,v 1.2 2023/07/15 13:51:36 rillig Exp $ */
+/* $NetBSD: gcc_statement_expression.c,v 1.3 2023/07/15 14:54:31 rillig Exp $ */
# 3 "gcc_statement_expression.c"
/*
@@ -21,12 +21,6 @@ use_inner_type_from_outside(void)
} outer = { { 3 } };
outer;
}).inner.member;
- /* expect-1: error: type 'struct outer' does not have member 'inner' [101] */
- /* expect-2: error: type 'int' does not have member 'member' [101] */
- /*
- * FIXME: The above types must not be removed from the symbol table
- * yet; at least, their member names must still be known.
- */
return x;
}
diff -r cb5c38b78006 -r d5796ddc6247 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sat Jul 15 14:50:47 2023 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sat Jul 15 14:54:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.570 2023/07/15 14:50:47 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.571 2023/07/15 14:54:31 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.570 2023/07/15 14:50:47 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.571 2023/07/15 14:54:31 rillig Exp $");
#endif
#include <float.h>
@@ -1923,11 +1923,6 @@ static sym_t *
struct_or_union_member(tnode_t *tn, op_t op, sym_t *msym)
{
- if (msym->s_scl == NOSCL) {
- remove_unknown_member(tn, msym);
- return msym;
- }
-
/* Determine the tag type of which msym is expected to be a member. */
const type_t *tp = NULL;
if (op == POINT && is_struct_or_union(tn->tn_type->t_tspec))
@@ -1956,6 +1951,11 @@ struct_or_union_member(tnode_t *tn, op_t
return nested_mem;
}
+ if (msym->s_scl == NOSCL) {
+ remove_unknown_member(tn, msym);
+ return msym;
+ }
+
bool eq = all_members_compatible(msym);
/*
Home |
Main Index |
Thread Index |
Old Index