Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint lint: rename type_t.t_str to t_sou
details: https://anonhg.NetBSD.org/src/rev/0faa5fea70d9
branches: trunk
changeset: 374432:0faa5fea70d9
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Apr 22 17:49:14 2023 +0000
description:
lint: rename type_t.t_str to t_sou
The name 't_str' could have meant 'string' or 'struct'. Since both
struct and union types have members, rename it to 't_sou'.
No functional change.
diffstat:
usr.bin/xlint/common/tyname.c | 14 +++++++-------
usr.bin/xlint/lint1/cgram.y | 6 +++---
usr.bin/xlint/lint1/debug.c | 6 +++---
usr.bin/xlint/lint1/decl.c | 34 +++++++++++++++++-----------------
usr.bin/xlint/lint1/emit1.c | 6 +++---
usr.bin/xlint/lint1/init.c | 10 +++++-----
usr.bin/xlint/lint1/lint1.h | 11 +++++------
usr.bin/xlint/lint1/tree.c | 38 +++++++++++++++++++-------------------
8 files changed, 62 insertions(+), 63 deletions(-)
diffs (truncated from 486 to 300 lines):
diff -r 21084adcf724 -r 0faa5fea70d9 usr.bin/xlint/common/tyname.c
--- a/usr.bin/xlint/common/tyname.c Sat Apr 22 17:42:29 2023 +0000
+++ b/usr.bin/xlint/common/tyname.c Sat Apr 22 17:49:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tyname.c,v 1.54 2023/02/18 15:14:11 rillig Exp $ */
+/* $NetBSD: tyname.c,v 1.55 2023/04/22 17:49:14 rillig Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: tyname.c,v 1.54 2023/02/18 15:14:11 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.55 2023/04/22 17:49:14 rillig Exp $");
#endif
#include <assert.h>
@@ -189,12 +189,12 @@ type_name_of_struct_or_union(buffer *buf
{
buf_add(buf, " ");
#ifdef IS_LINT1
- if (tp->t_str->sou_tag->s_name == unnamed &&
- tp->t_str->sou_first_typedef != NULL) {
+ if (tp->t_sou->sou_tag->s_name == unnamed &&
+ tp->t_sou->sou_first_typedef != NULL) {
buf_add(buf, "typedef ");
- buf_add(buf, tp->t_str->sou_first_typedef->s_name);
+ buf_add(buf, tp->t_sou->sou_first_typedef->s_name);
} else {
- buf_add(buf, tp->t_str->sou_tag->s_name);
+ buf_add(buf, tp->t_sou->sou_tag->s_name);
}
#else
buf_add(buf, tp->t_isuniqpos ? "*anonymous*" : tp->t_tag->h_name);
@@ -255,7 +255,7 @@ type_name(const type_t *tp)
buf_add(&buf, "volatile ");
#ifdef IS_LINT1
- if (is_struct_or_union(t) && tp->t_str->sou_incomplete)
+ if (is_struct_or_union(t) && tp->t_sou->sou_incomplete)
buf_add(&buf, "incomplete ");
#endif
buf_add(&buf, tspec_name(t));
diff -r 21084adcf724 -r 0faa5fea70d9 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Sat Apr 22 17:42:29 2023 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Sat Apr 22 17:49:14 2023 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.434 2023/04/02 19:47:54 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.435 2023/04/22 17:49:15 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.434 2023/04/02 19:47:54 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.435 2023/04/22 17:49:15 rillig Exp $");
#endif
#include <limits.h>
@@ -968,7 +968,7 @@ struct_declaration: /* C99 6.7.2.1 */
/* anonymous struct/union members is a C11 feature */
warning(49);
if (is_struct_or_union(dcs->d_type->t_tspec)) {
- $$ = dcs->d_type->t_str->sou_first_member;
+ $$ = dcs->d_type->t_sou->sou_first_member;
/* add all the members of the anonymous struct/union */
anonymize($$);
} else {
diff -r 21084adcf724 -r 0faa5fea70d9 usr.bin/xlint/lint1/debug.c
--- a/usr.bin/xlint/lint1/debug.c Sat Apr 22 17:42:29 2023 +0000
+++ b/usr.bin/xlint/lint1/debug.c Sat Apr 22 17:49:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.28 2023/04/11 17:52:11 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.29 2023/04/22 17:49:15 rillig Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.28 2023/04/11 17:52:11 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.29 2023/04/22 17:49:15 rillig Exp $");
#endif
#include <stdlib.h>
@@ -112,7 +112,7 @@ debug_type_details(const type_t *tp)
if (is_struct_or_union(tp->t_tspec)) {
debug_indent_inc();
- for (const sym_t *mem = tp->t_str->sou_first_member;
+ for (const sym_t *mem = tp->t_sou->sou_first_member;
mem != NULL; mem = mem->s_next) {
debug_sym("", mem, "\n");
debug_type_details(mem->s_type);
diff -r 21084adcf724 -r 0faa5fea70d9 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sat Apr 22 17:42:29 2023 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sat Apr 22 17:49:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.307 2023/03/28 20:04:52 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.308 2023/04/22 17:49:15 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.307 2023/03/28 20:04:52 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.308 2023/04/22 17:49:15 rillig Exp $");
#endif
#include <sys/param.h>
@@ -191,7 +191,7 @@ expr_unqualified_type(const type_t *tp)
* qualifiers as well, but that would require a deep copy of the
* struct or union type. This in turn would defeat the type
* comparison in types_compatible, which simply tests whether
- * tp1->t_str == tp2->t_str.
+ * tp1->t_sou == tp2->t_sou.
*/
return ntp;
@@ -211,7 +211,7 @@ is_incomplete(const type_t *tp)
if (t == ARRAY)
return tp->t_incomplete_array;
if (is_struct_or_union(t))
- return tp->t_str->sou_incomplete;
+ return tp->t_sou->sou_incomplete;
if (t == ENUM)
return tp->t_enum->en_incomplete;
@@ -467,8 +467,8 @@ set_first_typedef(type_t *tp, sym_t *sym
tspec_t t;
if (is_struct_or_union(t = tp->t_tspec)) {
- if (tp->t_str->sou_first_typedef == NULL)
- tp->t_str->sou_first_typedef = sym;
+ if (tp->t_sou->sou_first_typedef == NULL)
+ tp->t_sou->sou_first_typedef = sym;
} else if (t == ENUM) {
if (tp->t_enum->en_first_typedef == NULL)
tp->t_enum->en_first_typedef = sym;
@@ -495,7 +495,7 @@ set_packed_size(type_t *tp)
switch (tp->t_tspec) {
case STRUCT:
case UNION:
- sp = tp->t_str;
+ sp = tp->t_sou;
sp->sou_size_in_bits = 0;
for (mem = sp->sou_first_member;
mem != NULL; mem = mem->s_next) {
@@ -859,7 +859,7 @@ length_in_bits(const type_t *tp, const c
/* '%s' has incomplete type '%s' */
error(31, name, type_name(tp));
}
- elsz = tp->t_str->sou_size_in_bits;
+ elsz = tp->t_sou->sou_size_in_bits;
break;
case ENUM:
if (is_incomplete(tp) && name != NULL) {
@@ -896,7 +896,7 @@ alignment_in_bits(const type_t *tp)
tp = tp->t_subt;
if (is_struct_or_union(t = tp->t_tspec))
- a = tp->t_str->sou_align_in_bits;
+ a = tp->t_sou->sou_align_in_bits;
else {
lint_assert(t != FUNC);
if ((a = size_in_bits(t)) == 0)
@@ -1557,7 +1557,7 @@ declarator_name(sym_t *sym)
case DK_STRUCT_MEMBER:
case DK_UNION_MEMBER:
/* Set parent */
- sym->u.s_member.sm_sou_type = dcs->d_tagtyp->t_str;
+ sym->u.s_member.sm_sou_type = dcs->d_tagtyp->t_sou;
sym->s_def = DEF;
/* XXX: Where is sym->u.s_member.sm_offset_in_bits set? */
sc = dcs->d_kind == DK_STRUCT_MEMBER
@@ -1717,10 +1717,10 @@ make_tag_type(sym_t *tag, tspec_t kind,
if (tp->t_tspec == NOTSPEC) {
tp->t_tspec = kind;
if (kind != ENUM) {
- tp->t_str = block_zero_alloc(sizeof(*tp->t_str));
- tp->t_str->sou_align_in_bits = CHAR_SIZE;
- tp->t_str->sou_tag = tag;
- tp->t_str->sou_incomplete = true;
+ tp->t_sou = block_zero_alloc(sizeof(*tp->t_sou));
+ tp->t_sou->sou_align_in_bits = CHAR_SIZE;
+ tp->t_sou->sou_tag = tag;
+ tp->t_sou->sou_incomplete = true;
} else {
tp->t_is_enum = true;
tp->t_enum = block_zero_alloc(sizeof(*tp->t_enum));
@@ -1821,12 +1821,12 @@ complete_tag_struct_or_union(type_t *tp,
if (tp->t_tspec == ENUM)
tp->t_enum->en_incomplete = false;
else
- tp->t_str->sou_incomplete = false;
+ tp->t_sou->sou_incomplete = false;
tspec_t t = tp->t_tspec;
dcs_align((u_int)dcs->d_sou_align_in_bits, 0);
- struct_or_union *sp = tp->t_str;
+ struct_or_union *sp = tp->t_sou;
sp->sou_align_in_bits = dcs->d_sou_align_in_bits;
sp->sou_first_member = fmem;
if (tp->t_packed)
@@ -2228,7 +2228,7 @@ types_compatible(const type_t *tp1, cons
return false;
if (is_struct_or_union(t))
- return tp1->t_str == tp2->t_str;
+ return tp1->t_sou == tp2->t_sou;
if (t == ENUM && eflag)
return tp1->t_enum == tp2->t_enum;
diff -r 21084adcf724 -r 0faa5fea70d9 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c Sat Apr 22 17:42:29 2023 +0000
+++ b/usr.bin/xlint/lint1/emit1.c Sat Apr 22 17:49:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.65 2023/02/02 22:23:30 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.66 2023/04/22 17:49:15 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: emit1.c,v 1.65 2023/02/02 22:23:30 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.66 2023/04/22 17:49:15 rillig Exp $");
#endif
#include "lint1.h"
@@ -121,7 +121,7 @@ outtype(const type_t *tp)
} else if (ts == ENUM) {
outtt(tp->t_enum->en_tag, tp->t_enum->en_first_typedef);
} else if (is_struct_or_union(ts)) {
- outtt(tp->t_str->sou_tag, tp->t_str->sou_first_typedef);
+ outtt(tp->t_sou->sou_tag, tp->t_sou->sou_first_typedef);
} else if (ts == FUNC && tp->t_proto) {
na = 0;
for (arg = tp->t_args; arg != NULL; arg = arg->s_next)
diff -r 21084adcf724 -r 0faa5fea70d9 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c Sat Apr 22 17:42:29 2023 +0000
+++ b/usr.bin/xlint/lint1/init.c Sat Apr 22 17:49:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.240 2023/02/06 21:01:55 rillig Exp $ */
+/* $NetBSD: init.c,v 1.241 2023/04/22 17:49:15 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: init.c,v 1.240 2023/02/06 21:01:55 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.241 2023/04/22 17:49:15 rillig Exp $");
#endif
#include <stdlib.h>
@@ -224,7 +224,7 @@ first_named_member(const type_t *tp)
{
lint_assert(is_struct_or_union(tp->t_tspec));
- return skip_unnamed(tp->t_str->sou_first_member);
+ return skip_unnamed(tp->t_sou->sou_first_member);
}
static const sym_t *
@@ -233,7 +233,7 @@ look_up_member(const type_t *tp, const c
const sym_t *m;
lint_assert(is_struct_or_union(tp->t_tspec));
- for (m = tp->t_str->sou_first_member; m != NULL; m = m->s_next)
+ for (m = tp->t_sou->sou_first_member; m != NULL; m = m->s_next)
if (strcmp(m->s_name, name) == 0)
return m;
return NULL;
@@ -764,7 +764,7 @@ initialization_lbrace(initialization *in
warning(238);
}
- if (is_struct_or_union(tp->t_tspec) && tp->t_str->sou_incomplete) {
+ if (is_struct_or_union(tp->t_tspec) && tp->t_sou->sou_incomplete) {
/* initialization of incomplete type '%s' */
error(175, type_name(tp));
in->in_err = true;
diff -r 21084adcf724 -r 0faa5fea70d9 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h Sat Apr 22 17:42:29 2023 +0000
+++ b/usr.bin/xlint/lint1/lint1.h Sat Apr 22 17:49:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.163 2023/02/21 19:30:51 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.164 2023/04/22 17:49:15 rillig Exp $ */
Home |
Main Index |
Thread Index |
Old Index