CVS commit: src/lib/libutil

2024-05-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu May  2 18:34:01 UTC 2024

Modified Files:
src/lib/libutil: parsedate.3

Log Message:
parsedate.3: resolve contradictory values for 'next'


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libutil/parsedate.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libutil

2024-05-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu May  2 18:34:01 UTC 2024

Modified Files:
src/lib/libutil: parsedate.3

Log Message:
parsedate.3: resolve contradictory values for 'next'


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libutil/parsedate.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libutil/parsedate.3
diff -u src/lib/libutil/parsedate.3:1.26 src/lib/libutil/parsedate.3:1.27
--- src/lib/libutil/parsedate.3:1.26	Sun May 16 19:42:35 2021
+++ src/lib/libutil/parsedate.3	Thu May  2 18:34:01 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: parsedate.3,v 1.26 2021/05/16 19:42:35 kre Exp $
+.\" $NetBSD: parsedate.3,v 1.27 2024/05/02 18:34:01 rillig Exp $
 .\"
 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -96,7 +96,8 @@ The following words have the indicated n
 .Dv first , next ,
 or
 .Dv one =
-1,
+1
+.Pq but see the BUGS section below ,
 .Dv second
 is unused so that it is not confused with
 .Dq seconds ,



Re: CVS commit: src/lib/libutil

2024-05-01 Thread Roland Illig
Am 01.05.2024 um 21:59 schrieb Christos Zoulas:
> Module Name:  src
> Committed By: christos
> Date: Wed May  1 19:59:08 UTC 2024
>
> Modified Files:
>   src/lib/libutil: parsedate.y
>
> Log Message:
> next should increement by 1 not 2.

Are you sure? I get these test results:

> t_parsedate (2/5): 7 test cases
> atsecs: [0.006548s] Passed.
> dates: [0.007241s] Passed.
> dsttimes: [0.007517s] Passed.
> gibberish: [0.007637s] Passed.
> relative: [0.287375s] Failed: 2258 checks failed; see output for more 
> details
> times: [0.008402s] Passed.
> zones: [0.007586s] Passed.

After your change, "next sunday" goes backward in time, for example:

> From 28110552 (Sun Nov 22 08:29:12 1970) using "next sunday",
> obtained 2808 (Sun Nov 22 00:00:00 1970);
> expected 28684800 (Sun Nov 29 00:00:00 1970)



CVS commit: src

2024-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 17:42:58 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: decl.c
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: make 'offsetof(t, array-member)' a constant expression

The macro 'offsetof(t, m)' already expanded to a constant expression for
scalar members but not for arrays.  This was because the macro expanded
to '(size_t)(((t *)0)->m)', which lint internally represents as
'addr(indir(ptr(0) + offset(m)))', and build_address simplifies
'addr(indir(x))' to 'x' if the types match.  The types only match for
scalar types though, but not for arrays.

When build_address happens, the type information is incomplete,
therefore 'offsetof(t, array)' has to be simplified at a later point.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.638 -r1.639 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/decl.c
diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.29 src/tests/usr.bin/xlint/lint1/decl.c:1.30
--- src/tests/usr.bin/xlint/lint1/decl.c:1.29	Wed May  1 12:36:56 2024
+++ src/tests/usr.bin/xlint/lint1/decl.c	Wed May  1 17:42:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl.c,v 1.29 2024/05/01 12:36:56 rillig Exp $	*/
+/*	$NetBSD: decl.c,v 1.30 2024/05/01 17:42:57 rillig Exp $	*/
 # 3 "decl.c"
 
 /*
@@ -243,22 +243,29 @@ get_x(struct point3d { struct point3d_nu
 }
 
 // Expressions of the form '(size_t)_ptr->member' are used by several
-// C implementations to implement the offsetof macro.  Dereferencing a null
-// pointer invokes undefined behavior, though, even in this form.
+// C implementations to implement the offsetof macro.
 void
 offsetof_on_array_member(void)
 {
-	struct s1 {
+	typedef struct {
 		int padding, plain, arr[2];
-	};
+	} s1;
 
+	// Bit-fields must have a constant number of bits.
 	struct s2 {
-		unsigned int off_plain:(unsigned long)&((struct s1 *)0)->plain;
-		// FIXME: offsetof must work for array members as well.
-		/* expect+1: error: integral constant expression expected [55] */
-		unsigned int off_arr:(unsigned long)&((struct s1 *)0)->arr;
-		// FIXME: offsetof must work for array members as well.
-		/* expect+1: error: integral constant expression expected [55] */
-		unsigned int off_arr_element:(unsigned long)&((struct s1 *)0)->arr[0];
+		unsigned int off_plain:(unsigned long)&((s1 *)0)->plain;
+		unsigned int off_arr:(unsigned long)&((s1 *)0)->arr;
+		unsigned int off_arr_0:(unsigned long)&((s1 *)0)->arr[0];
+		unsigned int off_arr_3:(unsigned long)&((s1 *)0)->arr[3];
 	};
+
+	// Arrays may be variable-width, but the diagnostic reveals the size.
+	/* expect+1: error: negative array dimension (-4) [20] */
+	typedef int off_plain[-(int)(unsigned long)&((s1 *)0)->plain];
+	/* expect+1: error: negative array dimension (-8) [20] */
+	typedef int off_arr[-(int)(unsigned long)&((s1 *)0)->arr];
+	/* expect+1: error: negative array dimension (-8) [20] */
+	typedef int off_arr_0[-(int)(unsigned long)&((s1 *)0)->arr[0]];
+	/* expect+1: error: negative array dimension (-20) [20] */
+	typedef int off_arr_3[-(int)(unsigned long)&((s1 *)0)->arr[3]];
 }

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.638 src/usr.bin/xlint/lint1/tree.c:1.639
--- src/usr.bin/xlint/lint1/tree.c:1.638	Wed May  1 05:49:33 2024
+++ src/usr.bin/xlint/lint1/tree.c	Wed May  1 17:42:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.638 2024/05/01 05:49:33 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.639 2024/05/01 17:42:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.638 2024/05/01 05:49:33 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.639 2024/05/01 17:42:57 rillig Exp $");
 #endif
 
 #include 
@@ -4112,6 +4112,28 @@ cast_to_union(tnode_t *otn, bool sys, ty
 	return NULL;
 }
 
+// In GCC mode, allow 'nullptr + offset' as a constant expression.
+static tnode_t *
+null_pointer_offset(tnode_t *tn)
+{
+	uint64_t off = 0;
+	const tnode_t *n = tn;
+	while ((n->tn_op == PLUS || n->tn_op == MINUS)
+	&& is_integer(n->u.ops.right->tn_type->t_tspec)) {
+		off += (uint64_t)n->u.ops.right->u.value.u.integer;
+		n = n->u.ops.left;
+	}
+	if (n->tn_type->t_tspec == PTR
+	&& n->tn_op == ADDR
+	&& n->u.ops.left->tn_op == INDIR
+	&& n->u.ops.left->u.ops.left->tn_op == CON
+	&& n->u.ops.left->u.ops.left->tn_type->t_tspec == PTR) {
+		off += (uint64_t)n->u.ops.left->u.ops.left->u.value.u.integer;
+		return build_integer_constant(SIZEOF_TSPEC, (int64_t)off);
+	}
+	return tn;
+}
+
 tnode_t *
 cast(tnode_t *tn, bool sys, type_t *tp)
 {
@@ -4144,7 +4166,7 @@ cast(tnode_t *tn, bool sys, type_t *tp)
 		error(148);
 		return NULL;
 	} else if (is_integer(nt) && is_scalar(ot)) {
-		/* ok */
+		tn = 

CVS commit: src

2024-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 17:42:58 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: decl.c
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: make 'offsetof(t, array-member)' a constant expression

The macro 'offsetof(t, m)' already expanded to a constant expression for
scalar members but not for arrays.  This was because the macro expanded
to '(size_t)(((t *)0)->m)', which lint internally represents as
'addr(indir(ptr(0) + offset(m)))', and build_address simplifies
'addr(indir(x))' to 'x' if the types match.  The types only match for
scalar types though, but not for arrays.

When build_address happens, the type information is incomplete,
therefore 'offsetof(t, array)' has to be simplified at a later point.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.638 -r1.639 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/usr.bin/xlint/lint1

2024-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 12:36:56 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: decl.c decl_enum.c

Log Message:
tests/lint: test large enum constants and offsetof with array members


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/decl_enum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/usr.bin/xlint/lint1

2024-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 12:36:56 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: decl.c decl_enum.c

Log Message:
tests/lint: test large enum constants and offsetof with array members


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/decl_enum.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/decl.c
diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.28 src/tests/usr.bin/xlint/lint1/decl.c:1.29
--- src/tests/usr.bin/xlint/lint1/decl.c:1.28	Sun Jan 28 08:17:27 2024
+++ src/tests/usr.bin/xlint/lint1/decl.c	Wed May  1 12:36:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl.c,v 1.28 2024/01/28 08:17:27 rillig Exp $	*/
+/*	$NetBSD: decl.c,v 1.29 2024/05/01 12:36:56 rillig Exp $	*/
 # 3 "decl.c"
 
 /*
@@ -241,3 +241,24 @@ get_x(struct point3d { struct point3d_nu
 	static struct point3d_number z;
 	return arg.x.v + local.x.v + z.v;
 }
+
+// Expressions of the form '(size_t)_ptr->member' are used by several
+// C implementations to implement the offsetof macro.  Dereferencing a null
+// pointer invokes undefined behavior, though, even in this form.
+void
+offsetof_on_array_member(void)
+{
+	struct s1 {
+		int padding, plain, arr[2];
+	};
+
+	struct s2 {
+		unsigned int off_plain:(unsigned long)&((struct s1 *)0)->plain;
+		// FIXME: offsetof must work for array members as well.
+		/* expect+1: error: integral constant expression expected [55] */
+		unsigned int off_arr:(unsigned long)&((struct s1 *)0)->arr;
+		// FIXME: offsetof must work for array members as well.
+		/* expect+1: error: integral constant expression expected [55] */
+		unsigned int off_arr_element:(unsigned long)&((struct s1 *)0)->arr[0];
+	};
+}

Index: src/tests/usr.bin/xlint/lint1/decl_enum.c
diff -u src/tests/usr.bin/xlint/lint1/decl_enum.c:1.4 src/tests/usr.bin/xlint/lint1/decl_enum.c:1.5
--- src/tests/usr.bin/xlint/lint1/decl_enum.c:1.4	Fri Jun 30 21:39:54 2023
+++ src/tests/usr.bin/xlint/lint1/decl_enum.c	Wed May  1 12:36:56 2024
@@ -1,10 +1,22 @@
-/*	$NetBSD: decl_enum.c,v 1.4 2023/06/30 21:39:54 rillig Exp $	*/
+/*	$NetBSD: decl_enum.c,v 1.5 2024/05/01 12:36:56 rillig Exp $	*/
 # 3 "decl_enum.c"
 
 /*
  * Tests for enum declarations.
  */
 
+
+// Initializing an enum from a 64-bit value cuts off the upper bits.
+// TIME_MIN thus gets truncated from 0x8000___ to 0.
+// TIME_MAX thus gets truncated from 0x7fff___ to -1.
+enum {
+	/* expect+1: warning: integral constant too large [56] */
+	TIME_MIN = (long long)(1ULL << 63),
+	/* expect+1: warning: integral constant too large [56] */
+	TIME_MAX = (long long)~(1ULL << 63),
+};
+
+
 /* cover 'enumerator_list: error' */
 enum {
 	/* expect+1: error: syntax error 'goto' [249] */



CVS commit: src

2024-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 10:30:56 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: gcc_attribute_aligned.c
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: fix size of struct with large alignment

Lint now successfully passes all compile-time assertions in the amd64
kernel that deal with struct sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c
cvs rdiff -u -r1.399 -r1.400 src/usr.bin/xlint/lint1/decl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c:1.7 src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c:1.8
--- src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c:1.7	Wed May  1 07:40:11 2024
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c	Wed May  1 10:30:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gcc_attribute_aligned.c,v 1.7 2024/05/01 07:40:11 rillig Exp $	*/
+/*	$NetBSD: gcc_attribute_aligned.c,v 1.8 2024/05/01 10:30:56 rillig Exp $	*/
 # 3 "gcc_attribute_aligned.c"
 
 /*
@@ -72,3 +72,13 @@ aligned_struct_member(void)
 	/* expect+1: error: negative array dimension (-32) [20] */
 	typedef int ctassert[-(int)sizeof(struct aligned)];
 }
+
+void
+alignment_larger_than_size(void)
+{
+	struct s {
+		unsigned u32 __attribute__((__aligned__(32)));
+	} _Alignas(4096);
+	/* expect+1: error: negative array dimension (-4096) [20] */
+	typedef int size[-(int)sizeof(struct s)];
+}

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.399 src/usr.bin/xlint/lint1/decl.c:1.400
--- src/usr.bin/xlint/lint1/decl.c:1.399	Wed May  1 07:40:11 2024
+++ src/usr.bin/xlint/lint1/decl.c	Wed May  1 10:30:56 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.399 2024/05/01 07:40:11 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.400 2024/05/01 10:30:56 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.399 2024/05/01 07:40:11 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.400 2024/05/01 10:30:56 rillig Exp $");
 #endif
 
 #include 
@@ -463,6 +463,9 @@ void
 dcs_add_alignas(tnode_t *tn)
 {
 	dcs->d_mem_align_in_bits = to_int_constant(tn, true) * CHAR_SIZE;
+	if (dcs->d_type != NULL && is_struct_or_union(dcs->d_type->t_tspec))
+		dcs->d_type->u.sou->sou_align_in_bits =
+		dcs->d_mem_align_in_bits;
 }
 
 void
@@ -606,6 +609,7 @@ dcs_begin_type(void)
 	dcs->d_redeclared_symbol = NULL;
 	// keep d_sou_size_in_bits
 	// keep d_sou_align_in_bits
+	dcs->d_mem_align_in_bits = 0;
 	dcs->d_qual = (type_qualifiers) { .tq_const = false };
 	dcs->d_inline = false;
 	dcs->d_multiple_storage_classes = false;
@@ -707,6 +711,8 @@ dcs_merge_declaration_specifiers(void)
 	debug_dcs();
 }
 
+static void dcs_align(unsigned int, unsigned int);
+
 /* Create a type in 'dcs->d_type' from the information gathered in 'dcs'. */
 void
 dcs_end_type(void)
@@ -741,6 +747,14 @@ dcs_end_type(void)
 		dcs->d_type->t_const |= dcs->d_qual.tq_const;
 		dcs->d_type->t_volatile |= dcs->d_qual.tq_volatile;
 	}
+	unsigned align = dcs->d_mem_align_in_bits;
+	if (align > 0 && dcs->d_type->t_tspec == STRUCT) {
+		dcs_align(align, 0);
+		dcs->d_type->u.sou->sou_align_in_bits = align;
+		dcs->d_type->u.sou->sou_size_in_bits =
+		(dcs->d_type->u.sou->sou_size_in_bits + align - 1)
+		& -align;
+	}
 
 	debug_dcs();
 	debug_leave();
@@ -814,7 +828,6 @@ alignment_in_bits(const type_t *tp)
 			a = worst_align_in_bits;
 	}
 	lint_assert(a >= CHAR_SIZE);
-	lint_assert(a <= worst_align_in_bits);
 	return a;
 }
 



CVS commit: src

2024-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 10:30:56 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: gcc_attribute_aligned.c
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: fix size of struct with large alignment

Lint now successfully passes all compile-time assertions in the amd64
kernel that deal with struct sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c
cvs rdiff -u -r1.399 -r1.400 src/usr.bin/xlint/lint1/decl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/sys

2024-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 07:43:42 UTC 2024

Modified Files:
src/sys/sys: cdefs.h

Log Message:
sys/cdefs.h: pass __aligned to lint

Lint could parse _Alignas and __attribute__((__aligned__(4))) previously
but simply ignored them. Since today, they affect the layout of struct
and union.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/sys/cdefs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/sys

2024-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 07:43:42 UTC 2024

Modified Files:
src/sys/sys: cdefs.h

Log Message:
sys/cdefs.h: pass __aligned to lint

Lint could parse _Alignas and __attribute__((__aligned__(4))) previously
but simply ignored them. Since today, they affect the layout of struct
and union.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/sys/cdefs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.160 src/sys/sys/cdefs.h:1.161
--- src/sys/sys/cdefs.h:1.160	Sun Apr 30 08:45:48 2023
+++ src/sys/sys/cdefs.h	Wed May  1 07:43:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.160 2023/04/30 08:45:48 riastradh Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.161 2024/05/01 07:43:41 rillig Exp $	*/
 
 /* * Copyright (c) 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -451,7 +451,7 @@
 #if defined(__lint__)
 #define __thread	/* delete */
 #define	__packed	__packed
-#define	__aligned(x)	/* delete */
+#define	__aligned(x)	_Alignas((x))
 #define	__section(x)	/* delete */
 #elif __GNUC_PREREQ__(2, 7) || defined(__PCC__) || defined(__lint__)
 #define	__packed	__attribute__((__packed__))



CVS commit: src

2024-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 07:40:11 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: expr_precedence.c
gcc_attribute_aligned.c
src/usr.bin/xlint/lint1: cgram.y debug.c decl.c externs1.h lint1.h

Log Message:
lint: support _Alignas and __attribute__((__aligned(4)))


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/expr_precedence.c
cvs rdiff -u -r1.6 -r1.7 \
src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c
cvs rdiff -u -r1.493 -r1.494 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.398 -r1.399 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.222 -r1.223 src/usr.bin/xlint/lint1/externs1.h \
src/usr.bin/xlint/lint1/lint1.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/expr_precedence.c
diff -u src/tests/usr.bin/xlint/lint1/expr_precedence.c:1.11 src/tests/usr.bin/xlint/lint1/expr_precedence.c:1.12
--- src/tests/usr.bin/xlint/lint1/expr_precedence.c:1.11	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/expr_precedence.c	Wed May  1 07:40:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: expr_precedence.c,v 1.11 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: expr_precedence.c,v 1.12 2024/05/01 07:40:11 rillig Exp $	*/
 # 3 "expr_precedence.c"
 
 /*
@@ -20,8 +20,9 @@ int init_error = 3, 4;
 int init_syntactically_ok = var = 1 ? 2 : 3;
 
 /*
- * The arguments of __attribute__ must be constant-expression, as assignments
- * don't make sense at that point.
+ * The arguments of __attribute__ must be constant-expression, but for
+ * simplicity of implementation, they are parsed just like function arguments,
+ * even though this allows assignment-expression.
  */
 void __attribute__((format(printf,
 /*
@@ -32,7 +33,6 @@ void __attribute__((format(printf,
  *
  * See lex.c, function 'search', keyword 'in_gcc_attribute'.
  */
-/* expect+1: error: syntax error '=' [249] */
 var = 1,
 /* Syntactically ok, must be a constant expression though. */
 var > 0 ? 2 : 1)))

Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c:1.6 src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c:1.7
--- src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c:1.6	Fri Jul  7 19:45:22 2023
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c	Wed May  1 07:40:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gcc_attribute_aligned.c,v 1.6 2023/07/07 19:45:22 rillig Exp $	*/
+/*	$NetBSD: gcc_attribute_aligned.c,v 1.7 2024/05/01 07:40:11 rillig Exp $	*/
 # 3 "gcc_attribute_aligned.c"
 
 /*
@@ -47,8 +47,8 @@ struct save87 {
 	struct fpacc87 s87_ac[8];
 };
 
-/* FIXME: @4 2 + @4 2 + @4 2 + @4 8 + @4 8 + @2 (8 * 10) == 108 */
-/* expect+1: error: negative array dimension (-104) [20] */
+/* @4 2 + @4 2 + @4 2 + @4 8 + @4 8 + @2 (8 * 10) == 108 */
+/* expect+1: error: negative array dimension (-108) [20] */
 typedef int sizeof_save87[-(int)sizeof(struct save87)];
 
 
@@ -69,7 +69,6 @@ aligned_struct_member(void)
 	 *
 	 * https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html
 	 */
-	/* TODO: should be -32 instead of -8. */
-	/* expect+1: error: negative array dimension (-8) [20] */
+	/* expect+1: error: negative array dimension (-32) [20] */
 	typedef int ctassert[-(int)sizeof(struct aligned)];
 }

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.493 src/usr.bin/xlint/lint1/cgram.y:1.494
--- src/usr.bin/xlint/lint1/cgram.y:1.493	Fri Mar 29 08:35:32 2024
+++ src/usr.bin/xlint/lint1/cgram.y	Wed May  1 07:40:11 2024
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.493 2024/03/29 08:35:32 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.494 2024/05/01 07:40:11 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.493 2024/03/29 08:35:32 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.494 2024/05/01 07:40:11 rillig Exp $");
 #endif
 
 #include 
@@ -423,7 +423,6 @@ is_either(const char *s, const char *a, 
 /* No type for gcc_attribute_specifier. */
 /* No type for gcc_attribute_list. */
 /* No type for gcc_attribute. */
-/* No type for gcc_attribute_parameters. */
 %type	 sys
 
 %%
@@ -937,8 +936,12 @@ type_attribute_opt:
 
 type_attribute:			/* See C11 6.7 declaration-specifiers */
 	gcc_attribute_specifier
-|	T_ALIGNAS T_LPAREN type_specifier T_RPAREN	/* C11 6.7.5 */
-|	T_ALIGNAS T_LPAREN constant_expression T_RPAREN	/* C11 6.7.5 */
+|	T_ALIGNAS T_LPAREN type_specifier T_RPAREN {		/* C11 6.7.5 */
+		dcs_add_alignas(build_sizeof($3));
+	}
+|	T_ALIGNAS T_LPAREN constant_expression T_RPAREN {	/* C11 6.7.5 */
+		dcs_add_alignas($3);
+	}
 |	T_PACKED {
 		dcs_add_packed();
 	}
@@ -2197,18 +2200,18 @@ gcc_attribute:
 	

CVS commit: src

2024-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 07:40:11 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: expr_precedence.c
gcc_attribute_aligned.c
src/usr.bin/xlint/lint1: cgram.y debug.c decl.c externs1.h lint1.h

Log Message:
lint: support _Alignas and __attribute__((__aligned(4)))


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/expr_precedence.c
cvs rdiff -u -r1.6 -r1.7 \
src/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c
cvs rdiff -u -r1.493 -r1.494 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.398 -r1.399 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.222 -r1.223 src/usr.bin/xlint/lint1/externs1.h \
src/usr.bin/xlint/lint1/lint1.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 05:49:33 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_132.c
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: fix warning about out-of-bounds bit-field value


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/tests/usr.bin/xlint/lint1/msg_132.c
cvs rdiff -u -r1.637 -r1.638 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 05:49:33 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_132.c
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: fix warning about out-of-bounds bit-field value


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/tests/usr.bin/xlint/lint1/msg_132.c
cvs rdiff -u -r1.637 -r1.638 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_132.c
diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.39 src/tests/usr.bin/xlint/lint1/msg_132.c:1.40
--- src/tests/usr.bin/xlint/lint1/msg_132.c:1.39	Wed May  1 05:38:11 2024
+++ src/tests/usr.bin/xlint/lint1/msg_132.c	Wed May  1 05:49:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_132.c,v 1.39 2024/05/01 05:38:11 rillig Exp $	*/
+/*	$NetBSD: msg_132.c,v 1.40 2024/05/01 05:49:33 rillig Exp $	*/
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -265,13 +265,13 @@ test_ic_shr(u64_t x)
 unsigned char
 test_bit_fields(unsigned long long m)
 {
-	/* expect+1: warning: conversion from 'unsigned long long:32' to 'unsigned int:3' may lose accuracy [132] */
+	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int:3' may lose accuracy [132] */
 	bits.u3 = bits.u32 & m;
 
 	bits.u5 = bits.u3 & m;
 	bits.u32 = bits.u5 & m;
 
-	/* expect+1: warning: conversion from 'unsigned long long:32' to 'unsigned char' may lose accuracy [132] */
+	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned char' may lose accuracy [132] */
 	return bits.u32 & m;
 }
 
@@ -450,6 +450,7 @@ binary_operators_on_bit_fields(void)
 	cond = (s.u15 | s.u48 | s.u64) != 0;
 	cond = (s.u64 | s.u48 | s.u15) != 0;
 
-	/* expect+1: warning: conversion of 'int' to 'int:4' is out of range [119] */
+	// Before tree.c from 1.638 from 2024-05-01, lint wrongly warned:
+	// warning: conversion of 'int' to 'int:4' is out of range [119]
 	s32 = 8 - bits.u3;
 }

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.637 src/usr.bin/xlint/lint1/tree.c:1.638
--- src/usr.bin/xlint/lint1/tree.c:1.637	Sat Apr 27 12:46:37 2024
+++ src/usr.bin/xlint/lint1/tree.c	Wed May  1 05:49:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.637 2024/04/27 12:46:37 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.638 2024/05/01 05:49:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.637 2024/04/27 12:46:37 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.638 2024/05/01 05:49:33 rillig Exp $");
 #endif
 
 #include 
@@ -763,12 +763,14 @@ balance(op_t op, tnode_t **lnp, tnode_t 
 	if (t != rt)
 		*rnp = apply_usual_arithmetic_conversions(op, *rnp, t);
 
-	unsigned lw = (*lnp)->tn_type->t_bit_field_width;
-	unsigned rw = (*rnp)->tn_type->t_bit_field_width;
-	if (lw < rw)
-		*lnp = convert(NOOP, 0, (*rnp)->tn_type, *lnp);
-	if (rw < lw)
-		*rnp = convert(NOOP, 0, (*lnp)->tn_type, *rnp);
+	if (is_integer(t)) {
+		unsigned lw = width_in_bits((*lnp)->tn_type);
+		unsigned rw = width_in_bits((*rnp)->tn_type);
+		if (lw < rw)
+			*lnp = convert(NOOP, 0, (*rnp)->tn_type, *lnp);
+		if (rw < lw)
+			*rnp = convert(NOOP, 0, (*lnp)->tn_type, *rnp);
+	}
 }
 
 static tnode_t *



CVS commit: src/tests/usr.bin/xlint/lint1

2024-04-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 05:38:11 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_132.c

Log Message:
lint: demonstrate wrong warning about out-of-range bit-field


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/tests/usr.bin/xlint/lint1/msg_132.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_132.c
diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.38 src/tests/usr.bin/xlint/lint1/msg_132.c:1.39
--- src/tests/usr.bin/xlint/lint1/msg_132.c:1.38	Mon Mar 25 23:39:14 2024
+++ src/tests/usr.bin/xlint/lint1/msg_132.c	Wed May  1 05:38:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_132.c,v 1.38 2024/03/25 23:39:14 rillig Exp $	*/
+/*	$NetBSD: msg_132.c,v 1.39 2024/05/01 05:38:11 rillig Exp $	*/
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -449,4 +449,7 @@ binary_operators_on_bit_fields(void)
 	u64 = s.u64 | s.u48 | s.u15;
 	cond = (s.u15 | s.u48 | s.u64) != 0;
 	cond = (s.u64 | s.u48 | s.u15) != 0;
+
+	/* expect+1: warning: conversion of 'int' to 'int:4' is out of range [119] */
+	s32 = 8 - bits.u3;
 }



CVS commit: src/tests/usr.bin/xlint/lint1

2024-04-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed May  1 05:38:11 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_132.c

Log Message:
lint: demonstrate wrong warning about out-of-range bit-field


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/tests/usr.bin/xlint/lint1/msg_132.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/arch/hp300/dev

2024-04-30 Thread Roland Illig
Am 30.04.2024 um 11:55 schrieb Izumi Tsutsui:
> Module Name:  src
> Committed By: tsutsui
> Date: Tue Apr 30 09:55:46 UTC 2024
>
> Modified Files:
>   src/sys/arch/hp300/dev: dma.c
>
> Log Message:
> Fix another fatal typo that prevents dma(4) interrupts.

The buggy code was:
>   if ((sc->sc_ipl == ipl) == 0) {

The typo in the first '==' can be found by treating bool as a data type
incompatible with any other scalar type, and this is what lint does in
its "strict bool mode".

Lint is not yet ready for the whole kernel source, as it errors out on
232 of the 3223 source files. But it can check hp300/dma.c, and running
it with the extra flag -T finds the bug, among several false positives.

If you want to play around a bit, the attached patch allows you to
suppress the uninteresting lint warnings in the kernel source, and to
configure per-file lint flags. To detect the above bug in dma.c 1.47, run:

cd OBJDIR/sys/arch/hp300/compile/GENERIC
make dma.ln KERNLINTFLAGS.dma.c=-T

Roland
Index: sys/conf/lint.mk
===
RCS file: /cvsroot/src/sys/conf/lint.mk,v
retrieving revision 1.5
diff -u -r1.5 lint.mk
--- sys/conf/lint.mk27 Aug 2022 21:49:33 -  1.5
+++ sys/conf/lint.mk30 Apr 2024 22:50:59 -
@@ -5,11 +5,25 @@
 ##
 
 .if !target(lint)
+DEFKERNLINTFLAGS=  -bceghnxzFS
+DEFKERNLINTFLAGS+= -X 0# empty declaration
+DEFKERNLINTFLAGS+= -X 2# empty declaration
+DEFKERNLINTFLAGS+= -X 56   # integral constant too large
+DEFKERNLINTFLAGS+= -X 129  # expression with null effect
+DEFKERNLINTFLAGS+= -X 161  # constant in conditional context
+DEFKERNLINTFLAGS+= -X 226  # static variable unused
+DEFKERNLINTFLAGS+= -X 231  # unused parameter
+DEFKERNLINTFLAGS+= -X 236  # unused static function
+DEFKERNLINTFLAGS+= -X 247  # pointer cast may be troublesome
+DEFKERNLINTFLAGS+= -X 309  # lossy bitwise '&'
+DEFKERNLINTFLAGS+= -X 351  # missing header declaration
+DEFKERNLINTFLAGS+= -X 352  # nested 'extern' declaration
+
 .PATH: $S
 ALLSFILES?=${MD_SFILES} ${SFILES}
 LINTSTUBS?=${ALLSFILES:T:R:%=LintStub_%.c}
-KERNLINTFLAGS?=-bceghnxzFS
-NORMAL_LN?=${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -o $@ -i $<
+KERNLINTFLAGS?=${DEFKERNLINTFLAGS}
+NORMAL_LN?=${LINT} ${KERNLINTFLAGS} ${KERNLINTFLAGS.${.IMPSRC:T}} 
${CPPFLAGS:M-[IDU]*} -o $@ -i $<
 
 _lsrc= ${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
 LOBJS?=${_lsrc:T:.c=.ln} ${LIBKERNLN} ${SYSLIBCOMPATLN}


CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:57:16 UTC 2024

Modified Files:
src/lib/libc/gen: time.3

Log Message:
time.3: clarify that *tloc is always set if tloc != NULL


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gen/time.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/time.3
diff -u src/lib/libc/gen/time.3:1.16 src/lib/libc/gen/time.3:1.17
--- src/lib/libc/gen/time.3:1.16	Sat Nov  5 18:17:29 2011
+++ src/lib/libc/gen/time.3	Sun Apr 28 22:57:16 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: time.3,v 1.16 2011/11/05 18:17:29 christos Exp $
+.\"	$NetBSD: time.3,v 1.17 2024/04/28 22:57:16 rillig Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\" @(#)time.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd November 5, 2011
+.Dd April 29, 2024
 .Dt TIME 3
 .Os
 .Sh NAME
@@ -52,21 +52,17 @@ function
 returns the value of time in seconds since 0 hours, 0 minutes,
 0 seconds, January 1, 1970, Coordinated Universal Time.
 .Pp
-A copy of the time value may be saved to the area indicated by the
-pointer
-.Fa tloc .
 If
 .Fa tloc
-is a
-.Dv NULL
-pointer, no value is stored.
+is not a null pointer, a copy of the time value is saved in
+.Fa *tloc .
 .Pp
 Upon successful completion,
 .Fn time
 returns the value of time.
 Otherwise a value of
 .Po
-.Po Fa time_t Pc \-1
+.Po Fa time_t Pc Ns \-1
 .Pc
 is returned and the global variable
 .Va errno



CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:57:16 UTC 2024

Modified Files:
src/lib/libc/gen: time.3

Log Message:
time.3: clarify that *tloc is always set if tloc != NULL


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gen/time.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:43:30 UTC 2024

Modified Files:
src/lib/libc/gen: setmode.3

Log Message:
setmode.3: fix typos


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/setmode.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/setmode.3
diff -u src/lib/libc/gen/setmode.3:1.23 src/lib/libc/gen/setmode.3:1.24
--- src/lib/libc/gen/setmode.3:1.23	Sat Mar 12 17:31:39 2022
+++ src/lib/libc/gen/setmode.3	Sun Apr 28 22:43:30 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: setmode.3,v 1.23 2022/03/12 17:31:39 christos Exp $
+.\"	$NetBSD: setmode.3,v 1.24 2024/04/28 22:43:30 rillig Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -51,16 +51,15 @@ function accepts a string representation
 compiles it to binary form, and returns an abstract representation
 that may be passed to
 .Fn getmode .
-The string may be an numeric (octal) or symbolic string of the form
+The string may be a numeric (octal) or symbolic string of the form
 accepted by
 .Xr chmod 1 ,
 and may represent either an exact mode to set or a change to make to
-the existing mode.
+an existing mode.
 .Pp
 The
 .Fn getmode
-function
-adjusts the file permission bits given by
+function adjusts the file permission bits given by
 .Fa mode
 according to the compiled change representation
 .Fa set ,
@@ -116,7 +115,7 @@ or
 .Xr strtol 3 .
 In addition,
 .Fn setmode
-will fail and set
+may fail and set
 .Va errno
 to:
 .Bl -tag -width Er



CVS commit: src/lib/libc/gen

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:43:30 UTC 2024

Modified Files:
src/lib/libc/gen: setmode.3

Log Message:
setmode.3: fix typos


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/setmode.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/sys

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:21:21 UTC 2024

Modified Files:
src/lib/libc/sys: execve.2

Log Message:
execve.2: fix typo in markup


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/sys/execve.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/execve.2
diff -u src/lib/libc/sys/execve.2:1.45 src/lib/libc/sys/execve.2:1.46
--- src/lib/libc/sys/execve.2:1.45	Wed Sep 18 04:57:53 2019
+++ src/lib/libc/sys/execve.2	Sun Apr 28 22:21:21 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: execve.2,v 1.45 2019/09/18 04:57:53 wiz Exp $
+.\"	$NetBSD: execve.2,v 1.46 2024/04/28 22:21:21 rillig Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -83,7 +83,7 @@ An interpreter file begins with a line o
 .Ed
 .Pp
 When an interpreter file is
-.Sy execve Ar d ,
+.Sy execve Ap d ,
 the system actually
 .Sy execve Ap s
 the specified



CVS commit: src/lib/libc/sys

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 22:21:21 UTC 2024

Modified Files:
src/lib/libc/sys: execve.2

Log Message:
execve.2: fix typo in markup


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/sys/execve.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/sets/lists/debug

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 18:55:04 UTC 2024

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
tests/cd9660: add debug info to the file list


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/distrib/sets/lists/debug/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.433 src/distrib/sets/lists/debug/mi:1.434
--- src/distrib/sets/lists/debug/mi:1.433	Sun Apr 28 01:21:26 2024
+++ src/distrib/sets/lists/debug/mi	Sun Apr 28 18:55:04 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.433 2024/04/28 01:21:26 riastradh Exp $
+# $NetBSD: mi,v 1.434 2024/04/28 18:55:04 rillig Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib
@@ -1681,6 +1681,7 @@
 ./usr/libdata/debug/usr/tests/dev/scsipi/t_cd.debug			tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/dev/sysmon/t_swwdog.debug			tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/dev/usb/t_hid.debug			tests-fs-debug		debug,atf,rump
+./usr/libdata/debug/usr/tests/fs/cd9660/h_hexdump_r.debug		tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/fs/ffs/h_ffs_server.debug			tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/fs/ffs/h_quota2_server.debug		tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/fs/ffs/h_quota2_tests.debug		tests-fs-debug		debug,atf,rump



CVS commit: src/distrib/sets/lists/debug

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 18:55:04 UTC 2024

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
tests/cd9660: add debug info to the file list


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/distrib/sets/lists/debug/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 15:10:19 UTC 2024

Modified Files:
src/usr.bin/make: buf.c buf.h var.c

Log Message:
make: don't reallocate memory after evaluating an expression

When an expression is evaluated, the resulting text is short-lived in
almost all cases.  In particular, the compaction neither affects the
target names nor the global variable values, which are the prime
candidates for permanent memory usage.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/make/buf.c
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/make/buf.h
cvs rdiff -u -r1.1107 -r1.1108 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 15:10:19 UTC 2024

Modified Files:
src/usr.bin/make: buf.c buf.h var.c

Log Message:
make: don't reallocate memory after evaluating an expression

When an expression is evaluated, the resulting text is short-lived in
almost all cases.  In particular, the compaction neither affects the
target names nor the global variable values, which are the prime
candidates for permanent memory usage.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/make/buf.c
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/make/buf.h
cvs rdiff -u -r1.1107 -r1.1108 src/usr.bin/make/var.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/make/buf.c
diff -u src/usr.bin/make/buf.c:1.57 src/usr.bin/make/buf.c:1.58
--- src/usr.bin/make/buf.c:1.57	Tue Dec 19 19:33:39 2023
+++ src/usr.bin/make/buf.c	Sun Apr 28 15:10:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.c,v 1.57 2023/12/19 19:33:39 rillig Exp $	*/
+/*	$NetBSD: buf.c,v 1.58 2024/04/28 15:10:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -75,7 +75,7 @@
 #include "make.h"
 
 /*	"@(#)buf.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: buf.c,v 1.57 2023/12/19 19:33:39 rillig Exp $");
+MAKE_RCSID("$NetBSD: buf.c,v 1.58 2024/04/28 15:10:19 rillig Exp $");
 
 /* Make space in the buffer for adding at least 16 more bytes. */
 void
@@ -187,30 +187,3 @@ Buf_DoneData(Buffer *buf)
 
 	return data;
 }
-
-#ifndef BUF_COMPACT_LIMIT
-# define BUF_COMPACT_LIMIT 128	/* worthwhile saving */
-#endif
-
-/*
- * Return the data from the buffer.
- * Leave the buffer itself in an indeterminate state.
- *
- * If the buffer size is much greater than its content,
- * a new buffer will be allocated and the old one freed.
- */
-char *
-Buf_DoneDataCompact(Buffer *buf)
-{
-#if BUF_COMPACT_LIMIT > 0
-	if (buf->cap - buf->len >= BUF_COMPACT_LIMIT) {
-		/* We trust realloc to be smart */
-		char *data = bmake_realloc(buf->data, buf->len + 1);
-		buf->data = NULL;
-		data[buf->len] = '\0';	/* XXX: unnecessary */
-		Buf_Done(buf);
-		return data;
-	}
-#endif
-	return Buf_DoneData(buf);
-}

Index: src/usr.bin/make/buf.h
diff -u src/usr.bin/make/buf.h:1.49 src/usr.bin/make/buf.h:1.50
--- src/usr.bin/make/buf.h:1.49	Tue Dec 19 19:33:39 2023
+++ src/usr.bin/make/buf.h	Sun Apr 28 15:10:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.h,v 1.49 2023/12/19 19:33:39 rillig Exp $	*/
+/*	$NetBSD: buf.h,v 1.50 2024/04/28 15:10:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -124,6 +124,5 @@ void Buf_Init(Buffer *);
 void Buf_InitSize(Buffer *, size_t);
 void Buf_Done(Buffer *);
 char *Buf_DoneData(Buffer *) MAKE_ATTR_USE;
-char *Buf_DoneDataCompact(Buffer *) MAKE_ATTR_USE;
 
 #endif

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1107 src/usr.bin/make/var.c:1.1108
--- src/usr.bin/make/var.c:1.1107	Sat Apr 27 21:26:23 2024
+++ src/usr.bin/make/var.c	Sun Apr 28 15:10:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1107 2024/04/27 21:26:23 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1108 2024/04/28 15:10:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -132,7 +132,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1107 2024/04/27 21:26:23 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1108 2024/04/28 15:10:19 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -4731,7 +4731,7 @@ Var_Subst(const char *str, GNode *scope,
 			VarSubstPlain(, );
 	}
 
-	return Buf_DoneDataCompact();
+	return Buf_DoneData();
 }
 
 void



CVS commit: src

2024-04-28 Thread Roland Illig
09:24 2023
+++ src/tests/fs/cd9660/t_high_ino_big_file.sh	Sun Apr 28 14:39:22 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_high_ino_big_file.sh,v 1.5 2023/12/30 13:09:24 martin Exp $
+# $NetBSD: t_high_ino_big_file.sh,v 1.6 2024/04/28 14:39:22 rillig Exp $
 #
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -76,13 +76,14 @@ pr_kern_48787_head() {
 }
 
 pr_kern_48787_body() {
-	avail=$( df -Pk . | awk '{if (NR==2) print $4}' )
+	avail=$(df -Pk . | awk 'NR == 2 { print $4 }')
 	if [ $avail -lt 450 ]; then
 		atf_skip "not enough free disk space, have ${avail} Kbytes, need ~ 450 Kbytes"
 	fi
-	bunzip2 < $(atf_get_srcdir)/pr_48787.image.bz2 > pr_48787.image
+	$(atf_get_srcdir)/h_hexdump_r < $(atf_get_srcdir)/pr_48787.image.hex > pr_48787.image || atf_fail "h_hexdump_r failed"
 	mntpnt=$(pwd)/mnt
 	mkdir ${mntpnt}
+
 	rump_cd9660 -o norrip ./pr_48787.image ${mntpnt}
 	if [ ! -r ${mntpnt}/small_file ]; then
 		atf_fail "${mntpnt}/small_file does not exist"
@@ -91,6 +92,7 @@ pr_kern_48787_body() {
 		atf_fail "${mntpnt}/my/large_file does not exist"
 	fi
 	umount ${mntpnt}
+
 	rump_cd9660 ./pr_48787.image ${mntpnt}
 	if [ ! -r ${mntpnt}/small_file ]; then
 		atf_fail "${mntpnt}/small_file does not exist"
@@ -102,6 +104,7 @@ pr_kern_48787_body() {
 	atf_check -o match:"^4329541966$" stat -f "%i" ${mntpnt}/small_file
 	atf_check -o match:"^4329545920$" stat -f "%i" ${mntpnt}/my/large_file
 	umount ${mntpnt}
+
 	touch "done"
 }
 

Added files:

Index: src/tests/fs/cd9660/h_hexdump_r.c
diff -u /dev/null src/tests/fs/cd9660/h_hexdump_r.c:1.1
--- /dev/null	Sun Apr 28 14:39:22 2024
+++ src/tests/fs/cd9660/h_hexdump_r.c	Sun Apr 28 14:39:22 2024
@@ -0,0 +1,100 @@
+/*	$NetBSD: h_hexdump_r.c,v 1.1 2024/04/28 14:39:22 rillig Exp $	*/
+
+/*
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code was contributed to The NetBSD Foundation by Roland Illig.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Given the output from "hexdump -C", reconstruct the original file. */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define	H	"[0-9a-f]"
+#define	HH	" (" H H ")"
+
+static off_t off, noff;
+static unsigned char prev_bytes[16], bytes[16], zeroes[16];
+
+int
+main(void)
+{
+	char line[81];
+	regex_t data_re, end_re;
+	regmatch_t m[18];
+
+	if (regcomp(_re, "^(" H "{8,9})"
+	" " HH HH HH HH HH HH HH HH " " HH HH HH HH HH HH HH HH
+	"  \\|.{16}\\|$", REG_EXTENDED) != 0)
+		err(1, "regcomp");
+	if (regcomp(_re, "^(" H "{8,9})$", REG_EXTENDED) != 0)
+		err(1, "regcomp");
+
+	while (fgets(line, sizeof(line), stdin) != NULL) {
+		line[strcspn(line, "\n")] = '\0';
+
+		if (strcmp(line, "*") == 0)
+			continue;
+
+		if (regexec(_re, line, 18, m, 0) == 0) {
+			noff = (off_t)strtoimax(line + m[1].rm_so, NULL, 16);
+			for (size_t i = 0; i < 16; i++)
+bytes[i] = (unsigned char)strtoumax(
+line + m[2 + i].rm_so, NULL, 16);
+
+		} else if (regexec(_re, line, 2, m, 0) == 0) {
+			noff = (off_t)strtoimax(line + m[1].rm_so, NULL, 16);
+			if (off < noff) {
+if (fseeko(stdout, noff - 16, SEEK_SET) != 0)
+	err(1, "fseeko");
+if (fwrite(prev_bytes, 1, 16, stdout) != 16)
+	err(1, "fwrite");
+			}
+		} else
+			err(1, "invalid line '%s'", line);
+
+		if (memcmp(prev_bytes, zeroes, 16) != 0) {
+			while (off < noff) {
+if (fwrite(prev_bytes, 1, 16, stdout) != 16)
+

CVS commit: src

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 14:39:22 UTC 2024

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/fs/cd9660: Makefile t_high_ino_big_file.sh
Added Files:
src/tests/fs/cd9660: h_hexdump_r.c pr_48787.image.hex
Removed Files:
src/tests/fs/cd9660: pr_48787.image.bz2.uue

Log Message:
tests/cd9660: replace compressed blob with readable hexdump

This test is skipped in most circumstances because it creates a file
whose apparent size is 4.5 GB.  It's an ISO 9660 image though,
containing mostly null bytes.  Nevertheless, tmpfs doesn't allow such a
big file to be created, so this test is skipped in settings where /tmp
is on a tmpfs.

If the test is run, the ISO image is uncompressed, which takes several
minutes.  Replace bzip2 with direct file creation from a hex dump of
that disk image, which is easier to inspect manually and also faster by
about 3 magnitudes.


To generate a diff of this commit:
cvs rdiff -u -r1.1313 -r1.1314 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.204 -r1.205 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/cd9660/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/cd9660/h_hexdump_r.c \
src/tests/fs/cd9660/pr_48787.image.hex
cvs rdiff -u -r1.1 -r0 src/tests/fs/cd9660/pr_48787.image.bz2.uue
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/cd9660/t_high_ino_big_file.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 07:27:43 UTC 2024

Modified Files:
src/tests/bin/df: t_df.sh
src/tests/bin/pax: t_pax.sh
src/tests/bin/sh: t_ulimit.sh t_varquote.sh
src/tests/bin/tar: t_tar.sh
src/tests/crypto/libcrypto: t_libcrypto.sh
src/tests/fs/psshfs: t_psshfs.sh
src/tests/fs/tmpfs: h_funcs.subr t_create.sh t_devices.sh t_dots.sh
t_exec.sh t_link.sh t_mkdir.sh t_mknod.sh t_mount.sh t_pipes.sh
t_read_write.sh t_readdir.sh t_remove.sh t_rename.sh t_rmdir.sh
t_setattr.sh t_sizes.sh t_sockets.sh t_symlink.sh t_times.sh
t_trail_slash.sh t_vnd.sh t_vnode_leak.sh
src/tests/games: t_factor.sh
src/tests/lib/librumphijack: t_tcpip.sh
src/tests/modules: t_abi_uvm.sh t_klua_pr_52864.sh t_modload.sh
t_threadpool.sh
src/tests/sbin/newfs_msdos: t_create.sh
src/tests/sys/rc: t_rc_d_cli.sh
src/tests/usr.bin/config: t_config.sh
src/tests/usr.bin/id: t_groups.sh t_id.sh t_whoami.sh
src/tests/usr.bin/mtree: t_sets.sh
src/tests/usr.bin/netpgpverify: Testspec t_netpgpverify.sh
src/tests/usr.bin/sdiff: t_sdiff.sh

Log Message:
tests: replace deprecated '-s eq:...' with '-s exit:...'


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/df/t_df.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/pax/t_pax.sh
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/sh/t_ulimit.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/bin/sh/t_varquote.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/tar/t_tar.sh
cvs rdiff -u -r1.9 -r1.10 src/tests/crypto/libcrypto/t_libcrypto.sh
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/psshfs/t_psshfs.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/tmpfs/h_funcs.subr \
src/tests/fs/tmpfs/t_devices.sh src/tests/fs/tmpfs/t_dots.sh \
src/tests/fs/tmpfs/t_exec.sh src/tests/fs/tmpfs/t_mknod.sh \
src/tests/fs/tmpfs/t_pipes.sh src/tests/fs/tmpfs/t_read_write.sh \
src/tests/fs/tmpfs/t_readdir.sh src/tests/fs/tmpfs/t_remove.sh \
src/tests/fs/tmpfs/t_rename.sh src/tests/fs/tmpfs/t_rmdir.sh \
src/tests/fs/tmpfs/t_setattr.sh src/tests/fs/tmpfs/t_sockets.sh \
src/tests/fs/tmpfs/t_symlink.sh src/tests/fs/tmpfs/t_trail_slash.sh
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/tmpfs/t_create.sh \
src/tests/fs/tmpfs/t_mkdir.sh
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/tmpfs/t_link.sh \
src/tests/fs/tmpfs/t_mount.sh src/tests/fs/tmpfs/t_sizes.sh
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/tmpfs/t_times.sh \
src/tests/fs/tmpfs/t_vnode_leak.sh
cvs rdiff -u -r1.13 -r1.14 src/tests/fs/tmpfs/t_vnd.sh
cvs rdiff -u -r1.11 -r1.12 src/tests/games/t_factor.sh
cvs rdiff -u -r1.23 -r1.24 src/tests/lib/librumphijack/t_tcpip.sh
cvs rdiff -u -r1.3 -r1.4 src/tests/modules/t_abi_uvm.sh \
src/tests/modules/t_klua_pr_52864.sh
cvs rdiff -u -r1.13 -r1.14 src/tests/modules/t_modload.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/modules/t_threadpool.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/sbin/newfs_msdos/t_create.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/sys/rc/t_rc_d_cli.sh
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/config/t_config.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/id/t_groups.sh \
src/tests/usr.bin/id/t_id.sh src/tests/usr.bin/id/t_whoami.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/mtree/t_sets.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/netpgpverify/Testspec
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/netpgpverify/t_netpgpverify.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/sdiff/t_sdiff.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests

2024-04-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 28 07:27:43 UTC 2024

Modified Files:
src/tests/bin/df: t_df.sh
src/tests/bin/pax: t_pax.sh
src/tests/bin/sh: t_ulimit.sh t_varquote.sh
src/tests/bin/tar: t_tar.sh
src/tests/crypto/libcrypto: t_libcrypto.sh
src/tests/fs/psshfs: t_psshfs.sh
src/tests/fs/tmpfs: h_funcs.subr t_create.sh t_devices.sh t_dots.sh
t_exec.sh t_link.sh t_mkdir.sh t_mknod.sh t_mount.sh t_pipes.sh
t_read_write.sh t_readdir.sh t_remove.sh t_rename.sh t_rmdir.sh
t_setattr.sh t_sizes.sh t_sockets.sh t_symlink.sh t_times.sh
t_trail_slash.sh t_vnd.sh t_vnode_leak.sh
src/tests/games: t_factor.sh
src/tests/lib/librumphijack: t_tcpip.sh
src/tests/modules: t_abi_uvm.sh t_klua_pr_52864.sh t_modload.sh
t_threadpool.sh
src/tests/sbin/newfs_msdos: t_create.sh
src/tests/sys/rc: t_rc_d_cli.sh
src/tests/usr.bin/config: t_config.sh
src/tests/usr.bin/id: t_groups.sh t_id.sh t_whoami.sh
src/tests/usr.bin/mtree: t_sets.sh
src/tests/usr.bin/netpgpverify: Testspec t_netpgpverify.sh
src/tests/usr.bin/sdiff: t_sdiff.sh

Log Message:
tests: replace deprecated '-s eq:...' with '-s exit:...'


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/df/t_df.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/pax/t_pax.sh
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/sh/t_ulimit.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/bin/sh/t_varquote.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/tar/t_tar.sh
cvs rdiff -u -r1.9 -r1.10 src/tests/crypto/libcrypto/t_libcrypto.sh
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/psshfs/t_psshfs.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/tmpfs/h_funcs.subr \
src/tests/fs/tmpfs/t_devices.sh src/tests/fs/tmpfs/t_dots.sh \
src/tests/fs/tmpfs/t_exec.sh src/tests/fs/tmpfs/t_mknod.sh \
src/tests/fs/tmpfs/t_pipes.sh src/tests/fs/tmpfs/t_read_write.sh \
src/tests/fs/tmpfs/t_readdir.sh src/tests/fs/tmpfs/t_remove.sh \
src/tests/fs/tmpfs/t_rename.sh src/tests/fs/tmpfs/t_rmdir.sh \
src/tests/fs/tmpfs/t_setattr.sh src/tests/fs/tmpfs/t_sockets.sh \
src/tests/fs/tmpfs/t_symlink.sh src/tests/fs/tmpfs/t_trail_slash.sh
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/tmpfs/t_create.sh \
src/tests/fs/tmpfs/t_mkdir.sh
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/tmpfs/t_link.sh \
src/tests/fs/tmpfs/t_mount.sh src/tests/fs/tmpfs/t_sizes.sh
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/tmpfs/t_times.sh \
src/tests/fs/tmpfs/t_vnode_leak.sh
cvs rdiff -u -r1.13 -r1.14 src/tests/fs/tmpfs/t_vnd.sh
cvs rdiff -u -r1.11 -r1.12 src/tests/games/t_factor.sh
cvs rdiff -u -r1.23 -r1.24 src/tests/lib/librumphijack/t_tcpip.sh
cvs rdiff -u -r1.3 -r1.4 src/tests/modules/t_abi_uvm.sh \
src/tests/modules/t_klua_pr_52864.sh
cvs rdiff -u -r1.13 -r1.14 src/tests/modules/t_modload.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/modules/t_threadpool.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/sbin/newfs_msdos/t_create.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/sys/rc/t_rc_d_cli.sh
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/config/t_config.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/id/t_groups.sh \
src/tests/usr.bin/id/t_id.sh src/tests/usr.bin/id/t_whoami.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/mtree/t_sets.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/netpgpverify/Testspec
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/netpgpverify/t_netpgpverify.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/sdiff/t_sdiff.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/df/t_df.sh
diff -u src/tests/bin/df/t_df.sh:1.2 src/tests/bin/df/t_df.sh:1.3
--- src/tests/bin/df/t_df.sh:1.2	Sun Aug 23 15:51:30 2020
+++ src/tests/bin/df/t_df.sh	Sun Apr 28 07:27:40 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_df.sh,v 1.2 2020/08/23 15:51:30 ryo Exp $
+# $NetBSD: t_df.sh,v 1.3 2024/04/28 07:27:40 rillig Exp $
 #
 # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -79,7 +79,7 @@ filer:/1202716672   1202716672  
 /dev/strpct   21474836476  10737418240  10737418236  50% /strpct
 /dev/wd0e10485688  2859932  7625756  27% /mount/windows/C
 EOF
-	atf_check -s eq:0 -o file:expout -e empty \
+	atf_check -s exit:0 -o file:expout -e empty \
 	-x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -n"
 }
 
@@ -137,7 +137,7 @@ filer:/1.1T   1.1T  -172G 117% /
 /dev/strpct 20T10T10T  50% /strpct
 /dev/wd0e   10G   2.7G   7.3G  27% /mount/windows/C
 EOF
-	atf_check -s eq:0 -o file:expout -e empty \
+	atf_check -s exit:0 -o file:expout -e empty \
 	-x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -hn"
 }
 

Index: src/tests/bin/pax/t_pax.sh
diff -u src/tests/bin/pax/t_pax.sh:1.1 src/tests/bin/pax/t_pax.sh:1.2
--- src/tests/bin/pax/t_pax.sh:1.1	Sat Mar 17 16:33:11 2012
+++ src/tests/bin/pax/t_pax.sh	Sun Apr 28 07:27:40 

CVS commit: src/usr.bin/make

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 21:26:23 UTC 2024

Modified Files:
src/usr.bin/make: var.c

Log Message:
make: fix comment about forcing a use-after-free

The previous expression didn't cause any bug, as the modifier
':@VAR@loop@' changed the value of the expression, thus making the
expression independent from the variable value.

Instead, the variable needs to be deleted from within an indirect
modifier, and that modifier needs to evaluate to an empty string, thus
doing nothing and preserving the original expression value.


To generate a diff of this commit:
cvs rdiff -u -r1.1106 -r1.1107 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 21:26:23 UTC 2024

Modified Files:
src/usr.bin/make: var.c

Log Message:
make: fix comment about forcing a use-after-free

The previous expression didn't cause any bug, as the modifier
':@VAR@loop@' changed the value of the expression, thus making the
expression independent from the variable value.

Instead, the variable needs to be deleted from within an indirect
modifier, and that modifier needs to evaluate to an empty string, thus
doing nothing and preserving the original expression value.


To generate a diff of this commit:
cvs rdiff -u -r1.1106 -r1.1107 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.1106 src/usr.bin/make/var.c:1.1107
--- src/usr.bin/make/var.c:1.1106	Sat Apr 27 20:41:32 2024
+++ src/usr.bin/make/var.c	Sat Apr 27 21:26:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1106 2024/04/27 20:41:32 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1107 2024/04/27 21:26:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -132,7 +132,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1106 2024/04/27 20:41:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1107 2024/04/27 21:26:23 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -4542,7 +4542,7 @@ Var_Parse(const char **pp, GNode *scope,
 	 * while its value is still being used:
 	 *
 	 *	VAR=	value
-	 *	_:=	${VAR:${:U@VAR@loop@}:S,^,prefix,}
+	 *	_:=	${VAR:${:U:@VAR@@}:S,^,prefix,}
 	 *
 	 * The same effect might be achievable using the '::=' or the ':_'
 	 * modifiers.



CVS commit: src/usr.bin/make

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 20:41:32 UTC 2024

Modified Files:
src/usr.bin/make: arch.c job.c make.h var.c
src/usr.bin/make/unit-tests: depsrc-end.mk depsrc-nopath.exp
depsrc-nopath.mk depsrc-phony.mk

Log Message:
make: clean up, test .NOPATH

Trim down the comments in the archive module, as they mainly repeated
the code.  Trim down the binary code size in the archive module, as it
is rarely used.

In Var_Parse, delay two variable assignments until they are actually
needed.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/arch.c
cvs rdiff -u -r1.469 -r1.470 src/usr.bin/make/job.c
cvs rdiff -u -r1.331 -r1.332 src/usr.bin/make/make.h
cvs rdiff -u -r1.1105 -r1.1106 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/depsrc-end.mk \
src/usr.bin/make/unit-tests/depsrc-nopath.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-nopath.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/depsrc-phony.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 20:41:32 UTC 2024

Modified Files:
src/usr.bin/make: arch.c job.c make.h var.c
src/usr.bin/make/unit-tests: depsrc-end.mk depsrc-nopath.exp
depsrc-nopath.mk depsrc-phony.mk

Log Message:
make: clean up, test .NOPATH

Trim down the comments in the archive module, as they mainly repeated
the code.  Trim down the binary code size in the archive module, as it
is rarely used.

In Var_Parse, delay two variable assignments until they are actually
needed.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/arch.c
cvs rdiff -u -r1.469 -r1.470 src/usr.bin/make/job.c
cvs rdiff -u -r1.331 -r1.332 src/usr.bin/make/make.h
cvs rdiff -u -r1.1105 -r1.1106 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/depsrc-end.mk \
src/usr.bin/make/unit-tests/depsrc-nopath.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-nopath.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/depsrc-phony.mk

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/make/arch.c
diff -u src/usr.bin/make/arch.c:1.216 src/usr.bin/make/arch.c:1.217
--- src/usr.bin/make/arch.c:1.216	Sat Apr 27 17:33:46 2024
+++ src/usr.bin/make/arch.c	Sat Apr 27 20:41:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.216 2024/04/27 17:33:46 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.217 2024/04/27 20:41:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.216 2024/04/27 17:33:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.217 2024/04/27 20:41:32 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -134,7 +134,7 @@ typedef struct ListNode ArchListNode;
 static ArchList archives;	/* The archives we've already examined */
 
 typedef struct Arch {
-	char *name;		/* Name of archive */
+	char *name;
 	HashTable members;	/* All the members of the archive described
  * by  key/value pairs */
 	char *fnametab;		/* Extended name table strings */
@@ -155,7 +155,6 @@ ArchFree(Arch *a)
 {
 	HashIter hi;
 
-	/* Free memory from hash entries */
 	HashIter_Init(, >members);
 	while (HashIter_Next() != NULL)
 		free(hi.entry->value);
@@ -168,32 +167,22 @@ ArchFree(Arch *a)
 #endif
 
 /* Return "archive(member)". */
-static char *
+MAKE_ATTR_NOINLINE static char *
 FullName(const char *archive, const char *member)
 {
-	size_t len1 = strlen(archive);
-	size_t len3 = strlen(member);
-	char *result = bmake_malloc(len1 + 1 + len3 + 1 + 1);
-	memcpy(result, archive, len1);
-	memcpy(result + len1, "(", 1);
-	memcpy(result + len1 + 1, member, len3);
-	memcpy(result + len1 + 1 + len3, ")", 1 + 1);
-	return result;
+	Buffer buf;
+	Buf_Init();
+	Buf_AddStr(, archive);
+	Buf_AddStr(, "(");
+	Buf_AddStr(, member);
+	Buf_AddStr(, ")");
+	return Buf_DoneData();
 }
 
 /*
  * Parse an archive specification such as "archive.a(member1 member2.${EXT})",
- * adding nodes for the expanded members to gns.  Nodes are created as
- * necessary.
- *
- * Input:
- *	pp		The start of the specification.
- *	gns		The list on which to place the nodes.
- *	scope		The scope in which to expand variables.
- *
- * Output:
- *	return		True if it was a valid specification.
- *	*pp		Points to the first non-space after the archive spec.
+ * adding nodes for the expanded members to gns.  If successful, advance pp
+ * beyond the archive specification and any trailing whitespace.
  */
 bool
 Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
@@ -274,12 +263,6 @@ Arch_ParseArchive(char **pp, GNodeList *
 			}
 		}
 
-		/*
-		 * If the specification ends without a closing parenthesis,
-		 * chances are there's something wrong (like a missing
-		 * backslash), so it's better to return failure than allow
-		 * such things to happen
-		 */
 		if (*cp == '\0') {
 			Parse_Error(PARSE_FATAL,
 			"No closing parenthesis "
@@ -287,9 +270,6 @@ Arch_ParseArchive(char **pp, GNodeList *
 			return false;
 		}
 
-		/*
-		 * If we didn't move anywhere, we must be done
-		 */
 		if (cp == mem.str)
 			break;
 
@@ -326,8 +306,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 /*
  * Must contain dynamic sources, so we can't
  * deal with it now. Just create an ARCHV node
- * for the thing and let SuffExpandChildren
- * handle it.
+ * and let SuffExpandChildren handle it.
  */
 gn = Targ_GetNode(fullName);
 gn->type |= OP_ARCHV;
@@ -364,13 +343,6 @@ Arch_ParseArchive(char **pp, GNodeList *
 			gn = Targ_GetNode(fullname);
 			free(fullname);
 
-			/*
-			 * We've found the node, but have to make sure the
-			 * rest of the world knows it's an archive member,
-			 * without having to constantly check for parentheses,
-			 * so we type the thing with the OP_ARCHV bit before

CVS commit: src/usr.bin/make/unit-tests

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 20:23:22 UTC 2024

Modified Files:
src/usr.bin/make/unit-tests: archive.exp archive.mk

Log Message:
tests/make: test detection of static library files


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/archive.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/archive.mk

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/make/unit-tests/archive.exp
diff -u src/usr.bin/make/unit-tests/archive.exp:1.7 src/usr.bin/make/unit-tests/archive.exp:1.8
--- src/usr.bin/make/unit-tests/archive.exp:1.7	Fri Oct  9 06:44:42 2020
+++ src/usr.bin/make/unit-tests/archive.exp	Sat Apr 27 20:23:22 2024
@@ -25,4 +25,12 @@ depend-on-existing-member
 Making remove-archive
 rm -f libprog.a
 
+begin library
+Examining libbad.a...up-to-date.
+Examining -lbad...up-to-date.
+Examining libgood.a...library...up-to-date.
+Examining -lgood...library...up-to-date.
+Examining library...nonexistentPHONY node...out-of-date.
+Examining .END...nonexistent...nonexistent and no sources...out-of-date.
+end library
 exit status 0

Index: src/usr.bin/make/unit-tests/archive.mk
diff -u src/usr.bin/make/unit-tests/archive.mk:1.12 src/usr.bin/make/unit-tests/archive.mk:1.13
--- src/usr.bin/make/unit-tests/archive.mk:1.12	Fri Apr  9 14:42:00 2021
+++ src/usr.bin/make/unit-tests/archive.mk	Sat Apr 27 20:23:22 2024
@@ -1,4 +1,4 @@
-# $NetBSD: archive.mk,v 1.12 2021/04/09 14:42:00 christos Exp $
+# $NetBSD: archive.mk,v 1.13 2024/04/27 20:23:22 rillig Exp $
 #
 # Very basic demonstration of handling archives, based on the description
 # in PSD.doc/tutorial.ms.
@@ -24,6 +24,12 @@ all:
 	@${MAKE} -f ${MAKEFILE} depend-on-existing-member
 	@${MAKE} -f ${MAKEFILE} depend-on-nonexistent-member
 	@${MAKE} -f ${MAKEFILE} remove-archive
+	@${MAKE} -f ${MAKEFILE} set-up-library
+	@${MAKE} -f ${MAKEFILE} -dm library 2>&1 \
+	| sed -n '/^Examining/p' \
+	| sed 's,\.\.\.modified[^.]*,,'
+	@${MAKE} -f ${MAKEFILE} tear-down-library
+
 
 create-archive: ${ARCHIVE} pre post
 
@@ -58,3 +64,28 @@ pre: .USEBEFORE
 	@echo Making ${.TARGET} ${.OODATE:C,.+,out-of-date,W} ${.OODATE:O}
 post: .USE
 	@echo
+
+
+set-up-library: .PHONY
+	@echo "member" > member.txt
+	@echo "not a library" > libbad.a
+	@ar cr libgood.a member.txt
+	@echo "begin library"
+
+.if make(library)
+.SUFFIXES: .a
+.LIBS: .a
+.endif
+# The two lines for libgood contain the word "library", the two lines for
+# libbad don't.
+#
+# expect: Examining libbad.a...up-to-date.
+# expect: Examining -lbad...up-to-date.
+# expect: Examining libgood.a...library...up-to-date.
+# expect: Examining -lgood...library...up-to-date.
+library: .PHONY libbad.a -lbad libgood.a -lgood
+	: Making ${.TARGET} from ${.ALLSRC}
+
+tear-down-library: .PHONY
+	@echo "end library"
+	@rm member.txt libbad.a libgood.a



CVS commit: src/usr.bin/make/unit-tests

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 20:23:22 UTC 2024

Modified Files:
src/usr.bin/make/unit-tests: archive.exp archive.mk

Log Message:
tests/make: test detection of static library files


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/archive.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/archive.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 17:33:47 UTC 2024

Modified Files:
src/usr.bin/make: arch.c lst.c lst.h main.c meta.c parse.c targ.c

Log Message:
make: simplify freeing of lists


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/usr.bin/make/arch.c
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/make/lst.c
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/make/lst.h
cvs rdiff -u -r1.612 -r1.613 src/usr.bin/make/main.c
cvs rdiff -u -r1.207 -r1.208 src/usr.bin/make/meta.c
cvs rdiff -u -r1.721 -r1.722 src/usr.bin/make/parse.c
cvs rdiff -u -r1.180 -r1.181 src/usr.bin/make/targ.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/make/arch.c
diff -u src/usr.bin/make/arch.c:1.215 src/usr.bin/make/arch.c:1.216
--- src/usr.bin/make/arch.c:1.215	Wed Feb  7 06:43:02 2024
+++ src/usr.bin/make/arch.c	Sat Apr 27 17:33:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.215 2024/02/07 06:43:02 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.216 2024/04/27 17:33:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.215 2024/02/07 06:43:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.216 2024/04/27 17:33:46 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -151,9 +151,8 @@ static int ArchSVR4Entry(Arch *, char *,
 
 #ifdef CLEANUP
 static void
-ArchFree(void *ap)
+ArchFree(Arch *a)
 {
-	Arch *a = ap;
 	HashIter hi;
 
 	/* Free memory from hash entries */
@@ -1070,7 +1069,11 @@ void
 Arch_End(void)
 {
 #ifdef CLEANUP
-	Lst_DoneCall(, ArchFree);
+	ArchListNode *ln;
+
+	for (ln = archives.first; ln != NULL; ln = ln->next)
+		ArchFree(ln->datum);
+	Lst_Done();
 #endif
 }
 

Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.107 src/usr.bin/make/lst.c:1.108
--- src/usr.bin/make/lst.c:1.107	Fri Dec 29 20:43:58 2023
+++ src/usr.bin/make/lst.c	Sat Apr 27 17:33:46 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.107 2023/12/29 20:43:58 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.108 2024/04/27 17:33:46 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -34,7 +34,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.107 2023/12/29 20:43:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.108 2024/04/27 17:33:46 rillig Exp $");
 
 static ListNode *
 LstNodeNew(ListNode *prev, ListNode *next, void *datum)
@@ -60,13 +60,13 @@ Lst_Done(List *list)
 }
 
 void
-Lst_DoneCall(List *list, LstFreeProc freeProc)
+Lst_DoneFree(List *list)
 {
 	ListNode *ln, *next;
 
 	for (ln = list->first; ln != NULL; ln = next) {
 		next = ln->next;
-		freeProc(ln->datum);
+		free(ln->datum);
 		free(ln);
 	}
 }

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.104 src/usr.bin/make/lst.h:1.105
--- src/usr.bin/make/lst.h:1.104	Fri Dec 29 20:43:58 2023
+++ src/usr.bin/make/lst.h	Sat Apr 27 17:33:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.104 2023/12/29 20:43:58 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.105 2024/04/27 17:33:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -98,13 +98,10 @@ struct List {
 	ListNode *last;
 };
 
-/* Free the datum of a node, called before freeing the node itself. */
-typedef void LstFreeProc(void *);
-
-/* Free the list nodes, but not the list itself. */
+/* Free the list nodes. */
 void Lst_Done(List *);
-/* Free the list nodes, freeing the node data using the given function. */
-void Lst_DoneCall(List *, LstFreeProc);
+/* Free the list nodes, as well as each node's datum. */
+void Lst_DoneFree(List *);
 
 #define LST_INIT { NULL, NULL }
 

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.612 src/usr.bin/make/main.c:1.613
--- src/usr.bin/make/main.c:1.612	Sun Mar 10 02:53:37 2024
+++ src/usr.bin/make/main.c	Sat Apr 27 17:33:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.613 2024/04/27 17:33:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.613 2024/04/27 17:33:46 rillig Exp $");
 #if defined(MAKE_NATIVE)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1199,7 +1199,7 @@ ReadBuiltinRules(void)
 		Fatal("%s: cannot open %s.",
 		progname, (const char *)sysMkFiles.first->datum);
 
-	Lst_DoneCall(, free);
+	Lst_DoneFree();
 }
 
 static void
@@ -1564,9 +1564,9 @@ static void
 main_CleanUp(void)
 {
 #ifdef CLEANUP
-	Lst_DoneCall(, free);
-	Lst_DoneCall(, free);
-	Lst_DoneCall(, free);
+	Lst_DoneFree();
+	Lst_DoneFree();
+	Lst_DoneFree();
 #endif
 
 	if (DEBUG(GRAPH2))

Index: 

CVS commit: src/usr.bin/make

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 17:33:47 UTC 2024

Modified Files:
src/usr.bin/make: arch.c lst.c lst.h main.c meta.c parse.c targ.c

Log Message:
make: simplify freeing of lists


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/usr.bin/make/arch.c
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/make/lst.c
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/make/lst.h
cvs rdiff -u -r1.612 -r1.613 src/usr.bin/make/main.c
cvs rdiff -u -r1.207 -r1.208 src/usr.bin/make/meta.c
cvs rdiff -u -r1.721 -r1.722 src/usr.bin/make/parse.c
cvs rdiff -u -r1.180 -r1.181 src/usr.bin/make/targ.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 12:46:37 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: queries.c
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: converting a null pointer to another pointer type is not narrowing


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.636 -r1.637 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/queries.c
diff -u src/tests/usr.bin/xlint/lint1/queries.c:1.28 src/tests/usr.bin/xlint/lint1/queries.c:1.29
--- src/tests/usr.bin/xlint/lint1/queries.c:1.28	Sat Apr 27 10:08:54 2024
+++ src/tests/usr.bin/xlint/lint1/queries.c	Sat Apr 27 12:46:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: queries.c,v 1.28 2024/04/27 10:08:54 rillig Exp $	*/
+/*	$NetBSD: queries.c,v 1.29 2024/04/27 12:46:37 rillig Exp $	*/
 # 3 "queries.c"
 
 /*
@@ -532,4 +532,6 @@ Q20_void_pointer_conversion(void)
 	int_ptr = char_ptr;
 	/* expect+1: warning: illegal combination of 'pointer to char' and 'pointer to int', op '=' [124] */
 	char_ptr = int_ptr;
+
+	int_ptr = (void *)0;
 }

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.636 src/usr.bin/xlint/lint1/tree.c:1.637
--- src/usr.bin/xlint/lint1/tree.c:1.636	Sat Apr 27 10:08:54 2024
+++ src/usr.bin/xlint/lint1/tree.c	Sat Apr 27 12:46:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.636 2024/04/27 10:08:54 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.637 2024/04/27 12:46:37 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.636 2024/04/27 10:08:54 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.637 2024/04/27 12:46:37 rillig Exp $");
 #endif
 
 #include 
@@ -1434,7 +1434,8 @@ build_assignment(op_t op, bool sys, tnod
 
 	if (is_query_enabled[20]
 	&& lt == PTR && ln->tn_type->t_subt->t_tspec != VOID
-	&& rt == PTR && rn->tn_type->t_subt->t_tspec == VOID)
+	&& rt == PTR && rn->tn_type->t_subt->t_tspec == VOID
+	&& !is_null_pointer(rn))
 		/* implicit narrowing conversion from void ... */
 		query_message(20, type_name(ln->tn_type));
 



CVS commit: src

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 12:46:37 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: queries.c
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: converting a null pointer to another pointer type is not narrowing


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.636 -r1.637 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 10:08:55 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: queries.c t_usage.sh
src/usr.bin/xlint/lint1: err.c tree.c

Log Message:
lint: add query for conversion from void pointer to other pointer


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.19 -r1.20 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.635 -r1.636 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/queries.c
diff -u src/tests/usr.bin/xlint/lint1/queries.c:1.27 src/tests/usr.bin/xlint/lint1/queries.c:1.28
--- src/tests/usr.bin/xlint/lint1/queries.c:1.27	Sat Mar 30 19:12:37 2024
+++ src/tests/usr.bin/xlint/lint1/queries.c	Sat Apr 27 10:08:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: queries.c,v 1.27 2024/03/30 19:12:37 rillig Exp $	*/
+/*	$NetBSD: queries.c,v 1.28 2024/04/27 10:08:54 rillig Exp $	*/
 # 3 "queries.c"
 
 /*
@@ -16,7 +16,7 @@
  */
 
 /* lint1-extra-flags: -q 1,2,3,4,5,6,7,8,9,10 */
-/* lint1-extra-flags: -q 11,12,13,14,15,16,17,18,19 */
+/* lint1-extra-flags: -q 11,12,13,14,15,16,17,18,19,20 */
 /* lint1-extra-flags: -X 351 */
 
 typedef unsigned char u8_t;
@@ -73,6 +73,8 @@ volatile char *vstr;
 
 void *void_ptr;
 const void *const_void_ptr;
+char *char_ptr;
+int *int_ptr;
 
 int
 Q1(double dbl)
@@ -359,9 +361,9 @@ Q9(int x)
 		return (0.0);
 	case 9:
 		return
-# 363 "queries.c" 3 4
+# 365 "queries.c" 3 4
 		((void *)0)
-# 365 "queries.c"
+# 367 "queries.c"
 		/* expect+1: warning: illegal combination of integer 'int' and pointer 'pointer to void' [183] */
 		;
 	case 10:
@@ -509,10 +511,25 @@ convert_from_integer_to_floating(void)
 	f64 = (double)u32;
 }
 
-/*
- * Since queries do not affect the exit status, force a warning to make this
- * test conform to the general expectation that a test that produces output
- * exits non-successfully.
- */
-/* expect+1: warning: static variable 'unused' unused [226] */
-static int unused;
+// C allows implicit narrowing conversions from a void pointer to an arbitrary
+// object pointer. C++ doesn't allow this conversion since it is narrowing.
+void
+Q20_void_pointer_conversion(void)
+{
+	/* expect+1: warning: operands of '=' have incompatible pointer types to 'void' and 'const void' [128] */
+	void_ptr = const_void_ptr;
+	const_void_ptr = void_ptr;
+	/* expect+1: implicit narrowing conversion from void pointer to 'pointer to int' [Q20] */
+	int_ptr = void_ptr;
+	/* expect+1: redundant cast from 'pointer to void' to 'pointer to int' before assignment [Q7] */
+	int_ptr = (int *)void_ptr;
+	/* expect+1: implicit narrowing conversion from void pointer to 'pointer to char' [Q20] */
+	char_ptr = void_ptr;
+	void_ptr = char_ptr;
+	/* expect+1: implicit narrowing conversion from void pointer to 'pointer to int' [Q20] */
+	int_ptr = void_ptr;
+	/* expect+1: warning: illegal combination of 'pointer to int' and 'pointer to char', op '=' [124] */
+	int_ptr = char_ptr;
+	/* expect+1: warning: illegal combination of 'pointer to char' and 'pointer to int', op '=' [124] */
+	char_ptr = int_ptr;
+}

Index: src/tests/usr.bin/xlint/lint1/t_usage.sh
diff -u src/tests/usr.bin/xlint/lint1/t_usage.sh:1.19 src/tests/usr.bin/xlint/lint1/t_usage.sh:1.20
--- src/tests/usr.bin/xlint/lint1/t_usage.sh:1.19	Sat Mar 30 17:23:13 2024
+++ src/tests/usr.bin/xlint/lint1/t_usage.sh	Sat Apr 27 10:08:54 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_usage.sh,v 1.19 2024/03/30 17:23:13 rillig Exp $
+# $NetBSD: t_usage.sh,v 1.20 2024/04/27 10:08:54 rillig Exp $
 #
 # Copyright (c) 2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -89,13 +89,13 @@ enable_queries_body()
 
 	# The largest known query.
 	atf_check \
-	"$lint1" -q 19 code.c /dev/null
+	"$lint1" -q 20 code.c /dev/null
 
 	# Larger than the largest known query.
 	atf_check \
 	-s 'exit:1' \
-	-e "inline:lint1: invalid query ID '20'\n" \
-	"$lint1" -q 20 code.c /dev/null
+	-e "inline:lint1: invalid query ID '21'\n" \
+	"$lint1" -q 21 code.c /dev/null
 
 	# Whitespace is not allowed before a query ID.
 	atf_check \

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.240 src/usr.bin/xlint/lint1/err.c:1.241
--- src/usr.bin/xlint/lint1/err.c:1.240	Fri Apr 12 05:17:48 2024
+++ src/usr.bin/xlint/lint1/err.c	Sat Apr 27 10:08:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.240 2024/04/12 05:17:48 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.241 2024/04/27 10:08:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: err.c,v 1.240 2024/04/12 05:17:48 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.241 2024/04/27 10:08:54 rillig Exp $");
 #endif
 
 #include 
@@ -741,6 +741,7 @@ static 

CVS commit: src

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 10:08:55 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: queries.c t_usage.sh
src/usr.bin/xlint/lint1: err.c tree.c

Log Message:
lint: add query for conversion from void pointer to other pointer


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.19 -r1.20 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.240 -r1.241 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.635 -r1.636 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/include

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 06:01:08 UTC 2024

Modified Files:
src/sys/arch/mips/include: float.h

Log Message:
mips: fix syntax error in LDBL_MAX (since 2011)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/include/float.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/include/float.h
diff -u src/sys/arch/mips/include/float.h:1.18 src/sys/arch/mips/include/float.h:1.19
--- src/sys/arch/mips/include/float.h:1.18	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/float.h	Sat Apr 27 06:01:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: float.h,v 1.18 2020/07/26 08:08:41 simonb Exp $ */
+/*	$NetBSD: float.h,v 1.19 2024/04/27 06:01:08 rillig Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
 #if __STDC_VERSION__ >= 199901L
 #define	LDBL_EPSILON	0x1p-112L
 #define	LDBL_MIN	0x1p-16382L
-#define	LDBL_MAX	0x1.p+16383L,
+#define	LDBL_MAX	0x1.p+16383L
 #else
 #define	LDBL_EPSILON	1.9259299443872358530559779425849273E-34L
 #define	LDBL_MIN	3.3621031431120935062626778173217526E-4932L



CVS commit: src/sys/arch/mips/include

2024-04-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 27 06:01:08 UTC 2024

Modified Files:
src/sys/arch/mips/include: float.h

Log Message:
mips: fix syntax error in LDBL_MAX (since 2011)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/include/float.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:38:44 UTC 2024

Modified Files:
src: BUILDING
src/doc: BUILDING.mdoc

Log Message:
BUILDING: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/BUILDING
cvs rdiff -u -r1.149 -r1.150 src/doc/BUILDING.mdoc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:38:44 UTC 2024

Modified Files:
src: BUILDING
src/doc: BUILDING.mdoc

Log Message:
BUILDING: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/BUILDING
cvs rdiff -u -r1.149 -r1.150 src/doc/BUILDING.mdoc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/BUILDING
diff -u src/BUILDING:1.160 src/BUILDING:1.161
--- src/BUILDING:1.160	Sat Jul 22 18:50:04 2023
+++ src/BUILDING	Fri Apr 26 17:38:44 2024
@@ -729,7 +729,7 @@ BUILDING
MACHINE and MACHINE_ARCH settings.
 
  -N noiselevel
-   Set the "noisyness" level of the build, by setting MAKEVERBOSE
+   Set the "noisiness" level of the build, by setting MAKEVERBOSE
to noiselevel.
 
  -nShow the commands that would be executed by build.sh, but do

Index: src/doc/BUILDING.mdoc
diff -u src/doc/BUILDING.mdoc:1.149 src/doc/BUILDING.mdoc:1.150
--- src/doc/BUILDING.mdoc:1.149	Sat Jul 22 18:50:04 2023
+++ src/doc/BUILDING.mdoc	Fri Apr 26 17:38:44 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: BUILDING.mdoc,v 1.149 2023/07/22 18:50:04 lukem Exp $
+.\"	$NetBSD: BUILDING.mdoc,v 1.150 2024/04/26 17:38:44 rillig Exp $
 .\"
 .\" Copyright (c) 2001-2023 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -1645,7 +1645,7 @@ settings.
 .
 .It Fl N Ar noiselevel
 Set the
-.Dq noisyness
+.Dq noisiness
 level of the build, by setting
 .Sy MAKEVERBOSE
 to



CVS commit: src/external/mit/xorg/lib/dri

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:22:26 UTC 2024

Modified Files:
src/external/mit/xorg/lib/dri: Makefile

Log Message:
dri: disable lint


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/external/mit/xorg/lib/dri/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/xorg/lib/dri/Makefile
diff -u src/external/mit/xorg/lib/dri/Makefile:1.40 src/external/mit/xorg/lib/dri/Makefile:1.41
--- src/external/mit/xorg/lib/dri/Makefile:1.40	Sun Apr 21 00:23:23 2024
+++ src/external/mit/xorg/lib/dri/Makefile	Fri Apr 26 17:22:26 2024
@@ -1,7 +1,9 @@
-# $NetBSD: Makefile,v 1.40 2024/04/21 00:23:23 maya Exp $
+# $NetBSD: Makefile,v 1.41 2024/04/26 17:22:26 rillig Exp $
 
 # Link the mesa_dri_drivers mega driver.
 
+NOLINT=		# Lots of "Unsupported platform" due to undefined __GNUC__
+
 .include 
 
 .include "../mesa-which.mk"



CVS commit: src/external/mit/xorg/lib/dri

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:22:26 UTC 2024

Modified Files:
src/external/mit/xorg/lib/dri: Makefile

Log Message:
dri: disable lint


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/external/mit/xorg/lib/dri/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:11:22 UTC 2024

Modified Files:
src/usr.bin/make: job.c
src/usr.bin/make/unit-tests: opt-debug-errors-jobs.exp

Log Message:
make: in parallel mode, print the directory in which a job failed

When multiple targets run in parallel, the "stopped in" line may be
several lines away from the "Failed target" line, making them hard to
correlate.


To generate a diff of this commit:
cvs rdiff -u -r1.468 -r1.469 src/usr.bin/make/job.c
cvs rdiff -u -r1.4 -r1.5 \
src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp

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/make/job.c
diff -u src/usr.bin/make/job.c:1.468 src/usr.bin/make/job.c:1.469
--- src/usr.bin/make/job.c:1.468	Sat Apr 20 10:18:55 2024
+++ src/usr.bin/make/job.c	Fri Apr 26 17:11:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.468 2024/04/20 10:18:55 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.469 2024/04/26 17:11:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -141,7 +141,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.468 2024/04/20 10:18:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.469 2024/04/26 17:11:22 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1062,6 +1062,7 @@ DebugFailedJob(const Job *job)
 
 	debug_printf("\n");
 	debug_printf("*** Failed target: %s\n", job->node->name);
+	debug_printf("*** In directory: %s\n", curdir);
 	debug_printf("*** Failed commands:\n");
 	for (ln = job->node->commands.first; ln != NULL; ln = ln->next) {
 		const char *cmd = ln->datum;

Index: src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp:1.4 src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp:1.5
--- src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp:1.4	Sun Nov 28 00:02:07 2021
+++ src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp	Fri Apr 26 17:11:22 2024
@@ -2,6 +2,7 @@ echo '3   spaces'; false
 3   spaces
 
 *** Failed target: fail-spaces
+*** In directory: 
 *** Failed commands:
 	echo '3   spaces'; false
 *** [fail-spaces] Error code 1
@@ -11,6 +12,7 @@ echo \  indented; false
   indented
 
 *** Failed target: fail-escaped-space
+*** In directory: 
 *** Failed commands:
 	echo \  indented; false
 *** [fail-escaped-space] Error code 1
@@ -22,6 +24,7 @@ line1
 line2
 
 *** Failed target: fail-newline
+*** In directory: 
 *** Failed commands:
 	echo 'line1${.newline}line2'; false
 	=> echo 'line1
@@ -33,6 +36,7 @@ echo 'line1 line2'; false
 line1 line2
 
 *** Failed target: fail-multiline
+*** In directory: 
 *** Failed commands:
 	echo 'line1 line2'; false
 *** [fail-multiline] Error code 1
@@ -42,6 +46,7 @@ echo	'word1'			 'word2'; false
 word1 word2
 
 *** Failed target: fail-multiline-intention
+*** In directory: 
 *** Failed commands:
 	echo	'word1'			 'word2'; false
 *** [fail-multiline-intention] Error code 1
@@ -49,6 +54,7 @@ word1 word2
 make: stopped in unit-tests
 
 *** Failed target: fail-vars
+*** In directory: 
 *** Failed commands:
 	@${COMPILE_C} ${COMPILE_C_FLAGS}
 	=> @false c-compiler flag1 -macro="several words"



CVS commit: src/usr.bin/make

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 17:11:22 UTC 2024

Modified Files:
src/usr.bin/make: job.c
src/usr.bin/make/unit-tests: opt-debug-errors-jobs.exp

Log Message:
make: in parallel mode, print the directory in which a job failed

When multiple targets run in parallel, the "stopped in" line may be
several lines away from the "Failed target" line, making them hard to
correlate.


To generate a diff of this commit:
cvs rdiff -u -r1.468 -r1.469 src/usr.bin/make/job.c
cvs rdiff -u -r1.4 -r1.5 \
src/usr.bin/make/unit-tests/opt-debug-errors-jobs.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/mit/xorg/lib/gallium

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 16:34:18 UTC 2024

Modified Files:
src/external/mit/xorg/lib/gallium: Makefile

Log Message:
gallium: disable lint


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/external/mit/xorg/lib/gallium/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/xorg/lib/gallium/Makefile
diff -u src/external/mit/xorg/lib/gallium/Makefile:1.53 src/external/mit/xorg/lib/gallium/Makefile:1.54
--- src/external/mit/xorg/lib/gallium/Makefile:1.53	Sat Nov 25 20:00:25 2023
+++ src/external/mit/xorg/lib/gallium/Makefile	Fri Apr 26 16:34:17 2024
@@ -1,10 +1,12 @@
-# $NetBSD: Makefile,v 1.53 2023/11/25 20:00:25 rjs Exp $
+# $NetBSD: Makefile,v 1.54 2024/04/26 16:34:17 rillig Exp $
 
 # Link the gallium mega driver.
 
 LIBISMODULE=	yes
 LIBISCXX= yes
 
+NOLINT=		# Lots of "Unsupported platform" due to undefined __GNUC__
+
 .include 
 
 .include "../mesa-which.mk"



CVS commit: src/external/mit/xorg/lib/gallium

2024-04-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 16:34:18 UTC 2024

Modified Files:
src/external/mit/xorg/lib/gallium: Makefile

Log Message:
gallium: disable lint


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/external/mit/xorg/lib/gallium/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/bin/cp

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 01:33:23 UTC 2024

Modified Files:
src/tests/bin/cp: t_cp.sh

Log Message:
tests/cp: clean up

Replace the deprecated "eq:0" with "exit:0", remove redundant "-o empty"
and "-e empty".


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/cp/t_cp.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/cp/t_cp.sh
diff -u src/tests/bin/cp/t_cp.sh:1.1 src/tests/bin/cp/t_cp.sh:1.2
--- src/tests/bin/cp/t_cp.sh:1.1	Sat Mar 17 16:33:10 2012
+++ src/tests/bin/cp/t_cp.sh	Fri Apr 26 01:33:23 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_cp.sh,v 1.1 2012/03/17 16:33:10 jruoho Exp $
+# $NetBSD: t_cp.sh,v 1.2 2024/04/26 01:33:23 rillig Exp $
 #
 # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -62,7 +62,7 @@ file_to_file_simple() {
 	rm -f file2
 	umask 022
 	chmod 777 file
-	atf_check -s eq:0 -o empty -e empty cp file file2
+	atf_check cp file file2
 	cp_compare file_to_file_simple file file2
 	if [ `stat -f "%Lp" file2` != "755" ]; then
 		atf_fail "new file not created with umask"
@@ -80,7 +80,7 @@ file_to_file_preserve() {
 	rm file3
 	chmod 644 file
 	chflags nodump file
-	atf_check -s eq:0 -o empty -e empty cp -p file file3
+	atf_check cp -p file file3
 	finfo=`stat -f "%p%u%g%m%z%f" file`
 	f3info=`stat -f "%p%u%g%m%z%f" file3`
 	if [ $finfo != $f3info ]; then
@@ -92,7 +92,7 @@ file_to_file_noflags() {
 	rm file3
 	chmod 644 file
 	chflags nodump file
-	atf_check -s eq:0 -o empty -e empty cp -p -N file file3
+	atf_check cp -p -N file file3
 	finfo=`stat -f "%f" file`
 	f3info=`stat -f "%f" file3`
 	if [ $finfo = $f3info ]; then
@@ -106,7 +106,7 @@ file_to_link_head() {
 }
 file_to_link_body() {
 	reset
-	atf_check -s eq:0 -o empty -e empty cp file2 link
+	atf_check cp file2 link
 	cp_compare file_to_link file file2
 }
 
@@ -117,8 +117,8 @@ link_to_file_head() {
 link_to_file_body() {
 	reset
 	# file and link are identical (not copied).
-	atf_check -s eq:1 -o empty -e ignore cp link file
-	atf_check -s eq:0 -o empty -e empty cp link file2
+	atf_check -s exit:1 -e ignore cp link file
+	atf_check cp link file2
 	cp_compare link_to_file file file2
 }
 
@@ -129,7 +129,7 @@ file_over_link_head() {
 }
 file_over_link_body() {
 	reset
-	atf_check -s eq:0 -o empty -e empty cp -P file link
+	atf_check cp -P file link
 	cp_compare file_over_link file link
 }
 
@@ -140,7 +140,7 @@ link_over_file_head() {
 }
 link_over_file_body() {
 	reset
-	atf_check -s eq:0 -o empty -e empty cp -P link file
+	atf_check cp -P link file
 	if [ `readlink link` != `readlink file` ]; then
 		atf_fail "readlink link != readlink file"
 	fi
@@ -153,8 +153,8 @@ files_to_dir_head() {
 files_to_dir_body() {
 	reset
 	# can't copy multiple files to a file
-	atf_check -s eq:1 -o empty -e ignore cp file file2 file3
-	atf_check -s eq:0 -o empty -e empty cp file file2 link dir
+	atf_check -s exit:1 -e ignore cp file file2 file3
+	atf_check cp file file2 link dir
 	cp_compare files_to_dir file "dir/file"
 }
 
@@ -166,8 +166,8 @@ dir_to_file_head() {
 dir_to_file_body() {
 	reset
 	# can't copy a dir onto a file
-	atf_check -s eq:1 -o empty -e ignore cp dir file
-	atf_check -s eq:1 -o empty -e ignore cp -R dir file
+	atf_check -s exit:1 -e ignore cp dir file
+	atf_check -s exit:1 -e ignore cp -R dir file
 }
 
 atf_test_case file_to_linkdir
@@ -177,12 +177,12 @@ file_to_linkdir_head() {
 }
 file_to_linkdir_body() {
 	reset
-	atf_check -s eq:0 -o empty -e empty cp file dirlink
+	atf_check cp file dirlink
 	cp_compare file_to_linkdir file "dir/file"
 
 	# overwrite the link
-	atf_check -s eq:0 -o empty -e empty cp -P file dirlink
-	atf_check -s eq:1 -o empty -e empty readlink dirlink
+	atf_check cp -P file dirlink
+	atf_check -s exit:1 readlink dirlink
 	cp_compare file_to_linkdir file dirlink
 }
 
@@ -194,21 +194,21 @@ linkdir_to_file_head() {
 linkdir_to_file_body() {
 	reset
 	# cannot copy a dir onto a file
-	atf_check -s eq:1 -o empty -e ignore cp dirlink file
+	atf_check -s exit:1 -e ignore cp dirlink file
 
 	# overwrite the link
-	atf_check -s eq:0 -o empty -e empty cp -P dirlink file
+	atf_check cp -P dirlink file
 	if [ `readlink file` != `readlink dirlink` ]; then
 		atf_fail "readlink link != readlink file"
 	fi
 }
 
 dir_to_dne_no_R() {
-	atf_check -s eq:1 -o empty -e ignore cp dir dir2
+	atf_check -s exit:1 -e ignore cp dir dir2
 }
 
 dir_to_dne() {
-	atf_check -s eq:0 -o empty -e empty cp -R dir dir2
+	atf_check cp -R dir dir2
 	cp_compare dir_to_dne "dir/file" "dir2/file"
 	readlink dir2/link >/dev/null
 	if [ $? -gt 0 ]; then
@@ -218,12 +218,12 @@ dir_to_dne() {
 
 dir_to_dir_H() {
 	dir_to_dir_setup
-	atf_check -s eq:0 -o empty -e empty cp -R dir dir2
+	atf_check cp -R dir dir2
 
 	chmod 777 dir
 
 	# copy a dir into a dir, only command-line links are followed
-	atf_check -s eq:0 -o empty -e empty cp -R -H dirlink dir2
+	

CVS commit: src/tests/bin/cp

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 01:33:23 UTC 2024

Modified Files:
src/tests/bin/cp: t_cp.sh

Log Message:
tests/cp: clean up

Replace the deprecated "eq:0" with "exit:0", remove redundant "-o empty"
and "-e empty".


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/cp/t_cp.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/bin/cat

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 00:57:15 UTC 2024

Modified Files:
src/tests/bin/cat: t_cat.sh

Log Message:
tests/cat: clean up

Multiple arguments to atf_set are joined by spaces, there's no need for
an extra space.

The exit status on success must be 0, so don't ignore it.

Remove the unnecessary shell wrapper, as no redirection is going on.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/cat/t_cat.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/cat/t_cat.sh
diff -u src/tests/bin/cat/t_cat.sh:1.3 src/tests/bin/cat/t_cat.sh:1.4
--- src/tests/bin/cat/t_cat.sh:1.3	Thu Jun 16 01:04:58 2016
+++ src/tests/bin/cat/t_cat.sh	Fri Apr 26 00:57:15 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_cat.sh,v 1.3 2016/06/16 01:04:58 sevan Exp $
+# $NetBSD: t_cat.sh,v 1.4 2024/04/26 00:57:15 rillig Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -30,37 +30,37 @@
 
 atf_test_case align
 align_head() {
-	atf_set "descr" "Test that cat(1) aligns the output " \
+	atf_set "descr" "Test that cat(1) aligns the output" \
 			"right with options '-be' (PR bin/4841)"
 }
 
 align_body() {
 
-	atf_check -s ignore -o file:$(atf_get_srcdir)/d_align.out \
-		-x "cat -be $(atf_get_srcdir)/d_align.in"
+	atf_check -o file:$(atf_get_srcdir)/d_align.out \
+	cat -be $(atf_get_srcdir)/d_align.in
 }
 
 atf_test_case nonexistent
 nonexistent_head() {
-	atf_set "descr" "Test that cat(1) doesn't return zero exit " \
+	atf_set "descr" "Test that cat(1) doesn't return zero exit" \
 			"status for a nonexistent file (PR bin/3538)"
 }
 
 nonexistent_body() {
 
-	atf_check -s not-exit:0 -o empty -e not-empty \
-		-x "cat /some/name/that/does/not/exist"
+	atf_check -s not-exit:0 -e not-empty \
+	cat /some/name/that/does/not/exist
 }
 
 atf_test_case se_output
 se_output_head() {
-	atf_set "descr" "Test that cat(1) prints a $ sign " \
+	atf_set "descr" "Test that cat(1) prints a $ sign" \
 			"on blank lines with options '-se' (PR bin/51250)"
 }
 
 se_output_body() {
-	atf_check -s ignore -o file:$(atf_get_srcdir)/d_se_output.out \
-		-x "cat -se $(atf_get_srcdir)/d_se_output.in"
+	atf_check -o file:$(atf_get_srcdir)/d_se_output.out \
+	cat -se $(atf_get_srcdir)/d_se_output.in
 }
 
 atf_init_test_cases()



CVS commit: src/tests/bin/cat

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 26 00:57:15 UTC 2024

Modified Files:
src/tests/bin/cat: t_cat.sh

Log Message:
tests/cat: clean up

Multiple arguments to atf_set are joined by spaces, there's no need for
an extra space.

The exit status on success must be 0, so don't ignore it.

Remove the unnecessary shell wrapper, as no redirection is going on.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/cat/t_cat.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/doc

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 25 17:22:49 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
CHANGES: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.3050 -r1.3051 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.3050 src/doc/CHANGES:1.3051
--- src/doc/CHANGES:1.3050	Wed Apr 24 15:41:41 2024
+++ src/doc/CHANGES	Thu Apr 25 17:22:48 2024
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3050 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3051 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -137,7 +137,7 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 		[gutteridge 20230630]
 	tetris(6): Support the informal standard of allowing setting NO_COLOR
 		in the environment to disable the use of color. [nia 20230701]
-	lint(1): Initial support for C23. [rilling 20230702]
+	lint(1): Initial support for C23. [rillig 20230702]
 	heartbeat(9): New mechanism to check progress of kernel.  This uses
 		hard interrupts to check progress of low-priority soft
 		interrupts, and one CPU to check progress of another CPU.
@@ -230,7 +230,7 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 	kernel: Replace various usage of extent(9) with vmem(9).
 		[thorpej 20231201]
 	indent(1): Use line number of the token start in diagnostics
-		[rilling 20231203]
+		[rillig 20231203]
 	vmem(9): Add the notion of "private boundary tags", allowing vmem
 		to be used VERY early in boot. [thorpej 20231203]
 	kernel: Modularize compat90. [pgoyette 20231209]
@@ -314,7 +314,7 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 		be matched by ugen(4) and accessed through libusb.
 		[thorpej 20240326]
 	moused(8): Remove undocumented and unused option 'C'.
-		[rilling 20240329]
+		[rillig 20240329]
 	ugen(4): Add a "ugen-unit" device property which devpubd(8) scripts
 		can query to determine which /dev/ugenN.xx nodes a given ugen
 		or ugenif device is using.  [thorpej 20240329]



CVS commit: src/doc

2024-04-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 25 17:22:49 UTC 2024

Modified Files:
src/doc: CHANGES

Log Message:
CHANGES: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.3050 -r1.3051 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/makefs

2024-04-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 24 21:59:39 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
makefs: fix out-of-bounds fsnode count in fsnode_sort

Found by running './makefs img.dat cd9660'.

While here, apply more KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/walk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/makefs

2024-04-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 24 21:59:39 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
makefs: fix out-of-bounds fsnode count in fsnode_sort

Found by running './makefs img.dat cd9660'.

While here, apply more KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/walk.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.sbin/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.38 src/usr.sbin/makefs/walk.c:1.39
--- src/usr.sbin/makefs/walk.c:1.38	Wed Apr 24 14:23:37 2024
+++ src/usr.sbin/makefs/walk.c	Wed Apr 24 21:59:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: walk.c,v 1.38 2024/04/24 14:23:37 christos Exp $	*/
+/*	$NetBSD: walk.c,v 1.39 2024/04/24 21:59:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: walk.c,v 1.38 2024/04/24 14:23:37 christos Exp $");
+__RCSID("$NetBSD: walk.c,v 1.39 2024/04/24 21:59:39 rillig Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -93,7 +93,6 @@ fsnode_sort(fsnode *first, const char *r
 	size_t num = 0;
 
 	for (fsnode *tmp = first; tmp; tmp = tmp->next, num++) {
-		num++;
 		if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
 			printf("%s: pre sort: %s %s %s\n",
 			__func__, root, dir, tmp->name);
@@ -103,7 +102,7 @@ fsnode_sort(fsnode *first, const char *r
 	for (fsnode *tmp = first; tmp; tmp = tmp->next)
 		*listptr++ = tmp;
 
-	qsort (list, num, sizeof(*list), fsnode_cmp);
+	qsort(list, num, sizeof(*list), fsnode_cmp);
 
 	for (size_t i = 0; i < num - 1; ++i)
 		list[i]->next = list[i + 1];
@@ -562,7 +561,7 @@ apply_specdir(const char *dir, NODE *spe
 			if (curfsnode->type != S_IFDIR)
 errx(EXIT_FAILURE,
 "`%s' is not a directory", path);
-			assert (curfsnode->child != NULL);
+			assert(curfsnode->child != NULL);
 			apply_specdir(path, curnode, curfsnode->child, speconly);
 		}
 	}
@@ -676,14 +675,14 @@ dump_fsnodes(fsnode *root)
 			assert(cur->symlink != NULL);
 			printf(" -> %s", cur->symlink);
 		} else {
-			assert (cur->symlink == NULL);
+			assert(cur->symlink == NULL);
 		}
 		if (cur->inode->nlink > 1)
 			printf(", nlinks=%d", cur->inode->nlink);
 		putchar('\n');
 
 		if (cur->child) {
-			assert (cur->type == S_IFDIR);
+			assert(cur->type == S_IFDIR);
 			dump_fsnodes(cur->child);
 		}
 	}



CVS commit: src/usr.bin/make

2024-04-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr 23 22:51:28 UTC 2024

Modified Files:
src/usr.bin/make: cond.c make.h parse.c var.c
src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk
cmd-errors-lint.exp cmd-errors-lint.mk cmd-errors.exp cmd-errors.mk
cmdline-undefined.mk cmdline.mk comment.mk cond-cmp-string.mk
cond-func-defined.exp cond-func-defined.mk varmod-ifelse.mk
varmod-match.exp varmod-match.mk

Log Message:
make: clean up comments, code and tests


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/usr.bin/make/cond.c
cvs rdiff -u -r1.330 -r1.331 src/usr.bin/make/make.h
cvs rdiff -u -r1.720 -r1.721 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1104 -r1.1105 src/usr.bin/make/var.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \
src/usr.bin/make/unit-tests/cmd-errors-lint.exp \
src/usr.bin/make/unit-tests/cmd-errors.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmd-errors-lint.mk
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cmd-errors.exp \
src/usr.bin/make/unit-tests/cond-func-defined.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmdline-undefined.mk \
src/usr.bin/make/unit-tests/cmdline.mk
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/comment.mk
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/cond-cmp-string.mk
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-func-defined.mk
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-ifelse.mk
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-match.mk

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/make/cond.c
diff -u src/usr.bin/make/cond.c:1.362 src/usr.bin/make/cond.c:1.363
--- src/usr.bin/make/cond.c:1.362	Wed Feb  7 07:21:22 2024
+++ src/usr.bin/make/cond.c	Tue Apr 23 22:51:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.362 2024/02/07 07:21:22 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.363 2024/04/23 22:51:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -91,7 +91,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.362 2024/02/07 07:21:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.363 2024/04/23 22:51:28 rillig Exp $");
 
 /*
  * Conditional expressions conform to this grammar:
@@ -424,13 +424,12 @@ CondParser_StringExpr(CondParser *par, c
  * Parse a string from an expression or an optionally quoted string,
  * on the left-hand and right-hand sides of comparisons.
  *
- * Results:
- *	Returns the string without any enclosing quotes, or NULL on error.
- *	Sets out_quoted if the leaf was a quoted string literal.
+ * Return the string without any enclosing quotes, or NULL on error.
+ * Sets out_quoted if the leaf was a quoted string literal.
  */
-static void
+static FStr
 CondParser_Leaf(CondParser *par, bool doEval, bool unquotedOK,
-		  FStr *out_str, bool *out_quoted)
+		bool *out_quoted)
 {
 	Buffer buf;
 	FStr str;
@@ -492,7 +491,7 @@ return_buf:
 	buf.data = NULL;
 return_str:
 	Buf_Done();
-	*out_str = str;
+	return str;
 }
 
 /*
@@ -602,7 +601,7 @@ CondParser_Comparison(CondParser *par, b
 	ComparisonOp op;
 	bool lhsQuoted, rhsQuoted;
 
-	CondParser_Leaf(par, doEval, par->leftUnquotedOK, , );
+	lhs = CondParser_Leaf(par, doEval, par->leftUnquotedOK, );
 	if (lhs.str == NULL)
 		goto done_lhs;
 
@@ -622,7 +621,7 @@ CondParser_Comparison(CondParser *par, b
 		goto done_lhs;
 	}
 
-	CondParser_Leaf(par, doEval, true, , );
+	rhs = CondParser_Leaf(par, doEval, true, );
 	t = rhs.str == NULL ? TOK_ERROR
 	: !doEval ? TOK_FALSE
 	: EvalCompare(par, lhs.str, lhsQuoted, op, rhs.str, rhsQuoted);

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.330 src/usr.bin/make/make.h:1.331
--- src/usr.bin/make/make.h:1.330	Sat Apr 20 10:18:55 2024
+++ src/usr.bin/make/make.h	Tue Apr 23 22:51:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.330 2024/04/20 10:18:55 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.331 2024/04/23 22:51:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -399,7 +399,7 @@ typedef struct SearchPath {
 
 /*
  * A graph node represents a target that can possibly be made, including its
- * relation to other targets and a lot of other details.
+ * relation to other targets.
  */
 typedef struct GNode {
 	/* The target's name, such as "clean" or "make.c" */
@@ -581,8 +581,8 @@ extern GNode *SCOPE_GLOBAL;
 extern GNode *SCOPE_CMDLINE;
 
 /*
- * Value returned by Var_Parse when an error is encountered. It actually
- * points to an empty string, so naive callers needn't worry about it.
+ * Value returned by Var_Parse when an error is 

CVS commit: src/usr.bin/make

2024-04-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr 23 22:51:28 UTC 2024

Modified Files:
src/usr.bin/make: cond.c make.h parse.c var.c
src/usr.bin/make/unit-tests: cmd-errors-jobs.exp cmd-errors-jobs.mk
cmd-errors-lint.exp cmd-errors-lint.mk cmd-errors.exp cmd-errors.mk
cmdline-undefined.mk cmdline.mk comment.mk cond-cmp-string.mk
cond-func-defined.exp cond-func-defined.mk varmod-ifelse.mk
varmod-match.exp varmod-match.mk

Log Message:
make: clean up comments, code and tests


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/usr.bin/make/cond.c
cvs rdiff -u -r1.330 -r1.331 src/usr.bin/make/make.h
cvs rdiff -u -r1.720 -r1.721 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1104 -r1.1105 src/usr.bin/make/var.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \
src/usr.bin/make/unit-tests/cmd-errors-lint.exp \
src/usr.bin/make/unit-tests/cmd-errors.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmd-errors-lint.mk
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cmd-errors.exp \
src/usr.bin/make/unit-tests/cond-func-defined.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmdline-undefined.mk \
src/usr.bin/make/unit-tests/cmdline.mk
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/comment.mk
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/cond-cmp-string.mk
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-func-defined.mk
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-ifelse.mk
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-match.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 21:59:48 UTC 2024

Modified Files:
src/usr.bin/make: var.c

Log Message:
make: trim down code for parsing the :gmtime and :localtime modifiers

The :gmtime and :localtime modifiers are not used often and thus are not
time-critical. Exchange the custom code that parses an integer from a
substring for an additional memory allocation.

Thanks sjg@ for suggesting to avoid the custom parsing code.


To generate a diff of this commit:
cvs rdiff -u -r1.1103 -r1.1104 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.1103 src/usr.bin/make/var.c:1.1104
--- src/usr.bin/make/var.c:1.1103	Sun Apr 21 08:56:49 2024
+++ src/usr.bin/make/var.c	Sun Apr 21 21:59:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1103 2024/04/21 08:56:49 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1104 2024/04/21 21:59:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -137,7 +137,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1103 2024/04/21 08:56:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1104 2024/04/21 21:59:48 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -2515,26 +2515,6 @@ TryParseTime(const char **pp, time_t *ou
 	return true;
 }
 
-static bool
-Substring_ParseTime(Substring s, time_t *out_time)
-{
-	const char *p;
-	unsigned long n;
-
-	n = 0;
-	for (p = s.start; p != s.end && ch_isdigit(*p); p++) {
-		unsigned long next = 10 * n + ((unsigned)*p - '0');
-		if (next < n)
-			return false;
-		n = next;
-	}
-	if (p == s.start || p != s.end)
-		return false;
-
-	*out_time = (time_t)n;	/* ignore possible truncation for now */
-	return true;
-}
-
 /* :gmtime and :localtime */
 static ApplyModifierResult
 ApplyModifier_Time(const char **pp, ModChain *ch)
@@ -2552,21 +2532,22 @@ ApplyModifier_Time(const char **pp, ModC
 	if (args[0] == '=') {
 		const char *p = args + 1;
 		LazyBuf buf;
+		FStr arg;
 		if (!ParseModifierPartSubst(, true, '\0', ch->expr->emode,
 		ch, , NULL, NULL))
 			return AMR_CLEANUP;
+		arg = LazyBuf_DoneGet();
 		if (ModChain_ShouldEval(ch)) {
-			Substring arg = LazyBuf_Get();
-			if (!Substring_ParseTime(arg, )) {
+			const char *arg_p = arg.str;
+			if (!TryParseTime(_p, ) || *arg_p != '\0') {
 Parse_Error(PARSE_FATAL,
-"Invalid time value \"%.*s\"",
-(int)Substring_Length(arg), arg.start);
-LazyBuf_Done();
+"Invalid time value \"%s\"", arg.str);
+FStr_Done();
 return AMR_CLEANUP;
 			}
 		} else
 			t = 0;
-		LazyBuf_Done();
+		FStr_Done();
 		*pp = p;
 	} else {
 		t = 0;



CVS commit: src/usr.bin/make

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 21:59:48 UTC 2024

Modified Files:
src/usr.bin/make: var.c

Log Message:
make: trim down code for parsing the :gmtime and :localtime modifiers

The :gmtime and :localtime modifiers are not used often and thus are not
time-critical. Exchange the custom code that parses an integer from a
substring for an additional memory allocation.

Thanks sjg@ for suggesting to avoid the custom parsing code.


To generate a diff of this commit:
cvs rdiff -u -r1.1103 -r1.1104 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/ntp/lib/libntp

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 17:19:52 UTC 2024

Modified Files:
src/external/bsd/ntp/lib/libntp: Makefile

Log Message:
libntf: make MKREPRO timestamp compatible with NetBSD 10

In NetBSD 10, make(1) cannot handle :gmtime arguments that are
expressions, resulting in the error message "Unknown modifier '1'".


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/external/bsd/ntp/lib/libntp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/ntp/lib/libntp

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 17:19:52 UTC 2024

Modified Files:
src/external/bsd/ntp/lib/libntp: Makefile

Log Message:
libntf: make MKREPRO timestamp compatible with NetBSD 10

In NetBSD 10, make(1) cannot handle :gmtime arguments that are
expressions, resulting in the error message "Unknown modifier '1'".


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/external/bsd/ntp/lib/libntp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/ntp/lib/libntp/Makefile
diff -u src/external/bsd/ntp/lib/libntp/Makefile:1.35 src/external/bsd/ntp/lib/libntp/Makefile:1.36
--- src/external/bsd/ntp/lib/libntp/Makefile:1.35	Sat Apr 20 08:03:08 2024
+++ src/external/bsd/ntp/lib/libntp/Makefile	Sun Apr 21 17:19:52 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2024/04/20 08:03:08 rillig Exp $
+#	$NetBSD: Makefile,v 1.36 2024/04/21 17:19:52 rillig Exp $
 
 LIBISPRIVATE=yes
 
@@ -88,8 +88,8 @@ CPPFLAGS+= -I${IDIST}/sntp/libopts
 # For MKREPRO, avoid using __DATE__ and __TIME__.
 .if ${MKREPRO:Uno} == "yes"
 MKREPRO_CPPFLAGS.ntp_calendar.c:= \
-	-DMKREPRO_DATE=\"${%b %e %Y:L:gmtime=${MKREPRO_TIMESTAMP}:Q}\" \
-	-DMKREPRO_TIME=\"${%T:L:gmtime=${MKREPRO_TIMESTAMP}:Q}\"
+	-DMKREPRO_DATE=\"${%b %e %Y:L:${:Ugmtime=${MKREPRO_TIMESTAMP}}:Q}\" \
+	-DMKREPRO_TIME=\"${%T:L:${:Ugmtime=${MKREPRO_TIMESTAMP}}:Q}\"
 CPPFLAGS.ntp_calendar.c += ${MKREPRO_CPPFLAGS.ntp_calendar.c}
 .endif
 



CVS commit: src/usr.bin/make

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 08:56:49 UTC 2024

Modified Files:
src/usr.bin/make: var.c

Log Message:
make: fix out-of-bounds read when evaluating :gmtime and :localtime

The function TryParseTime takes a pointer to a string, but the LazyBuf
returns a Substring, which is not guaranteed to be null-terminated or
delimited.  In TryParseTime, calling strtoul on the Substring read past
the end of the substring.

Noticed in the NetBSD build in libntp, where the :gmtime modifier is
used in two places with the same timestamp value, of which the first was
evaluated correctly and the second wasn't.

The bug was introduced in var.c 1.1050 from 2023-05-09, when the
argument of the :gmtime and :localtime modifiers was allowed to be an
expression instead of an integer constant.


To generate a diff of this commit:
cvs rdiff -u -r1.1102 -r1.1103 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.1102 src/usr.bin/make/var.c:1.1103
--- src/usr.bin/make/var.c:1.1102	Sat Apr 20 10:18:55 2024
+++ src/usr.bin/make/var.c	Sun Apr 21 08:56:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1102 2024/04/20 10:18:55 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1103 2024/04/21 08:56:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -137,7 +137,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1102 2024/04/20 10:18:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1103 2024/04/21 08:56:49 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -2515,6 +2515,26 @@ TryParseTime(const char **pp, time_t *ou
 	return true;
 }
 
+static bool
+Substring_ParseTime(Substring s, time_t *out_time)
+{
+	const char *p;
+	unsigned long n;
+
+	n = 0;
+	for (p = s.start; p != s.end && ch_isdigit(*p); p++) {
+		unsigned long next = 10 * n + ((unsigned)*p - '0');
+		if (next < n)
+			return false;
+		n = next;
+	}
+	if (p == s.start || p != s.end)
+		return false;
+
+	*out_time = (time_t)n;	/* ignore possible truncation for now */
+	return true;
+}
+
 /* :gmtime and :localtime */
 static ApplyModifierResult
 ApplyModifier_Time(const char **pp, ModChain *ch)
@@ -2537,8 +2557,7 @@ ApplyModifier_Time(const char **pp, ModC
 			return AMR_CLEANUP;
 		if (ModChain_ShouldEval(ch)) {
 			Substring arg = LazyBuf_Get();
-			const char *arg_p = arg.start;
-			if (!TryParseTime(_p, ) || arg_p != arg.end) {
+			if (!Substring_ParseTime(arg, )) {
 Parse_Error(PARSE_FATAL,
 "Invalid time value \"%.*s\"",
 (int)Substring_Length(arg), arg.start);



CVS commit: src/usr.bin/make

2024-04-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 21 08:56:49 UTC 2024

Modified Files:
src/usr.bin/make: var.c

Log Message:
make: fix out-of-bounds read when evaluating :gmtime and :localtime

The function TryParseTime takes a pointer to a string, but the LazyBuf
returns a Substring, which is not guaranteed to be null-terminated or
delimited.  In TryParseTime, calling strtoul on the Substring read past
the end of the substring.

Noticed in the NetBSD build in libntp, where the :gmtime modifier is
used in two places with the same timestamp value, of which the first was
evaluated correctly and the second wasn't.

The bug was introduced in var.c 1.1050 from 2023-05-09, when the
argument of the :gmtime and :localtime modifiers was allowed to be an
expression instead of an integer constant.


To generate a diff of this commit:
cvs rdiff -u -r1.1102 -r1.1103 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 12:25:46 UTC 2024

Modified Files:
src: build.sh

Log Message:
build.sh: fix typos in usage message


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/build.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 12:25:46 UTC 2024

Modified Files:
src: build.sh

Log Message:
build.sh: fix typos in usage message


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/build.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.375 src/build.sh:1.376
--- src/build.sh:1.375	Wed Jan  3 02:48:45 2024
+++ src/build.sh	Sat Apr 20 12:25:46 2024
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.375 2024/01/03 02:48:45 thorpej Exp $
+#	$NetBSD: build.sh,v 1.376 2024/04/20 12:25:46 rillig Exp $
 #
 # Copyright (c) 2001-2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1091,7 +1091,7 @@ help()
 list-arch   Show a list of valid MACHINE/MACHINE_ARCH values,
 and exit.  The list may be narrowed by passing glob
 patterns or exact values in MACHINE or MACHINE_ARCH.
-mkrepro-timestamp   Show the latest source timestamp used for reproducable
+mkrepro-timestamp   Show the latest source timestamp used for reproducible
 builds and exit.  Requires -P or -V MKREPRO=yes.
 
  Options:
@@ -1114,7 +1114,7 @@ help()
aliases that set MACHINE/MACHINE_ARCH pairs.
[Default: deduced from the host system if the host
OS is NetBSD]
--N NOISY   Set the noisyness (MAKEVERBOSE) level of the build to NOISY:
+-N NOISY   Set the noisiness (MAKEVERBOSE) level of the build to NOISY:
0   Minimal output ("quiet").
1   Describe what is occurring.
2   Describe what is occurring and echo the actual
@@ -2031,7 +2031,7 @@ createmakewrapper()
 	eval cat <

CVS commit: src/usr.bin/make

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 10:18:56 UTC 2024

Modified Files:
src/usr.bin/make: compat.c job.c make.h parse.c var.c
src/usr.bin/make/unit-tests: Makefile cmd-errors-jobs.exp
cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors.exp
cond-token-string.exp cond-token-string.mk deptgt.exp deptgt.mk
directive-for-errors.exp directive-for-errors.mk directive-for.exp
directive-for.mk directive-include.exp directive-include.mk
directive-undef.exp directive-undef.mk lint.exp moderrs.exp
opt-debug-lint.exp opt-debug-lint.mk var-eval-short.exp
var-eval-short.mk var-op-expand.exp var-op-expand.mk vardebug.exp
vardebug.mk varmisc.exp varmod-assign.exp varmod-assign.mk
varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk
varmod-hash.exp varmod-ifelse.exp varmod-ifelse.mk
varmod-indirect.exp varmod-indirect.mk varmod-localtime.exp
varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk
varmod-loop-varname.exp varmod-loop-varname.mk
varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp
varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-range.exp
varmod-range.mk varmod-subst-regex.exp varmod-subst.exp
varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk
varparse-errors.exp varparse-errors.mk

Log Message:
make: provide more context information for parse/evaluate errors


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/make/compat.c
cvs rdiff -u -r1.467 -r1.468 src/usr.bin/make/job.c
cvs rdiff -u -r1.329 -r1.330 src/usr.bin/make/make.h
cvs rdiff -u -r1.719 -r1.720 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1101 -r1.1102 src/usr.bin/make/var.c
cvs rdiff -u -r1.342 -r1.343 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \
src/usr.bin/make/unit-tests/cmd-errors-lint.exp \
src/usr.bin/make/unit-tests/varmod-subst.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cmd-errors.exp \
src/usr.bin/make/unit-tests/varmod-mtime.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-token-string.exp \
src/usr.bin/make/unit-tests/directive-include.exp \
src/usr.bin/make/unit-tests/var-eval-short.mk \
src/usr.bin/make/unit-tests/varmod-range.exp \
src/usr.bin/make/unit-tests/varmod-to-separator.exp \
src/usr.bin/make/unit-tests/varparse-errors.mk
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-token-string.mk \
src/usr.bin/make/unit-tests/directive-for-errors.mk \
src/usr.bin/make/unit-tests/directive-undef.exp \
src/usr.bin/make/unit-tests/vardebug.mk \
src/usr.bin/make/unit-tests/varmod-mtime.mk
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/deptgt.exp \
src/usr.bin/make/unit-tests/varmod-match-escape.mk
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/deptgt.mk \
src/usr.bin/make/unit-tests/opt-debug-lint.mk \
src/usr.bin/make/unit-tests/varmod-edge.exp \
src/usr.bin/make/unit-tests/varmod-gmtime.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-for-errors.exp
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/directive-for.exp \
src/usr.bin/make/unit-tests/varmod-gmtime.mk
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/directive-for.mk \
src/usr.bin/make/unit-tests/var-eval-short.exp
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/directive-include.mk \
src/usr.bin/make/unit-tests/directive-undef.mk \
src/usr.bin/make/unit-tests/varmod-localtime.exp \
src/usr.bin/make/unit-tests/varmod-to-separator.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/lint.exp \
src/usr.bin/make/unit-tests/varmod-hash.exp \
src/usr.bin/make/unit-tests/varmod-loop-delete.exp \
src/usr.bin/make/unit-tests/varmod-loop-delete.mk
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/moderrs.exp \
src/usr.bin/make/unit-tests/vardebug.exp
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/opt-debug-lint.exp \
src/usr.bin/make/unit-tests/varmod-indirect.mk \
src/usr.bin/make/unit-tests/varmod-match-escape.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-op-expand.exp \
src/usr.bin/make/unit-tests/varmod.exp
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/var-op-expand.mk \
src/usr.bin/make/unit-tests/varmisc.exp \
src/usr.bin/make/unit-tests/varmod-assign.exp \
src/usr.bin/make/unit-tests/varmod-assign.mk \
src/usr.bin/make/unit-tests/varmod-edge.mk \
src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-ifelse.mk
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u 

CVS commit: src/external/bsd/ntp/lib/libntp

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 08:03:08 UTC 2024

Modified Files:
src/external/bsd/ntp/lib/libntp: Makefile

Log Message:
libntp: clean up MKREPRO_TIMESTAMP handling

NetBSD's make has built-in support for formatting timestamps, so use
that instead of relying on an external tool.  The month name is still
always in the C locale, and possible errors are reported in the affected
line, due to the ':=' assignment operator.

Without the ':=' assignment operator, the intermediate variable would
not be necessary, but in that case, make's error handling is broken and
unspecific.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/external/bsd/ntp/lib/libntp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 10:18:56 UTC 2024

Modified Files:
src/usr.bin/make: compat.c job.c make.h parse.c var.c
src/usr.bin/make/unit-tests: Makefile cmd-errors-jobs.exp
cmd-errors-jobs.mk cmd-errors-lint.exp cmd-errors.exp
cond-token-string.exp cond-token-string.mk deptgt.exp deptgt.mk
directive-for-errors.exp directive-for-errors.mk directive-for.exp
directive-for.mk directive-include.exp directive-include.mk
directive-undef.exp directive-undef.mk lint.exp moderrs.exp
opt-debug-lint.exp opt-debug-lint.mk var-eval-short.exp
var-eval-short.mk var-op-expand.exp var-op-expand.mk vardebug.exp
vardebug.mk varmisc.exp varmod-assign.exp varmod-assign.mk
varmod-edge.exp varmod-edge.mk varmod-gmtime.exp varmod-gmtime.mk
varmod-hash.exp varmod-ifelse.exp varmod-ifelse.mk
varmod-indirect.exp varmod-indirect.mk varmod-localtime.exp
varmod-localtime.mk varmod-loop-delete.exp varmod-loop-delete.mk
varmod-loop-varname.exp varmod-loop-varname.mk
varmod-match-escape.exp varmod-match-escape.mk varmod-match.exp
varmod-match.mk varmod-mtime.exp varmod-mtime.mk varmod-range.exp
varmod-range.mk varmod-subst-regex.exp varmod-subst.exp
varmod-to-separator.exp varmod-to-separator.mk varmod.exp varmod.mk
varparse-errors.exp varparse-errors.mk

Log Message:
make: provide more context information for parse/evaluate errors


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/make/compat.c
cvs rdiff -u -r1.467 -r1.468 src/usr.bin/make/job.c
cvs rdiff -u -r1.329 -r1.330 src/usr.bin/make/make.h
cvs rdiff -u -r1.719 -r1.720 src/usr.bin/make/parse.c
cvs rdiff -u -r1.1101 -r1.1102 src/usr.bin/make/var.c
cvs rdiff -u -r1.342 -r1.343 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \
src/usr.bin/make/unit-tests/cmd-errors-lint.exp \
src/usr.bin/make/unit-tests/varmod-subst.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cmd-errors.exp \
src/usr.bin/make/unit-tests/varmod-mtime.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-token-string.exp \
src/usr.bin/make/unit-tests/directive-include.exp \
src/usr.bin/make/unit-tests/var-eval-short.mk \
src/usr.bin/make/unit-tests/varmod-range.exp \
src/usr.bin/make/unit-tests/varmod-to-separator.exp \
src/usr.bin/make/unit-tests/varparse-errors.mk
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-token-string.mk \
src/usr.bin/make/unit-tests/directive-for-errors.mk \
src/usr.bin/make/unit-tests/directive-undef.exp \
src/usr.bin/make/unit-tests/vardebug.mk \
src/usr.bin/make/unit-tests/varmod-mtime.mk
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/deptgt.exp \
src/usr.bin/make/unit-tests/varmod-match-escape.mk
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/deptgt.mk \
src/usr.bin/make/unit-tests/opt-debug-lint.mk \
src/usr.bin/make/unit-tests/varmod-edge.exp \
src/usr.bin/make/unit-tests/varmod-gmtime.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-for-errors.exp
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/directive-for.exp \
src/usr.bin/make/unit-tests/varmod-gmtime.mk
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/directive-for.mk \
src/usr.bin/make/unit-tests/var-eval-short.exp
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/directive-include.mk \
src/usr.bin/make/unit-tests/directive-undef.mk \
src/usr.bin/make/unit-tests/varmod-localtime.exp \
src/usr.bin/make/unit-tests/varmod-to-separator.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/lint.exp \
src/usr.bin/make/unit-tests/varmod-hash.exp \
src/usr.bin/make/unit-tests/varmod-loop-delete.exp \
src/usr.bin/make/unit-tests/varmod-loop-delete.mk
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/moderrs.exp \
src/usr.bin/make/unit-tests/vardebug.exp
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/opt-debug-lint.exp \
src/usr.bin/make/unit-tests/varmod-indirect.mk \
src/usr.bin/make/unit-tests/varmod-match-escape.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-op-expand.exp \
src/usr.bin/make/unit-tests/varmod.exp
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/var-op-expand.mk \
src/usr.bin/make/unit-tests/varmisc.exp \
src/usr.bin/make/unit-tests/varmod-assign.exp \
src/usr.bin/make/unit-tests/varmod-assign.mk \
src/usr.bin/make/unit-tests/varmod-edge.mk \
src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/unit-tests/varmod-ifelse.mk
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u 

CVS commit: src/external/bsd/ntp/lib/libntp

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 08:03:08 UTC 2024

Modified Files:
src/external/bsd/ntp/lib/libntp: Makefile

Log Message:
libntp: clean up MKREPRO_TIMESTAMP handling

NetBSD's make has built-in support for formatting timestamps, so use
that instead of relying on an external tool.  The month name is still
always in the C locale, and possible errors are reported in the affected
line, due to the ':=' assignment operator.

Without the ':=' assignment operator, the intermediate variable would
not be necessary, but in that case, make's error handling is broken and
unspecific.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/external/bsd/ntp/lib/libntp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/ntp/lib/libntp/Makefile
diff -u src/external/bsd/ntp/lib/libntp/Makefile:1.34 src/external/bsd/ntp/lib/libntp/Makefile:1.35
--- src/external/bsd/ntp/lib/libntp/Makefile:1.34	Fri Apr 19 16:04:28 2024
+++ src/external/bsd/ntp/lib/libntp/Makefile	Sat Apr 20 08:03:08 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2024/04/19 16:04:28 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.35 2024/04/20 08:03:08 rillig Exp $
 
 LIBISPRIVATE=yes
 
@@ -86,18 +86,11 @@ ymd2yd.c
 CPPFLAGS+= -I${IDIST}/sntp/libopts
 
 # For MKREPRO, avoid using __DATE__ and __TIME__.
-# Instead, use the date and time from ${MKREPRO_TIMESTAMP}
 .if ${MKREPRO:Uno} == "yes"
-.if ${MKREPRO_TIMESTAMP:Uundefined} == "undefined"
-.error MKREPRO_TIMESTAMP is undefined with MKREPRO active
-.endif
-MKREPRO_DATE != env LC_ALL=C ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%b %e %Y"
-MKREPRO_TIME != env LC_ALL=C ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%T"
-.if ${MKREPRO_DATE} == "" || ${MKREPRO_TIME} == ""
-.error empty MKREPRO_DATE or MKREPRO_TIME
-.endif
-CPPFLAGS.ntp_calendar.c += -DMKREPRO_DATE=\"${MKREPRO_DATE:Q}\"
-CPPFLAGS.ntp_calendar.c += -DMKREPRO_TIME=\"${MKREPRO_TIME:Q}\"
+MKREPRO_CPPFLAGS.ntp_calendar.c:= \
+	-DMKREPRO_DATE=\"${%b %e %Y:L:gmtime=${MKREPRO_TIMESTAMP}:Q}\" \
+	-DMKREPRO_TIME=\"${%T:L:gmtime=${MKREPRO_TIMESTAMP}:Q}\"
+CPPFLAGS.ntp_calendar.c += ${MKREPRO_CPPFLAGS.ntp_calendar.c}
 .endif
 
 COPTS.timetoa.c+=	${CC_WNO_FORMAT_TRUNCATION}



CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 14:06:47 UTC 2024

Modified Files:
src: UPDATING

Log Message:
UPDATING: remove not-so-recent entries


To generate a diff of this commit:
cvs rdiff -u -r1.347 -r1.348 src/UPDATING

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.347 src/UPDATING:1.348
--- src/UPDATING:1.347	Thu Apr 11 06:20:29 2024
+++ src/UPDATING	Sat Apr 20 14:06:47 2024
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.347 2024/04/11 06:20:29 nia Exp $
+$NetBSD: UPDATING,v 1.348 2024/04/20 14:06:47 rillig Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -184,10 +184,6 @@ Recent changes:
 	tools/gcc or external/gpl/gcc, first try cleaning those objects and
 	removing the $DESTDIR/usr/include/g++ subdirectory.
 
-20201230:
-	lint1/ops.c is no longer autogenerated.  If this makes the build
-	fail, clean $OBJDIR/tools/*lint* and $OBJDIR/usr.bin/*xlint*.
-
 20201016:
 	MIPS kernel modules have been disabled until they work.  This will
 	turn up in extra files in the DESTDIR, which should be cleaned.
@@ -339,685 +335,6 @@ Recent changes:
 20190207:
 	GCC 7 switched for many ports.  Update builds are likely to fail.
 
-20180924:
-	A newer OpenSSL version has been imported. If you are doing
-	update builds, make sure to remove all old obj dirs, like:
-	cd /usr/obj && find . -type d -name openssl | xargs rm -rf
-
-20180717:
-	On aarch64 int64_t and related types have changed from long long
-	to long. This requires recompiling all C++ binaries.
-
-20180713:
-	On amd64 and i386 static binaries are now build position
-	independent. This requires recompilation of all object
-	files used to create the crunched /rescue binary.
-	Clean the rescue directory in your obj directory before
-	doing an update build, otherwise linking will fail.
-
-20180414:
-	Existing binutils was migrated to binutils.old.  Manual
-	removal of tools/binutils objects directory may be required
-	to fix tools build failure.
-
-20180311:
-	bdftopcf was updated and may need cleaning in the
-	src/external/mit/xorg/tools/bdftopcf subdirectory if there are
-	link errors.
-
-20180212:
-	between OpenSSL and GCC updates, many things may fail to build.
-	any failure that looks like GCC or openssl is best handled by
-	a clean destdir and objdir.  Full cleandir and destdir deletion
-	is recommended if build failures occur.
-
-20171225:
-	removal of the vadvise syscall requires manual removal of all
-	associated files from the libc build object directory (including
-	the .depend files) - a command like:
-		cd $OBJ && find . -type d -name libc | xargs rm -rf
-	For architectures that support multiple "compat" binary targets,
-	you'll need to cleanup both the regular libc directory and the
-	compat ones (the above command will do that).
-
-20171010:
-	a change to the build structure of external/bsd/acpica/bin/iasl
-	means that its objdir (or *.d and .depend at least) might need
-	to be manually removed - or a build done once without -u.
-
-20170822:
-	a new version of GMP has been imported and probably
-	will break parts of builds related to themselves or GCC, both
-	in the tools and the native section.  Remove all GCC, GMP, MPFR
-	and MPC objdirs or build once without -u.
-
-20170816:
-	a new version of MPFR and MPC have been imported and probably
-	will break parts of builds related to themselves or GCC, both
-	in the tools and the native section.  Remove all GCC, GMP, MPFR
-	and MPC objdirs or build once without -u.
-
-20170402:
-	a new version of dhcpcd has been imported, which does not support
-	update builds from the previous version. Remove your
-	external/bsd/dhcpcd object dir or build once without -u.
-
-20170211:
-	a new terminfo database has been imported.
-	The structure of it has changed slightly from prior versions and
-	an updated tic tool is required.
-	If you build.sh, don't use -u
-
-20170207:
-	various arch dependent libc/exect.S files were removed
-	Either remove the obj directories (lib/libc and compat/amd64/i386/lib
-	if it exists) or do a clean build.
-	(This is a bug in the make system, it should be corrected without
-	human intervention, but isn't.)
-
-20170104:
-	xinput build options have changed.
-	Remove the obj directory (external/mit/xorg/bin/xinput)
-	if you build.sh -u
-
-20170103:
-	a new version of flex has been imported.
-	Remove the file from obj (external/bsd/flex)
-	if you build.sh -u
-
-20161014:
-	a new version of OpenSSL has been imported.
-	Remove the files from obj (crypto/external/bsd/openssl) 
-	if you build.sh -u
-
-20161009:
-	a new version of dhcpcd has been imported with slightly changed
-	build infrastructure. When doing a build.sh -u this requires
-	pruning the external/bsd/dhcpcd objdir.
-
-20160914:
-	i386, amd64, shark, ofppc and macppc have joined 

CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 14:06:47 UTC 2024

Modified Files:
src: UPDATING

Log Message:
UPDATING: remove not-so-recent entries


To generate a diff of this commit:
cvs rdiff -u -r1.347 -r1.348 src/UPDATING

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 13:24:49 UTC 2024

Modified Files:
src/bin: Makefile.inc
src/sbin: Makefile.inc
src/sbin/fsck_lfs: Makefile
src/sbin/newfs_lfs: Makefile
src/sbin/resize_ffs: Makefile
src/usr.bin: Makefile.inc
src/usr.bin/kdump: Makefile
src/usr.bin/ktruss: Makefile
src/usr.bin/rump_server: Makefile
src/usr.sbin: Makefile.inc

Log Message:
{usr.,}{s,}bin: replace LINT_SUPPORTED with the standard NOLINT

While here, re-enable lint in those cases where lint was skipped due to
a bug in interpreting abstract types, which was fixed in cgram.y 1.469
from 2023-08-02.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/bin/Makefile.inc
cvs rdiff -u -r1.23 -r1.24 src/sbin/Makefile.inc
cvs rdiff -u -r1.23 -r1.24 src/sbin/fsck_lfs/Makefile
cvs rdiff -u -r1.15 -r1.16 src/sbin/newfs_lfs/Makefile
cvs rdiff -u -r1.7 -r1.8 src/sbin/resize_ffs/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/Makefile.inc
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/kdump/Makefile
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/ktruss/Makefile
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/rump_server/Makefile
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 20 13:24:49 UTC 2024

Modified Files:
src/bin: Makefile.inc
src/sbin: Makefile.inc
src/sbin/fsck_lfs: Makefile
src/sbin/newfs_lfs: Makefile
src/sbin/resize_ffs: Makefile
src/usr.bin: Makefile.inc
src/usr.bin/kdump: Makefile
src/usr.bin/ktruss: Makefile
src/usr.bin/rump_server: Makefile
src/usr.sbin: Makefile.inc

Log Message:
{usr.,}{s,}bin: replace LINT_SUPPORTED with the standard NOLINT

While here, re-enable lint in those cases where lint was skipped due to
a bug in interpreting abstract types, which was fixed in cgram.y 1.469
from 2023-08-02.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/bin/Makefile.inc
cvs rdiff -u -r1.23 -r1.24 src/sbin/Makefile.inc
cvs rdiff -u -r1.23 -r1.24 src/sbin/fsck_lfs/Makefile
cvs rdiff -u -r1.15 -r1.16 src/sbin/newfs_lfs/Makefile
cvs rdiff -u -r1.7 -r1.8 src/sbin/resize_ffs/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/Makefile.inc
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/kdump/Makefile
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/ktruss/Makefile
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/rump_server/Makefile
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/Makefile.inc
diff -u src/bin/Makefile.inc:1.18 src/bin/Makefile.inc:1.19
--- src/bin/Makefile.inc:1.18	Sat Oct  9 21:06:31 2021
+++ src/bin/Makefile.inc	Sat Apr 20 13:24:48 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.18 2021/10/09 21:06:31 rillig Exp $
+#	$NetBSD: Makefile.inc,v 1.19 2024/04/20 13:24:48 rillig Exp $
 #	@(#)Makefile.inc	8.1 (Berkeley) 5/31/93
 
 .include 		# for MKDYNAMICROOT definition
@@ -10,6 +10,6 @@ BINDIR?=	/bin
 LDSTATIC?=	-static
 .endif
 
-.if ${MKLINT} != "no" && ${LINT_SUPPORTED:Uyes} == "yes"
+.if ${MKLINT} != "no" && !defined(NOLINT)
 realall: lint
 .endif

Index: src/sbin/Makefile.inc
diff -u src/sbin/Makefile.inc:1.23 src/sbin/Makefile.inc:1.24
--- src/sbin/Makefile.inc:1.23	Tue Sep 14 20:13:03 2021
+++ src/sbin/Makefile.inc	Sat Apr 20 13:24:48 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.23 2021/09/14 20:13:03 rillig Exp $
+#	$NetBSD: Makefile.inc,v 1.24 2024/04/20 13:24:48 rillig Exp $
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/8/93
 
 .include 		# for MKDYNAMICROOT definition
@@ -10,6 +10,6 @@ BINDIR?=	/sbin
 LDSTATIC?=	-static
 .endif
 
-.if ${MKLINT} != "no" && ${LINT_SUPPORTED:Uyes} == "yes"
+.if ${MKLINT} != "no" && !defined(NOLINT)
 realall: lint
 .endif

Index: src/sbin/fsck_lfs/Makefile
diff -u src/sbin/fsck_lfs/Makefile:1.23 src/sbin/fsck_lfs/Makefile:1.24
--- src/sbin/fsck_lfs/Makefile:1.23	Tue Sep 14 20:13:03 2021
+++ src/sbin/fsck_lfs/Makefile	Sat Apr 20 13:24:48 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2021/09/14 20:13:03 rillig Exp $
+#	$NetBSD: Makefile,v 1.24 2024/04/20 13:24:48 rillig Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/5/93
 
 WARNS?=	3	# XXX: sign-compare issues
@@ -19,9 +19,4 @@ CPPFLAGS+=-I${.CURDIR} -I${FSCK} -DIN_FS
 LDADD+=-lutil
 DPADD+=${LIBUTIL}
 
-# As of 2021-09-14, lint does not recognize the types as equal, but it should.
-# vnode.c(104): error: redeclaration of register_vget [27]
-# vnode.h(75): previous declaration of register_vget [260]
-LINT_SUPPORTED=	no
-
 .include 

Index: src/sbin/newfs_lfs/Makefile
diff -u src/sbin/newfs_lfs/Makefile:1.15 src/sbin/newfs_lfs/Makefile:1.16
--- src/sbin/newfs_lfs/Makefile:1.15	Tue Sep 14 20:13:03 2021
+++ src/sbin/newfs_lfs/Makefile	Sat Apr 20 13:24:49 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2021/09/14 20:13:03 rillig Exp $
+#	$NetBSD: Makefile,v 1.16 2024/04/20 13:24:49 rillig Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 WARNS?=	3	# XXX: sign-compare issues
@@ -25,9 +25,4 @@ DPADD+=${LIBPROP}
 
 CPPFLAGS+=-I${FSCK_LFS} -I${FSCK} # -DNDEBUG # -DVERBOSE_BLOCKMAP
 
-# As of 2021-09-14, lint does not recognize the types as equal, but it should.
-# vnode.c(104): error: redeclaration of register_vget [27]
-# vnode.h(75): previous declaration of register_vget [260]
-LINT_SUPPORTED=	no
-
 .include 

Index: src/sbin/resize_ffs/Makefile
diff -u src/sbin/resize_ffs/Makefile:1.7 src/sbin/resize_ffs/Makefile:1.8
--- src/sbin/resize_ffs/Makefile:1.7	Tue Sep 14 20:13:03 2021
+++ src/sbin/resize_ffs/Makefile	Sat Apr 20 13:24:49 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2021/09/14 20:13:03 rillig Exp $
+#	$NetBSD: Makefile,v 1.8 2024/04/20 13:24:49 rillig Exp $
 
 .include 
 
@@ -14,7 +14,4 @@ LDADD+= -lutil
 .PATH: ${NETBSDSRCDIR}/sys/ufs/ffs
 .PATH: ${NETBSDSRCDIR}/sbin/fsck
 
-# resize_ffs.c(90): error: cannot take size/alignment of incomplete type [143]
-LINT_SUPPORTED=	no
-
 .include 

Index: src/usr.bin/Makefile.inc
diff -u src/usr.bin/Makefile.inc:1.11 src/usr.bin/Makefile.inc:1.12
--- src/usr.bin/Makefile.inc:1.11	Sun Aug 22 22:24:11 2021
+++ src/usr.bin/Makefile.inc	Sat Apr 20 13:24:49 2024

CVS commit: src/tests/usr.bin/xlint/lint1

2024-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 19 20:59:18 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_207.c

Log Message:
tests/lint: show how to trigger message 207


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_207.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_207.c
diff -u src/tests/usr.bin/xlint/lint1/msg_207.c:1.3 src/tests/usr.bin/xlint/lint1/msg_207.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_207.c:1.3	Thu Jun 16 21:24:41 2022
+++ src/tests/usr.bin/xlint/lint1/msg_207.c	Fri Apr 19 20:59:18 2024
@@ -1,8 +1,51 @@
-/*	$NetBSD: msg_207.c,v 1.3 2022/06/16 21:24:41 rillig Exp $	*/
+/*	$NetBSD: msg_207.c,v 1.4 2024/04/19 20:59:18 rillig Exp $	*/
 # 3 "msg_207.c"
 
 // Test for message: loop not entered at top [207]
 
-/* expect+1: error: syntax error ':' [249] */
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+static void
+/* expect+1: warning: static function 'for_loop' unused [236] */
+for_loop(void)
+{
+	for (int i = 0; i < 10; i++)
+		if (0 == 1)
+			for (i = 0;
+			i < 5;
+/* expect+2: warning: loop not entered at top [207] */
+/* expect+1: warning: end-of-loop code not reached [223] */
+			i += 4)
+return;
+
+	// XXX: Why is this different from the snippet above?
+	for (int i = 0; i < 10; i++)
+		if (0 == 1)
+			/* expect+1: warning: statement not reached [193] */
+			for (int j = 0;
+			j < 5;
+			/* expect+1: warning: end-of-loop code not reached [223] */
+			j += 4)
+return;
+}
+
+static void
+/* expect+1: warning: static function 'while_loop' unused [236] */
+while_loop(void)
+{
+	for (int i = 0; i < 10; i++)
+		if (0 == 1)
+			/* expect+1: warning: loop not entered at top [207] */
+			while (i < 5)
+i += 4;
+}
+
+static void
+/* expect+1: warning: static function 'do_loop' unused [236] */
+do_loop(void)
+{
+	for (int i = 0; i < 10; i++)
+		if (0 == 1)
+			/* expect+1: warning: loop not entered at top [207] */
+			do {
+i += 4;
+			} while (i < 5);
+}



CVS commit: src/tests/usr.bin/xlint/lint1

2024-04-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 19 20:59:18 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_207.c

Log Message:
tests/lint: show how to trigger message 207


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_207.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2024-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 14 15:21:20 UTC 2024

Modified Files:
src/usr.bin/make: str.c

Log Message:
make: make string matching platform-independent

Previously, whether the character range '[a-ä]' matched, depended on the
signedness of the plain 'char' type.  Since make operates on byte
strings and does not support UTF-8 or other multi-byte character
encodings, this edge case is not expected to occur in practice.

No change in the unit tests as this edge case is not covered by tests.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/make/str.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/make/str.c
diff -u src/usr.bin/make/str.c:1.102 src/usr.bin/make/str.c:1.103
--- src/usr.bin/make/str.c:1.102	Fri Jan  5 23:22:06 2024
+++ src/usr.bin/make/str.c	Sun Apr 14 15:21:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.102 2024/01/05 23:22:06 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.103 2024/04/14 15:21:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -71,7 +71,7 @@
 #include "make.h"
 
 /*	"@(#)str.c	5.8 (Berkeley) 6/1/90"	*/
-MAKE_RCSID("$NetBSD: str.c,v 1.102 2024/01/05 23:22:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.103 2024/04/14 15:21:20 rillig Exp $");
 
 
 static HashTable interned_strings;
@@ -297,26 +297,6 @@ Str_Words(const char *str, bool expand)
 }
 
 /*
- * XXX: In the extreme edge case that one of the characters is from the basic
- * execution character set and the other isn't, the result of the comparison
- * differs depending on whether plain char is signed or unsigned.
- *
- * An example is the character range from \xE4 to 'a', where \xE4 may come
- * from U+00E4 'Latin small letter A with diaeresis'.
- *
- * If char is signed, \xE4 evaluates to -28, the first half of the condition
- * becomes -28 <= '0' && '0' <= 'a', which evaluates to true.
- *
- * If char is unsigned, \xE4 evaluates to 228, the second half of the
- * condition becomes 'a' <= '0' && '0' <= 228, which evaluates to false.
- */
-static bool
-in_range(char e1, char c, char e2)
-{
-	return (e1 <= c && c <= e2) || (e2 <= c && c <= e1);
-}
-
-/*
  * Test if a string matches a pattern like "*.[ch]". The pattern matching
  * characters are '*', '?' and '[]', as in fnmatch(3).
  *
@@ -360,7 +340,11 @@ match_fixed_length:
 return res;
 			}
 			if (pat[1] == '-') {
-if (in_range(pat[0], *str, pat[2]))
+unsigned char e1 = (unsigned char)pat[0];
+unsigned char c = (unsigned char)*str;
+unsigned char e2 = (unsigned char)pat[2];
+if ((e1 <= c && c <= e2)
+|| (e2 <= c && c <= e1))
 	goto end_of_char_list;
 pat += 2;
 			}



CVS commit: src/usr.bin/make

2024-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 14 15:21:20 UTC 2024

Modified Files:
src/usr.bin/make: str.c

Log Message:
make: make string matching platform-independent

Previously, whether the character range '[a-ä]' matched, depended on the
signedness of the plain 'char' type.  Since make operates on byte
strings and does not support UTF-8 or other multi-byte character
encodings, this edge case is not expected to occur in practice.

No change in the unit tests as this edge case is not covered by tests.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/make/str.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2024-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 14 12:30:48 UTC 2024

Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: directive-export-impl.exp
directive-for-escape.exp opt-debug-parse.exp var-eval-short.exp
varmod-loop.exp varname-dot-shell.exp

Log Message:
make: add debug logging for .if and .for lines in -dp mode

This helps track down in which line a condition is evaluated.


To generate a diff of this commit:
cvs rdiff -u -r1.718 -r1.719 src/usr.bin/make/parse.c
cvs rdiff -u -r1.17 -r1.18 \
src/usr.bin/make/unit-tests/directive-export-impl.exp
cvs rdiff -u -r1.23 -r1.24 \
src/usr.bin/make/unit-tests/directive-for-escape.exp \
src/usr.bin/make/unit-tests/var-eval-short.exp
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/opt-debug-parse.exp
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-loop.exp
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varname-dot-shell.exp

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/make/parse.c
diff -u src/usr.bin/make/parse.c:1.718 src/usr.bin/make/parse.c:1.719
--- src/usr.bin/make/parse.c:1.718	Mon Apr  1 12:26:02 2024
+++ src/usr.bin/make/parse.c	Sun Apr 14 12:30:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.718 2024/04/01 12:26:02 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.719 2024/04/14 12:30:47 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -105,7 +105,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.718 2024/04/01 12:26:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.719 2024/04/14 12:30:47 rillig Exp $");
 
 /* Detects a multiple-inclusion guard in a makefile. */
 typedef enum {
@@ -2607,6 +2607,7 @@ ReadHighLevelLine(void)
 		if (line == NULL)
 			return NULL;
 
+		DEBUG2(PARSE, "Parsing line %u: %s\n", curFile->lineno, line);
 		if (curFile->guardState != GS_NO
 		&& ((curFile->guardState == GS_START && line[0] != '.')
 			|| curFile->guardState == GS_DONE))
@@ -2929,8 +2930,6 @@ Parse_File(const char *name, int fd)
 
 	do {
 		while ((line = ReadHighLevelLine()) != NULL) {
-			DEBUG2(PARSE, "Parsing line %u: %s\n",
-			CurFile()->lineno, line);
 			ParseLine(line);
 		}
 	} while (ParseEOF());

Index: src/usr.bin/make/unit-tests/directive-export-impl.exp
diff -u src/usr.bin/make/unit-tests/directive-export-impl.exp:1.17 src/usr.bin/make/unit-tests/directive-export-impl.exp:1.18
--- src/usr.bin/make/unit-tests/directive-export-impl.exp:1.17	Thu Mar  3 19:36:35 2022
+++ src/usr.bin/make/unit-tests/directive-export-impl.exp	Sun Apr 14 12:30:47 2024
@@ -10,6 +10,7 @@ Pattern for ':N' is "*"
 ModifyWords: split "<>" into 1 word
 Result of ${UT_VAR:N*} is ""
 ParseDependency(: )
+Parsing line 42: .if ${:!echo "\$UT_VAR"!} != "<>"
 CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<>"
 Var_Parse: ${:!echo "\$UT_VAR"!} != "<>" (eval-defined)
 Evaluating modifier ${:!...} on value "" (eval-defined, undefined)
@@ -34,6 +35,7 @@ Result of ${UT_VAR:N*} is ""
 ParseDependency(: )
 Parsing line 54: REF=		defined
 Global: REF = defined
+Parsing line 58: .if ${:!echo "\$UT_VAR"!} != ""
 CondParser_Eval: ${:!echo "\$UT_VAR"!} != ""
 Var_Parse: ${:!echo "\$UT_VAR"!} != "" (eval-defined)
 Evaluating modifier ${:!...} on value "" (eval-defined, undefined)

Index: src/usr.bin/make/unit-tests/directive-for-escape.exp
diff -u src/usr.bin/make/unit-tests/directive-for-escape.exp:1.23 src/usr.bin/make/unit-tests/directive-for-escape.exp:1.24
--- src/usr.bin/make/unit-tests/directive-for-escape.exp:1.23	Sun Nov 19 22:06:15 2023
+++ src/usr.bin/make/unit-tests/directive-for-escape.exp	Sun Apr 14 12:30:47 2024
@@ -106,6 +106,7 @@ make: "directive-for-escape.mk" line 228
 For: end for 1
 For: loop body with i = "
 ":
+Parsing line 244: .for i in "${.newline}"
 For: end for 1
 Parse_PushInput: .for loop in directive-for-escape.mk, line 244
 make: "directive-for-escape.mk" line 244: newline in .for value
Index: src/usr.bin/make/unit-tests/var-eval-short.exp
diff -u src/usr.bin/make/unit-tests/var-eval-short.exp:1.23 src/usr.bin/make/unit-tests/var-eval-short.exp:1.24
--- src/usr.bin/make/unit-tests/var-eval-short.exp:1.23	Thu Jun  1 20:56:35 2023
+++ src/usr.bin/make/unit-tests/var-eval-short.exp	Sun Apr 14 12:30:47 2024
@@ -1,5 +1,6 @@
 make: "var-eval-short.mk" line 46: In the :@ modifier of "", the variable name "${FAIL}" must not contain a dollar
 make: "var-eval-short.mk" line 46: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@})
+Parsing line 159: .if 0 && ${0:?${FAIL}then:${FAIL}else}
 CondParser_Eval: 0 && ${0:?${FAIL}then:${FAIL}else}
 Var_Parse: ${0:?${FAIL}then:${FAIL}else} (parse-only)
 Parsing modifier ${0:?...}
@@ -10,6 +11,7 @@ Modifier part: "${FAIL}else"
 Result of ${0:?${FAIL}then:${FAIL}else} is "" (parse-only, defined)
 Parsing line 167: DEFINED=	defined
 Global: 

CVS commit: src/usr.bin/make

2024-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 14 12:30:48 UTC 2024

Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: directive-export-impl.exp
directive-for-escape.exp opt-debug-parse.exp var-eval-short.exp
varmod-loop.exp varname-dot-shell.exp

Log Message:
make: add debug logging for .if and .for lines in -dp mode

This helps track down in which line a condition is evaluated.


To generate a diff of this commit:
cvs rdiff -u -r1.718 -r1.719 src/usr.bin/make/parse.c
cvs rdiff -u -r1.17 -r1.18 \
src/usr.bin/make/unit-tests/directive-export-impl.exp
cvs rdiff -u -r1.23 -r1.24 \
src/usr.bin/make/unit-tests/directive-for-escape.exp \
src/usr.bin/make/unit-tests/var-eval-short.exp
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/opt-debug-parse.exp
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-loop.exp
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varname-dot-shell.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/gen

2024-04-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 13 14:02:51 UTC 2024

Modified Files:
src/tests/lib/libc/gen: t_fmtcheck.c

Log Message:
tests/fmtcheck: show that fmtcheck does not support "%2$s"


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/gen/t_fmtcheck.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/gen/t_fmtcheck.c
diff -u src/tests/lib/libc/gen/t_fmtcheck.c:1.5 src/tests/lib/libc/gen/t_fmtcheck.c:1.6
--- src/tests/lib/libc/gen/t_fmtcheck.c:1.5	Wed Dec 13 06:47:04 2017
+++ src/tests/lib/libc/gen/t_fmtcheck.c	Sat Apr 13 14:02:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fmtcheck.c,v 1.5 2017/12/13 06:47:04 rin Exp $	*/
+/*	$NetBSD: t_fmtcheck.c,v 1.6 2024/04/13 14:02:51 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -75,6 +75,10 @@ struct test_fmt {
 	{ "%ld %30s %#llx %-10.*e", "This number %lu%% and string %s has %qd numbers and %.*g floats", 1 },
 	{ "%o", "%lx", 2 },
 	{ "%p", "%lu", 2 },
+	// When fmtcheck supports '$', it could be used in dcngettext.
+	{ "%1$s", "%s", 2 },
+	{ "%1$s %2$s", "%s %s", 2 },
+	{ "%2$d %1$s", "%s %d", 2 },
 };
 
 ATF_TC(fmtcheck_basic);



CVS commit: src/tests/lib/libc/gen

2024-04-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 13 14:02:51 UTC 2024

Modified Files:
src/tests/lib/libc/gen: t_fmtcheck.c

Log Message:
tests/fmtcheck: show that fmtcheck does not support "%2$s"


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/gen/t_fmtcheck.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/xlint/lint1

2024-04-11 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 12 05:44:38 UTC 2024

Modified Files:
src/usr.bin/xlint/lint1: cksnprintb.c externs1.h tree.c

Log Message:
lint: clean up and speed up the check for snprintb


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint1/cksnprintb.c
cvs rdiff -u -r1.221 -r1.222 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.634 -r1.635 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/cksnprintb.c
diff -u src/usr.bin/xlint/lint1/cksnprintb.c:1.13 src/usr.bin/xlint/lint1/cksnprintb.c:1.14
--- src/usr.bin/xlint/lint1/cksnprintb.c:1.13	Fri Apr 12 05:17:48 2024
+++ src/usr.bin/xlint/lint1/cksnprintb.c	Fri Apr 12 05:44:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cksnprintb.c,v 1.13 2024/04/12 05:17:48 rillig Exp $	*/
+/*	$NetBSD: cksnprintb.c,v 1.14 2024/04/12 05:44:38 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cksnprintb.c,v 1.13 2024/04/12 05:17:48 rillig Exp $");
+__RCSID("$NetBSD: cksnprintb.c,v 1.14 2024/04/12 05:44:38 rillig Exp $");
 #endif
 
 #include 
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: cksnprintb.c,v 1.13 20
 typedef struct {
 	bool new_style;
 	const buffer *fmt;
-	const tnode_t *value;
+	uint64_t possible_value_bits;
 
 	quoted_iterator it;
 	uint64_t field_width;
@@ -128,7 +128,7 @@ check_bit(checker *ck, uint64_t dir_lsb,
 		}
 	}
 
-	if (!(possible_bits(ck->value) & field_mask))
+	if (!(ck->possible_value_bits & field_mask))
 		/* conversion '%.*s' is unreachable by input value */
 		warning(378, len, start);
 }
@@ -265,9 +265,8 @@ check_conversion(checker *ck)
 }
 
 void
-check_snprintb(const tnode_t *expr)
+check_snprintb(const function_call *call)
 {
-	const function_call *call = expr->u.call;
 	const char *name;
 	const buffer *fmt;
 	const tnode_t *value;
@@ -287,7 +286,7 @@ check_snprintb(const tnode_t *expr)
 
 	checker ck = {
 		.fmt = fmt,
-		.value = value,
+		.possible_value_bits = possible_bits(value),
 		.field_width = 64,
 	};
 

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.221 src/usr.bin/xlint/lint1/externs1.h:1.222
--- src/usr.bin/xlint/lint1/externs1.h:1.221	Fri Mar 29 08:35:32 2024
+++ src/usr.bin/xlint/lint1/externs1.h	Fri Apr 12 05:44:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.221 2024/03/29 08:35:32 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.222 2024/04/12 05:44:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -422,4 +422,4 @@ void check_getopt_end_switch(void);
 void check_getopt_end_while(void);
 
 /* cksnprintb.c */
-void check_snprintb(const tnode_t *);
+void check_snprintb(const function_call *);

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.634 src/usr.bin/xlint/lint1/tree.c:1.635
--- src/usr.bin/xlint/lint1/tree.c:1.634	Sun Mar 31 20:28:45 2024
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr 12 05:44:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.634 2024/03/31 20:28:45 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.635 2024/04/12 05:44:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.634 2024/03/31 20:28:45 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.635 2024/04/12 05:44:38 rillig Exp $");
 #endif
 
 #include 
@@ -4507,7 +4507,10 @@ check_expr_call(const tnode_t *tn, const
 	lint_assert(ln->u.ops.left->tn_op == NAME);
 	if (!szof && !is_compiler_builtin(ln->u.ops.left->u.sym->s_name))
 		outcall(tn, vctx || cond, retval_discarded);
-	check_snprintb(tn);
+
+	const function_call *call = tn->u.call;
+	if (call->args_len == 4 || call->args_len == 5)
+		check_snprintb(call);
 }
 
 static void



CVS commit: src/usr.bin/xlint/lint1

2024-04-11 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 12 05:44:38 UTC 2024

Modified Files:
src/usr.bin/xlint/lint1: cksnprintb.c externs1.h tree.c

Log Message:
lint: clean up and speed up the check for snprintb


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint1/cksnprintb.c
cvs rdiff -u -r1.221 -r1.222 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.634 -r1.635 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-11 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 12 05:17:48 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_363.c msg_371.c msg_376.c
src/usr.bin/xlint/lint1: cksnprintb.c err.c

Log Message:
lint: in snprintb, warn about all escaped characters in descriptions


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_363.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_371.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_376.c
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/cksnprintb.c
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/xlint/lint1/err.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-04-11 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 12 05:17:48 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_363.c msg_371.c msg_376.c
src/usr.bin/xlint/lint1: cksnprintb.c err.c

Log Message:
lint: in snprintb, warn about all escaped characters in descriptions


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_363.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_371.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_376.c
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/cksnprintb.c
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/xlint/lint1/err.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_363.c
diff -u src/tests/usr.bin/xlint/lint1/msg_363.c:1.4 src/tests/usr.bin/xlint/lint1/msg_363.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_363.c:1.4	Sun Mar  3 16:09:01 2024
+++ src/tests/usr.bin/xlint/lint1/msg_363.c	Fri Apr 12 05:17:48 2024
@@ -1,12 +1,13 @@
-/*	$NetBSD: msg_363.c,v 1.4 2024/03/03 16:09:01 rillig Exp $	*/
+/*	$NetBSD: msg_363.c,v 1.5 2024/04/12 05:17:48 rillig Exp $	*/
 # 3 "msg_363.c"
 
-// Test for message: non-printing character '%.*s' in description '%.*s' [363]
+// Test for message: escaped character '%.*s' in description of conversion '%.*s' [363]
 
 /*
  * The purpose of snprintb is to produce a printable, visible representation
- * of a binary number, therefore the description should consist of visible
- * characters only.
+ * of a binary number, therefore the description should consist of simple
+ * characters only, and these should not need to be escaped.  If they are,
+ * it's often due to a typo, such as a missing terminating '\0'.
  */
 
 /* lint1-extra-flags: -X 351 */
@@ -22,17 +23,17 @@ old_style_description(unsigned u32)
 	char buf[64];
 
 	/* expect+6: warning: bit position '\t' in '\tprint' should be escaped as octal or hex [369] */
-	/* expect+5: warning: non-printing character '\377' in description 'able\377' [363] */
+	/* expect+5: warning: escaped character '\377' in description of conversion '\nable\377' [363] */
 	/* expect+4: warning: bit position '\n' in '\nable\377' should be escaped as octal or hex [369] */
 	snprintb(buf, sizeof(buf),
 	"\020"
 	"\001non\tprint\nable\377",
 	u32);
 
-	/* expect+10: warning: non-printing character '\177' in description '\177' [363] */
-	/* expect+9: warning: non-printing character '\177' in description 'aa\177' [363] */
-	/* expect+8: warning: non-printing character '\177' in description 'bb""\177' [363] */
-	/* expect+7: warning: non-printing character '\177' in description 'cc\177' [363] */
+	/* expect+10: warning: escaped character '\177' in description of conversion '\002""\177' [363] */
+	/* expect+9: warning: escaped character '\177' in description of conversion '\003aa\177' [363] */
+	/* expect+8: warning: escaped character '\177' in description of conversion '\004""bb""\177' [363] */
+	/* expect+7: warning: escaped character '\177' in description of conversion '\005cc\177' [363] */
 	snprintb(buf, sizeof(buf),
 	"\020"
 	"\002""\177"

Index: src/tests/usr.bin/xlint/lint1/msg_371.c
diff -u src/tests/usr.bin/xlint/lint1/msg_371.c:1.1 src/tests/usr.bin/xlint/lint1/msg_371.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_371.c:1.1	Fri Mar  1 19:39:29 2024
+++ src/tests/usr.bin/xlint/lint1/msg_371.c	Fri Apr 12 05:17:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_371.c,v 1.1 2024/03/01 19:39:29 rillig Exp $	*/
+/*	$NetBSD: msg_371.c,v 1.2 2024/04/12 05:17:48 rillig Exp $	*/
 # 3 "msg_371.c"
 
 // Test for message: bit position '%.*s' (%ju) in '%.*s' out of range %u..%u [371]
@@ -21,9 +21,10 @@ example(unsigned u32, uint64_t u64)
 {
 	char buf[64];
 
-	/* expect+11: warning: bit position '\000' (0) in '\000zero' out of range 1..32 [371] */
-	/* expect+10: warning: non-printing character '\177' in description 'bit32""\041bit33""\177' [363] */
-	/* expect+9: warning: non-printing character '\377' in description 'bit32""\041bit33""\177bit127""\377' [363] */
+	/* expect+12: warning: bit position '\000' (0) in '\000zero' out of range 1..32 [371] */
+	/* expect+11: warning: escaped character '\041' in description of conversion '\040bit32""\041' [363] */
+	/* expect+10: warning: escaped character '\177' in description of conversion '\040bit32""\041bit33""\177' [363] */
+	/* expect+9: warning: escaped character '\377' in description of conversion '\040bit32""\041bit33""\177bit127""\377' [363] */
 	snprintb(buf, sizeof(buf),
 	"\020"
 	"\000zero"

Index: src/tests/usr.bin/xlint/lint1/msg_376.c
diff -u src/tests/usr.bin/xlint/lint1/msg_376.c:1.2 src/tests/usr.bin/xlint/lint1/msg_376.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_376.c:1.2	Sun Mar  3 00:50:41 2024
+++ src/tests/usr.bin/xlint/lint1/msg_376.c	Fri Apr 12 05:17:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_376.c,v 1.2 2024/03/03 

CVS commit: src/bin/ed

2024-04-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 10 17:52:41 UTC 2024

Modified Files:
src/bin/ed: glbl.c

Log Message:
ed: fix inconsistency in comment


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/bin/ed/glbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/ed

2024-04-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 10 17:52:41 UTC 2024

Modified Files:
src/bin/ed: glbl.c

Log Message:
ed: fix inconsistency in comment


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/bin/ed/glbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ed/glbl.c
diff -u src/bin/ed/glbl.c:1.10 src/bin/ed/glbl.c:1.11
--- src/bin/ed/glbl.c:1.10	Fri Jan  4 19:13:58 2019
+++ src/bin/ed/glbl.c	Wed Apr 10 17:52:41 2024
@@ -1,6 +1,6 @@
-/*	$NetBSD: glbl.c,v 1.10 2019/01/04 19:13:58 maya Exp $	*/
+/*	$NetBSD: glbl.c,v 1.11 2024/04/10 17:52:41 rillig Exp $	*/
 
-/* glob.c: This file contains the global command routines for the ed line
+/* glbl.c: This file contains the global command routines for the ed line
editor */
 /*-
  * Copyright (c) 1993 Andrew Moore, Talke Studio.
@@ -33,7 +33,7 @@
 #if 0
 static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp";
 #else
-__RCSID("$NetBSD: glbl.c,v 1.10 2019/01/04 19:13:58 maya Exp $");
+__RCSID("$NetBSD: glbl.c,v 1.11 2024/04/10 17:52:41 rillig Exp $");
 #endif
 #endif /* not lint */
 



Re: CVS commit: src/lib/libutil

2024-04-08 Thread Roland Illig
Am 08.04.2024 um 21:18 schrieb Valery Ushakov:
>   "=\017FIFTEEN\0"
>
> with its result a few lines below that has:
>
>   BURST=0xf=FIFTEEN

Thank you for explaining this example. I had a gut feeling that there
would be some hidden correlation between some octal/hexadecimal
combinations, but I couldn't name it. Indeed, if the number base for
output is hexadecimal, the field comparisons should be done in
hexadecimal as well.

I adjusted the description and examples in the manual page accordingly.

Roland



CVS commit: src

2024-04-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  8 21:28:36 UTC 2024

Modified Files:
src/lib/libutil: snprintb.3
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb.3: provide examples for hexadecimal character escapes

Suggested by uwe@, in reaction to the previous commit, which preferred
octal in the examples. Hexadecimal escapes are more familiar to most
programmers, and the chance of mistaking \x14 for decimal 14 is less
than the chance of mistaking octal \014 for decimal 14.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/libutil/snprintb.3
cvs rdiff -u -r1.35 -r1.36 src/tests/lib/libutil/t_snprintb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libutil/snprintb.3
diff -u src/lib/libutil/snprintb.3:1.38 src/lib/libutil/snprintb.3:1.39
--- src/lib/libutil/snprintb.3:1.38	Sun Apr  7 14:28:26 2024
+++ src/lib/libutil/snprintb.3	Mon Apr  8 21:28:35 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: snprintb.3,v 1.38 2024/04/07 14:28:26 rillig Exp $
+.\" $NetBSD: snprintb.3,v 1.39 2024/04/08 21:28:35 rillig Exp $
 .\"
 .\" Copyright (c) 1998, 2024 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 7, 2024
+.Dd April 8, 2024
 .Dt SNPRINTB 3
 .Os
 .Sh NAME
@@ -118,7 +118,10 @@ the bit positions are 0-based.
 If the first character of
 .Fa fmt
 is
-.Ql \e177 ,
+.Pq in C escape-character format
+.Ql \e177
+or
+.Ql \ex7f ,
 the remainder of the
 .Fa fmt
 argument follows the
@@ -131,14 +134,18 @@ The next character
 format
 .Pc
 specifies the numeral base in which to print the numbers in the output.
-The possible values
-.Pq in C escape-character format
-are
+The possible values are
 .Ql \e010
+or
+.Ql \ex08
 for octal,
 .Ql \e012
+or
+.Ql \ex0a
 for decimal, and
 .Ql \e020
+or
+.Ql \ex10
 for hexadecimal.
 .Pp
 The remaining characters in the
@@ -160,8 +167,12 @@ and a description that is printed if the
 The bit position is a 1-based single-byte binary value,
 ranging from
 .Ql \e001
+or
+.Ql \ex01
 (1) for the least significant bit up to
 .Ql \e040
+or
+.Ql \ex20
 (32) for the most significant bit.
 .Pp
 The description is delimited by the next character whose value is 32 or less
@@ -182,8 +193,12 @@ followed by a
 The bit positions are 0-based,
 ranging from
 .Ql \e000
+or
+.Ql \ex00
 (0) for the least significant bit to
 .Ql \e077
+or
+.Ql \ex3f
 (63) for the most significant bit.
 .
 .Bl -tag -width Cm
@@ -212,6 +227,26 @@ and
 .Sq Cm \&*
 conversions below.
 .
+.It Cm \&= Ar cmp Ar descr
+Compares the field value from the previous
+.Sq Cm f
+conversion to the single-byte value
+.Ar cmp ,
+ranging from
+.Ql \e000
+or
+.Ql \ex00
+(0) to
+.Ql \e377
+or
+.Ql \exff
+(255).
+If they are equal, prints
+.Ql \&=
+followed by the description from
+.Ar descr .
+This conversion may be repeated.
+.
 .It Cm F Ar lsb Ar width Op Ar descr
 Describes a multi-bit field like
 .Sq Cm f ,
@@ -225,24 +260,20 @@ The description from
 is ignored,
 it is only present for uniformity with the other conversions.
 .
-.It Cm \&= Ar cmp Ar descr
-Compares the field value from the previous
-.Sq Cm f
-conversion to the single-byte value
-.Ar cmp ,
-which ranges from 0 to 255.
-If they are equal, prints
-.Ql \&=
-followed by the description from
-.Ar descr .
-This conversion may be repeated.
-.
 .It Cm \&: Ar cmp Ar descr
 Compares the field value from the previous
 .Sq Cm F
 conversion to the single-byte value
 .Ar cmp ,
-which ranges from 0 to 255.
+ranging from
+.Ql \e000
+or
+.Ql \ex00
+(0) to
+.Ql \e377
+or
+.Ql \exff
+(255).
 If they are equal, prints the description from
 .Ar descr .
 This conversion may be repeated.
@@ -255,7 +286,7 @@ or
 conversions matched, prints the format string
 .Ar fmt
 via
-.Xr printf 3 .
+.Xr snprintf 3 .
 The format string
 .Ar fmt
 may contain a single
@@ -289,11 +320,18 @@ snprintb(buf, bufsize, "\e010\e002BITTWO
 \(rA "03"
 
 snprintb(buf, bufsize,
-"\e020"
-"\ex10""NOTBOOT"   "\ex0f""FPP"   "\ex0e""SDVMA"
-"\ex0c""VIDEO" "\ex0b""LORES" "\ex0a""FPA"
-"\ex09""DIAG"  "\ex07""CACHE" "\ex06""IOCACHE"
-"\ex05""LOOPBACK"  "\ex04""DBGCACHE",
+"\ex10"
+"\ex10" "NOTBOOT"
+"\ex0f" "FPP"
+"\ex0e" "SDVMA"
+"\ex0c" "VIDEO"
+"\ex0b" "LORES"
+"\ex0a" "FPA"
+"\ex09" "DIAG"
+"\ex07" "CACHE"
+"\ex06" "IOCACHE"
+"\ex05" "LOOPBACK"
+"\ex04" "DBGCACHE",
 0xe860)
 \(rA "0xe860"
 .Ed
@@ -302,9 +340,13 @@ An example of the new formatting style:
 .Bd -literal -offset indent
 snprintb(buf, bufsize,
 "\e177\e020"
-"b\e000LSB\e0" "b\e001BITONE\e0" "f\e004\e004NIBBLE2\e0"
-"f\e020\e004BURST\e0" "=\e004FOUR\e0" "=\e017FIFTEEN\e0"
-"b\e037MSB\e0",
+"b\e000" "LSB\e0"
+"b\e001" "BITONE\e0"
+"f\e004\e004" 

CVS commit: src

2024-04-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  8 21:28:36 UTC 2024

Modified Files:
src/lib/libutil: snprintb.3
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb.3: provide examples for hexadecimal character escapes

Suggested by uwe@, in reaction to the previous commit, which preferred
octal in the examples. Hexadecimal escapes are more familiar to most
programmers, and the chance of mistaking \x14 for decimal 14 is less
than the chance of mistaking octal \014 for decimal 14.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/libutil/snprintb.3
cvs rdiff -u -r1.35 -r1.36 src/tests/lib/libutil/t_snprintb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/lib/libutil

2024-04-08 Thread Roland Illig
Am 08.04.2024 um 03:24 schrieb Valery Ushakov:
> On Sun, Apr 07, 2024 at 14:28:27 +0000, Roland Illig wrote:
>
>> Log Message:
>> snprintb.3: clean up formatting and wording, prefer octal in examples
>>
>> Using hexadecimal character escapes requires separate string literals if
>> the description starts with one of the letters A-F; octal character
>> escapes have at most 3 digits, reducing ambiguity.
>
> 70s are over, very few people speak octal fluently.  If anything, the
> man page should highlight the potential snag.  Besides, separate
> literal for the name is good for readability anyway.

When I looked through the NetBSD tree exploring the current usage, I
found that a significant majority uses octal instead of hexadecimal. I
don't know the exact reasons for this, it might be due to existing
practice in the 1990s, to avoid splitting the bit position and the
description to separate string literals, to be able to easily split the
bit position into the byte and the bit portion mentally, or maybe
something entirely different.

While your claim that "very few people speak octal fluently" may be true
for programmers in general, I expect those using the snprintb function
to be more fluent than others. Of course, I saw cases where "\040" was
followed by "\039", just as I saw cases of "\x0fFIELD". Lint now warns
in both these cases.

Regarding the separate literals, I didn't see them in wide use up to
now. Existing code seems to focus more on compressing the source code
into as few lines as possible rather than making it easily readable. I
agree that separate string literals are more readable, and I converted
the example that uses hexadecimal escapes to this style.

I didn't eradicate _all_ hexadecimal examples, I just made each example
use only one number base, not mix them both. There are both octal and
hexadecimal examples in the manual page.

Roland



CVS commit: src/sys/arch

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 17:08:00 UTC 2024

Modified Files:
src/sys/arch/sparc/include: psl.h
src/sys/arch/sparc/sparc: memeccreg.h
src/sys/arch/sparc64/include: psl.h

Log Message:
sparc: fix typos and omissions in PSTATE_BITS and ECC_AFR_BITS

Fixes PR 57869.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sparc/include/psl.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc/sparc/memeccreg.h
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sparc64/include/psl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch

2024-04-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr  7 17:08:00 UTC 2024

Modified Files:
src/sys/arch/sparc/include: psl.h
src/sys/arch/sparc/sparc: memeccreg.h
src/sys/arch/sparc64/include: psl.h

Log Message:
sparc: fix typos and omissions in PSTATE_BITS and ECC_AFR_BITS

Fixes PR 57869.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sparc/include/psl.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc/sparc/memeccreg.h
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sparc64/include/psl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc/include/psl.h
diff -u src/sys/arch/sparc/include/psl.h:1.52 src/sys/arch/sparc/include/psl.h:1.53
--- src/sys/arch/sparc/include/psl.h:1.52	Tue Jul 11 13:10:08 2023
+++ src/sys/arch/sparc/include/psl.h	Sun Apr  7 17:08:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.52 2023/07/11 13:10:08 martin Exp $ */
+/*	$NetBSD: psl.h,v 1.53 2024/04/07 17:08:00 rillig Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -113,8 +113,11 @@
 #define PSTATE_IE	0x002	/* interrupt enable */
 #define PSTATE_AG	0x001	/* enable alternate globals */
 
-#define PSTATE_BITS "\20\14IG\13MG\12CLE\11TLE\10\7MM\6RED\5PEF\4AM\3PRIV\2IE\1AG"
-
+#define PSTATE_BITS "\177\020"		\
+	"b\013IG\0"	"b\012MG\0"	"b\011CLE\0"	"b\010TLE\0"	\
+			"F\006\002\0"	":\000MM_TSO\0"	":\001MM_PSO\0"	\
+	":\002MM_RMO\0"	"*?\0"		"b\005RED\0"	"b\004PEF\0"	\
+	"b\003AM\0"	"b\002PRIV\0"	"b\001IE\0"	"b\000AG\0"
 
 /*
  * 32-bit code requires TSO or at best PSO since that's what's supported on

Index: src/sys/arch/sparc/sparc/memeccreg.h
diff -u src/sys/arch/sparc/sparc/memeccreg.h:1.2 src/sys/arch/sparc/sparc/memeccreg.h:1.3
--- src/sys/arch/sparc/sparc/memeccreg.h:1.2	Mon Apr 28 20:23:36 2008
+++ src/sys/arch/sparc/sparc/memeccreg.h	Sun Apr  7 17:08:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: memeccreg.h,v 1.2 2008/04/28 20:23:36 martin Exp $	*/
+/*	$NetBSD: memeccreg.h,v 1.3 2024/04/07 17:08:00 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
 #define ECC_AFR_S	0x0800	/* Access was in supervisor mode */
 #define ECC_AFR_MID	0xf000	/* Module code */
 #define ECC_AFR_BITS	"\177\020"\
-			"f\0\4VAH\0f\4\4TYPE\0f\10\3SIZE\0"	\
+			"f\0\4PAH\0f\4\4TYPE\0f\10\3SIZE\0"	\
 			"b\13C\0b\14LOCK\0b\15MBL\0"		\
 			"f\16\10VA\0b\33S\0f\34\4MID\0"
 

Index: src/sys/arch/sparc64/include/psl.h
diff -u src/sys/arch/sparc64/include/psl.h:1.64 src/sys/arch/sparc64/include/psl.h:1.65
--- src/sys/arch/sparc64/include/psl.h:1.64	Sat Sep  2 05:51:57 2023
+++ src/sys/arch/sparc64/include/psl.h	Sun Apr  7 17:08:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.64 2023/09/02 05:51:57 jdc Exp $ */
+/*	$NetBSD: psl.h,v 1.65 2024/04/07 17:08:00 rillig Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -129,7 +129,11 @@
 #define PSTATE_IE	0x002	/* interrupt enable */
 #define PSTATE_AG	0x001	/* enable alternate globals */
 
-#define PSTATE_BITS "\20\14IG\13MG\12CLE\11TLE\10\7MM\6RED\5PEF\4AM\3PRIV\2IE\1AG"
+#define PSTATE_BITS "\177\020"		\
+	"b\013IG\0"	"b\012MG\0"	"b\011CLE\0"	"b\010TLE\0"	\
+			"F\006\002\0"	":\000MM_TSO\0"	":\001MM_PSO\0"	\
+	":\002MM_RMO\0"	"*?\0"		"b\005RED\0"	"b\004PEF\0"	\
+	"b\003AM\0"	"b\002PRIV\0"	"b\001IE\0"	"b\000AG\0"
 
 
 /*



<    1   2   3   4   5   6   7   8   9   10   >