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: rename push_member and pop_member
details: https://anonhg.NetBSD.org/src/rev/bdeaf6d71730
branches: trunk
changeset: 953740:bdeaf6d71730
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Mar 19 00:55:02 2021 +0000
description:
lint: rename push_member and pop_member
These two functions are supposed to model the designator that is used
for initializing structs and arrays. The implementation is still buggy
and does not work at all for C99 designators with multiple names, see
d_init_pop_member.c.
For now, just rename the functions to head in the right direction.
No functional change.
diffstat:
usr.bin/xlint/lint1/cgram.y | 8 ++++----
usr.bin/xlint/lint1/externs1.h | 4 ++--
usr.bin/xlint/lint1/init.c | 14 +++++++-------
3 files changed, 13 insertions(+), 13 deletions(-)
diffs (118 lines):
diff -r 9d6444fb0322 -r bdeaf6d71730 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Fri Mar 19 00:44:09 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Fri Mar 19 00:55:02 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.176 2021/03/17 15:45:30 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.177 2021/03/19 00:55:02 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.176 2021/03/17 15:45:30 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.177 2021/03/19 00:55:02 rillig Exp $");
#endif
#include <limits.h>
@@ -1368,7 +1368,7 @@
if (!Sflag)
/* struct or union member name in initializer is ... */
warning(313);
- push_member($2);
+ designator_push_name($2);
}
;
@@ -1382,7 +1382,7 @@
| identifier T_COLON {
/* GCC style struct or union member name in initializer */
gnuism(315);
- push_member($1);
+ designator_push_name($1);
}
;
diff -r 9d6444fb0322 -r bdeaf6d71730 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h Fri Mar 19 00:44:09 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h Fri Mar 19 00:55:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: externs1.h,v 1.76 2021/03/17 15:45:30 rillig Exp $ */
+/* $NetBSD: externs1.h,v 1.77 2021/03/19 00:55:02 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -299,7 +299,7 @@
extern void init_rbrace(void);
extern void init_lbrace(void);
extern void init_using_expr(tnode_t *);
-extern void push_member(sbuf_t *);
+extern void designator_push_name(sbuf_t *);
extern void designator_push_subscript(range_t);
/*
diff -r 9d6444fb0322 -r bdeaf6d71730 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c Fri Mar 19 00:44:09 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c Fri Mar 19 00:55:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.102 2021/03/19 00:39:17 rillig Exp $ */
+/* $NetBSD: init.c,v 1.103 2021/03/19 00:55:02 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.102 2021/03/19 00:39:17 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.103 2021/03/19 00:55:02 rillig Exp $");
#endif
#include <stdlib.h>
@@ -338,7 +338,7 @@
#endif
void
-push_member(sbuf_t *sb)
+designator_push_name(sbuf_t *sb)
{
namlist_t *nam = xcalloc(1, sizeof (namlist_t));
nam->n_name = sb->sb_name;
@@ -378,7 +378,7 @@
}
static void
-pop_member(void)
+designator_pop_name(void)
{
debug_step("%s: %s %p", __func__, namedmem->n_name, namedmem);
if (namedmem->n_next == namedmem) {
@@ -450,7 +450,7 @@
/* XXX: why ++? */
istk->i_remaining++;
/* XXX: why is i_seen_named_member not set? */
- pop_member();
+ designator_pop_name();
return;
}
}
@@ -458,7 +458,7 @@
/* undefined struct/union member: %s */
error(101, namedmem->n_name);
- pop_member();
+ designator_pop_name();
istk->i_seen_named_member = true;
}
@@ -650,7 +650,7 @@
istk->i_subt = m->s_type;
istk->i_seen_named_member = true;
debug_step("named member '%s'", namedmem->n_name);
- pop_member();
+ designator_pop_name();
cnt = istk->i_type->t_tspec == STRUCT ? 2 : 1;
}
istk->i_brace = true;
Home |
Main Index |
Thread Index |
Old Index