Module Name: src Committed By: rillig Date: Wed Dec 30 10:35:38 UTC 2020
Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c lint1.h scan.l tree.c Log Message: lint: rename symt_t constants There's no need to abbreviate them, furthermore FMOS was imprecise. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.80 -r1.81 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.98 -r1.99 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.119 src/usr.bin/xlint/lint1/cgram.y:1.120 --- src/usr.bin/xlint/lint1/cgram.y:1.119 Wed Dec 30 10:26:12 2020 +++ src/usr.bin/xlint/lint1/cgram.y Wed Dec 30 10:35:38 2020 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.119 2020/12/30 10:26:12 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.120 2020/12/30 10:35:38 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.119 2020/12/30 10:26:12 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.120 2020/12/30 10:35:38 rillig Exp $"); #endif #include <limits.h> @@ -785,13 +785,13 @@ member_declaration_list: member_declaration: noclass_declmods deftyp { /* too late, i know, but getsym() compensates it */ - symtyp = FMOS; + symtyp = FMEMBER; } notype_member_decls opt_type_attribute { symtyp = FVFT; $$ = $4; } | noclass_declspecs deftyp { - symtyp = FMOS; + symtyp = FMEMBER; } type_member_decls opt_type_attribute { symtyp = FVFT; $$ = $4; @@ -851,7 +851,7 @@ notype_member_decls: $$ = declarator_1_struct_union($1); } | notype_member_decls { - symtyp = FMOS; + symtyp = FMEMBER; } T_COMMA type_member_decl { $$ = lnklst($1, declarator_1_struct_union($4)); } @@ -862,7 +862,7 @@ type_member_decls: $$ = declarator_1_struct_union($1); } | type_member_decls { - symtyp = FMOS; + symtyp = FMEMBER; } T_COMMA type_member_decl { $$ = lnklst($1, declarator_1_struct_union($4)); } @@ -1488,7 +1488,7 @@ labeled_stmnt: label: T_NAME T_COLON { - symtyp = FLAB; + symtyp = FLABEL; label(T_NAME, getsym($1), NULL); } | T_CASE constant T_COLON { @@ -1753,7 +1753,7 @@ jump_stmnt: goto: T_GOTO { - symtyp = FLAB; + symtyp = FLABEL; } ; @@ -1948,7 +1948,7 @@ term: } | T_BUILTIN_OFFSETOF T_LPARN type_name T_COMMA identifier T_RPARN %prec T_BUILTIN_OFFSETOF { - symtyp = FMOS; + symtyp = FMEMBER; $$ = build_offsetof($3, getsym($5)); } | T_SIZEOF term %prec T_SIZEOF { @@ -2008,7 +2008,7 @@ func_arg_list: point_or_arrow: T_STROP { - symtyp = FMOS; + symtyp = FMEMBER; $$ = $1; } ; Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.80 src/usr.bin/xlint/lint1/decl.c:1.81 --- src/usr.bin/xlint/lint1/decl.c:1.80 Wed Dec 30 10:26:12 2020 +++ src/usr.bin/xlint/lint1/decl.c Wed Dec 30 10:35:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.80 2020/12/30 10:26:12 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.81 2020/12/30 10:35:38 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.80 2020/12/30 10:26:12 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.81 2020/12/30 10:35:38 rillig Exp $"); #endif #include <sys/param.h> @@ -1246,7 +1246,7 @@ bitfield(sym_t *dsym, int len) if (dsym == NULL) { dsym = getblk(sizeof (sym_t)); dsym->s_name = unnamed; - dsym->s_kind = FMOS; + dsym->s_kind = FMEMBER; dsym->s_scl = MOS; dsym->s_type = gettyp(UINT); dsym->s_blklev = -1; @@ -2950,7 +2950,7 @@ check_usage_sym(int novar, sym_t *sym) } else { check_variable_usage(novar, sym); } - } else if (sym->s_kind == FLAB) { + } else if (sym->s_kind == FLABEL) { check_label_usage(sym); } else if (sym->s_kind == FTAG) { check_tag_usage(sym); @@ -3118,7 +3118,7 @@ check_global_symbols(void) } else if (sym->s_kind == FTAG) { check_tag_usage(sym); } else { - if (sym->s_kind != FMOS) + if (sym->s_kind != FMEMBER) LERROR("check_global_symbols()"); } } Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.38 src/usr.bin/xlint/lint1/lint1.h:1.39 --- src/usr.bin/xlint/lint1/lint1.h:1.38 Wed Dec 30 10:26:12 2020 +++ src/usr.bin/xlint/lint1/lint1.h Wed Dec 30 10:35:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.38 2020/12/30 10:26:12 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.39 2020/12/30 10:35:38 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -184,9 +184,9 @@ struct type { */ typedef enum { FVFT, /* variables, functions, type names, enums */ - FMOS, /* members of structs or unions */ + FMEMBER, /* members of structs or unions */ FTAG, /* tags */ - FLAB /* labels */ + FLABEL /* labels */ } symt_t; /* @@ -219,7 +219,7 @@ typedef struct sym { const char *s_name; const char *s_rename; /* renamed symbol's given name */ pos_t s_dpos; /* position of last (prototype)definition, - prototypedeclaration, no-prototype-def., + prototype declaration, no-prototype-def., tentative definition or declaration, in this order */ pos_t s_spos; /* position of first initialisation */ Index: src/usr.bin/xlint/lint1/scan.l diff -u src/usr.bin/xlint/lint1/scan.l:1.98 src/usr.bin/xlint/lint1/scan.l:1.99 --- src/usr.bin/xlint/lint1/scan.l:1.98 Tue Dec 29 13:33:03 2020 +++ src/usr.bin/xlint/lint1/scan.l Wed Dec 30 10:35:38 2020 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: scan.l,v 1.98 2020/12/29 13:33:03 rillig Exp $ */ +/* $NetBSD: scan.l,v 1.99 2020/12/30 10:35:38 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: scan.l,v 1.98 2020/12/29 13:33:03 rillig Exp $"); +__RCSID("$NetBSD: scan.l,v 1.99 2020/12/30 10:35:38 rillig Exp $"); #endif #include <ctype.h> @@ -1466,7 +1466,7 @@ getsym(sbuf_t *sb) * symbols of type FTAG. Same can happen for labels. Both cases * are compensated here. */ - if (symtyp == FMOS || symtyp == FLAB) { + if (symtyp == FMEMBER || symtyp == FLABEL) { if (sym == NULL || sym->s_kind == FVFT) sym = search(sb); } @@ -1482,7 +1482,7 @@ getsym(sbuf_t *sb) /* create a new symbol table entry */ /* labels must always be allocated at level 1 (outhermost block) */ - if (symtyp == FLAB) { + if (symtyp == FLABEL) { sym = getlblk(1, sizeof (sym_t)); s = getlblk(1, sb->sb_len + 1); (void)memcpy(s, sb->sb_name, sb->sb_len + 1); @@ -1501,7 +1501,7 @@ getsym(sbuf_t *sb) } UNIQUE_CURR_POS(sym->s_dpos); - if ((sym->s_kind = symtyp) != FLAB) + if ((sym->s_kind = symtyp) != FLABEL) sym->s_type = gettyp(INT); symtyp = FVFT; Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.101 src/usr.bin/xlint/lint1/tree.c:1.102 --- src/usr.bin/xlint/lint1/tree.c:1.101 Wed Dec 30 10:26:12 2020 +++ src/usr.bin/xlint/lint1/tree.c Wed Dec 30 10:35:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.101 2020/12/30 10:26:12 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.102 2020/12/30 10:35:38 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.101 2020/12/30 10:26:12 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.102 2020/12/30 10:35:38 rillig Exp $"); #endif #include <float.h> @@ -245,7 +245,7 @@ getnnode(sym_t *sym, int ntok) } } - if (sym->s_kind != FVFT && sym->s_kind != FMOS) + if (sym->s_kind != FVFT && sym->s_kind != FMEMBER) LERROR("getnnode(%d)", sym->s_kind); n = getnode(); @@ -322,7 +322,7 @@ struct_or_union_member(tnode_t *tn, op_t /* undefined struct/union member: %s */ error(101, msym->s_name); rmsym(msym); - msym->s_kind = FMOS; + msym->s_kind = FMEMBER; msym->s_scl = MOS; msym->s_styp = tgetblk(sizeof (str_t)); msym->s_styp->stag = tgetblk(sizeof (sym_t));