Module Name: src
Committed By: rillig
Date: Sun Dec 3 12:03:38 UTC 2023
Modified Files:
src/usr.bin/xlint/lint1: ckbool.c ckctype.c debug.c decl.c emit1.c
func.c lex.c mem1.c tree.c
src/usr.bin/xlint/lint2: chk.c read.c
src/usr.bin/xlint/xlint: xlint.c
Log Message:
lint: indent statement continuations consistently
No binary change.
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/lint1/ckbool.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/lint1/ckctype.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.380 -r1.381 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.175 -r1.176 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.583 -r1.584 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/lint2/chk.c
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/xlint/lint2/read.c
cvs rdiff -u -r1.117 -r1.118 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/ckbool.c
diff -u src/usr.bin/xlint/lint1/ckbool.c:1.26 src/usr.bin/xlint/lint1/ckbool.c:1.27
--- src/usr.bin/xlint/lint1/ckbool.c:1.26 Wed Aug 2 18:51:25 2023
+++ src/usr.bin/xlint/lint1/ckbool.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ckbool.c,v 1.26 2023/08/02 18:51:25 rillig Exp $ */
+/* $NetBSD: ckbool.c,v 1.27 2023/12/03 12:03:38 rillig Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: ckbool.c,v 1.26 2023/08/02 18:51:25 rillig Exp $");
+__RCSID("$NetBSD: ckbool.c,v 1.27 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <string.h>
@@ -58,16 +58,16 @@ static bool
is_assignment_bool_or_other(op_t op)
{
return op == ASSIGN ||
- op == ANDASS || op == XORASS || op == ORASS ||
- op == RETURN || op == INIT || op == FARG;
+ op == ANDASS || op == XORASS || op == ORASS ||
+ op == RETURN || op == INIT || op == FARG;
}
static bool
is_symmetric_bool_or_other(op_t op)
{
return op == EQ || op == NE ||
- op == BITAND || op == BITXOR || op == BITOR ||
- op == COLON;
+ op == BITAND || op == BITXOR || op == BITOR ||
+ op == COLON;
}
static bool
Index: src/usr.bin/xlint/lint1/ckctype.c
diff -u src/usr.bin/xlint/lint1/ckctype.c:1.7 src/usr.bin/xlint/lint1/ckctype.c:1.8
--- src/usr.bin/xlint/lint1/ckctype.c:1.7 Wed Sep 13 20:31:58 2023
+++ src/usr.bin/xlint/lint1/ckctype.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ckctype.c,v 1.7 2023/09/13 20:31:58 rillig Exp $ */
+/* $NetBSD: ckctype.c,v 1.8 2023/12/03 12:03:38 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.7 2023/09/13 20:31:58 rillig Exp $");
+__RCSID("$NetBSD: ckctype.c,v 1.8 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <string.h>
@@ -61,21 +61,21 @@ is_ctype_function(const char *name)
if (name[0] == 'i' && name[1] == 's')
return strcmp(name, "isalnum") == 0 ||
- strcmp(name, "isalpha") == 0 ||
- strcmp(name, "isblank") == 0 ||
- strcmp(name, "iscntrl") == 0 ||
- strcmp(name, "isdigit") == 0 ||
- strcmp(name, "isgraph") == 0 ||
- strcmp(name, "islower") == 0 ||
- strcmp(name, "isprint") == 0 ||
- strcmp(name, "ispunct") == 0 ||
- strcmp(name, "isspace") == 0 ||
- strcmp(name, "isupper") == 0 ||
- strcmp(name, "isxdigit") == 0;
+ strcmp(name, "isalpha") == 0 ||
+ strcmp(name, "isblank") == 0 ||
+ strcmp(name, "iscntrl") == 0 ||
+ strcmp(name, "isdigit") == 0 ||
+ strcmp(name, "isgraph") == 0 ||
+ strcmp(name, "islower") == 0 ||
+ strcmp(name, "isprint") == 0 ||
+ strcmp(name, "ispunct") == 0 ||
+ strcmp(name, "isspace") == 0 ||
+ strcmp(name, "isupper") == 0 ||
+ strcmp(name, "isxdigit") == 0;
if (name[0] == 't' && name[1] == 'o')
return strcmp(name, "tolower") == 0 ||
- strcmp(name, "toupper") == 0;
+ strcmp(name, "toupper") == 0;
return false;
}
Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.64 src/usr.bin/xlint/lint1/debug.c:1.65
--- src/usr.bin/xlint/lint1/debug.c:1.64 Sat Dec 2 21:47:05 2023
+++ src/usr.bin/xlint/lint1/debug.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.64 2023/12/02 21:47:05 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.65 2023/12/03 12:03:38 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.64 2023/12/02 21:47:05 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.65 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <stdlib.h>
@@ -160,7 +160,7 @@ debug_type_details(const type_t *tp)
tp->t_sou->sou_incomplete ? "incomplete" : "complete");
for (const sym_t *mem = tp->t_sou->sou_first_member;
- mem != NULL; mem = mem->s_next) {
+ mem != NULL; mem = mem->s_next) {
debug_sym("", mem, "\n");
debug_type_details(mem->s_type);
}
@@ -169,7 +169,7 @@ debug_type_details(const type_t *tp)
if (tp->t_is_enum) {
debug_indent_inc();
for (const sym_t *en = tp->t_enum->en_first_enumerator;
- en != NULL; en = en->s_next) {
+ en != NULL; en = en->s_next) {
debug_sym("", en, "\n");
}
debug_indent_dec();
@@ -484,7 +484,7 @@ debug_decl_level(const decl_level *dl)
dl->d_func_def_pos.p_file, dl->d_func_def_pos.p_line,
dl->d_func_def_pos.p_uniq);
for (const sym_t *sym = dl->d_func_proto_syms;
- sym != NULL; sym = sym->s_next)
+ sym != NULL; sym = sym->s_next)
debug_sym(" func_proto_sym(", sym, ")");
debug_printf("\n");
}
Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.380 src/usr.bin/xlint/lint1/decl.c:1.381
--- src/usr.bin/xlint/lint1/decl.c:1.380 Sat Dec 2 21:47:05 2023
+++ src/usr.bin/xlint/lint1/decl.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.380 2023/12/02 21:47:05 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.381 2023/12/03 12:03:38 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.380 2023/12/02 21:47:05 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.381 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <sys/param.h>
@@ -456,7 +456,7 @@ pack_struct_or_union(type_t *tp)
unsigned int bits = 0;
bool named = false;
for (const sym_t *mem = tp->t_sou->sou_first_member;
- mem != NULL; mem = mem->s_next) {
+ mem != NULL; mem = mem->s_next) {
// TODO: Maybe update mem->u.s_member.sm_offset_in_bits.
if (mem->s_type->t_bitfield) {
bits += bit_fields_width(&mem, &named);
@@ -633,7 +633,7 @@ dcs_adjust_storage_class(void)
dcs->d_scl = NO_SCL;
}
} else if (dcs->d_kind == DLK_OLD_STYLE_PARAMS ||
- dcs->d_kind == DLK_PROTO_PARAMS) {
+ dcs->d_kind == DLK_PROTO_PARAMS) {
if (dcs->d_scl != NO_SCL && dcs->d_scl != REG) {
/* only 'register' is valid as storage class ... */
error(9);
@@ -1310,7 +1310,7 @@ check_prototype_parameters(sym_t *args)
{
for (sym_t *sym = dcs->d_first_dlsym;
- sym != NULL; sym = sym->s_level_next) {
+ sym != NULL; sym = sym->s_level_next) {
scl_t sc = sym->s_scl;
if (sc == STRUCT_TAG || sc == UNION_TAG || sc == ENUM_TAG) {
/* dubious tag declaration '%s %s' */
@@ -1677,7 +1677,7 @@ static bool
has_named_member(const type_t *tp)
{
for (const sym_t *mem = tp->t_sou->sou_first_member;
- mem != NULL; mem = mem->s_next) {
+ mem != NULL; mem = mem->s_next) {
if (mem->s_name != unnamed)
return true;
if (is_struct_or_union(mem->s_type->t_tspec)
@@ -1784,7 +1784,7 @@ ends_with(const char *s, const char *suf
size_t s_len = strlen(s);
size_t suffix_len = strlen(suffix);
return s_len >= suffix_len &&
- memcmp(s + s_len - suffix_len, suffix, suffix_len) == 0;
+ memcmp(s + s_len - suffix_len, suffix, suffix_len) == 0;
}
void
@@ -2021,7 +2021,7 @@ declare(sym_t *decl, bool has_initialize
if (dcs->d_kind == DLK_EXTERN)
declare_extern(decl, has_initializer, renaming);
else if (dcs->d_kind == DLK_OLD_STYLE_PARAMS ||
- dcs->d_kind == DLK_PROTO_PARAMS) {
+ dcs->d_kind == DLK_PROTO_PARAMS) {
if (renaming != NULL) {
/* symbol renaming can't be used on function ... */
error(310);
@@ -2147,7 +2147,7 @@ pointer_types_are_compatible(const type_
{
return tp1->t_tspec == VOID || tp2->t_tspec == VOID ||
- qualifiers_correspond(tp1, tp2, ignqual);
+ qualifiers_correspond(tp1, tp2, ignqual);
}
static bool
@@ -2375,8 +2375,8 @@ is_character_pointer(const type_t *tp)
tspec_t st;
return tp->t_tspec == PTR &&
- (st = tp->t_subt->t_tspec,
- st == CHAR || st == SCHAR || st == UCHAR);
+ (st = tp->t_subt->t_tspec,
+ st == CHAR || st == SCHAR || st == UCHAR);
}
void
@@ -2862,7 +2862,7 @@ check_usage(const decl_level *dl)
debug_step("begin lwarn %d", lwarn);
for (sym_t *sym = dl->d_first_dlsym;
- sym != NULL; sym = sym->s_level_next)
+ sym != NULL; sym = sym->s_level_next)
check_usage_sym(dl->d_asm, sym);
lwarn = saved_lwarn;
debug_step("end lwarn %d", lwarn);
@@ -3114,7 +3114,7 @@ end_translation_unit(void)
norecover();
for (const sym_t *sym = dcs->d_first_dlsym;
- sym != NULL; sym = sym->s_level_next) {
+ sym != NULL; sym = sym->s_level_next) {
if (sym->s_block_level == -1)
continue;
if (sym->s_kind == FVFT)
Index: src/usr.bin/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.78 src/usr.bin/xlint/lint1/emit1.c:1.79
--- src/usr.bin/xlint/lint1/emit1.c:1.78 Sat Dec 2 21:50:20 2023
+++ src/usr.bin/xlint/lint1/emit1.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.78 2023/12/02 21:50:20 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.79 2023/12/03 12:03:38 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.78 2023/12/02 21:50:20 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.79 2023/12/03 12:03:38 rillig Exp $");
#endif
#include "lint1.h"
@@ -119,13 +119,13 @@ outtype(const type_t *tp)
} else if (ts == FUNC && tp->t_proto) {
na = 0;
for (const sym_t *param = tp->t_params;
- param != NULL; param = param->s_next)
+ param != NULL; param = param->s_next)
na++;
if (tp->t_vararg)
na++;
outint(na);
for (const sym_t *param = tp->t_params;
- param != NULL; param = param->s_next)
+ param != NULL; param = param->s_next)
outtype(param->s_type);
if (tp->t_vararg)
outchar('E');
@@ -367,8 +367,8 @@ outcall(const tnode_t *tn, bool retval_u
outint(n);
}
} else if (arg->tn_op == ADDR &&
- arg->tn_left->tn_op == STRING &&
- arg->tn_left->tn_string->st_char) {
+ arg->tn_left->tn_op == STRING &&
+ arg->tn_left->tn_string->st_char) {
/* constant string, write all format specifiers */
outchar('s');
outint(n);
@@ -474,7 +474,7 @@ outfstrg(strg_t *strg)
/* flags for printf and scanf and *-fieldwidth for printf */
while (c == '-' || c == '+' || c == ' ' ||
- c == '#' || c == '0' || c == '*') {
+ c == '#' || c == '0' || c == '*') {
outchar(c);
c = *cp++;
}
Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.175 src/usr.bin/xlint/lint1/func.c:1.176
--- src/usr.bin/xlint/lint1/func.c:1.175 Sat Dec 2 21:50:20 2023
+++ src/usr.bin/xlint/lint1/func.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.175 2023/12/02 21:50:20 rillig Exp $ */
+/* $NetBSD: func.c,v 1.176 2023/12/03 12:03:38 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.175 2023/12/02 21:50:20 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.176 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <stdlib.h>
@@ -267,7 +267,7 @@ begin_function(sym_t *fsym)
*/
n = 1;
for (const sym_t *param = fsym->s_type->t_params;
- param != NULL; param = param->s_next) {
+ param != NULL; param = param->s_next) {
if (param->s_scl == ABSTRACT) {
lint_assert(param->s_name == unnamed);
/* formal parameter #%d lacks name */
@@ -380,7 +380,7 @@ end_function(void)
int n = nargusg;
nargusg = -1;
for (const sym_t *param = dcs->d_func_params;
- param != NULL && n != 0; param = param->s_next, n--)
+ param != NULL && n != 0; param = param->s_next, n--)
check_usage_sym(dcs->d_asm, param);
/*
@@ -724,7 +724,7 @@ stmt_switch_expr_stmt(void)
nenum = nclab = 0;
lint_assert(cstmt->c_switch_type->t_enum != NULL);
for (esym = cstmt->c_switch_type->t_enum->en_first_enumerator;
- esym != NULL; esym = esym->s_next) {
+ esym != NULL; esym = esym->s_next) {
nenum++;
}
for (cl = cstmt->c_case_labels; cl != NULL; cl = cl->cl_next)
Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.193 src/usr.bin/xlint/lint1/lex.c:1.194
--- src/usr.bin/xlint/lint1/lex.c:1.193 Sat Dec 2 21:47:05 2023
+++ src/usr.bin/xlint/lint1/lex.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.193 2023/12/02 21:47:05 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.194 2023/12/03 12:03:38 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.193 2023/12/02 21:47:05 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.194 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <ctype.h>
@@ -689,7 +689,7 @@ lex_floating_constant(const char *yytext
ld = ld > 0 ? FLT_MAX : -FLT_MAX;
}
} else if (typ == DOUBLE
- || /* CONSTCOND */LDOUBLE_SIZE == DOUBLE_SIZE) {
+ || /* CONSTCOND */ LDOUBLE_SIZE == DOUBLE_SIZE) {
ld = (double)ld;
if (isfinite(ld) == 0) {
/* floating-point constant out of range */
Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.74 src/usr.bin/xlint/lint1/mem1.c:1.75
--- src/usr.bin/xlint/lint1/mem1.c:1.74 Sat Aug 12 20:48:24 2023
+++ src/usr.bin/xlint/lint1/mem1.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mem1.c,v 1.74 2023/08/12 20:48:24 rillig Exp $ */
+/* $NetBSD: mem1.c,v 1.75 2023/12/03 12:03:38 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.74 2023/08/12 20:48:24 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.75 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <sys/param.h>
@@ -329,7 +329,7 @@ str_ends_with(const char *haystack, cons
size_t nlen = strlen(needle);
return nlen <= hlen &&
- memcmp(haystack + hlen - nlen, needle, nlen) == 0;
+ memcmp(haystack + hlen - nlen, needle, nlen) == 0;
}
/*
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.583 src/usr.bin/xlint/lint1/tree.c:1.584
--- src/usr.bin/xlint/lint1/tree.c:1.583 Sat Dec 2 21:53:15 2023
+++ src/usr.bin/xlint/lint1/tree.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.583 2023/12/02 21:53:15 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.584 2023/12/03 12:03:38 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.583 2023/12/02 21:53:15 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.584 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <float.h>
@@ -79,7 +79,7 @@ str_ends_with(const char *haystack, cons
size_t nlen = strlen(needle);
return nlen <= hlen &&
- memcmp(haystack + hlen - nlen, needle, nlen) == 0;
+ memcmp(haystack + hlen - nlen, needle, nlen) == 0;
}
static unsigned
@@ -453,7 +453,7 @@ static bool
is_gcc_bool_builtin(const char *name)
{
return strncmp(name, "__builtin_", 10) == 0 &&
- (str_ends_with(name, "_overflow") ||
+ (str_ends_with(name, "_overflow") ||
str_ends_with(name, "_overflow_p"));
}
@@ -571,9 +571,9 @@ static bool
is_out_of_char_range(const tnode_t *tn)
{
return tn->tn_op == CON &&
- !tn->tn_val.v_char_constant &&
- !(0 <= tn->tn_val.u.integer &&
- tn->tn_val.u.integer < 1 << (CHAR_SIZE - 1));
+ !tn->tn_val.v_char_constant &&
+ !(0 <= tn->tn_val.u.integer &&
+ tn->tn_val.u.integer < 1 << (CHAR_SIZE - 1));
}
static bool
@@ -1173,9 +1173,9 @@ is_null_pointer(const tnode_t *tn)
// TODO: Investigate how other pointers are stored, in particular,
// whether a pointer constant can have a non-zero value.
// If not, simplify the code below.
- return ((t == PTR && tn->tn_type->t_subt->t_tspec == VOID) ||
- is_integer(t))
- && (tn->tn_op == CON && tn->tn_val.u.integer == 0);
+ return ((t == PTR && tn->tn_type->t_subt->t_tspec == VOID)
+ || is_integer(t))
+ && (tn->tn_op == CON && tn->tn_val.u.integer == 0);
}
/* Return a type based on tp1, with added qualifiers from tp2. */
@@ -1271,13 +1271,13 @@ is_cast_redundant(const tnode_t *tn)
if (is_integer(nt) && is_integer(ot)) {
unsigned int nw = width_in_bits(ntp), ow = width_in_bits(otp);
if (is_uinteger(nt) == is_uinteger(ot))
- return nw >= ow;
+ return nw >= ow;
return is_uinteger(ot) && nw > ow;
}
if (is_complex(nt) || is_complex(ot))
return is_complex(nt) && is_complex(ot) &&
- size_in_bits(nt) >= size_in_bits(ot);
+ size_in_bits(nt) >= size_in_bits(ot);
if (is_floating(nt) && is_floating(ot))
return size_in_bits(nt) >= size_in_bits(ot);
@@ -1303,18 +1303,18 @@ is_assignment(op_t op)
{
return op == ASSIGN ||
- op == MULASS ||
- op == DIVASS ||
- op == MODASS ||
- op == ADDASS ||
- op == SUBASS ||
- op == SHLASS ||
- op == SHRASS ||
- op == ANDASS ||
- op == XORASS ||
- op == ORASS ||
- op == RETURN ||
- op == INIT;
+ op == MULASS ||
+ op == DIVASS ||
+ op == MODASS ||
+ op == ADDASS ||
+ op == SUBASS ||
+ op == SHLASS ||
+ op == SHRASS ||
+ op == ANDASS ||
+ op == XORASS ||
+ op == ORASS ||
+ op == RETURN ||
+ op == INIT;
}
/* Create a node for an assignment operator (both '=' and 'op='). */
@@ -1890,14 +1890,14 @@ static bool
all_members_compatible(const sym_t *msym)
{
for (const sym_t *csym = msym;
- csym != NULL; csym = csym->s_symtab_next) {
+ csym != NULL; csym = csym->s_symtab_next) {
if (!is_member(csym))
continue;
if (strcmp(msym->s_name, csym->s_name) != 0)
continue;
for (const sym_t *sym = csym->s_symtab_next;
- sym != NULL; sym = sym->s_symtab_next) {
+ sym != NULL; sym = sym->s_symtab_next) {
if (is_member(sym)
&& strcmp(csym->s_name, sym->s_name) == 0
&& !are_members_compatible(csym, sym))
@@ -1911,7 +1911,7 @@ sym_t *
find_member(const struct_or_union *sou, const char *name)
{
for (sym_t *mem = sou->sou_first_member;
- mem != NULL; mem = mem->s_next) {
+ mem != NULL; mem = mem->s_next) {
lint_assert(is_member(mem));
lint_assert(mem->u.s_member.sm_containing_type == sou);
if (strcmp(mem->s_name, name) == 0)
@@ -1919,7 +1919,7 @@ find_member(const struct_or_union *sou,
}
for (sym_t *mem = sou->sou_first_member;
- mem != NULL; mem = mem->s_next) {
+ mem != NULL; mem = mem->s_next) {
if (is_struct_or_union(mem->s_type->t_tspec)
&& mem->s_name == unnamed) {
sym_t *nested_mem =
@@ -2304,14 +2304,14 @@ typeok_shr(op_t op,
warning(120, op_name(op));
}
} else if (allow_trad && allow_c90 &&
- !is_uinteger(olt) && is_uinteger(ort)) {
+ !is_uinteger(olt) && is_uinteger(ort)) {
/* The left operand would become unsigned in traditional C. */
if (hflag && (ln->tn_op != CON || ln->tn_val.u.integer < 0)) {
/* semantics of '%s' change in C90; use ... */
warning(118, op_name(op));
}
} else if (allow_trad && allow_c90 &&
- !is_uinteger(olt) && !is_uinteger(ort) &&
+ !is_uinteger(olt) && !is_uinteger(ort) &&
portable_rank_cmp(lt, rt) < 0) {
/*
* In traditional C, the left operand would be extended
@@ -2561,7 +2561,7 @@ has_constant_member(const type_t *tp)
lint_assert(is_struct_or_union(tp->t_tspec));
for (sym_t *m = tp->t_sou->sou_first_member;
- m != NULL; m = m->s_next) {
+ m != NULL; m = m->s_next) {
const type_t *mtp = m->s_type;
if (mtp->t_const)
return true;
@@ -2671,8 +2671,8 @@ is_direct_function_call(const tnode_t *t
{
if (!(tn->tn_op == CALL &&
- tn->tn_left->tn_op == ADDR &&
- tn->tn_left->tn_left->tn_op == NAME))
+ tn->tn_left->tn_op == ADDR &&
+ tn->tn_left->tn_left->tn_op == NAME))
return false;
*out_name = tn->tn_left->tn_left->tn_sym->s_name;
@@ -2684,10 +2684,10 @@ is_unconst_function(const char *name)
{
return strcmp(name, "memchr") == 0 ||
- strcmp(name, "strchr") == 0 ||
- strcmp(name, "strpbrk") == 0 ||
- strcmp(name, "strrchr") == 0 ||
- strcmp(name, "strstr") == 0;
+ strcmp(name, "strchr") == 0 ||
+ strcmp(name, "strpbrk") == 0 ||
+ strcmp(name, "strrchr") == 0 ||
+ strcmp(name, "strstr") == 0;
}
static bool
@@ -2711,8 +2711,8 @@ is_const_char_pointer(const tnode_t *tn)
const type_t *tp = before_conversion(tn)->tn_type;
return tp->t_tspec == PTR &&
- tp->t_subt->t_tspec == CHAR &&
- tp->t_subt->t_const;
+ tp->t_subt->t_tspec == CHAR &&
+ tp->t_subt->t_const;
}
static bool
@@ -2956,7 +2956,7 @@ has_side_effect(const tnode_t *tn) /* NO
if (op == COLON || op == COMMA) {
return has_side_effect(tn->tn_left) ||
- has_side_effect(tn->tn_right);
+ has_side_effect(tn->tn_right);
}
return false;
@@ -2967,7 +2967,7 @@ is_void_cast(const tnode_t *tn)
{
return tn->tn_op == CVT && tn->tn_cast &&
- tn->tn_type->t_tspec == VOID;
+ tn->tn_type->t_tspec == VOID;
}
static bool
@@ -2975,8 +2975,8 @@ is_local_symbol(const tnode_t *tn)
{
return tn->tn_op == LOAD &&
- tn->tn_left->tn_op == NAME &&
- tn->tn_left->tn_sym->s_scl == AUTO;
+ tn->tn_left->tn_op == NAME &&
+ tn->tn_left->tn_sym->s_scl == AUTO;
}
static bool
@@ -2984,8 +2984,8 @@ is_int_constant_zero(const tnode_t *tn)
{
return tn->tn_op == CON &&
- tn->tn_type->t_tspec == INT &&
- tn->tn_val.u.integer == 0;
+ tn->tn_type->t_tspec == INT &&
+ tn->tn_val.u.integer == 0;
}
static void
@@ -3197,10 +3197,10 @@ typeok_enum(op_t op, const mod_t *mp, in
(ltp->t_is_enum || (mp->m_binary && rtp->t_is_enum))) {
check_bad_enum_operation(op, ln, rn);
} else if (mp->m_valid_on_enum &&
- (ltp->t_is_enum && rtp != NULL && rtp->t_is_enum)) {
+ (ltp->t_is_enum && rtp != NULL && rtp->t_is_enum)) {
check_enum_type_mismatch(op, arg, ln, rn);
} else if (mp->m_valid_on_enum &&
- (ltp->t_is_enum || (rtp != NULL && rtp->t_is_enum))) {
+ (ltp->t_is_enum || (rtp != NULL && rtp->t_is_enum))) {
check_enum_int_mismatch(op, arg, ln, rn);
}
}
@@ -3518,8 +3518,8 @@ struct_starts_with(const type_t *struct_
{
return struct_tp->t_sou->sou_first_member != NULL &&
- types_compatible(struct_tp->t_sou->sou_first_member->s_type,
- member_tp, true, false, NULL);
+ types_compatible(struct_tp->t_sou->sou_first_member->s_type,
+ member_tp, true, false, NULL);
}
static bool
@@ -3527,14 +3527,14 @@ is_byte_array(const type_t *tp)
{
return tp->t_tspec == ARRAY &&
- (tp->t_subt->t_tspec == CHAR || tp->t_subt->t_tspec == UCHAR);
+ (tp->t_subt->t_tspec == CHAR || tp->t_subt->t_tspec == UCHAR);
}
static bool
union_contains(const type_t *utp, const type_t *mtp)
{
for (const sym_t *mem = utp->t_sou->sou_first_member;
- mem != NULL; mem = mem->s_next) {
+ mem != NULL; mem = mem->s_next) {
if (types_compatible(mem->s_type, mtp, true, false, NULL))
return true;
}
@@ -3569,8 +3569,8 @@ should_warn_about_pointer_cast(const typ
const sym_t *nmem = nstp->t_sou->sou_first_member;
const sym_t *omem = ostp->t_sou->sou_first_member;
while (nmem != NULL && omem != NULL &&
- types_compatible(nmem->s_type, omem->s_type,
- true, false, NULL))
+ types_compatible(nmem->s_type, omem->s_type,
+ true, false, NULL))
nmem = nmem->s_next, omem = omem->s_next;
if (nmem != NULL && is_byte_array(nmem->s_type))
return false;
@@ -3824,8 +3824,8 @@ convert_constant_check_range_bitand(size
warning(309, type_name(gettyp(ot)),
type_name(tp), op_name(op));
} else if (nsz < osz &&
- (v->u.integer & xmask) != xmask &&
- (v->u.integer & xmask) != 0) {
+ (v->u.integer & xmask) != xmask &&
+ (v->u.integer & xmask) != 0) {
/* constant truncated by conversion, op '%s' */
warning(306, op_name(op));
}
@@ -3933,12 +3933,12 @@ convert_constant_check_range(tspec_t ot,
convert_constant_check_range_bitand(
nbitsz, obitsz, xmask, nv, ot, v, tp, op);
} else if ((nt != PTR && is_uinteger(nt)) &&
- (ot != PTR && !is_uinteger(ot)) &&
- v->u.integer < 0)
+ (ot != PTR && !is_uinteger(ot)) &&
+ v->u.integer < 0)
convert_constant_check_range_signed(op, arg);
else if (nv->u.integer != v->u.integer && nbitsz <= obitsz &&
- (v->u.integer & xmask) != 0 &&
- (is_uinteger(ot) || (v->u.integer & xmsk1) != xmsk1))
+ (v->u.integer & xmask) != 0 &&
+ (is_uinteger(ot) || (v->u.integer & xmsk1) != xmsk1))
warn_constant_check_range_truncated(op, arg, tp, ot);
else if (nv->u.integer != v->u.integer)
warn_constant_check_range_loss(op, arg, tp, ot);
@@ -4302,14 +4302,14 @@ check_function_arguments(type_t *ftp, tn
return NULL;
}
if (is_struct_or_union(at) &&
- is_incomplete(arg->tn_left->tn_type)) {
+ is_incomplete(arg->tn_left->tn_type)) {
/* argument cannot have unknown size, arg #%d */
error(152, n);
return NULL;
}
if (is_integer(at) &&
- arg->tn_left->tn_type->t_is_enum &&
- is_incomplete(arg->tn_left->tn_type)) {
+ arg->tn_left->tn_type->t_is_enum &&
+ is_incomplete(arg->tn_left->tn_type)) {
/* argument cannot have unknown size, arg #%d */
warning(152, n);
}
@@ -4418,7 +4418,7 @@ static bool
is_constcond_false(const tnode_t *tn, tspec_t t)
{
return (t == BOOL || t == INT) &&
- tn->tn_op == CON && tn->tn_val.u.integer == 0;
+ tn->tn_op == CON && tn->tn_val.u.integer == 0;
}
/*
@@ -4682,8 +4682,8 @@ check_expr_misc(const tnode_t *tn, bool
bool cvctx = mp->m_value_context;
bool ccond = mp->m_compares_with_zero;
bool eq = mp->m_warn_if_operand_eq &&
- !ln->tn_parenthesized &&
- rn != NULL && !rn->tn_parenthesized;
+ !ln->tn_parenthesized &&
+ rn != NULL && !rn->tn_parenthesized;
/*
* values of operands of ':' are not used if the type of at least
Index: src/usr.bin/xlint/lint2/chk.c
diff -u src/usr.bin/xlint/lint2/chk.c:1.62 src/usr.bin/xlint/lint2/chk.c:1.63
--- src/usr.bin/xlint/lint2/chk.c:1.62 Sat Dec 2 21:50:21 2023
+++ src/usr.bin/xlint/lint2/chk.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: chk.c,v 1.62 2023/12/02 21:50:21 rillig Exp $ */
+/* $NetBSD: chk.c,v 1.63 2023/12/03 12:03:38 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.62 2023/12/02 21:50:21 rillig Exp $");
+__RCSID("$NetBSD: chk.c,v 1.63 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <ctype.h>
@@ -377,14 +377,14 @@ chkfaui(const hte_t *hte, sym_t *def, sy
break;
n++;
chkau(hte, n, def, decl, pos1p, call1, call,
- *ap1, *ap2);
+ *ap1, *ap2);
ap1++;
ap2++;
}
if (*ap1 == *ap2) {
/* equal # of arguments */
} else if (def != NULL && def->s_check_only_first_args &&
- n >= def->s_check_num_args) {
+ n >= def->s_check_num_args) {
/*
* function definition with VARARGS; The # of
* arguments of the call must be at least as large
@@ -761,7 +761,7 @@ printflike(const hte_t *hte, fcall_t *ca
goto uint_conv;
}
} else if (fc == 'f' || fc == 'e' || fc == 'E' ||
- fc == 'g' || fc == 'G') {
+ fc == 'g' || fc == 'G') {
if (sz == NO_TSPEC)
sz = DOUBLE;
if (sz != DOUBLE && sz != LDOUBLE)
@@ -980,7 +980,7 @@ scanflike(const hte_t *hte, fcall_t *cal
if (t1 != PTR) {
inconsistent_arguments(hte, call, n);
} else if (t2 != CHAR && t2 != UCHAR &&
- t2 != SCHAR) {
+ t2 != SCHAR) {
inconsistent_arguments(hte, call, n);
}
}
Index: src/usr.bin/xlint/lint2/read.c
diff -u src/usr.bin/xlint/lint2/read.c:1.87 src/usr.bin/xlint/lint2/read.c:1.88
--- src/usr.bin/xlint/lint2/read.c:1.87 Thu Jul 13 08:40:38 2023
+++ src/usr.bin/xlint/lint2/read.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.87 2023/07/13 08:40:38 rillig Exp $ */
+/* $NetBSD: read.c,v 1.88 2023/12/03 12:03:38 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.87 2023/07/13 08:40:38 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.88 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <ctype.h>
@@ -635,7 +635,7 @@ parse_tspec(const char **pp, char c, boo
return s == 'e' ? ENUM : (s == 's' ? STRUCT : UNION);
case 'X':
return s == 's' ? FCOMPLEX
- : (s == 'l' ? LCOMPLEX : DCOMPLEX);
+ : (s == 'l' ? LCOMPLEX : DCOMPLEX);
default:
inperr("tspec '%c'", c);
/* NOTREACHED */
@@ -698,7 +698,7 @@ inptype(const char *cp, const char **epp
tp->t_proto = true;
narg = parse_int(&cp);
tp->t_args = xcalloc((size_t)narg + 1,
- sizeof(*tp->t_args));
+ sizeof(*tp->t_args));
for (i = 0; i < narg; i++) {
if (i == narg - 1 && *cp == 'E') {
tp->t_vararg = true;
Index: src/usr.bin/xlint/xlint/xlint.c
diff -u src/usr.bin/xlint/xlint/xlint.c:1.117 src/usr.bin/xlint/xlint/xlint.c:1.118
--- src/usr.bin/xlint/xlint/xlint.c:1.117 Thu Oct 26 20:21:13 2023
+++ src/usr.bin/xlint/xlint/xlint.c Sun Dec 3 12:03:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.117 2023/10/26 20:21:13 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.118 2023/12/03 12:03:38 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.117 2023/10/26 20:21:13 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.118 2023/12/03 12:03:38 rillig Exp $");
#endif
#include <sys/param.h>
@@ -265,8 +265,8 @@ is_safe_shell(char ch)
{
return ch_isalnum(ch) || ch == '%' || ch == '+' || ch == ',' ||
- ch == '-' || ch == '.' || ch == '/' || ch == ':' ||
- ch == '=' || ch == '@' || ch == '_';
+ ch == '-' || ch == '.' || ch == '/' || ch == ':' ||
+ ch == '=' || ch == '@' || ch == '_';
}
static void