Module Name: src Committed By: rillig Date: Tue Jan 23 19:44:29 UTC 2024
Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: decl.c src/usr.bin/xlint: Makefile.inc src/usr.bin/xlint/lint1: cgram.y debug.c decl.c externs1.h lex.c lint1.h tree.c Log Message: lint: rename symt_t to symbol_kind It was confusing to have two kinds of "symbol type" (s_type and s_symt), so rename all related identifiers to be more distinctive. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.1297 -r1.1298 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.26 -r1.27 src/tests/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/Makefile.inc cvs rdiff -u -r1.483 -r1.484 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.65 -r1.66 src/usr.bin/xlint/lint1/debug.c cvs rdiff -u -r1.388 -r1.389 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.211 -r1.212 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.199 -r1.200 src/usr.bin/xlint/lint1/lex.c cvs rdiff -u -r1.208 -r1.209 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.596 -r1.597 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/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1297 src/distrib/sets/lists/tests/mi:1.1298 --- src/distrib/sets/lists/tests/mi:1.1297 Fri Nov 24 16:21:17 2023 +++ src/distrib/sets/lists/tests/mi Tue Jan 23 19:44:28 2024 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1297 2023/11/24 16:21:17 riastradh Exp $ +# $NetBSD: mi,v 1.1298 2024/01/23 19:44:28 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -1330,8 +1330,8 @@ ./usr/tests/compat/Atffile tests-compat-tests compattestfile,atf ./usr/tests/compat/linux tests-compat-tests compattestfile,atf ./usr/tests/compat/linux/Atffile tests-compat-tests compattestfile,atf -./usr/tests/compat/linux/h_inotify_init tests-compat-tests compattestfile,atf ./usr/tests/compat/linux/h_inotify_directory tests-compat-tests compattestfile,atf +./usr/tests/compat/linux/h_inotify_init tests-compat-tests compattestfile,atf ./usr/tests/compat/linux/h_inotify_single_file tests-compat-tests compattestfile,atf ./usr/tests/compat/linux/h_inotify_watch_change tests-compat-tests compattestfile,atf ./usr/tests/compat/linux/t_inotify tests-compat-tests compattestfile,atf @@ -7464,6 +7464,7 @@ ./usr/tests/usr.bin/xlint/lint1/msg_353.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_354.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_355.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_356.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/op_colon.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/op_colon.exp tests-obsolete obsolete,atf ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/decl.c diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.26 src/tests/usr.bin/xlint/lint1/decl.c:1.27 --- src/tests/usr.bin/xlint/lint1/decl.c:1.26 Tue Aug 1 19:52:15 2023 +++ src/tests/usr.bin/xlint/lint1/decl.c Tue Jan 23 19:44:28 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.26 2023/08/01 19:52:15 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.27 2024/01/23 19:44:28 rillig Exp $ */ # 3 "decl.c" /* @@ -224,7 +224,7 @@ symbol_type_in_unnamed_bit_field_member( struct s { // Since there is no name in the declarator, the next symbol // after the ':' must not be interpreted as a member name, but - // instead as a variable, type or function (FVFT). + // instead as a variable, type or function (SK_VCFT). unsigned int :bits; int named_member; }; Index: src/usr.bin/xlint/Makefile.inc diff -u src/usr.bin/xlint/Makefile.inc:1.27 src/usr.bin/xlint/Makefile.inc:1.28 --- src/usr.bin/xlint/Makefile.inc:1.27 Sun Jan 21 14:59:18 2024 +++ src/usr.bin/xlint/Makefile.inc Tue Jan 23 19:44:28 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.27 2024/01/21 14:59:18 rillig Exp $ +# $NetBSD: Makefile.inc,v 1.28 2024/01/23 19:44:28 rillig Exp $ .include <bsd.own.mk> Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.483 src/usr.bin/xlint/lint1/cgram.y:1.484 --- src/usr.bin/xlint/lint1/cgram.y:1.483 Sat Jan 13 11:24:57 2024 +++ src/usr.bin/xlint/lint1/cgram.y Tue Jan 23 19:44:28 2024 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.483 2024/01/13 11:24:57 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.484 2024/01/23 19:44:28 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.483 2024/01/13 11:24:57 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.484 2024/01/23 19:44:28 rillig Exp $"); #endif #include <limits.h> @@ -494,7 +494,7 @@ primary_expression: | generic_selection /* GCC primary-expression, see c_parser_postfix_expression */ | T_BUILTIN_OFFSETOF T_LPAREN type_name T_COMMA { - set_symtyp(FMEMBER); + set_sym_kind(SK_MEMBER); } member_designator T_RPAREN { $$ = build_offsetof($3, $6); } @@ -511,7 +511,7 @@ member_designator: designation_push(&$$, DK_SUBSCRIPT, NULL, $3.lo); } | member_designator T_POINT { - set_symtyp(FMEMBER); + set_sym_kind(SK_MEMBER); } identifier { $$ = $1; designation_push(&$$, DK_MEMBER, getsym($4), 0); @@ -631,11 +631,11 @@ gcc_statement_expr_item: point_or_arrow: /* helper for 'postfix_expression' */ T_POINT { - set_symtyp(FMEMBER); + set_sym_kind(SK_MEMBER); $$ = POINT; } | T_ARROW { - set_symtyp(FMEMBER); + set_sym_kind(SK_MEMBER); $$ = ARROW; } ; @@ -1010,7 +1010,7 @@ struct_or_union_specifier: $$ = complete_struct_or_union($3); } | struct_or_union error { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); $$ = gettyp(INT); } ; @@ -1018,7 +1018,7 @@ struct_or_union_specifier: /* K&R ---, C90 ---, C99 6.7.2.1, C11 ???, C23 6.7.2.1 */ struct_or_union: T_STRUCT_OR_UNION { - set_symtyp(FTAG); + set_sym_kind(SK_TAG); begin_declaration_level($1 == STRUCT ? DLK_STRUCT : DLK_UNION); dcs->d_sou_size_in_bits = 0; dcs->d_sou_align_in_bits = CHAR_SIZE; @@ -1029,7 +1029,7 @@ struct_or_union: braced_member_declaration_list: /* see C99 6.7.2.1 */ T_LBRACE { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); } member_declaration_list_with_rbrace { $$ = $3; } @@ -1058,15 +1058,15 @@ member_declaration: begin_type_qualifier_list end_type { /* ^^ There is no check for the missing type-specifier. */ /* too late, i know, but getsym() compensates it */ - set_symtyp(FMEMBER); + set_sym_kind(SK_MEMBER); } notype_member_declarators T_SEMI { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); $$ = $4; } | begin_type_specifier_qualifier_list end_type { - set_symtyp(FMEMBER); + set_sym_kind(SK_MEMBER); } type_member_declarators T_SEMI { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); $$ = $4; } | begin_type_qualifier_list end_type type_attribute_opt T_SEMI { @@ -1076,7 +1076,7 @@ member_declaration: } | begin_type_specifier_qualifier_list end_type type_attribute_opt T_SEMI { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); if (!allow_c11 && !allow_gcc) /* anonymous struct/union members is a C11 feature */ warning(49); @@ -1092,7 +1092,7 @@ member_declaration: $$ = NULL; } | error T_SEMI { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); $$ = NULL; } ; @@ -1103,7 +1103,7 @@ notype_member_declarators: $$ = declare_member($1); } | notype_member_declarators { - set_symtyp(FMEMBER); + set_sym_kind(SK_MEMBER); } T_COMMA type_member_declarator { $$ = concat_symbols($1, declare_member($4)); } @@ -1115,7 +1115,7 @@ type_member_declarators: $$ = declare_member($1); } | type_member_declarators { - set_symtyp(FMEMBER); + set_sym_kind(SK_MEMBER); } T_COMMA type_member_declarator { $$ = concat_symbols($1, declare_member($4)); } @@ -1130,7 +1130,7 @@ notype_member_declarator: } /* C99 6.7.2.1 */ | { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); } T_COLON constant_expression { $$ = set_bit_field_width(NULL, to_int_constant($3, true)); } @@ -1143,7 +1143,7 @@ type_member_declarator: $$ = set_bit_field_width($1, to_int_constant($3, true)); } | { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); } T_COLON constant_expression type_attribute_list_opt { $$ = set_bit_field_width(NULL, to_int_constant($3, true)); } @@ -1165,21 +1165,21 @@ enum_specifier: $$ = complete_enum($4); } | enum error { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); $$ = gettyp(INT); } ; enum: /* helper for C99 6.7.2.2 */ T_ENUM { - set_symtyp(FTAG); + set_sym_kind(SK_TAG); begin_declaration_level(DLK_ENUM); } ; enum_declaration: /* helper for C99 6.7.2.2 */ T_LBRACE { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); enumval = 0; } enums_with_opt_comma T_RBRACE { $$ = $3; @@ -1771,7 +1771,7 @@ labeled_statement: /* C99 6.8.1 */ label: T_NAME T_COLON { - set_symtyp(FLABEL); + set_sym_kind(SK_LABEL); named_label(getsym($1)); } | T_CASE constant_expression T_COLON { @@ -1977,7 +1977,7 @@ jump_statement: /* C99 6.8.6 */ stmt_goto(getsym($2)); } | goto error T_SEMI { - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); } | T_CONTINUE T_SEMI { stmt_continue(); @@ -1995,7 +1995,7 @@ jump_statement: /* C99 6.8.6 */ goto: /* see C99 6.8.6 */ T_GOTO { - set_symtyp(FLABEL); + set_sym_kind(SK_LABEL); } ; Index: src/usr.bin/xlint/lint1/debug.c diff -u src/usr.bin/xlint/lint1/debug.c:1.65 src/usr.bin/xlint/lint1/debug.c:1.66 --- src/usr.bin/xlint/lint1/debug.c:1.65 Sun Dec 3 12:03:38 2023 +++ src/usr.bin/xlint/lint1/debug.c Tue Jan 23 19:44:28 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.65 2023/12/03 12:03:38 rillig Exp $ */ +/* $NetBSD: debug.c,v 1.66 2024/01/23 19:44:28 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.65 2023/12/03 12:03:38 rillig Exp $"); +__RCSID("$NetBSD: debug.c,v 1.66 2024/01/23 19:44:28 rillig Exp $"); #endif #include <stdlib.h> @@ -320,7 +320,7 @@ scl_name(scl_t scl) } const char * -symt_name(symt_t kind) +symbol_kind_name(symbol_kind kind) { static const char *const name[] = { "var-func-type", @@ -373,7 +373,7 @@ debug_sym(const char *prefix, const sym_ debug_printf(" type='%s'", type_name(sym->s_type)); if (sym->s_rename != NULL) debug_printf(" rename=%s", sym->s_rename); - debug_printf(" %s", symt_name(sym->s_kind)); + debug_printf(" %s", symbol_kind_name(sym->s_kind)); debug_word(sym->s_keyword != NULL, "keyword"); debug_word(sym->s_bitfield, "bit-field"); debug_word(sym->s_set, "set"); Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.388 src/usr.bin/xlint/lint1/decl.c:1.389 --- src/usr.bin/xlint/lint1/decl.c:1.388 Sun Jan 21 14:21:34 2024 +++ src/usr.bin/xlint/lint1/decl.c Tue Jan 23 19:44:28 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.388 2024/01/21 14:21:34 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.389 2024/01/23 19:44:28 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.388 2024/01/21 14:21:34 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.389 2024/01/23 19:44:28 rillig Exp $"); #endif #include <sys/param.h> @@ -932,7 +932,7 @@ check_type(sym_t *sym) * implementation-defined type". */ static void -check_bit_field_type(sym_t *dsym, type_t **inout_tp, tspec_t *inout_t) +check_bit_field_type(sym_t *dsym, type_t **const inout_tp, tspec_t *inout_t) { type_t *tp = *inout_tp; tspec_t t = *inout_t; @@ -976,7 +976,7 @@ check_bit_field_type(sym_t *dsym, type_t } static void -check_bit_field(sym_t *dsym, tspec_t *inout_t, type_t **inout_tp) +check_bit_field(sym_t *dsym, tspec_t *inout_t, type_t **const inout_tp) { check_bit_field_type(dsym, inout_tp, inout_t); @@ -1054,7 +1054,7 @@ declare_unnamed_member(void) sym_t *mem = block_zero_alloc(sizeof(*mem), "sym"); mem->s_name = unnamed; - mem->s_kind = FMEMBER; + mem->s_kind = SK_MEMBER; mem->s_scl = dcs->d_kind == DLK_STRUCT ? STRUCT_MEMBER : UNION_MEMBER; mem->s_block_level = -1; mem->s_type = dcs->d_type; @@ -1123,7 +1123,7 @@ set_bit_field_width(sym_t *dsym, int bit if (dsym == NULL) { dsym = block_zero_alloc(sizeof(*dsym), "sym"); dsym->s_name = unnamed; - dsym->s_kind = FMEMBER; + dsym->s_kind = SK_MEMBER; dsym->s_scl = STRUCT_MEMBER; dsym->s_type = gettyp(UINT); dsym->s_block_level = -1; @@ -1640,7 +1640,7 @@ make_tag_type(sym_t *tag, tspec_t kind, tag = block_zero_alloc(sizeof(*tag), "sym"); tag->s_name = unnamed; tag->s_def_pos = unique_curr_pos(); - tag->s_kind = FTAG; + tag->s_kind = SK_TAG; tag->s_scl = scl; tag->s_block_level = -1; tag->s_type = tp = block_zero_alloc(sizeof(*tp), "type"); @@ -2612,7 +2612,7 @@ declare_external_in_block(sym_t *dsym) sym_t *esym = dcs->d_redeclared_symbol; while (esym != NULL && esym->s_block_level != 0) { while ((esym = esym->s_symtab_next) != NULL) { - if (esym->s_kind != FVFT) + if (esym->s_kind != SK_VCFT) continue; if (strcmp(dsym->s_name, esym->s_name) == 0) break; @@ -2858,7 +2858,7 @@ mark_as_used(sym_t *sym, bool fcall, boo * Probably not, because there is no point in declaring an external * variable only to get its size. */ - if (!fcall && !szof && sym->s_kind == FVFT && sym->s_scl == EXTERN) + if (!fcall && !szof && sym->s_kind == SK_VCFT && sym->s_scl == EXTERN) outusg(sym); } @@ -3015,13 +3015,13 @@ check_usage_sym(bool novar, const sym_t if (sym->s_block_level == -1) return; - if (sym->s_kind == FVFT && sym->s_param) + if (sym->s_kind == SK_VCFT && sym->s_param) check_parameter_usage(novar, sym); - else if (sym->s_kind == FVFT) + else if (sym->s_kind == SK_VCFT) check_variable_usage(novar, sym); - else if (sym->s_kind == FLABEL) + else if (sym->s_kind == SK_LABEL) check_label_usage(sym); - else if (sym->s_kind == FTAG) + else if (sym->s_kind == SK_TAG) check_tag_usage(sym); } @@ -3127,12 +3127,12 @@ end_translation_unit(void) sym != NULL; sym = sym->s_level_next) { if (sym->s_block_level == -1) continue; - if (sym->s_kind == FVFT) + if (sym->s_kind == SK_VCFT) check_global_variable(sym); - else if (sym->s_kind == FTAG) + else if (sym->s_kind == SK_TAG) check_tag_usage(sym); else - lint_assert(sym->s_kind == FMEMBER); + lint_assert(sym->s_kind == SK_MEMBER); } } Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.211 src/usr.bin/xlint/lint1/externs1.h:1.212 --- src/usr.bin/xlint/lint1/externs1.h:1.211 Thu Jan 11 23:06:19 2024 +++ src/usr.bin/xlint/lint1/externs1.h Tue Jan 23 19:44:28 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.211 2024/01/11 23:06:19 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.212 2024/01/23 19:44:28 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -80,7 +80,7 @@ extern bool in_gcc_attribute; extern pos_t curr_pos; extern pos_t csrc_pos; extern bool in_system_header; -extern symt_t symtyp; +extern symbol_kind sym_kind; extern FILE *yyin; void initscan(void); @@ -133,7 +133,7 @@ void expr_restore_memory(memory_pool); #ifdef DEBUG const char *decl_level_kind_name(decl_level_kind); const char *scl_name(scl_t); -const char *symt_name(symt_t); +const char *symbol_kind_name(symbol_kind); const char *type_qualifiers_string(type_qualifiers); const char *function_specifier_name(function_specifier); void debug_dcs(void); Index: src/usr.bin/xlint/lint1/lex.c diff -u src/usr.bin/xlint/lint1/lex.c:1.199 src/usr.bin/xlint/lint1/lex.c:1.200 --- src/usr.bin/xlint/lint1/lex.c:1.199 Fri Jan 19 19:23:34 2024 +++ src/usr.bin/xlint/lint1/lex.c Tue Jan 23 19:44:28 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.199 2024/01/19 19:23:34 rillig Exp $ */ +/* $NetBSD: lex.c,v 1.200 2024/01/23 19:44:28 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: lex.c,v 1.199 2024/01/19 19:23:34 rillig Exp $"); +__RCSID("$NetBSD: lex.c,v 1.200 2024/01/23 19:44:28 rillig Exp $"); #endif #include <ctype.h> @@ -205,7 +205,7 @@ static sym_t *symtab[503]; * The kind of the next expected symbol, to distinguish the namespaces of * members, labels, type tags and other identifiers. */ -symt_t symtyp; +symbol_kind sym_kind; static unsigned int @@ -243,7 +243,7 @@ symtab_search(const char *name) if (strcmp(sym->s_name, name) != 0) continue; if (sym->s_keyword != NULL || - sym->s_kind == symtyp || + sym->s_kind == sym_kind || in_gcc_attribute) return sym; } @@ -459,7 +459,7 @@ lex_keyword(sym_t *sym) /* * Look up the definition of a name in the symbol table. This symbol must - * either be a keyword or a symbol of the type required by symtyp (label, + * either be a keyword or a symbol of the type required by sym_kind (label, * member, tag, ...). */ extern int @@ -1335,18 +1335,18 @@ getsym(sbuf_t *sb) /* * During member declaration it is possible that name() looked for - * symbols of type FVFT, although it should have looked for symbols of - * type FTAG. Same can happen for labels. Both cases are compensated - * here. + * symbols of type SK_VCFT, although it should have looked for symbols + * of type SK_TAG. Same can happen for labels. Both cases are + * compensated here. */ - if (symtyp == FMEMBER || symtyp == FLABEL) { - if (sym == NULL || sym->s_kind == FVFT) + if (sym_kind == SK_MEMBER || sym_kind == SK_LABEL) { + if (sym == NULL || sym->s_kind == SK_VCFT) sym = symtab_search(sb->sb_name); } if (sym != NULL) { - lint_assert(sym->s_kind == symtyp); - set_symtyp(FVFT); + lint_assert(sym->s_kind == sym_kind); + set_sym_kind(SK_VCFT); free(sb); return sym; } @@ -1355,7 +1355,7 @@ getsym(sbuf_t *sb) /* labels must always be allocated at level 1 (outermost block) */ decl_level *dl; - if (symtyp == FLABEL) { + if (sym_kind == SK_LABEL) { sym = level_zero_alloc(1, sizeof(*sym), "sym"); char *s = level_zero_alloc(1, sb->sb_len + 1, "string"); (void)memcpy(s, sb->sb_name, sb->sb_len + 1); @@ -1374,10 +1374,10 @@ getsym(sbuf_t *sb) } sym->s_def_pos = unique_curr_pos(); - if ((sym->s_kind = symtyp) != FLABEL) + if ((sym->s_kind = sym_kind) != SK_LABEL) sym->s_type = gettyp(INT); - set_symtyp(FVFT); + set_sym_kind(SK_VCFT); if (!in_gcc_attribute) { debug_printf("%s: symtab_add ", __func__); @@ -1414,7 +1414,7 @@ mktempsym(type_t *tp) sym->s_type = tp; sym->s_block_level = block_level; sym->s_scl = scl; - sym->s_kind = FVFT; + sym->s_kind = SK_VCFT; sym->s_used = true; sym->s_set = true; @@ -1432,7 +1432,8 @@ rmsym(sym_t *sym) { debug_step("rmsym '%s' %s '%s'", - sym->s_name, symt_name(sym->s_kind), type_name(sym->s_type)); + sym->s_name, symbol_kind_name(sym->s_kind), + type_name(sym->s_type)); symtab_remove(sym); /* avoid that the symbol will later be put back to the symbol table */ @@ -1454,9 +1455,8 @@ symtab_remove_level(sym_t *syms) for (sym_t *sym = syms; sym != NULL; sym = sym->s_level_next) { if (sym->s_block_level != -1) { debug_step("%s '%s' %s '%s' %d", __func__, - sym->s_name, symt_name(sym->s_kind), - type_name(sym->s_type), - sym->s_block_level); + sym->s_name, symbol_kind_name(sym->s_kind), + type_name(sym->s_type), sym->s_block_level); symtab_remove(sym); sym->s_symtab_ref = NULL; } @@ -1469,8 +1469,8 @@ inssym(int level, sym_t *sym) { debug_step("%s '%s' %s '%s' %d", __func__, - sym->s_name, symt_name(sym->s_kind), type_name(sym->s_type), - level); + sym->s_name, symbol_kind_name(sym->s_kind), + type_name(sym->s_type), level); sym->s_block_level = level; symtab_add(sym); @@ -1502,7 +1502,8 @@ pushdown(const sym_t *sym) sym_t *nsym; debug_step("pushdown '%s' %s '%s'", - sym->s_name, symt_name(sym->s_kind), type_name(sym->s_type)); + sym->s_name, symbol_kind_name(sym->s_kind), + type_name(sym->s_type)); nsym = block_zero_alloc(sizeof(*nsym), "sym"); lint_assert(sym->s_block_level <= block_level); nsym->s_name = sym->s_name; Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.208 src/usr.bin/xlint/lint1/lint1.h:1.209 --- src/usr.bin/xlint/lint1/lint1.h:1.208 Thu Jan 11 23:26:39 2024 +++ src/usr.bin/xlint/lint1/lint1.h Tue Jan 23 19:44:28 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.208 2024/01/11 23:26:39 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.209 2024/01/23 19:44:28 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -192,15 +192,15 @@ struct lint1_type { #define t_enum t_u._t_enum #define t_params t_u._t_params -/* - * types of symbols - */ + + + typedef enum { - FVFT, /* variables, functions, type names, enums */ - FMEMBER, /* members of structs or unions */ - FTAG, /* tags */ - FLABEL /* labels */ -} symt_t; + SK_VCFT, /* variable, constant, function, type */ + SK_MEMBER, /* member of a struct or union */ + SK_TAG, + SK_LABEL +} symbol_kind; /* * storage classes and related things @@ -242,7 +242,7 @@ typedef struct sym { * order */ pos_t s_set_pos; /* position of first initialization */ pos_t s_use_pos; /* position of first use */ - symt_t s_kind; /* type of symbol */ + symbol_kind s_kind; const struct keyword *s_keyword; bool s_bitfield:1; bool s_set:1; /* variable set, label defined */ @@ -717,10 +717,10 @@ is_member(const sym_t *sym) } static inline void -set_symtyp(symt_t symt) +set_sym_kind(symbol_kind kind) { if (yflag) debug_step("%s: %s -> %s", __func__, - symt_name(symtyp), symt_name(symt)); - symtyp = symt; + symbol_kind_name(sym_kind), symbol_kind_name(kind)); + sym_kind = kind; } Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.596 src/usr.bin/xlint/lint1/tree.c:1.597 --- src/usr.bin/xlint/lint1/tree.c:1.596 Sun Jan 21 14:21:34 2024 +++ src/usr.bin/xlint/lint1/tree.c Tue Jan 23 19:44:28 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.596 2024/01/21 14:21:34 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.597 2024/01/23 19:44:28 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.596 2024/01/21 14:21:34 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.597 2024/01/23 19:44:28 rillig Exp $"); #endif #include <float.h> @@ -495,7 +495,7 @@ build_name(sym_t *sym, bool is_funcname) fallback_symbol(sym); } - lint_assert(sym->s_kind == FVFT || sym->s_kind == FMEMBER); + lint_assert(sym->s_kind == SK_VCFT || sym->s_kind == SK_MEMBER); tnode_t *n = expr_alloc_tnode(); n->tn_type = sym->s_type; @@ -514,7 +514,7 @@ build_name(sym_t *sym, bool is_funcname) } else { n->tn_op = NAME; n->tn_sym = sym; - if (sym->s_kind == FVFT && sym->s_type->t_tspec != FUNC) + if (sym->s_kind == SK_VCFT && sym->s_type->t_tspec != FUNC) n->tn_lvalue = true; } @@ -1869,7 +1869,7 @@ remove_unknown_member(tnode_t *tn, sym_t /* type '%s' does not have member '%s' */ error(101, type_name(tn->tn_type), msym->s_name); rmsym(msym); - msym->s_kind = FMEMBER; + msym->s_kind = SK_MEMBER; msym->s_scl = STRUCT_MEMBER; struct_or_union *sou = expr_zero_alloc(sizeof(*sou), @@ -2670,11 +2670,11 @@ check_unconst_function(const type_t *lst static bool check_assign_void_pointer_compat(op_t op, int arg, - const type_t *ltp, tspec_t lt, - const type_t *lstp, tspec_t lst, - const tnode_t *rn, - const type_t *rtp, tspec_t rt, - const type_t *rstp, tspec_t rst) + const type_t *const ltp, tspec_t const lt, + const type_t *const lstp, tspec_t const lst, + const tnode_t *const rn, + const type_t *const rtp, tspec_t const rt, + const type_t *const rstp, tspec_t const rst) { if (!(lt == PTR && rt == PTR && (lst == VOID || rst == VOID || types_compatible(lstp, rstp, @@ -2713,8 +2713,8 @@ check_assign_void_pointer_compat(op_t op static bool check_assign_pointer_integer(op_t op, int arg, - const type_t *ltp, tspec_t lt, - const type_t *rtp, tspec_t rt) + const type_t *const ltp, tspec_t const lt, + const type_t *const rtp, tspec_t const rt) { if (!((lt == PTR && is_integer(rt)) || (is_integer(lt) && rt == PTR)))