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 str_t and its members to be more ...
details: https://anonhg.NetBSD.org/src/rev/1a35240ab825
branches: trunk
changeset: 980814:1a35240ab825
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Feb 19 22:16:12 2021 +0000
description:
lint: rename str_t and its members to be more expressive
No functional change.
diffstat:
usr.bin/xlint/common/tyname.c | 10 +++---
usr.bin/xlint/lint1/cgram.y | 8 +++---
usr.bin/xlint/lint1/decl.c | 57 +++++++++++++++++++++---------------------
usr.bin/xlint/lint1/emit1.c | 6 ++--
usr.bin/xlint/lint1/init.c | 10 ++++---
usr.bin/xlint/lint1/lint1.h | 22 ++++++++--------
usr.bin/xlint/lint1/tree.c | 22 ++++++++--------
7 files changed, 69 insertions(+), 66 deletions(-)
diffs (truncated from 445 to 300 lines):
diff -r 776aac6ad864 -r 1a35240ab825 usr.bin/xlint/common/tyname.c
--- a/usr.bin/xlint/common/tyname.c Fri Feb 19 21:35:44 2021 +0000
+++ b/usr.bin/xlint/common/tyname.c Fri Feb 19 22:16:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tyname.c,v 1.26 2021/01/26 18:38:57 rillig Exp $ */
+/* $NetBSD: tyname.c,v 1.27 2021/02/19 22:16:12 rillig Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.26 2021/01/26 18:38:57 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.27 2021/02/19 22:16:12 rillig Exp $");
#endif
#include <limits.h>
@@ -238,8 +238,8 @@
case STRUCT:
case UNION:
#ifdef t_str
- return strcmp(t1->t_str->stag->s_name,
- t2->t_str->stag->s_name) == 0;
+ return strcmp(t1->t_str->sou_tag->s_name,
+ t2->t_str->sou_tag->s_name) == 0;
#else
return true;
#endif
@@ -349,7 +349,7 @@
case UNION:
buf_add(&buf, " ");
#ifdef t_str
- buf_add(&buf, tp->t_str->stag->s_name);
+ buf_add(&buf, tp->t_str->sou_tag->s_name);
#else
buf_add(&buf,
tp->t_isuniqpos ? "*anonymous*" : tp->t_tag->h_name);
diff -r 776aac6ad864 -r 1a35240ab825 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Fri Feb 19 21:35:44 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Fri Feb 19 22:16:12 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.160 2021/01/31 12:44:34 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.161 2021/02/19 22:16:12 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.160 2021/01/31 12:44:34 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.161 2021/02/19 22:16:12 rillig Exp $");
#endif
#include <limits.h>
@@ -802,7 +802,7 @@
/* anonymous struct/union members is a C9X feature */
warning(49);
/* add all the members of the anonymous struct/union */
- $$ = dcs->d_type->t_str->memb;
+ $$ = dcs->d_type->t_str->sou_first_member;
anonymize($$);
}
| noclass_declspecs deftyp opt_type_attribute {
@@ -811,7 +811,7 @@
if (!Sflag)
/* anonymous struct/union members is a C9X feature */
warning(49);
- $$ = dcs->d_type->t_str->memb;
+ $$ = dcs->d_type->t_str->sou_first_member;
/* add all the members of the anonymous struct/union */
anonymize($$);
}
diff -r 776aac6ad864 -r 1a35240ab825 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Fri Feb 19 21:35:44 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Fri Feb 19 22:16:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.133 2021/01/31 11:23:01 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.134 2021/02/19 22:16:12 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.133 2021/01/31 11:23:01 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.134 2021/02/19 22:16:12 rillig Exp $");
#endif
#include <sys/param.h>
@@ -181,7 +181,7 @@
} else if (t == ARRAY) {
return tp->t_aincompl;
} else if (t == STRUCT || t == UNION) {
- return tp->t_str->sincompl;
+ return tp->t_str->sou_incomplete;
} else if (t == ENUM) {
return tp->t_enum->eincompl;
}
@@ -199,7 +199,7 @@
if ((t = tp->t_tspec) == ARRAY) {
tp->t_aincompl = !complete;
} else if (t == STRUCT || t == UNION) {
- tp->t_str->sincompl = !complete;
+ tp->t_str->sou_incomplete = !complete;
} else {
lint_assert(t == ENUM);
tp->t_enum->eincompl = !complete;
@@ -482,8 +482,8 @@
tspec_t t;
if ((t = tp->t_tspec) == STRUCT || t == UNION) {
- if (tp->t_str->stdef == NULL)
- tp->t_str->stdef = sym;
+ if (tp->t_str->sou_first_typedef == NULL)
+ tp->t_str->sou_first_typedef = sym;
} else if (t == ENUM) {
if (tp->t_enum->etdef == NULL)
tp->t_enum->etdef = sym;
@@ -504,25 +504,26 @@
static void
setpackedsize(type_t *tp)
{
- str_t *sp;
+ struct_or_union *sp;
sym_t *mem;
switch (tp->t_tspec) {
case STRUCT:
case UNION:
sp = tp->t_str;
- sp->size = 0;
- for (mem = sp->memb; mem != NULL; mem = mem->s_next) {
+ sp->sou_size_in_bit = 0;
+ for (mem = sp->sou_first_member;
+ mem != NULL; mem = mem->s_next) {
if (mem->s_type->t_bitfield) {
- sp->size += bitfieldsize(&mem);
+ sp->sou_size_in_bit += bitfieldsize(&mem);
if (mem == NULL)
break;
}
size_t x = (size_t)tsize(mem->s_type);
if (tp->t_tspec == STRUCT)
- sp->size += x;
- else if (x > sp->size)
- sp->size = x;
+ sp->sou_size_in_bit += x;
+ else if (x > sp->sou_size_in_bit)
+ sp->sou_size_in_bit = x;
}
break;
default:
@@ -905,9 +906,9 @@
case UNION:
if (is_incomplete(tp) && name != NULL) {
/* incomplete structure or union %s: %s */
- error(31, tp->t_str->stag->s_name, name);
+ error(31, tp->t_str->sou_tag->s_name, name);
}
- elsz = tp->t_str->size;
+ elsz = tp->t_str->sou_size_in_bit;
break;
case ENUM:
if (is_incomplete(tp) && name != NULL) {
@@ -940,7 +941,7 @@
return -1;
if ((t = tp->t_tspec) == STRUCT || t == UNION) {
- a = tp->t_str->align;
+ a = tp->t_str->sou_align_in_bit;
} else if (t == FUNC) {
/* compiler takes alignment of function */
error(14);
@@ -1660,9 +1661,9 @@
if (tp->t_tspec == NOTSPEC) {
tp->t_tspec = kind;
if (kind != ENUM) {
- tp->t_str = getblk(sizeof (str_t));
- tp->t_str->align = CHAR_SIZE;
- tp->t_str->stag = tag;
+ tp->t_str = getblk(sizeof (struct_or_union));
+ tp->t_str->sou_align_in_bit = CHAR_SIZE;
+ tp->t_str->sou_tag = tag;
} else {
tp->t_isenum = true;
tp->t_enum = getblk(sizeof(*tp->t_enum));
@@ -1763,7 +1764,7 @@
complete_tag_struct_or_union(type_t *tp, sym_t *fmem)
{
tspec_t t;
- str_t *sp;
+ struct_or_union *sp;
int n;
sym_t *mem;
@@ -1772,14 +1773,14 @@
t = tp->t_tspec;
align(dcs->d_stralign, 0);
sp = tp->t_str;
- sp->align = dcs->d_stralign;
- sp->memb = fmem;
+ sp->sou_align_in_bit = dcs->d_stralign;
+ sp->sou_first_member = fmem;
if (tp->t_packed)
setpackedsize(tp);
else
- sp->size = dcs->d_offset;
-
- if (sp->size == 0) {
+ sp->sou_size_in_bit = dcs->d_offset;
+
+ if (sp->sou_size_in_bit == 0) {
/* zero sized %s is a C9X feature */
c99ism(47, ttab[t].tt_name);
}
@@ -1790,17 +1791,17 @@
if (mem->s_styp == NULL) {
mem->s_styp = sp;
if (mem->s_type->t_bitfield) {
- sp->size += bitfieldsize(&mem);
+ sp->sou_size_in_bit += bitfieldsize(&mem);
if (mem == NULL)
break;
}
- sp->size += tsize(mem->s_type);
+ sp->sou_size_in_bit += tsize(mem->s_type);
}
if (mem->s_name != unnamed)
n++;
}
- if (n == 0 && sp->size != 0) {
+ if (n == 0 && sp->sou_size_in_bit != 0) {
/* %s has no named members */
warning(65, t == STRUCT ? "structure" : "union");
}
diff -r 776aac6ad864 -r 1a35240ab825 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c Fri Feb 19 21:35:44 2021 +0000
+++ b/usr.bin/xlint/lint1/emit1.c Fri Feb 19 22:16:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.39 2021/01/17 14:50:11 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.40 2021/02/19 22:16:12 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.39 2021/01/17 14:50:11 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.40 2021/02/19 22:16:12 rillig Exp $");
#endif
#include <ctype.h>
@@ -142,7 +142,7 @@
} else if (ts == ENUM) {
outtt(tp->t_enum->etag, tp->t_enum->etdef);
} else if (ts == STRUCT || ts == UNION) {
- outtt(tp->t_str->stag, tp->t_str->stdef);
+ outtt(tp->t_str->sou_tag, tp->t_str->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 776aac6ad864 -r 1a35240ab825 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c Fri Feb 19 21:35:44 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c Fri Feb 19 22:16:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.66 2021/01/31 12:44:34 rillig Exp $ */
+/* $NetBSD: init.c,v 1.67 2021/02/19 22:16:12 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.66 2021/01/31 12:44:34 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.67 2021/02/19 22:16:12 rillig Exp $");
#endif
#include <stdlib.h>
@@ -236,7 +236,8 @@
__func__, istk->i_remaining,
type_name(istk->i_type), namedmem->n_name));
- for (m = istk->i_type->t_str->memb; m != NULL; m = m->s_next) {
+ for (m = istk->i_type->t_str->sou_first_member;
+ m != NULL; m = m->s_next) {
DPRINTF(("%s: pop lhs.name=%s rhs.name=%s\n", __func__,
m->s_name, namedmem->n_name));
if (m->s_bitfield && m->s_name == unnamed)
@@ -380,7 +381,8 @@
DPRINTF(("%s: lookup type=%s, name=%s named=%d\n", __func__,
type_name(istk->i_type),
namedmem ? namedmem->n_name : "*none*", istk->i_namedmem));
- for (m = istk->i_type->t_str->memb; m != NULL; m = m->s_next) {
Home |
Main Index |
Thread Index |
Old Index