Module Name: src Committed By: rillig Date: Sun Dec 3 13:12:40 UTC 2023
Modified Files: src/usr.bin/xlint/lint1: ckctype.c ckgetopt.c decl.c emit1.c err.c func.c init.c lex.c lint1.h mem1.c tree.c src/usr.bin/xlint/lint2: chk.c lint2.h read.c src/usr.bin/xlint/xlint: xlint.c Log Message: lint: re-wrap comments No functional change. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/lint1/ckctype.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/xlint/lint1/ckgetopt.c cvs rdiff -u -r1.381 -r1.382 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.79 -r1.80 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.218 -r1.219 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.176 -r1.177 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.251 -r1.252 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.194 -r1.195 src/usr.bin/xlint/lint1/lex.c cvs rdiff -u -r1.203 -r1.204 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/mem1.c cvs rdiff -u -r1.585 -r1.586 src/usr.bin/xlint/lint1/tree.c cvs rdiff -u -r1.63 -r1.64 src/usr.bin/xlint/lint2/chk.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint2/lint2.h cvs rdiff -u -r1.88 -r1.89 src/usr.bin/xlint/lint2/read.c cvs rdiff -u -r1.118 -r1.119 src/usr.bin/xlint/xlint/xlint.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/ckctype.c diff -u src/usr.bin/xlint/lint1/ckctype.c:1.8 src/usr.bin/xlint/lint1/ckctype.c:1.9 --- src/usr.bin/xlint/lint1/ckctype.c:1.8 Sun Dec 3 12:03:38 2023 +++ src/usr.bin/xlint/lint1/ckctype.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ckctype.c,v 1.8 2023/12/03 12:03:38 rillig Exp $ */ +/* $NetBSD: ckctype.c,v 1.9 2023/12/03 13:12:40 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: ckctype.c,v 1.8 2023/12/03 12:03:38 rillig Exp $"); +__RCSID("$NetBSD: ckctype.c,v 1.9 2023/12/03 13:12:40 rillig Exp $"); #endif #include <string.h> @@ -106,7 +106,7 @@ check_ctype_arg(const char *func, const return; if (arg->tn_op == CVT && arg->tn_cast) { - /* argument to '%s' must be cast to 'unsigned char', not to '%s' */ + /* argument to '%s' must be cast to 'unsigned char', not ... */ warning(342, func, type_name(arg->tn_type)); return; } Index: src/usr.bin/xlint/lint1/ckgetopt.c diff -u src/usr.bin/xlint/lint1/ckgetopt.c:1.16 src/usr.bin/xlint/lint1/ckgetopt.c:1.17 --- src/usr.bin/xlint/lint1/ckgetopt.c:1.16 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/lint1/ckgetopt.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ckgetopt.c,v 1.16 2022/05/20 21:18:55 rillig Exp $ */ +/* $NetBSD: ckgetopt.c,v 1.17 2023/12/03 13:12:40 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: ckgetopt.c,v 1.16 2022/05/20 21:18:55 rillig Exp $"); +__RCSID("$NetBSD: ckgetopt.c,v 1.17 2023/12/03 13:12:40 rillig Exp $"); #endif #include <stdbool.h> @@ -51,7 +51,7 @@ __RCSID("$NetBSD: ckgetopt.c,v 1.16 2022 */ static struct { - /* + /*- * 0 means outside a while loop with a getopt call. * 1 means directly inside a while loop with a getopt call. * > 1 means in a nested while loop; this is used for finishing the @@ -61,8 +61,8 @@ static struct { /* * The options string from the getopt call. Whenever an option is - * handled by a case label, it is set to ' '. In the end, only ' ' - * and ':' should remain. + * handled by a case label, it is set to ' '. In the end, only ' ' and + * ':' should remain. */ pos_t options_pos; char *options; Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.381 src/usr.bin/xlint/lint1/decl.c:1.382 --- src/usr.bin/xlint/lint1/decl.c:1.381 Sun Dec 3 12:03:38 2023 +++ src/usr.bin/xlint/lint1/decl.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.381 2023/12/03 12:03:38 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.382 2023/12/03 13:12:40 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.381 2023/12/03 12:03:38 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.382 2023/12/03 13:12:40 rillig Exp $"); #endif #include <sys/param.h> @@ -150,10 +150,10 @@ expr_unqualified_type(const type_t *tp) /* * In case of a struct or union type, the members should lose their - * 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_sou == tp2->t_sou. + * 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_sou == + * tp2->t_sou. */ debug_step("%s '%s'", __func__, type_name(ntp)); @@ -317,7 +317,7 @@ dcs_add_type(type_t *tp) debug_step("%s: %s", __func__, type_name(tp)); debug_dcs(); if (tp->t_typedef) { - /* + /*- * something like "typedef int a; int a b;" * This should not happen with current grammar. */ @@ -332,10 +332,7 @@ dcs_add_type(type_t *tp) tspec_t t = tp->t_tspec; if (is_struct_or_union(t) || t == ENUM) { - /* - * something like "int struct a ..." - * struct/union/enum with anything else is not allowed - */ + /* something like "int struct a ..." */ if (dcs->d_type != NULL || dcs->d_abstract_type != NO_TSPEC || dcs->d_rank_mod != NO_TSPEC || dcs->d_sign_mod != NO_TSPEC) { dcs->d_invalid_type_combination = true; @@ -349,10 +346,7 @@ dcs_add_type(type_t *tp) } if (dcs->d_type != NULL && !dcs->d_type->t_typedef) { - /* - * something like "struct a int" - * struct/union/enum with anything else is not allowed - */ + /* something like "struct a int" */ dcs->d_invalid_type_combination = true; return; } @@ -365,7 +359,7 @@ dcs_add_type(type_t *tp) else { /* invalid type for _Complex */ error(308); - t = DCOMPLEX; /* just as a fallback */ + t = DCOMPLEX; /* just as a fallback */ } dcs->d_complex_mod = NO_TSPEC; } @@ -856,8 +850,8 @@ check_type(sym_t *sym) type_t *tp = *tpp; tspec_t t = tp->t_tspec; /* - * If this is the type of an old-style function definition, - * a better warning is printed in begin_function(). + * If this is the type of an old-style function definition, a + * better warning is printed in begin_function(). */ if (t == FUNC && !tp->t_proto && !(to == NO_TSPEC && sym->s_osdef)) { @@ -1108,8 +1102,8 @@ declare_member(sym_t *dsym) /* * bit-fields of length 0 are not warned about because length_in_bits - * does not return the length of the bit-field but the length - * of the type the bit-field is packed in (it's ok) + * does not return the length of the bit-field but the length of the + * type the bit-field is packed in (it's ok) */ int sz = length_in_bits(dsym->s_type, dsym->s_name); if (sz == 0 && t == ARRAY && dsym->s_type->t_dim == 0) { @@ -1233,14 +1227,14 @@ block_derive_array(type_t *stp, bool dim #if 0 /* * As of 2022-04-03, the implementation of the type parser (see - * add_function, add_array, add_pointer) is strange. When it sees - * the type 'void *b[4]', it first creates 'void b[4]' and only later + * add_function, add_array, add_pointer) is strange. When it sees the + * type 'void *b[4]', it first creates 'void b[4]' and only later * inserts the '*' in the middle of the type. Late modifications like * these should not be done at all, instead the parser should be fixed * to process the type names in the proper syntactical order. * - * Since the intermediate type would be an array of void, but the - * final type is valid, this check cannot be enabled yet. + * Since the intermediate type would be an array of void, but the final + * type is valid, this check cannot be enabled yet. */ if (stp->t_tspec == VOID) { /* array of incomplete type */ @@ -1378,10 +1372,10 @@ add_function(sym_t *decl, struct paramet /* * The symbols are removed from the symbol table by - * end_declaration_level after add_function. To be able to restore - * them if this is a function definition, a pointer to the list of - * all symbols is stored in dcs->d_enclosing->d_func_proto_syms. Also, - * a list of the parameters (concatenated by s_next) is stored in + * end_declaration_level after add_function. To be able to restore them + * if this is a function definition, a pointer to the list of all + * symbols is stored in dcs->d_enclosing->d_func_proto_syms. Also, a + * list of the parameters (concatenated by s_next) is stored in * dcs->d_enclosing->d_func_params. (dcs->d_enclosing must be used * because *dcs is the declaration stack element created for the list * of params and is removed after add_function.) @@ -1919,8 +1913,8 @@ declare_extern(sym_t *dsym, bool has_ini /* * Declarations of functions are marked as "tentative" in - * declarator_name(). This is wrong because there are no - * tentative function definitions. + * declarator_name(). This is wrong because there are no tentative + * function definitions. */ if (dsym->s_type->t_tspec == FUNC && dsym->s_def == TDEF) dsym->s_def = DECL; @@ -1938,8 +1932,8 @@ declare_extern(sym_t *dsym, bool has_ini if (plibflg && llibflg && dsym->s_type->t_tspec == FUNC && dsym->s_type->t_proto) { /* - * With both LINTLIBRARY and PROTOLIB the prototype is - * written as a function definition to the output file. + * With both LINTLIBRARY and PROTOLIB the prototype is written + * as a function definition to the output file. */ bool rval = dsym->s_type->t_subt->t_tspec != VOID; outfdef(dsym, &dsym->s_def_pos, rval, false, NULL); @@ -1974,8 +1968,8 @@ declare_extern(sym_t *dsym, bool has_ini } /* - * Take over the remembered params if the new symbol - * is not a prototype. + * Take over the remembered params if the new symbol is + * not a prototype. */ if (rdsym->s_osdef && !dsym->s_type->t_proto) { dsym->s_osdef = rdsym->s_osdef; @@ -2103,8 +2097,8 @@ check_redeclaration(sym_t *dsym, bool *d return false; if (rdsym->s_scl == EXTERN && rdsym->s_def == DEF) { /* - * All cases except "int a = 1; static int a;" are caught - * above with or without a warning + * All cases except "int a = 1; static int a;" are caught above + * with or without a warning */ /* redeclaration of '%s' */ error(27, dsym->s_name); @@ -2117,9 +2111,11 @@ check_redeclaration(sym_t *dsym, bool *d print_previous_declaration(rdsym); return false; } - /* + /*- * Now it's one of: - * "static a; int a;", "static a; int a = 1;", "static a = 1; int a;" + * "static a; int a;" + * "static a; int a = 1;" + * "static a = 1; int a;" */ /* TODO: Make this an error in C99 mode as well. */ if (!allow_trad && !allow_c99) { @@ -2354,9 +2350,9 @@ declare_parameter(sym_t *sym, bool has_i warning(269, sym->s_name); /* - * Arguments must have complete types. length_in_bits prints the - * needed error messages (null dimension is impossible because arrays - * are converted to pointers). + * Arguments must have complete types. length_in_bits prints the needed + * error messages (null dimension is impossible because arrays are + * converted to pointers). */ if (sym->s_type->t_tspec != VOID) (void)length_in_bits(sym->s_type, sym->s_name); @@ -2499,8 +2495,8 @@ check_func_old_style_parameters(void) } /* - * If this is an old-style function definition and a prototype - * exists, compare the types of parameters. + * If this is an old-style function definition and a prototype exists, + * compare the types of parameters. */ if (funcsym->s_osdef && funcsym->s_type->t_proto) { /* @@ -2573,8 +2569,8 @@ check_local_redeclaration(const sym_t *d /* no hflag, because it's illegal! */ if (rdsym->s_param) { /* - * if allow_c90, a "redeclaration of '%s'" error - * is produced below + * if allow_c90, a "redeclaration of '%s'" error is + * produced below */ if (!allow_c90) { if (hflag) { @@ -2681,11 +2677,11 @@ declare_local(sym_t *dsym, bool has_init } /* - * functions may be declared inline at local scope, although - * this has no effect for a later definition of the same - * function. - * XXX it should have an effect if !allow_c90 is set. this would - * also be the way gcc behaves. + * functions may be declared inline at local scope, although this has + * no effect for a later definition of the same function. + * + * XXX it should have an effect if !allow_c90 is set. this would also + * be the way gcc behaves. */ if (dcs->d_inline) { if (dsym->s_type->t_tspec == FUNC) @@ -2705,8 +2701,8 @@ declare_local(sym_t *dsym, bool has_init if (dsym->s_scl == EXTERN) { /* - * XXX if the static variable at level 0 is only defined - * later, checking will be possible. + * XXX if the static variable at level 0 is only defined later, + * checking will be possible. */ if (dsym->s_ext_sym == NULL) outsym(dsym, EXTERN, dsym->s_def); @@ -2753,9 +2749,9 @@ abstract_name_level(bool enclosing) sym->s_param = dcs->d_kind == DLK_PROTO_PARAMS; /* - * At this point, dcs->d_type contains only the basic type. That - * type will be updated later, adding pointers, arrays and functions - * as necessary. + * At this point, dcs->d_type contains only the basic type. That type + * will be updated later, adding pointers, arrays and functions as + * necessary. */ sym->s_type = (enclosing ? dcs->d_enclosing : dcs)->d_type; dcs->d_redeclared_symbol = NULL; @@ -2898,8 +2894,8 @@ check_variable_usage(bool novar, const s return; /* - * XXX Only variables are checked, although types should - * probably also be checked + * XXX Only variables are checked, although types should probably also + * be checked */ scl_t sc = sym->s_scl; if (sc != EXTERN && sc != STATIC && sc != AUTO && sc != REG) @@ -2928,14 +2924,14 @@ check_variable_usage(bool novar, const s if (sc == EXTERN) { /* - * information about usage is taken over into the symbol - * table entry at level 0 if the symbol was locally declared - * as an external symbol. + * information about usage is taken over into the symbol table + * entry at level 0 if the symbol was locally declared as an + * external symbol. * - * XXX This is wrong for symbols declared static at level 0 - * if the usage information stems from sizeof(). This is - * because symbols at level 0 only used in sizeof() are - * considered to not be used. + * XXX This is wrong for symbols declared static at level 0 if + * the usage information stems from sizeof(). This is because + * symbols at level 0 only used in sizeof() are considered to + * not be used. */ sym_t *xsym = sym->s_ext_sym; if (xsym != NULL) { @@ -3168,10 +3164,9 @@ to_int_constant(tnode_t *tn, bool requir free(v); /* - * Abstract declarations are used inside expression. To free - * the memory would be a fatal error. - * We don't free blocks that are inside casts because these - * will be used later to match types. + * Abstract declarations are used inside expression. To free the memory + * would be a fatal error. We don't free blocks that are inside casts + * because these will be used later to match types. */ if (tn->tn_op != CON && dcs->d_kind != DLK_ABSTRACT) expr_free_all(); Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.79 src/usr.bin/xlint/lint1/emit1.c:1.80 --- src/usr.bin/xlint/lint1/emit1.c:1.79 Sun Dec 3 12:03:38 2023 +++ src/usr.bin/xlint/lint1/emit1.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: emit1.c,v 1.79 2023/12/03 12:03:38 rillig Exp $ */ +/* $NetBSD: emit1.c,v 1.80 2023/12/03 13:12:40 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.79 2023/12/03 12:03:38 rillig Exp $"); +__RCSID("$NetBSD: emit1.c,v 1.80 2023/12/03 13:12:40 rillig Exp $"); #endif #include "lint1.h" @@ -176,10 +176,10 @@ outsym(const sym_t *sym, scl_t sc, def_t /* * Static function declarations must also be written to the output - * file. Compatibility of function declarations (for both static - * and extern functions) must be checked in lint2. Lint1 can't do - * this, especially not if functions are declared at block level - * before their first declaration at level 0. + * file. Compatibility of function declarations (for both static and + * extern functions) must be checked in lint2. Lint1 can't do this, + * especially not if functions are declared at block level before their + * first declaration at level 0. */ if (sc != EXTERN && !(sc == STATIC && sym->s_type->t_tspec == FUNC)) return; @@ -205,8 +205,8 @@ outsym(const sym_t *sym, scl_t sc, def_t if (llibflg && def != DECL) { /* - * mark it as used so lint2 does not complain about - * unused symbols in libraries + * mark it as used so lint2 does not complain about unused + * symbols in libraries */ outchar('u'); } @@ -274,8 +274,8 @@ outfdef(const sym_t *fsym, const pos_t * if (llibflg) /* - * mark it as used so lint2 does not complain about - * unused symbols in libraries + * mark it as used so lint2 does not complain about unused + * symbols in libraries */ outchar('u'); @@ -333,9 +333,8 @@ outcall(const tnode_t *tn, bool retval_u outint(curr_pos.p_line); /* - * flags; 'u' and 'i' must be last to make sure a letter - * is between the numeric argument of a flag and the name of - * the function + * flags; 'u' and 'i' must be last to make sure a letter is between the + * numeric argument of a flag and the name of the function */ narg = 0; args = tn_ck_right(tn); @@ -515,8 +514,8 @@ outfstrg(strg_t *strg) oc = c; c = *cp++; /* - * handle [ for scanf. [-] means that a minus sign - * was found at an undefined position. + * handle [ for scanf. [-] means that a minus sign was + * found at an undefined position. */ if (oc == '[') { if (c == '^') Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.218 src/usr.bin/xlint/lint1/err.c:1.219 --- src/usr.bin/xlint/lint1/err.c:1.218 Thu Sep 14 21:53:02 2023 +++ src/usr.bin/xlint/lint1/err.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.218 2023/09/14 21:53:02 rillig Exp $ */ +/* $NetBSD: err.c,v 1.219 2023/12/03 13:12:40 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: err.c,v 1.218 2023/09/14 21:53:02 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.219 2023/12/03 13:12:40 rillig Exp $"); #endif #include <limits.h> @@ -586,12 +586,12 @@ assert_failed(const char *file, int line { /* - * After encountering a parse error in the grammar, lint often does - * not properly clean up its data structures, especially in 'dcs', - * the stack of declaration levels. This often leads to assertion - * failures. These cases are not interesting though, as the purpose - * of lint is to check syntactically valid code. In such a case, - * exit gracefully. This allows a fuzzer like afl to focus on more + * After encountering a parse error in the grammar, lint often does not + * properly clean up its data structures, especially in 'dcs', the + * stack of declaration levels. This often leads to assertion + * failures. These cases are not interesting though, as the purpose of + * lint is to check syntactically valid code. In such a case, exit + * gracefully. This allows a fuzzer like afl to focus on more * interesting cases instead of reporting nonsense translation units * like 'f=({e:;}' or 'v(const(char););e(v){'. */ Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.176 src/usr.bin/xlint/lint1/func.c:1.177 --- src/usr.bin/xlint/lint1/func.c:1.176 Sun Dec 3 12:03:38 2023 +++ src/usr.bin/xlint/lint1/func.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.176 2023/12/03 12:03:38 rillig Exp $ */ +/* $NetBSD: func.c,v 1.177 2023/12/03 13:12:40 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: func.c,v 1.176 2023/12/03 12:03:38 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.177 2023/12/03 13:12:40 rillig Exp $"); #endif #include <stdlib.h> @@ -219,8 +219,8 @@ begin_function(sym_t *fsym) funcsym = fsym; /* - * Put all symbols declared in the parameter list back to the - * symbol table. + * Put all symbols declared in the parameter list back to the symbol + * table. */ for (sym = dcs->d_func_proto_syms; sym != NULL; sym = sym->s_level_next) { @@ -231,9 +231,9 @@ begin_function(sym_t *fsym) } /* - * In old_style_function() we did not know whether it is an old - * style function definition or only an old-style declaration, - * if there are no parameters inside the parameter list ("f()"). + * In old_style_function() we did not know whether it is an old style + * function definition or only an old-style declaration, if there are + * no parameters inside the parameter list ("f()"). */ if (!fsym->s_type->t_proto && fsym->u.s_old_style_params == NULL) fsym->s_osdef = true; @@ -262,8 +262,8 @@ begin_function(sym_t *fsym) fsym->s_inline = true; /* - * Parameters in new-style function declarations need a name. - * ('void' is already removed from the list of parameters.) + * Parameters in new-style function declarations need a name. ('void' + * is already removed from the list of parameters.) */ n = 1; for (const sym_t *param = fsym->s_type->t_params; @@ -279,8 +279,8 @@ begin_function(sym_t *fsym) } /* - * We must also remember the position. s_def_pos is overwritten - * if this is an old-style definition, and we had already a prototype. + * We must also remember the position. s_def_pos is overwritten if this + * is an old-style definition, and we had already a prototype. */ dcs->d_func_def_pos = fsym->s_def_pos; @@ -289,9 +289,9 @@ begin_function(sym_t *fsym) if (!check_redeclaration(fsym, (dowarn = false, &dowarn))) { /* - * Print nothing if the newly defined function - * is defined in old style. A better warning will - * be printed in check_func_lint_directives(). + * Print nothing if the newly defined function is + * defined in old style. A better warning will be + * printed in check_func_lint_directives(). */ if (dowarn && !fsym->s_osdef) { /* TODO: error in C99 mode as well? */ @@ -307,9 +307,9 @@ begin_function(sym_t *fsym) copy_usage_info(fsym, rdsym); /* - * If the old symbol was a prototype and the new - * one is none, overtake the position of the - * declaration of the prototype. + * If the old symbol was a prototype and the new one is + * none, overtake the position of the declaration of + * the prototype. */ if (fsym->s_osdef && rdsym->s_type->t_proto) fsym->s_def_pos = rdsym->s_def_pos; @@ -368,8 +368,8 @@ end_function(void) /* * This warning is printed only if the return value was implicitly - * declared to be int. Otherwise, the wrong return statement - * has already printed a warning. + * declared to be int. Otherwise, the wrong return statement has + * already printed a warning. */ if (cstmt->c_had_return_noval && cstmt->c_had_return_value && funcsym->s_return_type_implicit_int) @@ -384,9 +384,8 @@ end_function(void) check_usage_sym(dcs->d_asm, param); /* - * write the information about the function definition to the - * output file - * inline functions explicitly declared extern are written as + * Write the information about the function definition to the output + * file. Inline functions explicitly declared extern are written as * declarations only. */ if (dcs->d_scl == EXTERN && funcsym->s_inline) { @@ -515,8 +514,8 @@ check_case_label(tnode_t *tn, control_st } /* - * get the value of the expression and convert it - * to the type of the switch expression + * get the value of the expression and convert it to the type of the + * switch expression */ v = integer_constant(tn, true); (void)memset(&nv, 0, sizeof(nv)); @@ -678,10 +677,9 @@ stmt_switch_expr(tnode_t *tn) } /* - * Remember the type of the expression. Because it's possible - * that (*tp) is allocated on tree memory, the type must be - * duplicated. This is not too complicated because it is - * only an integer type. + * Remember the type of the expression. Because it's possible that + * (*tp) is allocated on tree memory, the type must be duplicated. This + * is not too complicated because it is only an integer type. */ tp = xcalloc(1, sizeof(*tp)); if (tn != NULL) { @@ -740,21 +738,21 @@ stmt_switch_expr_stmt(void) if (cstmt->c_break) { /* * The end of the switch statement is always reached since - * c_break is only set if a break statement can actually - * be reached. + * c_break is only set if a break statement can actually be + * reached. */ set_reached(true); } else if (cstmt->c_default || (hflag && cstmt->c_switch_type->t_is_enum && nenum == nclab)) { /* - * The end of the switch statement is reached if the end - * of the last statement inside it is reached. + * The end of the switch statement is reached if the end of the + * last statement inside it is reached. */ } else { /* - * There are possible values that are not handled in the - * switch statement. + * There are possible values that are not handled in the switch + * statement. */ set_reached(true); } @@ -793,8 +791,8 @@ stmt_while_expr_stmt(void) { /* - * The end of the loop can be reached if it is no endless loop - * or there was a break statement which was reached. + * The end of the loop can be reached if it is no endless loop or there + * was a break statement which was reached. */ set_reached(!cstmt->c_maybe_endless || cstmt->c_break); @@ -852,8 +850,8 @@ stmt_for_exprs(tnode_t *tn1, tnode_t *tn { /* - * If there is no initialization expression it is possible that - * it is intended not to enter the loop at top. + * If there is no initialization expression it is possible that it is + * intended not to enter the loop at top. */ if (tn1 != NULL && !reached) { /* loop not entered at top */ @@ -865,9 +863,9 @@ stmt_for_exprs(tnode_t *tn1, tnode_t *tn cstmt->c_loop = true; /* - * Store the tree memory for the reinitialization expression. - * Also remember this expression itself. We must check it at - * the end of the loop to get "used but not set" warnings correct. + * Store the tree memory for the reinitialization expression. Also + * remember this expression itself. We must check it at the end of the + * loop to get "used but not set" warnings correct. */ cstmt->c_for_expr3_mem = expr_save_memory(); cstmt->c_for_expr3 = tn3; Index: src/usr.bin/xlint/lint1/init.c diff -u src/usr.bin/xlint/lint1/init.c:1.251 src/usr.bin/xlint/lint1/init.c:1.252 --- src/usr.bin/xlint/lint1/init.c:1.251 Sat Dec 2 21:50:20 2023 +++ src/usr.bin/xlint/lint1/init.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.251 2023/12/02 21:50:20 rillig Exp $ */ +/* $NetBSD: init.c,v 1.252 2023/12/03 13:12:40 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.251 2023/12/02 21:50:20 rillig Exp $"); +__RCSID("$NetBSD: init.c,v 1.252 2023/12/03 13:12:40 rillig Exp $"); #endif #include <stdlib.h> @@ -81,8 +81,8 @@ typedef enum designator_kind { DK_UNION, /* .member */ DK_ARRAY, /* [subscript] */ /* TODO: actually necessary? */ - DK_SCALAR /* no textual representation, not generated - * by the parser */ + DK_SCALAR /* no textual representation, not generated by + * the parser */ } designator_kind; /* @@ -130,11 +130,10 @@ typedef struct brace_level { * The path from the "current object" to the sub-object that is * initialized by the next expression. * - * Initially, the designation is empty. Before handling an - * expression, the designation is updated to point to the - * corresponding sub-object to be initialized. After handling an - * expression, the designation is marked as done. It is later - * advanced as necessary. + * Initially, the designation is empty. Before handling an expression, + * the designation is updated to point to the corresponding sub-object + * to be initialized. After handling an expression, the designation is + * marked as done. It is later advanced as necessary. */ designation bl_designation; @@ -161,8 +160,8 @@ typedef struct initialization { size_t in_max_subscript; /* - * Is set when a structural error occurred in the initialization. - * If set, the rest of the initialization is still parsed, but the + * Is set when a structural error occurred in the initialization. If + * set, the rest of the initialization is still parsed, but the * initialization assignments are not checked. */ bool in_err; @@ -321,8 +320,8 @@ check_init_expr(const type_t *ltp, sym_t return; /* - * Preserve the tree memory. This is necessary because otherwise - * expr() would free it. + * Preserve the tree memory. This is necessary because otherwise expr() + * would free it. */ memory_pool saved_mem = expr_save_memory(); expr(rn, true, false, true, false); Index: src/usr.bin/xlint/lint1/lex.c diff -u src/usr.bin/xlint/lint1/lex.c:1.194 src/usr.bin/xlint/lint1/lex.c:1.195 --- src/usr.bin/xlint/lint1/lex.c:1.194 Sun Dec 3 12:03:38 2023 +++ src/usr.bin/xlint/lint1/lex.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.194 2023/12/03 12:03:38 rillig Exp $ */ +/* $NetBSD: lex.c,v 1.195 2023/12/03 13:12:40 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.194 2023/12/03 12:03:38 rillig Exp $"); +__RCSID("$NetBSD: lex.c,v 1.195 2023/12/03 13:12:40 rillig Exp $"); #endif #include <ctype.h> @@ -547,8 +547,8 @@ lex_integer_constant(const char *yytext, } /* - * If the value is too big for the current type, we must choose - * another type. + * If the value is too big for the current type, we must choose another + * type. */ bool ansiu = false; switch (typ) { @@ -571,8 +571,8 @@ lex_integer_constant(const char *yytext, typ = LONG; } else if (allow_trad) { /* - * Remember that the constant is unsigned - * only in C90. + * Remember that the constant is unsigned only + * in C90. */ ansiu = true; } @@ -1321,10 +1321,10 @@ getsym(sbuf_t *sb) sym_t *sym = sb->sb_sym; /* - * 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. + * 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. */ if (symtyp == FMEMBER || symtyp == FLABEL) { if (sym == NULL || sym->s_kind == FVFT) @@ -1462,9 +1462,9 @@ inssym(int level, sym_t *sym) symtab_add(sym); /* - * Placing the inner symbols to the beginning of the list ensures - * that these symbols are preferred over symbols from the outer - * blocks that happen to have the same name. + * Placing the inner symbols to the beginning of the list ensures that + * these symbols are preferred over symbols from the outer blocks that + * happen to have the same name. */ const sym_t *next = sym->s_symtab_next; if (next != NULL) Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.203 src/usr.bin/xlint/lint1/lint1.h:1.204 --- src/usr.bin/xlint/lint1/lint1.h:1.203 Sat Dec 2 21:47:05 2023 +++ src/usr.bin/xlint/lint1/lint1.h Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.203 2023/12/02 21:47:05 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.204 2023/12/03 13:12:40 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -164,13 +164,13 @@ struct lint1_type { bool t_typeof:1; /* type defined with GCC's __typeof__ */ bool t_bitfield:1; /* - * Either the type is currently an enum (having t_tspec ENUM), or - * it is an integer type (typically INT) that has been implicitly - * converted from an enum type. In both cases, t_enum is valid. + * Either the type is currently an enum (having t_tspec ENUM), or it is + * an integer type (typically INT) that has been implicitly converted + * from an enum type. In both cases, t_enum is valid. * - * The information about a former enum type is retained to allow - * type checks in expressions such as ((var1 & 0x0001) == var2), to - * detect when var1 and var2 are from incompatible enum types. + * The information about a former enum type is retained to allow type + * checks in expressions such as ((var1 & 0x0001) == var2), to detect + * when var1 and var2 are from incompatible enum types. */ bool t_is_enum:1; bool t_packed:1; @@ -182,7 +182,7 @@ struct lint1_type { } t_u; unsigned int t_bit_field_width:8; unsigned int t_bit_field_offset:24; - struct lint1_type *t_subt; /* element type (if ARRAY), + struct lint1_type *t_subt; /*- element type (if ARRAY), * return value (if FUNC), * target type (if PTR) */ }; @@ -196,10 +196,10 @@ struct lint1_type { * types of symbols */ typedef enum { - FVFT, /* variables, functions, type names, enums */ - FMEMBER, /* members of structs or unions */ - FTAG, /* tags */ - FLABEL /* labels */ + FVFT, /* variables, functions, type names, enums */ + FMEMBER, /* members of structs or unions */ + FTAG, /* tags */ + FLABEL /* labels */ } symt_t; /* @@ -207,11 +207,11 @@ typedef enum { */ typedef enum { NO_SCL, - EXTERN, /* external symbols (independent of decl_t) */ - STATIC, /* static symbols (local and global) */ - AUTO, /* automatic symbols (except register) */ - REG, /* register */ - TYPEDEF, /* typedef */ + EXTERN, /* external symbols (independent of decl_t) */ + STATIC, /* static symbols (local and global) */ + AUTO, /* automatic symbols (except register) */ + REG, /* register */ + TYPEDEF, /* typedef */ THREAD_LOCAL, STRUCT_TAG, UNION_TAG, @@ -220,7 +220,8 @@ typedef enum { UNION_MEMBER, BOOL_CONST, ENUM_CONST, - ABSTRACT, /* abstract symbol (sizeof, casts, unnamed argument) */ + ABSTRACT, /* abstract symbol (sizeof, casts, unnamed + * argument) */ } scl_t; /* C23 6.7.4 */ @@ -236,9 +237,9 @@ typedef struct sym { const char *s_name; const char *s_rename; /* renamed symbol's given name */ pos_t s_def_pos; /* position of last (prototype) definition, - prototype declaration, no-prototype-def., - tentative definition or declaration, - in this order */ + * prototype declaration, no-prototype-def., + * tentative definition or declaration, in this + * 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 */ @@ -249,17 +250,17 @@ typedef struct sym { bool s_param:1; /* symbol is function parameter */ bool s_register:1; /* symbol is register variable */ bool s_defparam:1; /* undefined symbol in old-style function - definition */ + * definition */ bool s_return_type_implicit_int:1; bool s_osdef:1; /* symbol stems from old-style function def. */ bool s_inline:1; /* true if this is an inline function */ struct sym *s_ext_sym; /* for locally declared external symbols, the - * pointer to the external symbol with the - * same name */ + * pointer to the external symbol with the same + * name */ def_t s_def; /* declared, tentative defined, defined */ scl_t s_scl; /* storage class, more or less */ int s_block_level; /* level of declaration, -1 if not in symbol - table */ + * table */ type_t *s_type; union { bool s_bool_constant; @@ -286,7 +287,7 @@ typedef struct sym { struct sym **s_symtab_ref; /* pointer to s_symtab_next of the * previous symbol */ struct sym *s_next; /* next struct/union member, enumerator, - parameter */ + * parameter */ struct sym *s_level_next; /* next symbol declared on the same * level */ } sym_t; @@ -445,13 +446,13 @@ typedef enum { */ typedef struct control_statement { control_statement_kind c_kind; /* to ensure proper nesting */ - bool c_loop:1; /* 'continue' and 'break' are valid */ - bool c_switch:1; /* 'case' and 'break' are valid */ - bool c_break:1; /* the loop/switch has a reachable - * 'break' statement */ - bool c_continue:1; /* the loop has a reachable 'continue' - * statement */ - bool c_default:1; /* the switch has a 'default' label */ + bool c_loop:1; /* 'continue' and 'break' are valid */ + bool c_switch:1; /* 'case' and 'break' are valid */ + bool c_break:1; /* the loop/switch has a reachable 'break' + * statement */ + bool c_continue:1; /* the loop has a reachable 'continue' + * statement */ + bool c_default:1; /* the switch has a 'default' label */ bool c_maybe_endless:1; /* the controlling expression is * always true (as in 'for (;;)' or * 'while (1)'), there may be break @@ -461,13 +462,13 @@ typedef struct control_statement { bool c_had_return_noval:1; /* had "return;" */ bool c_had_return_value:1; /* had "return expr;" */ - type_t *c_switch_type; /* type of switch expression */ + type_t *c_switch_type; /* type of switch expression */ tnode_t *c_switch_expr; case_label_t *c_case_labels; /* list of case values */ memory_pool c_for_expr3_mem; /* saved memory for end of loop * expression in for() */ - tnode_t *c_for_expr3; /* end of loop expr in for() */ + tnode_t *c_for_expr3; /* end of loop expr in for() */ pos_t c_for_expr3_pos; /* position of end of loop expr */ pos_t c_for_expr3_csrc_pos; /* same for csrc_pos */ @@ -475,8 +476,8 @@ typedef struct control_statement { } control_statement; typedef struct { - size_t lo; /* inclusive */ - size_t hi; /* inclusive */ + size_t lo; /* inclusive */ + size_t hi; /* inclusive */ } range_t; typedef enum { @@ -635,8 +636,8 @@ static inline uint64_t bit(unsigned i) { /* - * TODO: Add proper support for INT128. - * This involves changing val_t to 128 bits. + * TODO: Add proper support for INT128. This involves changing val_t to + * 128 bits. */ if (i >= 64) return 0; /* XXX: not correct for INT128 and UINT128 */ @@ -658,9 +659,9 @@ value_bits(unsigned bitsize) /* for long double (80 or 128), double _Complex (128) */ /* - * XXX: double _Complex does not have 128 bits of precision, - * therefore it should never be necessary to query the value bits - * of such a type; see d_c99_complex_split.c to trigger this case. + * XXX: double _Complex does not have 128 bits of precision, therefore + * it should never be necessary to query the value bits of such a type; + * see d_c99_complex_split.c to trigger this case. */ if (bitsize >= 64) return ~((uint64_t)0); Index: src/usr.bin/xlint/lint1/mem1.c diff -u src/usr.bin/xlint/lint1/mem1.c:1.75 src/usr.bin/xlint/lint1/mem1.c:1.76 --- src/usr.bin/xlint/lint1/mem1.c:1.75 Sun Dec 3 12:03:38 2023 +++ src/usr.bin/xlint/lint1/mem1.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: mem1.c,v 1.75 2023/12/03 12:03:38 rillig Exp $ */ +/* $NetBSD: mem1.c,v 1.76 2023/12/03 13:12:40 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: mem1.c,v 1.75 2023/12/03 12:03:38 rillig Exp $"); +__RCSID("$NetBSD: mem1.c,v 1.76 2023/12/03 13:12:40 rillig Exp $"); #endif #include <sys/param.h> @@ -345,8 +345,8 @@ expr_alloc_tnode(void) tnode_t *tn = expr_zero_alloc(sizeof(*tn), "tnode"); /* * files named *.c that are different from the main translation unit - * typically contain generated code that cannot be influenced, such - * as a flex lexer or a yacc parser. + * typically contain generated code that cannot be influenced, such as + * a flex lexer or a yacc parser. */ tn->tn_sys = in_system_header || (curr_pos.p_file != csrc_pos.p_file && Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.585 src/usr.bin/xlint/lint1/tree.c:1.586 --- src/usr.bin/xlint/lint1/tree.c:1.585 Sun Dec 3 12:24:49 2023 +++ src/usr.bin/xlint/lint1/tree.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.585 2023/12/03 12:24:49 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.586 2023/12/03 13:12:40 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.585 2023/12/03 12:24:49 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.586 2023/12/03 13:12:40 rillig Exp $"); #endif #include <float.h> @@ -464,9 +464,8 @@ build_name_call(sym_t *sym) if (is_compiler_builtin(sym->s_name)) { /* - * Do not warn about these, just assume that - * they are regular functions compatible with - * non-prototype calling conventions. + * Do not warn about these, just assume that they are regular + * functions compatible with non-prototype calling conventions. */ if (allow_gcc && is_gcc_bool_builtin(sym->s_name)) sym->s_type = gettyp(BOOL); @@ -882,8 +881,8 @@ fold(tnode_t *tn) break; case SHR: /* - * The sign must be explicitly extended because - * shifts of signed values are implementation dependent. + * The sign must be explicitly extended because shifts of + * signed values are implementation dependent. */ /* TODO: warn about out-of-bounds 'sr'. */ si = (int64_t)(ul >> (sr & 63)); @@ -1083,8 +1082,8 @@ check_enum_array_index(const tnode_t *ln /* * If the name of the largest enum constant contains 'MAX' or 'NUM', - * that constant is typically not part of the allowed enum values but - * a marker for the number of actual enum values. + * that constant is typically not part of the allowed enum values but a + * marker for the number of actual enum values. */ if (max_enum_value == max_array_index + 1 && (strstr(max_ec->s_name, "MAX") != NULL || @@ -1248,10 +1247,9 @@ build_colon(bool sys, tnode_t *ln, tnode tp = merge_qualifiers(rn->tn_type, ln->tn_type); } else { /* - * XXX For now we simply take the left type. This is - * probably wrong, if one type contains a function prototype - * and the other one, at the same place, only an old-style - * declaration. + * XXX For now we simply take the left type. This is probably + * wrong, if one type contains a function prototype and the + * other one, at the same place, only an old-style declaration. */ tp = merge_qualifiers(ln->tn_type, rn->tn_type); } @@ -1390,8 +1388,8 @@ build_real_imag(op_t op, bool sys, tnode lint_assert(ln != NULL); if (ln->tn_op == NAME) { /* - * This may be too much, but it avoids wrong warnings. - * See d_c99_complex_split.c. + * This may be too much, but it avoids wrong warnings. See + * d_c99_complex_split.c. */ mark_as_used(ln->tn_sym, false, false); mark_as_set(ln->tn_sym); @@ -1530,21 +1528,21 @@ floating_error_value(tspec_t t, long dou if (t == DOUBLE) return lv < 0 ? -DBL_MAX : DBL_MAX; /* - * When NetBSD is cross-built in MKLINT=yes mode on x86_64 for - * sparc64, tools/lint checks this code while building usr.bin/xlint. - * In that situation, lint uses the preprocessor for sparc64, in which - * the type 'long double' is IEEE-754-binary128, affecting the macro - * LDBL_MAX below. The type 'long double', as well as the strtold + * When NetBSD is cross-built in MKLINT=yes mode on x86_64 for sparc64, + * tools/lint checks this code while building usr.bin/xlint. In that + * situation, lint uses the preprocessor for sparc64, in which the type + * 'long double' is IEEE-754-binary128, affecting the macro LDBL_MAX + * below. The type 'long double', as well as the strtold * implementation, comes from the host platform x86_64 though, where * 'long double' consumes 128 bits as well but only uses 80 of them. * The exponent range of the two 'long double' types is the same, but * the maximum finite value differs due to the extended precision on * sparc64. * - * To properly handle the data types of the target platform, lint - * would have to implement the floating-point types in a - * platform-independent way, which is not worth the effort, given how - * few programs practically use 'long double'. + * To properly handle the data types of the target platform, lint would + * have to implement the floating-point types in a platform-independent + * way, which is not worth the effort, given how few programs + * practically use 'long double'. */ /* LINTED 248: floating-point constant out of range */ long double max = LDBL_MAX; @@ -1686,8 +1684,8 @@ build_binary(tnode_t *ln, op_t op, bool return NULL; /* - * Apply class conversions to the left operand, but only if its - * value is needed or compared with zero. + * Apply class conversions to the left operand, but only if its value + * is needed or compared with zero. */ if (mp->m_value_context || mp->m_compares_with_zero) ln = cconv(ln); @@ -1700,10 +1698,10 @@ build_binary(tnode_t *ln, op_t op, bool /* * Print some warnings for comparisons of unsigned values with - * constants lower than or equal to null. This must be done - * before promote() because otherwise unsigned char and unsigned - * short would be promoted to int. Types are also tested to be - * CHAR, which would also become int. + * constants lower than or equal to null. This must be done before + * promote() because otherwise unsigned char and unsigned short would + * be promoted to int. Types are also tested to be CHAR, which would + * also become int. */ if (mp->m_comparison) check_integer_comparison(op, ln, rn); @@ -1716,9 +1714,9 @@ build_binary(tnode_t *ln, op_t op, bool } /* - * If the result of the operation is different for signed or - * unsigned operands and one of the operands is signed only in - * C90, print a warning. + * If the result of the operation is different for signed or unsigned + * operands and one of the operands is signed only in C90, print a + * warning. */ if (mp->m_warn_if_left_unsigned_in_c90 && ln->tn_op == CON && ln->tn_val.v_unsigned_since_c90) { @@ -1820,8 +1818,8 @@ build_binary(tnode_t *ln, op_t op, bool check_precedence_confusion(ntn); /* - * Print a warning if one of the operands is in a context where - * it is compared with zero and if this operand is a constant. + * Print a warning if one of the operands is in a context where it is + * compared with zero and if this operand is a constant. */ if (hflag && !suppress_constcond && mp->m_compares_with_zero && @@ -1952,8 +1950,8 @@ remove_unknown_member(tnode_t *tn, sym_t msym->u.s_member.sm_containing_type = sou; /* - * The member sm_offset_in_bits is not needed here since this - * symbol can only be used for error reporting. + * The member sm_offset_in_bits is not needed here since this symbol + * can only be used for error reporting. */ } @@ -1988,8 +1986,8 @@ struct_or_union_member(tnode_t *tn, op_t bool eq = all_members_compatible(msym); /* - * Now handle the case in which the left operand refers really - * to a struct/union, but the right operand is not member of it. + * Now handle the case in which the left operand refers really to a + * struct/union, but the right operand is not member of it. */ if (sou != NULL) { if (eq && !allow_c90) { @@ -2003,8 +2001,8 @@ struct_or_union_member(tnode_t *tn, op_t } /* - * Now the left operand of ARROW does not point to a struct/union - * or the left operand of POINT is no struct/union. + * Now the left operand of ARROW does not point to a struct/union or + * the left operand of POINT is no struct/union. */ if (eq) { if (op == POINT) { @@ -2068,8 +2066,8 @@ tnode_t * cconv(tnode_t *tn) { /* - * Array-lvalue (array of type T) is converted into rvalue - * (pointer to type T) + * Array-lvalue (array of type T) is converted into rvalue (pointer to + * type T) */ if (tn->tn_type->t_tspec == ARRAY) { if (!tn->tn_lvalue) { @@ -2083,8 +2081,8 @@ cconv(tnode_t *tn) /* * Expression of type function (function with return value of type T) - * in rvalue-expression (pointer to function with return value - * of type T) + * in rvalue-expression (pointer to function with return value of type + * T) */ if (tn->tn_type->t_tspec == FUNC) tn = build_address(tn->tn_sys, tn, true); @@ -2123,9 +2121,9 @@ typeok_point(const tnode_t *ln, const ty /* * Some C dialects from before C90 tolerated any lvalue on the - * left-hand side of the '.' operator, allowing things like - * char st[100]; st.st_mtime, assuming that the member 'st_mtime' - * only occurred in a single struct; see typeok_arrow. + * left-hand side of the '.' operator, allowing things like 'char + * st[100]; st.st_mtime', assuming that the member 'st_mtime' only + * occurred in a single struct; see typeok_arrow. */ if (ln->tn_lvalue) return true; @@ -2144,9 +2142,9 @@ typeok_arrow(tspec_t lt) { /* * C1978 Appendix A 14.1 says: <quote>In fact, any lvalue is allowed - * before '.', and that lvalue is then assumed to have the form of - * the structure of which the name of the right is a member. [...] - * Such constructions are non-portable.</quote> + * before '.', and that lvalue is then assumed to have the form of the + * structure of which the name of the right is a member. [...] Such + * constructions are non-portable.</quote> */ if (lt == PTR || (!allow_c90 && is_integer(lt))) return true; @@ -2294,8 +2292,8 @@ typeok_shr(op_t op, return; /* - * The left operand is signed. This means that - * the operation is (possibly) nonportable. + * The left operand is signed. This means that the operation is + * (possibly) nonportable. */ if (ln->tn_op != CON) { /* bitwise '%s' on signed value possibly nonportable */ @@ -2329,18 +2327,16 @@ static void typeok_shl(op_t op, tspec_t lt, tspec_t rt) { /* - * C90 does not perform balancing for shift operations, - * but traditional C does. If the width of the right operand - * is greater than the width of the left operand, then in - * traditional C the left operand would be extended to the - * width of the right operand. For SHL this may result in - * different results. + * C90 does not perform balancing for shift operations, but traditional + * C does. If the width of the right operand is greater than the width + * of the left operand, then in traditional C the left operand would be + * extended to the width of the right operand. For SHL this may result + * in different results. */ if (portable_rank_cmp(lt, rt) < 0) { /* - * XXX If both operands are constant, make sure - * that there is really a difference between - * C90 and traditional C. + * XXX If both operands are constant, make sure that there is + * really a difference between C90 and traditional C. */ if (hflag && allow_trad && allow_c90) /* semantics of '%s' change in C90; use ... */ @@ -2696,8 +2692,8 @@ is_const_char_pointer(const tnode_t *tn) { /* * For traditional reasons, C99 6.4.5p5 defines that string literals - * have type 'char[]'. They are often implicitly converted to - * 'char *', for example when they are passed as function arguments. + * have type 'char[]'. They are often implicitly converted to 'char + * *', for example when they are passed as function arguments. * * C99 6.4.5p6 further defines that modifying a string that is * constructed from a string literal invokes undefined behavior. @@ -3304,9 +3300,8 @@ promote(op_t op, bool farg, tnode_t *tn) type_t *ntp = expr_dup_type(tn->tn_type); ntp->t_tspec = nt; /* - * Keep t_is_enum even though t_tspec gets converted from - * ENUM to INT, so we are later able to check compatibility - * of enum types. + * Keep t_is_enum even though t_tspec gets converted from ENUM to INT, + * so we are later able to check compatibility of enum types. */ return convert(op, 0, ntp, tn); } @@ -3378,9 +3373,9 @@ check_prototype_conversion(int arg, tspe return; /* - * If the type of the formal parameter is char/short, a warning - * would be useless, because functions declared the old style - * can't expect char/short arguments. + * If the type of the formal parameter is char/short, a warning would + * be useless, because functions declared the old style can't expect + * char/short arguments. */ if (nt == CHAR || nt == SCHAR || nt == UCHAR || nt == SHORT || nt == USHORT) @@ -4171,8 +4166,8 @@ cast(tnode_t *tn, type_t *tp) if (nt == VOID) { /* - * C90 6.3.4, C99 6.5.4p2 and C11 6.5.4p2 allow any type to - * be cast to void. The only other allowed casts are from a + * C90 6.3.4, C99 6.5.4p2 and C11 6.5.4p2 allow any type to be + * cast to void. The only other allowed casts are from a * scalar type to a scalar type. */ } else if (nt == UNION) @@ -4458,8 +4453,7 @@ expr(tnode_t *tn, bool vctx, bool cond, } if (!modtab[tn->tn_op].m_has_side_effect) { /* - * for left operands of COMMA this warning is already - * printed + * for left operands of COMMA this warning is already printed */ if (tn->tn_op != COMMA && !vctx && !cond) check_null_effect(tn); @@ -4497,8 +4491,8 @@ check_array_index(tnode_t *tn, bool ampe return; /* - * For incomplete array types, we can print a warning only if - * the index is negative. + * For incomplete array types, we can print a warning only if the index + * is negative. */ if (is_incomplete(ln->tn_left->tn_type) && rn->tn_val.u.integer >= 0) return; @@ -4687,10 +4681,11 @@ check_expr_misc(const tnode_t *tn, bool rn != NULL && !rn->tn_parenthesized; /* - * values of operands of ':' are not used if the type of at least - * one of the operands (for gcc compatibility) is void + * Values of operands of ':' are not used if the type of at least + * one of the operands (for GCC compatibility) is 'void'. + * * XXX test/value context of QUEST should probably be used as - * context for both operands of COLON + * context for both operands of COLON. */ if (op == COLON && tn->tn_type->t_tspec == VOID) cvctx = ccond = false; @@ -4775,8 +4770,8 @@ constant_addr(const tnode_t *tn, const s return true; } else { /* - * If this were the front end of a compiler, we - * would return a label instead of 0, at least if + * If this were the front end of a compiler, we would + * return a label instead of 0, at least if * 'tn->tn_left->tn_op == STRING'. */ *symp = NULL; @@ -4791,7 +4786,7 @@ constant_addr(const tnode_t *tn, const s return false; } #if 0 - /* + /*- * consider: * struct foo { * unsigned char a; Index: src/usr.bin/xlint/lint2/chk.c diff -u src/usr.bin/xlint/lint2/chk.c:1.63 src/usr.bin/xlint/lint2/chk.c:1.64 --- src/usr.bin/xlint/lint2/chk.c:1.63 Sun Dec 3 12:03:38 2023 +++ src/usr.bin/xlint/lint2/chk.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: chk.c,v 1.63 2023/12/03 12:03:38 rillig Exp $ */ +/* $NetBSD: chk.c,v 1.64 2023/12/03 13:12:40 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: chk.c,v 1.63 2023/12/03 12:03:38 rillig Exp $"); +__RCSID("$NetBSD: chk.c,v 1.64 2023/12/03 13:12:40 rillig Exp $"); #endif #include <ctype.h> @@ -205,8 +205,8 @@ check_multiple_definitions(const hte_t * def1 = NULL; for (sym = hte->h_syms; sym != NULL; sym = sym->s_next) { /* - * C90 allows tentative definitions of the same name in - * only one compilation unit. + * C90 allows tentative definitions of the same name in only + * one compilation unit. */ if (sym->s_def != DEF && (!sflag || sym->s_def != TDEF)) continue; @@ -341,9 +341,8 @@ chkfaui(const hte_t *hte, sym_t *def, sy /* * If we find a function definition, we use this for comparison, - * otherwise the first prototype we can find. If there is no - * definition or prototype declaration, the first function call - * is used. + * otherwise the first prototype we can find. If there is no definition + * or prototype declaration, the first function call is used. */ tp1 = NULL; call1 = NULL; @@ -386,15 +385,15 @@ chkfaui(const hte_t *hte, sym_t *def, sy } else if (def != NULL && def->s_check_only_first_args && n >= def->s_check_num_args) { /* - * function definition with VARARGS; The # of - * arguments of the call must be at least as large - * as the parameter of VARARGS. + * function definition with VARARGS; The # of arguments + * of the call must be at least as large as the + * parameter of VARARGS. */ } else if (*ap2 != NULL && tp1->t_proto && tp1->t_vararg) { /* - * prototype with ... and function call with - * at least the same # of arguments as declared - * in the prototype. + * prototype with ... and function call with at least + * the same # of arguments as declared in the + * prototype. */ } else { /* %s: variable # of args \t%s :: %s */ @@ -447,19 +446,18 @@ chkau(const hte_t *hte, int n, sym_t *de /* * If a function definition is available (def != NULL), we compare the * function call (call) with the definition. Otherwise, if a function - * definition is available and it is not an old-style definition - * (decl != NULL && TP(decl->s_type)->t_proto), we compare the call - * with this declaration. Otherwise we compare it with the first - * call we have found (call1). + * definition is available and it is not an old-style definition (decl + * != NULL && TP(decl->s_type)->t_proto), we compare the call with this + * declaration. Otherwise we compare it with the first call we have + * found (call1). */ /* arg1 must be promoted if it stems from an old-style definition */ promote = def != NULL && def->s_old_style_function; /* - * If we compare with a definition or declaration, we must perform - * the same checks for qualifiers in indirected types as in - * assignments. + * If we compare with a definition or declaration, we must perform the + * same checks for qualifiers in indirected types as in assignments. */ asgn = def != NULL || (decl != NULL && TP(decl->s_type)->t_proto); @@ -468,21 +466,22 @@ chkau(const hte_t *hte, int n, sym_t *de (!sflag || !dowarn)) return; - /* - * Other lint implementations print warnings as soon as the type - * of an argument does not match exactly the expected type. The - * result are lots of warnings which are really not necessary. + /*- + * Other lint implementations print warnings as soon as the type of an + * argument does not match exactly the expected type. The result are + * lots of warnings which are really not necessary. * We print a warning only if * (0) at least one type is not an integer type and types differ * (1) hflag is set and types differ * (2) types differ, except in signedness + * * If the argument is an integer constant whose msb is not set, - * signedness is ignored (e.g. 0 matches both signed and unsigned - * int). This is with and without hflag. - * If the argument is an integer constant with value 0 and the - * expected argument is of type pointer and the width of the - * integer constant is the same as the width of the pointer, - * no warning is printed. + * signedness is ignored (e.g. 0 matches both signed and unsigned int). + * This is with and without hflag. + * + * If the argument is an integer constant with value 0 and the expected + * argument is of type pointer and the width of the integer constant is + * the same as the width of the pointer, no warning is printed. */ t1 = arg1->t_tspec; t2 = arg2->t_tspec; @@ -525,17 +524,17 @@ chkau(const hte_t *hte, int n, sym_t *de /* * if two calls are compared, ai1 is set to the - * information for the n-th argument, if this was - * a constant, otherwise to NULL + * information for the n-th argument, if this was a + * constant, otherwise to NULL */ for ( ; ai1 != NULL; ai1 = ai1->a_next) { if (ai1->a_num == n) break; } /* - * ai is set to the information of the n-th arg - * of the (second) call, if this was a constant, - * otherwise to NULL + * ai is set to the information of the n-th arg of the + * (second) call, if this was a constant, otherwise to + * NULL */ for (ai = call->f_args; ai != NULL; ai = ai->a_next) { if (ai->a_num == n) @@ -556,9 +555,9 @@ chkau(const hte_t *hte, int n, sym_t *de /* value (not representation) differently */ } else { /* - * two constants, one signed, one unsigned; - * if the msb of one of the constants is set, - * the argument is used inconsistently. + * two constants, one signed, one unsigned; if + * the msb of one of the constants is set, the + * argument is used inconsistently. */ if (!ai1->a_ncon && !ai->a_ncon) return; @@ -572,8 +571,8 @@ chkau(const hte_t *hte, int n, sym_t *de } /* * Vendor implementations of lint (e.g. HP-UX, Digital UNIX) - * don't care about the size of the integer argument, - * only whether or not it is zero. We do the same. + * don't care about the size of the integer argument, only + * whether or not it is zero. We do the same. */ if (ai != NULL && ai->a_zero) return; @@ -727,8 +726,8 @@ printflike(const hte_t *hte, fcall_t *ca inconsistent_arguments(hte, call, n); } else { /* - * SHORT is always promoted to INT, USHORT - * to INT or UINT. + * SHORT is always promoted to INT, USHORT to + * INT or UINT. */ if (t1 != INT && (hflag || t1 != UINT)) inconsistent_arguments(hte, call, n); @@ -921,8 +920,8 @@ scanflike(const hte_t *hte, fcall_t *cal goto conv; } else if (fc == 'X') { /* - * XXX valid in C90, but in NetBSD's libc imple- - * mented as "lx". That's why it should be avoided. + * XXX valid in C90, but in NetBSD's libc implemented + * as "lx". That's why it should be avoided. */ if (sz != NO_TSPEC || !tflag) bad_format_string(hte, call); @@ -930,8 +929,8 @@ scanflike(const hte_t *hte, fcall_t *cal goto conv; } else if (fc == 'E') { /* - * XXX valid in C90, but in NetBSD's libc imple- - * mented as "lf". That's why it should be avoided. + * XXX valid in C90, but in NetBSD's libc implemented + * as "lf". That's why it should be avoided. */ if (sz != NO_TSPEC || !tflag) bad_format_string(hte, call); @@ -1069,10 +1068,10 @@ check_return_values(const hte_t *hte, sy if (def->s_function_has_return_value) { /* - * XXX as soon as we are able to disable single warnings, - * the following dependencies from hflag should be removed. - * But for now I don't want to be bothered by these warnings - * which are almost always useless. + * XXX as soon as we are able to disable single warnings, the + * following dependencies from hflag should be removed. But for + * now I don't want to be bothered by these warnings which are + * almost always useless. */ if (!hflag) return; @@ -1246,8 +1245,8 @@ types_compatible(type_t *tp1, type_t *tp } /* - * XXX Handle combinations of enum and int if eflag is set. - * But note: enum and 0 should be allowed. + * XXX Handle combinations of enum and int if eflag is set. But + * note: enum and 0 should be allowed. */ if (asgn && indir == 1) { Index: src/usr.bin/xlint/lint2/lint2.h diff -u src/usr.bin/xlint/lint2/lint2.h:1.25 src/usr.bin/xlint/lint2/lint2.h:1.26 --- src/usr.bin/xlint/lint2/lint2.h:1.25 Sun Dec 3 12:24:49 2023 +++ src/usr.bin/xlint/lint2/lint2.h Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lint2.h,v 1.25 2023/12/03 12:24:49 rillig Exp $ */ +/* $NetBSD: lint2.h,v 1.26 2023/12/03 13:12:40 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -49,24 +49,24 @@ struct lint2_type { bool t_isuniqpos:1; /* tag with _t_uniqpos valid */ union { int _t_dim; /* if the type is an ARRAY than this - is the dimension of the array. */ + * is the dimension of the array. */ struct hte *_t_tag; /* hash table entry of tag if - t_is_enum, STRUCT or UNION */ + * t_is_enum, STRUCT or UNION */ struct hte *_t_tynam; /* hash table entry of typename if - t_is_enum, STRUCT or UNION */ + * t_is_enum, STRUCT or UNION */ struct { int p_line; short p_file; int p_uniq; } _t_uniqpos; /* unique position, for untagged - untyped STRUCTs, UNIONS, and ENUMs, - if t_isuniqpos */ + * untyped STRUCTs, UNIONS, and ENUMs, + * if t_isuniqpos */ struct lint2_type **_t_args; /* list of argument types if - this is a prototype */ + * this is a prototype */ } t_u; - struct lint2_type *t_subt; /* element type (if ARRAY), - return type (if FUNC), - target type (if PTR) */ + struct lint2_type *t_subt; /*- element type (if ARRAY), + * return type (if FUNC), + * target type (if PTR) */ }; #define t_dim t_u._t_dim @@ -95,9 +95,8 @@ typedef struct arginf { * Keeps information about position in source file. */ typedef struct { - unsigned short p_src; /* index of name of translation unit - (the name which was specified at the - command line) */ + unsigned short p_src; /* index of name of translation unit (the name + * which was specified at the command line) */ unsigned short p_line; /* line number in p_src */ unsigned short p_isrc; /* index of (included) file */ unsigned short p_iline; /* line number in p_iline */ Index: src/usr.bin/xlint/lint2/read.c diff -u src/usr.bin/xlint/lint2/read.c:1.88 src/usr.bin/xlint/lint2/read.c:1.89 --- src/usr.bin/xlint/lint2/read.c:1.88 Sun Dec 3 12:03:38 2023 +++ src/usr.bin/xlint/lint2/read.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: read.c,v 1.88 2023/12/03 12:03:38 rillig Exp $ */ +/* $NetBSD: read.c,v 1.89 2023/12/03 13:12:40 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: read.c,v 1.88 2023/12/03 12:03:38 rillig Exp $"); +__RCSID("$NetBSD: read.c,v 1.89 2023/12/03 13:12:40 rillig Exp $"); #endif #include <ctype.h> @@ -178,9 +178,8 @@ read_ln_line(const char *line) } /* - * Index of (included) source file. If this index is - * different from csrcfile, it refers to an included - * file. + * Index of (included) source file. If this index is different from + * csrcfile, it refers to an included file. */ isrc = parse_int(&cp); isrc = inpfns[isrc]; @@ -299,8 +298,8 @@ setfnid(int fid, const char *cp) ninpfns *= 2; } /* - * Should always be true because indices written in the output - * file by lint1 are always the previous index + 1. + * Should always be true because indices written in the output file by + * lint1 are always the previous index + 1. */ if ((size_t)fid >= ninpfns) errx(1, "internal error: setfnid"); @@ -517,11 +516,11 @@ decldef(pos_t pos, const char *cp) sym.s_type = inptype(cp, &cp); /* - * Allocate memory for this symbol only if it was not already - * declared or tentatively defined at the same location with - * the same type. Works only for symbols with external linkage, - * because static symbols, tentatively defined at the same location - * but in different translation units are really different symbols. + * Allocate memory for this symbol only if it was not already declared + * or tentatively defined at the same location with the same type. + * Works only for symbols with external linkage, because static + * symbols, tentatively defined at the same location but in different + * translation units are really different symbols. */ for (symp = hte->h_syms; symp != NULL; symp = symp->s_next) { if (symp->s_pos.p_isrc == sym.s_pos.p_isrc && @@ -590,10 +589,10 @@ parse_tspec(const char **pp, char c, boo char s; switch (c) { - case 's': /* 'signed' or 'struct' or 'float' */ - case 'u': /* 'unsigned' or 'union' */ - case 'l': /* 'long double' */ - case 'e': /* 'enum' */ + case 's': /* 'signed' or 'struct' or 'float' */ + case 'u': /* 'unsigned' or 'union' */ + case 'l': /* 'long double' */ + case 'e': /* 'enum' */ s = c; c = *(*pp)++; break; @@ -1176,8 +1175,8 @@ mkstatic(hte_t *hte) /* * Create a new hash table entry * - * XXX this entry should be put at the beginning of the list to - * avoid processing the same symbol twice. + * XXX this entry should be put at the beginning of the list to avoid + * processing the same symbol twice. */ for (nhte = hte; nhte->h_link != NULL; nhte = nhte->h_link) continue; @@ -1197,8 +1196,8 @@ mkstatic(hte_t *hte) nhte->h_hte = NULL; /* - * move all symbols used in this translation unit into the new - * hash table entry. + * move all symbols used in this translation unit into the new hash + * table entry. */ for (symp = &hte->h_syms; (sym = *symp) != NULL; ) { if (sym->s_pos.p_src == sym1->s_pos.p_src) { Index: src/usr.bin/xlint/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.118 src/usr.bin/xlint/xlint/xlint.c:1.119 --- src/usr.bin/xlint/xlint/xlint.c:1.118 Sun Dec 3 12:03:38 2023 +++ src/usr.bin/xlint/xlint/xlint.c Sun Dec 3 13:12:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.118 2023/12/03 12:03:38 rillig Exp $ */ +/* $NetBSD: xlint.c,v 1.119 2023/12/03 13:12:40 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: xlint.c,v 1.118 2023/12/03 12:03:38 rillig Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.119 2023/12/03 13:12:40 rillig Exp $"); #endif #include <sys/param.h> @@ -766,8 +766,8 @@ main(int argc, char *argv[]) argv += optind; /* - * To avoid modifying getopt(3)'s state engine midstream, we - * explicitly accept just a few options after the first source file. + * To avoid modifying getopt(3)'s state engine midstream, we explicitly + * accept just a few options after the first source file. * * In particular, only -l<lib> and -L<libdir> (and these with a space * after -l or -L) are allowed.