CVS commit: src/tests/net/altq

2021-07-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jul 16 02:33:32 UTC 2021

Modified Files:
src/tests/net/altq: t_cbq.sh

Log Message:
tests, altq: fix checks of altqd startup

Hopefully the fix stabilizes test results on qemu/anita.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/altq/t_cbq.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/net/altq/t_cbq.sh
diff -u src/tests/net/altq/t_cbq.sh:1.2 src/tests/net/altq/t_cbq.sh:1.3
--- src/tests/net/altq/t_cbq.sh:1.2	Wed Jul 14 08:33:47 2021
+++ src/tests/net/altq/t_cbq.sh	Fri Jul 16 02:33:32 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cbq.sh,v 1.2 2021/07/14 08:33:47 ozaki-r Exp $
+#	$NetBSD: t_cbq.sh,v 1.3 2021/07/16 02:33:32 ozaki-r Exp $
 #
 # Copyright (c) 2021 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -45,6 +45,23 @@ IP_REMOTE21=10.0.1.2
 IP_REMOTE22=10.0.1.22
 ALTQD_PIDFILE=./pid
 
+start_altqd()
+{
+
+	$HIJACKING_ALTQ altqd
+
+	sleep 0.1
+	if $HIJACKING_ALTQ test ! -f /var/run/altqd.pid; then
+		sleep 1
+	fi
+
+	$HIJACKING_ALTQ test -f /var/run/altqd.pid
+	if [ $? != 0 ]; then
+		atf_fail "starting altqd failed"
+	fi
+
+	$HIJACKING_ALTQ cat /var/run/altqd.pid > $ALTQD_PIDFILE
+}
 
 start_altqd_basic()
 {
@@ -64,18 +81,9 @@ start_altqd_basic()
 	EOF
 	$DEBUG && cat ./altq.conf
 	atf_check -s exit:0 $HIJACKING_ALTQ cp ./altq.conf /rump/etc/altq.conf
-	$HIJACKING_ALTQ test -f /rump/etc/altq.conf
-
-	#atf_check -s exit:0 $HIJACKING_ALTQ altqd
-	$HIJACKING_ALTQ altqd
-
-	$HIJACKING_ALTQ test -f /var/run/altqd.pid
-	if [ $? != 0 ]; then
-		atf_check -s exit:0 $HIJACKING_ALTQ altqd -d
-		# Should abort
-	fi
+	atf_check -s exit:0 $HIJACKING_ALTQ test -f /rump/etc/altq.conf
 
-	$HIJACKING_ALTQ cat /var/run/altqd.pid > $ALTQD_PIDFILE
+	start_altqd
 
 	$DEBUG && $HIJACKING_ALTQ altqstat -s
 	$HIJACKING_ALTQ altqstat -c 1 >./out
@@ -196,16 +204,7 @@ start_altqd_multi_ifaces()
 	atf_check -s exit:0 $HIJACKING_ALTQ cp ./altq.conf /rump/etc/altq.conf
 	$HIJACKING_ALTQ test -f /rump/etc/altq.conf
 
-	#atf_check -s exit:0 $HIJACKING_ALTQ altqd
-	$HIJACKING_ALTQ altqd
-
-	$HIJACKING_ALTQ test -f /var/run/altqd.pid
-	if [ $? != 0 ]; then
-		atf_check -s exit:0 $HIJACKING_ALTQ altqd -d
-		# Should abort
-	fi
-
-	$HIJACKING_ALTQ cat /var/run/altqd.pid > $ALTQD_PIDFILE
+	start_altqd
 
 	$DEBUG && $HIJACKING_ALTQ altqstat -s
 
@@ -335,15 +334,7 @@ start_altqd_options()
 	atf_check -s exit:0 $HIJACKING_ALTQ cp ./altq.conf /rump/etc/altq.conf
 	$HIJACKING_ALTQ test -f /rump/etc/altq.conf
 
-	$HIJACKING_ALTQ altqd
-
-	$HIJACKING_ALTQ test -f /var/run/altqd.pid
-	if [ $? != 0 ]; then
-		atf_check -s exit:0 $HIJACKING_ALTQ altqd -d
-		# Should abort
-	fi
-
-	$HIJACKING_ALTQ cat /var/run/altqd.pid > $ALTQD_PIDFILE
+	start_altqd
 
 	$DEBUG && $HIJACKING_ALTQ altqstat -s
 	$HIJACKING_ALTQ altqstat -c 1 >./out



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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 23:54:22 UTC 2021

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

Log Message:
lint: reduce verboseness of merge_signedness

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 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/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.206 src/usr.bin/xlint/lint1/decl.c:1.207
--- src/usr.bin/xlint/lint1/decl.c:1.206	Thu Jul 15 23:47:00 2021
+++ src/usr.bin/xlint/lint1/decl.c	Thu Jul 15 23:54:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.206 2021/07/15 23:47:00 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.207 2021/07/15 23:54:22 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.206 2021/07/15 23:47:00 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.207 2021/07/15 23:54:22 rillig Exp $");
 #endif
 
 #include 
@@ -386,20 +386,16 @@ static tspec_t
 merge_signedness(tspec_t t, tspec_t s)
 {
 
-	if (s != SIGNED && s != UNSIGN)
+	if (s == SIGNED)
+		return t == CHAR ? SCHAR : t;
+	if (s != UNSIGN)
 		return t;
-
-	if (t == CHAR)
-		return s == SIGNED ? SCHAR : UCHAR;
-	if (t == SHORT)
-		return s == SIGNED ? SHORT : USHORT;
-	if (t == INT)
-		return s == SIGNED ? INT : UINT;
-	if (t == LONG)
-		return s == SIGNED ? LONG : ULONG;
-	if (t == QUAD)
-		return s == SIGNED ? QUAD : UQUAD;
-	return t;
+	return t == CHAR ? UCHAR
+	: t == SHORT ? USHORT
+	: t == INT ? UINT
+	: t == LONG ? ULONG
+	: t == QUAD ? UQUAD
+	: t;
 }
 
 /*



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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 23:47:00 UTC 2021

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

Log Message:
lint: rename merge_type_specifiers to merge_signedness

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 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/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.205 src/usr.bin/xlint/lint1/decl.c:1.206
--- src/usr.bin/xlint/lint1/decl.c:1.205	Thu Jul 15 23:42:49 2021
+++ src/usr.bin/xlint/lint1/decl.c	Thu Jul 15 23:47:00 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.205 2021/07/15 23:42:49 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.206 2021/07/15 23:47:00 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.205 2021/07/15 23:42:49 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.206 2021/07/15 23:47:00 rillig Exp $");
 #endif
 
 #include 
@@ -64,7 +64,6 @@ dinfo_t	*dcs;
 
 static	type_t	*tdeferr(type_t *, tspec_t);
 static	void	settdsym(type_t *, sym_t *);
-static	tspec_t	merge_type_specifiers(tspec_t, tspec_t);
 static	void	align(int, int);
 static	sym_t	*newtag(sym_t *, scl_t, bool, bool);
 static	bool	eqargs(const type_t *, const type_t *, bool *);
@@ -382,6 +381,27 @@ add_type(type_t *tp)
 	}
 }
 
+/* Merge the signedness into the abstract type. */
+static tspec_t
+merge_signedness(tspec_t t, tspec_t s)
+{
+
+	if (s != SIGNED && s != UNSIGN)
+		return t;
+
+	if (t == CHAR)
+		return s == SIGNED ? SCHAR : UCHAR;
+	if (t == SHORT)
+		return s == SIGNED ? SHORT : USHORT;
+	if (t == INT)
+		return s == SIGNED ? INT : UINT;
+	if (t == LONG)
+		return s == SIGNED ? LONG : ULONG;
+	if (t == QUAD)
+		return s == SIGNED ? QUAD : UQUAD;
+	return t;
+}
+
 /*
  * called if a list of declaration specifiers contains a typedef name
  * and other specifiers (except struct, union, enum, typedef name)
@@ -401,7 +421,7 @@ tdeferr(type_t *td, tspec_t t)
 			if (!tflag)
 /* modifying typedef with '%s'; only ... */
 warning(5, ttab[t].tt_name);
-			td = dup_type(gettyp(merge_type_specifiers(t2, t)));
+			td = dup_type(gettyp(merge_signedness(t2, t)));
 			td->t_typedef = true;
 			return td;
 		}
@@ -814,7 +834,7 @@ dcs_merge_declaration_specifiers(void)
 	}
 	if (l != NOTSPEC)
 		t = l;
-	dcs->d_type = gettyp(merge_type_specifiers(t, s));
+	dcs->d_type = gettyp(merge_signedness(t, s));
 }
 
 /*
@@ -859,29 +879,6 @@ end_type(void)
 }
 
 /*
- * Merge type specifiers (char, ..., long long, signed, unsigned).
- */
-static tspec_t
-merge_type_specifiers(tspec_t t, tspec_t s)
-{
-
-	if (s != SIGNED && s != UNSIGN)
-		return t;
-
-	if (t == CHAR)
-		return s == SIGNED ? SCHAR : UCHAR;
-	if (t == SHORT)
-		return s == SIGNED ? SHORT : USHORT;
-	if (t == INT)
-		return s == SIGNED ? INT : UINT;
-	if (t == LONG)
-		return s == SIGNED ? LONG : ULONG;
-	if (t == QUAD)
-		return s == SIGNED ? QUAD : UQUAD;
-	return t;
-}
-
-/*
  * Return the length of a type in bits.
  *
  * Printing a message if the outermost dimension of an array is 0 must



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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 23:42:50 UTC 2021

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

Log Message:
lint: replace switch statement in dcs_merge_declaration_specifiers

Grouping the rules by their abstract type took a lot of visual space.
Instead, move each of the rules from C11 6.7.2 into its own if
statement, so that the rules almost read like in the standard.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 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/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.204 src/usr.bin/xlint/lint1/decl.c:1.205
--- src/usr.bin/xlint/lint1/decl.c:1.204	Thu Jul 15 23:07:05 2021
+++ src/usr.bin/xlint/lint1/decl.c	Thu Jul 15 23:42:49 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.204 2021/07/15 23:07:05 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.205 2021/07/15 23:42:49 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.204 2021/07/15 23:07:05 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.205 2021/07/15 23:42:49 rillig Exp $");
 #endif
 
 #include 
@@ -746,7 +746,11 @@ dcs_adjust_storage_class(void)
 	}
 }
 
-/* Merge the declaration specifiers from dcs into dcs->d_type. */
+/*
+ * Merge the declaration specifiers from dcs into dcs->d_type.
+ *
+ * See C99 6.7.2 "Type specifiers".
+ */
 static void
 dcs_merge_declaration_specifiers(void)
 {
@@ -776,55 +780,34 @@ dcs_merge_declaration_specifiers(void)
 		return;
 	}
 
-	switch (t) {
-	case BOOL:
-		break;
-	case NOTSPEC:
+	if (t == NOTSPEC)
 		t = INT;
-		/* FALLTHROUGH */
-	case INT:
-		if (s == NOTSPEC)
-			s = SIGNED;
-		break;
-	case CHAR:
-		if (l != NOTSPEC) {
-			dcs->d_terr = true;
-			l = NOTSPEC;
-		}
-		break;
-	case FLOAT:
-		if (l == LONG) {
-			l = NOTSPEC;
-			t = DOUBLE;
-			if (!tflag)
-/* use 'double' instead of 'long float' */
-warning(6);
-		}
-		break;
-	case DOUBLE:
-		if (l != LONG)
-			break;
-		/* FALLTHROUGH */
-	case LDOUBLE:
+	if (s == NOTSPEC && t == INT)
+		s = SIGNED;
+	if (l != NOTSPEC && t == CHAR) {
+		dcs->d_terr = true;
+		l = NOTSPEC;
+	}
+	if (l == LONG && t == FLOAT) {
+		l = NOTSPEC;
+		t = DOUBLE;
+		if (!tflag)
+			/* use 'double' instead of 'long float' */
+			warning(6);
+	}
+	if ((l == LONG && t == DOUBLE) || t == LDOUBLE) {
 		l = NOTSPEC;
 		t = LDOUBLE;
-		if (tflag)
-			/* 'long double' is illegal in traditional C */
-			warning(266);
-		break;
-	case DCOMPLEX:
-		if (l == LONG) {
-			l = NOTSPEC;
-			t = LCOMPLEX;
-		}
-		break;
-	case VOID:
-	case FCOMPLEX:
-	case LCOMPLEX:
-		break;
-	default:
-		lint_assert(is_integer(t));
 	}
+	if (t == LDOUBLE && tflag) {
+		/* 'long double' is illegal in traditional C */
+		warning(266);
+	}
+	if (l == LONG && t == DCOMPLEX) {
+		l = NOTSPEC;
+		t = LCOMPLEX;
+	}
+
 	if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
 		dcs->d_terr = true;
 		l = s = NOTSPEC;



CVS commit: src

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 23:07:05 UTC 2021

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

Log Message:
lint: extract dcs_merge_declaration_specifiers from end_type

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.203 -r1.204 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/decl.c
diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.8 src/tests/usr.bin/xlint/lint1/decl.c:1.9
--- src/tests/usr.bin/xlint/lint1/decl.c:1.8	Thu Jul 15 21:56:51 2021
+++ src/tests/usr.bin/xlint/lint1/decl.c	Thu Jul 15 23:07:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl.c,v 1.8 2021/07/15 21:56:51 rillig Exp $	*/
+/*	$NetBSD: decl.c,v 1.9 2021/07/15 23:07:05 rillig Exp $	*/
 # 3 "decl.c"
 
 /*
@@ -145,6 +145,9 @@ int signed_int;
 unsigned int unsigned_int;
 long signed_long;
 unsigned long unsigned_long;
+struct {
+	int member;
+} unnamed_struct;
 
 /*
  * Before decl.c 1.201 from 2021-07-15, lint crashed with an internal error
@@ -160,4 +163,5 @@ unsigned long sizes =
 sizeof(const typeof(signed_int)) +
 sizeof(const typeof(unsigned_int)) +
 sizeof(const typeof(signed_long)) +
-sizeof(const typeof(unsigned_long));
+sizeof(const typeof(unsigned_long)) +
+sizeof(const typeof(unnamed_struct));

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.203 src/usr.bin/xlint/lint1/decl.c:1.204
--- src/usr.bin/xlint/lint1/decl.c:1.203	Thu Jul 15 22:47:17 2021
+++ src/usr.bin/xlint/lint1/decl.c	Thu Jul 15 23:07:05 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.203 2021/07/15 22:47:17 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.204 2021/07/15 23:07:05 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.203 2021/07/15 22:47:17 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.204 2021/07/15 23:07:05 rillig Exp $");
 #endif
 
 #include 
@@ -746,14 +746,9 @@ dcs_adjust_storage_class(void)
 	}
 }
 
-/*
- * Create a type structure from the information gathered in
- * the declaration stack.
- * Complain about storage classes which are not possible in current
- * context.
- */
-void
-end_type(void)
+/* Merge the declaration specifiers from dcs into dcs->d_type. */
+static void
+dcs_merge_declaration_specifiers(void)
 {
 	tspec_t	t, s, l, c;
 	type_t	*tp;
@@ -778,68 +773,78 @@ end_type(void)
 		lint_assert(t == NOTSPEC);
 		lint_assert(s == NOTSPEC);
 		lint_assert(l == NOTSPEC);
+		return;
 	}
 
-	if (tp == NULL) {
-		switch (t) {
-		case BOOL:
-			break;
-		case NOTSPEC:
-			t = INT;
-			/* FALLTHROUGH */
-		case INT:
-			if (s == NOTSPEC)
-s = SIGNED;
-			break;
-		case CHAR:
-			if (l != NOTSPEC) {
-dcs->d_terr = true;
-l = NOTSPEC;
-			}
-			break;
-		case FLOAT:
-			if (l == LONG) {
-l = NOTSPEC;
-t = DOUBLE;
-if (!tflag)
-	/* use 'double' instead of 'long ... */
-	warning(6);
-			}
-			break;
-		case DOUBLE:
-			if (l != LONG)
-break;
-			/* FALLTHROUGH */
-		case LDOUBLE:
+	switch (t) {
+	case BOOL:
+		break;
+	case NOTSPEC:
+		t = INT;
+		/* FALLTHROUGH */
+	case INT:
+		if (s == NOTSPEC)
+			s = SIGNED;
+		break;
+	case CHAR:
+		if (l != NOTSPEC) {
+			dcs->d_terr = true;
 			l = NOTSPEC;
-			t = LDOUBLE;
-			if (tflag)
-/* 'long double' is illegal in ... */
-warning(266);
-			break;
-		case DCOMPLEX:
-			if (l == LONG) {
-l = NOTSPEC;
-t = LCOMPLEX;
-			}
-			break;
-		case VOID:
-		case FCOMPLEX:
-		case LCOMPLEX:
-			break;
-		default:
-			if (is_integer(t))
-break;
-			INTERNAL_ERROR("end_type(%s)", tspec_name(t));
 		}
-		if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
-			dcs->d_terr = true;
-			l = s = NOTSPEC;
+		break;
+	case FLOAT:
+		if (l == LONG) {
+			l = NOTSPEC;
+			t = DOUBLE;
+			if (!tflag)
+/* use 'double' instead of 'long float' */
+warning(6);
 		}
-		if (l != NOTSPEC)
-			t = l;
-		dcs->d_type = gettyp(merge_type_specifiers(t, s));
+		break;
+	case DOUBLE:
+		if (l != LONG)
+			break;
+		/* FALLTHROUGH */
+	case LDOUBLE:
+		l = NOTSPEC;
+		t = LDOUBLE;
+		if (tflag)
+			/* 'long double' is illegal in traditional C */
+			warning(266);
+		break;
+	case DCOMPLEX:
+		if (l == LONG) {
+			l = NOTSPEC;
+			t = LCOMPLEX;
+		}
+		break;
+	case VOID:
+	case FCOMPLEX:
+	case LCOMPLEX:
+		break;
+	default:
+		lint_assert(is_integer(t));
+	}
+	if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
+		dcs->d_terr = true;
+		l = s = NOTSPEC;
 	}
+	if (l != NOTSPEC)
+		t = l;
+	dcs->d_type = gettyp(merge_type_specifiers(t, s));
+}
+
+/*
+ * Create a type structure from the information gathered in
+ * the declaration stack.
+ * Complain about 

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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 22:47:17 UTC 2021

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

Log Message:
lint: clean up mix of 'case' and 'if'

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 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/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.202 src/usr.bin/xlint/lint1/decl.c:1.203
--- src/usr.bin/xlint/lint1/decl.c:1.202	Thu Jul 15 22:42:46 2021
+++ src/usr.bin/xlint/lint1/decl.c	Thu Jul 15 22:47:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.202 2021/07/15 22:42:46 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.203 2021/07/15 22:47:17 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.202 2021/07/15 22:42:46 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.203 2021/07/15 22:47:17 rillig Exp $");
 #endif
 
 #include 
@@ -807,14 +807,15 @@ end_type(void)
 			}
 			break;
 		case DOUBLE:
-			if (l == LONG) {
+			if (l != LONG)
+break;
+			/* FALLTHROUGH */
 		case LDOUBLE:
-l = NOTSPEC;
-t = LDOUBLE;
-if (tflag)
-	/* 'long double' is illegal in ... */
-	warning(266);
-			}
+			l = NOTSPEC;
+			t = LDOUBLE;
+			if (tflag)
+/* 'long double' is illegal in ... */
+warning(266);
 			break;
 		case DCOMPLEX:
 			if (l == LONG) {



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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 22:42:46 UTC 2021

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

Log Message:
lint: remove warning about _Complex long double in traditional C

Complex types have been introduced in C99, so there is no danger of
anyone trying to use them in traditional C.


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 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/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.201 src/usr.bin/xlint/lint1/decl.c:1.202
--- src/usr.bin/xlint/lint1/decl.c:1.201	Thu Jul 15 21:56:51 2021
+++ src/usr.bin/xlint/lint1/decl.c	Thu Jul 15 22:42:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.201 2021/07/15 21:56:51 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.202 2021/07/15 22:42:46 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.201 2021/07/15 21:56:51 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.202 2021/07/15 22:42:46 rillig Exp $");
 #endif
 
 #include 
@@ -820,9 +820,6 @@ end_type(void)
 			if (l == LONG) {
 l = NOTSPEC;
 t = LCOMPLEX;
-if (tflag)
-	/* 'long double' is illegal in ... */
-	warning(266);
 			}
 			break;
 		case VOID:



CVS commit: src/sys/ufs/chfs

2021-07-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Jul 15 22:39:06 UTC 2021

Modified Files:
src/sys/ufs/chfs: chfs_readinode.c chfs_scan.c

Log Message:
Make sure that mutex is released before conditional return statements. Fixes PR 
kern/56242
ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/ufs/chfs/chfs_readinode.c
cvs rdiff -u -r1.8 -r1.9 src/sys/ufs/chfs/chfs_scan.c

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

Modified files:

Index: src/sys/ufs/chfs/chfs_readinode.c
diff -u src/sys/ufs/chfs/chfs_readinode.c:1.10 src/sys/ufs/chfs/chfs_readinode.c:1.11
--- src/sys/ufs/chfs/chfs_readinode.c:1.10	Thu Jun  1 02:45:15 2017
+++ src/sys/ufs/chfs/chfs_readinode.c	Thu Jul 15 22:39:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: chfs_readinode.c,v 1.10 2017/06/01 02:45:15 chs Exp $	*/
+/*	$NetBSD: chfs_readinode.c,v 1.11 2021/07/15 22:39:06 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -1012,6 +1012,7 @@ retry:
 (unsigned long long)vc->vno, vc->state);
 			chfs_err("wants to read a nonexistent ino %llu\n",
 (unsigned long long)vc->vno);
+			mutex_exit(>chm_lock_vnocache);
 			return ENOENT;
 		default:
 			panic("BUG() Bad vno cache state.");

Index: src/sys/ufs/chfs/chfs_scan.c
diff -u src/sys/ufs/chfs/chfs_scan.c:1.8 src/sys/ufs/chfs/chfs_scan.c:1.9
--- src/sys/ufs/chfs/chfs_scan.c:1.8	Mon Jun 17 17:14:56 2019
+++ src/sys/ufs/chfs/chfs_scan.c	Thu Jul 15 22:39:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: chfs_scan.c,v 1.8 2019/06/17 17:14:56 ryoon Exp $	*/
+/*	$NetBSD: chfs_scan.c,v 1.9 2021/07/15 22:39:06 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -151,6 +151,7 @@ chfs_scan_check_vnode(struct chfs_mount 
 		} else {
 			err = chfs_update_eb_dirty(chmp, cheb,
 			sizeof(struct chfs_flash_vnode));
+			mutex_exit(>chm_lock_vnocache);
 			return CHFS_NODE_OK;
 		}
 	} else {
@@ -325,6 +326,7 @@ chfs_scan_check_dirent_node(struct chfs_
 	parentvc = chfs_scan_make_vnode_cache(chmp, le64toh(dirent->pvno));
 	if (!parentvc) {
 		chfs_free_dirent(fd);
+		mutex_exit(>chm_lock_vnocache);
 		return ENOMEM;
 	}
 
@@ -381,8 +383,10 @@ chfs_scan_check_data_node(struct chfs_mo
 	vc = chfs_vnode_cache_get(chmp, vno);
 	if (!vc) {
 		vc = chfs_scan_make_vnode_cache(chmp, vno);
-		if (!vc)
+		if (!vc) {
+			mutex_exit(>chm_lock_vnocache);
 			return ENOMEM;
+		}
 	}
 	chfs_add_node_to_list(chmp, vc, nref, >dnode);
 	mutex_exit(>chm_lock_vnocache);



CVS commit: src

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 21:56:51 UTC 2021

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

Log Message:
lint: fix internal error for sizeof(typeof)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.200 -r1.201 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/decl.c
diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.7 src/tests/usr.bin/xlint/lint1/decl.c:1.8
--- src/tests/usr.bin/xlint/lint1/decl.c:1.7	Thu Jul 15 21:34:11 2021
+++ src/tests/usr.bin/xlint/lint1/decl.c	Thu Jul 15 21:56:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl.c,v 1.7 2021/07/15 21:34:11 rillig Exp $	*/
+/*	$NetBSD: decl.c,v 1.8 2021/07/15 21:56:51 rillig Exp $	*/
 # 3 "decl.c"
 
 /*
@@ -131,7 +131,33 @@ int *const volatile cover_type_qualifier
 unsigned long cover_abstract_declaration_declmods = sizeof(const);
 unsigned long cover_abstract_declaration_declmods_abstract_declarator =
 sizeof(const *);
-// FIXME:
-// lint: internal error in decl.c:833 near decl.c:135: end_type(unsigned long)
-//unsigned long cover_abstract_declarator_typeof =
-//sizeof(const typeof(cover_abstract_declaration_declmods));
+
+unsigned long cover_abstract_declarator_typeof =
+sizeof(const typeof(cover_abstract_declaration_declmods));
+
+_Bool bool;
+char plain_char;
+signed char signed_char;
+unsigned char unsigned_char;
+short signed_short;
+unsigned short unsigned_short;
+int signed_int;
+unsigned int unsigned_int;
+long signed_long;
+unsigned long unsigned_long;
+
+/*
+ * Before decl.c 1.201 from 2021-07-15, lint crashed with an internal error
+ * in end_type.
+ */
+unsigned long sizes =
+sizeof(const typeof(bool)) +
+sizeof(const typeof(plain_char)) +
+sizeof(const typeof(signed_char)) +
+sizeof(const typeof(unsigned_char)) +
+sizeof(const typeof(signed_short)) +
+sizeof(const typeof(unsigned_short)) +
+sizeof(const typeof(signed_int)) +
+sizeof(const typeof(unsigned_int)) +
+sizeof(const typeof(signed_long)) +
+sizeof(const typeof(unsigned_long));

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.200 src/usr.bin/xlint/lint1/decl.c:1.201
--- src/usr.bin/xlint/lint1/decl.c:1.200	Thu Jul 15 07:58:05 2021
+++ src/usr.bin/xlint/lint1/decl.c	Thu Jul 15 21:56:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.200 2021/07/15 07:58:05 rin Exp $ */
+/* $NetBSD: decl.c,v 1.201 2021/07/15 21:56:51 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.200 2021/07/15 07:58:05 rin Exp $");
+__RCSID("$NetBSD: decl.c,v 1.201 2021/07/15 21:56:51 rillig Exp $");
 #endif
 
 #include 
@@ -830,6 +830,8 @@ end_type(void)
 		case LCOMPLEX:
 			break;
 		default:
+			if (is_integer(t))
+break;
 			INTERNAL_ERROR("end_type(%s)", tspec_name(t));
 		}
 		if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {



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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 21:34:11 UTC 2021

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

Log Message:
tests/lint: cover abstract_declaration, discover internal error


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/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/decl.c
diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.6 src/tests/usr.bin/xlint/lint1/decl.c:1.7
--- src/tests/usr.bin/xlint/lint1/decl.c:1.6	Thu Jul 15 21:00:05 2021
+++ src/tests/usr.bin/xlint/lint1/decl.c	Thu Jul 15 21:34:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl.c,v 1.6 2021/07/15 21:00:05 rillig Exp $	*/
+/*	$NetBSD: decl.c,v 1.7 2021/07/15 21:34:11 rillig Exp $	*/
 # 3 "decl.c"
 
 /*
@@ -127,3 +127,11 @@ unused_linted(void)
 
 /* covers 'type_qualifier_list: type_qualifier_list type_qualifier' */
 int *const volatile cover_type_qualifier_list;
+
+unsigned long cover_abstract_declaration_declmods = sizeof(const);
+unsigned long cover_abstract_declaration_declmods_abstract_declarator =
+sizeof(const *);
+// FIXME:
+// lint: internal error in decl.c:833 near decl.c:135: end_type(unsigned long)
+//unsigned long cover_abstract_declarator_typeof =
+//sizeof(const typeof(cover_abstract_declaration_declmods));



CVS commit: src

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 21:22:19 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_135.c msg_135.exp msg_247.c
msg_247.exp
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: allow pointer casts from 'char *' and 'unsigned char *'

For the sake of traditional code that did not yet migrate to using 'void
*' for arbitrary pointers.

In the standard NetBSD build, this reduces the number of lint warnings
by around 7000, of 57000 total.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_135.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_135.exp
cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/msg_247.c
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_247.exp
cvs rdiff -u -r1.315 -r1.316 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_135.c
diff -u src/tests/usr.bin/xlint/lint1/msg_135.c:1.8 src/tests/usr.bin/xlint/lint1/msg_135.c:1.9
--- src/tests/usr.bin/xlint/lint1/msg_135.c:1.8	Thu Jul 15 21:12:46 2021
+++ src/tests/usr.bin/xlint/lint1/msg_135.c	Thu Jul 15 21:22:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_135.c,v 1.8 2021/07/15 21:12:46 rillig Exp $	*/
+/*	$NetBSD: msg_135.c,v 1.9 2021/07/15 21:22:19 rillig Exp $	*/
 # 3 "msg_135.c"
 
 // Test for message: converting '%s' to '%s' may cause alignment problem [135]
@@ -8,11 +8,12 @@
 void sink(const void *);
 
 unsigned
-read_uint(const unsigned char **pp)
+read_uint(const unsigned short **pp)
 {
 	unsigned val;
 
-	val = *(const unsigned *)(*pp);	/* expect: 135 */
+	/* expect+1: warning: converting 'pointer to const unsigned short' to 'pointer to const unsigned int' may cause alignment problem [135] */
+	val = *(const unsigned *)(*pp);
 	pp += sizeof(unsigned);
 	return val;
 }
@@ -43,24 +44,32 @@ pointer_to_structs(struct incomplete *in
 	sink(complete);
 }
 
+/*
+ * Before tree.c 1.316 from 2021-07-15, lint warned about pointer casts from
+ * unsigned char or plain char to another type.  These casts often occur in
+ * traditional code that does not use void pointers, even 30 years after C90
+ * introduced 'void'.
+ */
 void
 unsigned_char_to_unsigned_type(unsigned char *ucp)
 {
 	unsigned short *usp;
 
-	/* FIXME */
-	/* expect+1: warning: converting 'pointer to unsigned char' to 'pointer to unsigned short' may cause alignment problem [135] */
 	usp = (unsigned short *)ucp;
 	sink(usp);
 }
 
+/*
+ * Before tree.c 1.316 from 2021-07-15, lint warned about pointer casts from
+ * unsigned char or plain char to another type.  These casts often occur in
+ * traditional code that does not use void pointers, even 30 years after C90
+ * introduced 'void'.
+ */
 void
 plain_char_to_unsigned_type(char *cp)
 {
 	unsigned short *usp;
 
-	/* FIXME */
-	/* expect+1: warning: converting 'pointer to char' to 'pointer to unsigned short' may cause alignment problem [135] */
 	usp = (unsigned short *)cp;
 	sink(usp);
 }

Index: src/tests/usr.bin/xlint/lint1/msg_135.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_135.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_135.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_135.exp:1.6	Thu Jul 15 21:12:46 2021
+++ src/tests/usr.bin/xlint/lint1/msg_135.exp	Thu Jul 15 21:22:19 2021
@@ -1,4 +1,2 @@
-msg_135.c(15): warning: converting 'pointer to const unsigned char' to 'pointer to const unsigned int' may cause alignment problem [135]
-msg_135.c(53): warning: converting 'pointer to unsigned char' to 'pointer to unsigned short' may cause alignment problem [135]
-msg_135.c(64): warning: converting 'pointer to char' to 'pointer to unsigned short' may cause alignment problem [135]
-msg_135.c(20): warning: struct incomplete never defined [233]
+msg_135.c(16): warning: converting 'pointer to const unsigned short' to 'pointer to const unsigned int' may cause alignment problem [135]
+msg_135.c(21): warning: struct incomplete never defined [233]

Index: src/tests/usr.bin/xlint/lint1/msg_247.c
diff -u src/tests/usr.bin/xlint/lint1/msg_247.c:1.15 src/tests/usr.bin/xlint/lint1/msg_247.c:1.16
--- src/tests/usr.bin/xlint/lint1/msg_247.c:1.15	Thu Jul 15 21:12:46 2021
+++ src/tests/usr.bin/xlint/lint1/msg_247.c	Thu Jul 15 21:22:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_247.c,v 1.15 2021/07/15 21:12:46 rillig Exp $	*/
+/*	$NetBSD: msg_247.c,v 1.16 2021/07/15 21:22:19 rillig Exp $	*/
 # 3 "msg_247.c"
 
 // Test for message: pointer cast from '%s' to '%s' may be troublesome [247]
@@ -157,24 +157,32 @@ lh_OPENSSL_STRING_new(void)
 
 void sink(const void *);
 
+/*
+ * Before tree.c 1.316 from 2021-07-15, lint warned about pointer casts from
+ * unsigned char or plain char to another type.  These casts often occur in
+ * traditional code that does not use void pointers, even 30 years after C90
+ * introduced 'void'.
+ */
 void
 

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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 21:12:46 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_135.c msg_135.exp msg_247.c
msg_247.exp

Log Message:
tests/lint: demonstrate questionable warnings for pointer casts


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_135.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_135.exp
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/msg_247.c
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_247.exp

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_135.c
diff -u src/tests/usr.bin/xlint/lint1/msg_135.c:1.7 src/tests/usr.bin/xlint/lint1/msg_135.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_135.c:1.7	Sat Apr 17 16:58:04 2021
+++ src/tests/usr.bin/xlint/lint1/msg_135.c	Thu Jul 15 21:12:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_135.c,v 1.7 2021/04/17 16:58:04 rillig Exp $	*/
+/*	$NetBSD: msg_135.c,v 1.8 2021/07/15 21:12:46 rillig Exp $	*/
 # 3 "msg_135.c"
 
 // Test for message: converting '%s' to '%s' may cause alignment problem [135]
@@ -42,3 +42,25 @@ pointer_to_structs(struct incomplete *in
 	complete = (struct complete *)incomplete;
 	sink(complete);
 }
+
+void
+unsigned_char_to_unsigned_type(unsigned char *ucp)
+{
+	unsigned short *usp;
+
+	/* FIXME */
+	/* expect+1: warning: converting 'pointer to unsigned char' to 'pointer to unsigned short' may cause alignment problem [135] */
+	usp = (unsigned short *)ucp;
+	sink(usp);
+}
+
+void
+plain_char_to_unsigned_type(char *cp)
+{
+	unsigned short *usp;
+
+	/* FIXME */
+	/* expect+1: warning: converting 'pointer to char' to 'pointer to unsigned short' may cause alignment problem [135] */
+	usp = (unsigned short *)cp;
+	sink(usp);
+}

Index: src/tests/usr.bin/xlint/lint1/msg_135.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_135.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_135.exp:1.6
--- src/tests/usr.bin/xlint/lint1/msg_135.exp:1.5	Sat Apr 17 16:58:04 2021
+++ src/tests/usr.bin/xlint/lint1/msg_135.exp	Thu Jul 15 21:12:46 2021
@@ -1,2 +1,4 @@
 msg_135.c(15): warning: converting 'pointer to const unsigned char' to 'pointer to const unsigned int' may cause alignment problem [135]
+msg_135.c(53): warning: converting 'pointer to unsigned char' to 'pointer to unsigned short' may cause alignment problem [135]
+msg_135.c(64): warning: converting 'pointer to char' to 'pointer to unsigned short' may cause alignment problem [135]
 msg_135.c(20): warning: struct incomplete never defined [233]

Index: src/tests/usr.bin/xlint/lint1/msg_247.c
diff -u src/tests/usr.bin/xlint/lint1/msg_247.c:1.14 src/tests/usr.bin/xlint/lint1/msg_247.c:1.15
--- src/tests/usr.bin/xlint/lint1/msg_247.c:1.14	Sat Jul 10 17:35:54 2021
+++ src/tests/usr.bin/xlint/lint1/msg_247.c	Thu Jul 15 21:12:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_247.c,v 1.14 2021/07/10 17:35:54 rillig Exp $	*/
+/*	$NetBSD: msg_247.c,v 1.15 2021/07/15 21:12:46 rillig Exp $	*/
 # 3 "msg_247.c"
 
 // Test for message: pointer cast from '%s' to '%s' may be troublesome [247]
@@ -154,3 +154,27 @@ lh_OPENSSL_STRING_new(void)
 	return (struct lhash_st_OPENSSL_STRING *)OPENSSL_LH_new();
 }
 # 157 "msg_247.c" 2
+
+void sink(const void *);
+
+void
+unsigned_char_to_unsigned_type(unsigned char *ucp)
+{
+	unsigned short *usp;
+
+	/* FIXME */
+	/* expect+1: warning: pointer cast from 'pointer to unsigned char' to 'pointer to unsigned short' may be troublesome [247] */
+	usp = (unsigned short *)ucp;
+	sink(usp);
+}
+
+void
+plain_char_to_unsigned_type(char *cp)
+{
+	unsigned short *usp;
+
+	/* FIXME */
+	/* expect+1: warning: pointer cast from 'pointer to char' to 'pointer to unsigned short' may be troublesome [247] */
+	usp = (unsigned short *)cp;
+	sink(usp);
+}

Index: src/tests/usr.bin/xlint/lint1/msg_247.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_247.exp:1.10 src/tests/usr.bin/xlint/lint1/msg_247.exp:1.11
--- src/tests/usr.bin/xlint/lint1/msg_247.exp:1.10	Fri Apr  9 20:00:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_247.exp	Thu Jul 15 21:12:46 2021
@@ -1,3 +1,5 @@
 msg_247.c(31): warning: pointer cast from 'pointer to struct Other' to 'pointer to struct ' may be troublesome [247]
 msg_247.c(70): warning: pointer cast from 'pointer to struct Other' to 'pointer to signed char' may be troublesome [247]
+msg_247.c(167): warning: pointer cast from 'pointer to unsigned char' to 'pointer to unsigned short' may be troublesome [247]
+msg_247.c(178): warning: pointer cast from 'pointer to char' to 'pointer to unsigned short' may be troublesome [247]
 msg_247.c(134): warning: struct lhash_st never defined [233]



CVS commit: src

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 21:00:05 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile decl.c decl_struct_c90.c
decl_struct_c90.exp decl_struct_member.c decl_struct_member.exp
gcc_attribute.c gcc_attribute.exp gcc_stmt_asm.c gcc_stmt_asm.exp
msg_343.c msg_343.exp
Added Files:
src/tests/usr.bin/xlint/lint1: decl_enum.c decl_enum.exp
decl_enum_c90.c decl_enum_c90.exp

Log Message:
tests/lint: cover more edge cases in the parser


To generate a diff of this commit:
cvs rdiff -u -r1.1090 -r1.1091 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.91 -r1.92 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/decl_enum.c \
src/tests/usr.bin/xlint/lint1/decl_enum.exp \
src/tests/usr.bin/xlint/lint1/decl_enum_c90.c \
src/tests/usr.bin/xlint/lint1/decl_enum_c90.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/decl_struct_c90.c \
src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/decl_struct_member.exp
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/gcc_attribute.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/gcc_attribute.exp
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/gcc_stmt_asm.c \
src/tests/usr.bin/xlint/lint1/gcc_stmt_asm.exp
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_343.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_343.exp

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1090 src/distrib/sets/lists/tests/mi:1.1091
--- src/distrib/sets/lists/tests/mi:1.1090	Thu Jul 15 19:51:29 2021
+++ src/distrib/sets/lists/tests/mi	Thu Jul 15 21:00:05 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1090 2021/07/15 19:51:29 rillig Exp $
+# $NetBSD: mi,v 1.1091 2021/07/15 21:00:05 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6218,6 +6218,10 @@
 ./usr/tests/usr.bin/xlint/lint1/decl.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/decl_arg.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/decl_arg.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/decl_enum.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/decl_enum.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/decl_enum_c90.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/decl_enum_c90.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/decl_struct_c90.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/decl_struct_c90.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/decl_struct_member.c		tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.91 src/tests/usr.bin/xlint/lint1/Makefile:1.92
--- src/tests/usr.bin/xlint/lint1/Makefile:1.91	Thu Jul 15 19:51:29 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Thu Jul 15 21:00:05 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.91 2021/07/15 19:51:29 rillig Exp $
+# $NetBSD: Makefile,v 1.92 2021/07/15 21:00:05 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -118,6 +118,10 @@ FILES+=		decl.c
 FILES+=		decl.exp
 FILES+=		decl_arg.c
 FILES+=		decl_arg.exp
+FILES+=		decl_enum.c
+FILES+=		decl_enum.exp
+FILES+=		decl_enum_c90.c
+FILES+=		decl_enum_c90.exp
 FILES+=		decl_struct_c90.c
 FILES+=		decl_struct_c90.exp
 FILES+=		decl_struct_member.c

Index: src/tests/usr.bin/xlint/lint1/decl.c
diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.5 src/tests/usr.bin/xlint/lint1/decl.c:1.6
--- src/tests/usr.bin/xlint/lint1/decl.c:1.5	Wed Jul 14 20:39:13 2021
+++ src/tests/usr.bin/xlint/lint1/decl.c	Thu Jul 15 21:00:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl.c,v 1.5 2021/07/14 20:39:13 rillig Exp $	*/
+/*	$NetBSD: decl.c,v 1.6 2021/07/15 21:00:05 rillig Exp $	*/
 # 3 "decl.c"
 
 /*
@@ -124,3 +124,6 @@ static void
 unused_linted(void)
 {
 }
+
+/* covers 'type_qualifier_list: type_qualifier_list type_qualifier' */
+int *const volatile cover_type_qualifier_list;

Index: src/tests/usr.bin/xlint/lint1/decl_struct_c90.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.2 src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.3
--- src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.2	Thu Jul 15 20:05:49 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_c90.c	Thu Jul 15 21:00:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_struct_c90.c,v 1.2 

CVS commit: src

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 20:05:49 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: decl_struct_c90.c decl_struct_c90.exp
decl_struct_member.c decl_struct_member.exp msg_066.c msg_066.exp
src/usr.bin/xlint/lint1: cgram.y err.c

Log Message:
lint: remove message 66 about missing semicolon in struct-declaration


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/decl_struct_c90.c \
src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/decl_struct_member.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_066.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_066.exp
cvs rdiff -u -r1.327 -r1.328 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.129 -r1.130 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/decl_struct_c90.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.1 src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.2
--- src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.1	Thu Jul 15 19:51:29 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_c90.c	Thu Jul 15 20:05:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_struct_c90.c,v 1.1 2021/07/15 19:51:29 rillig Exp $	*/
+/*	$NetBSD: decl_struct_c90.c,v 1.2 2021/07/15 20:05:49 rillig Exp $	*/
 # 3 "decl_struct_c90.c"
 
 /*
@@ -9,10 +9,13 @@
 
 /*
  * All of K, C90, C99 require that a struct member declaration is
- * terminated with a semicolon.  No idea why lint allows the missing
- * semicolon in non-C90 mode.
+ * terminated with a semicolon.
+ *
+ * Before cgram.y 1.328 from 2021-07-15, lint allowed the missing semicolon
+ * in non-C90 mode, no idea why.
  */
 struct missing_semicolon {
 	int member
 };
-/* expect-1: error: syntax requires ';' after last struct/union member [66] */
+/* expect-1: error: syntax error '}' [249] */
+/* expect+1: error: cannot recover from previous errors [224] */
Index: src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp:1.1 src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp:1.2
--- src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp:1.1	Thu Jul 15 19:51:29 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp	Thu Jul 15 20:05:49 2021
@@ -1 +1,2 @@
-decl_struct_c90.c(17): error: syntax requires ';' after last struct/union member [66]
+decl_struct_c90.c(19): error: syntax error '}' [249]
+decl_struct_c90.c(22): error: cannot recover from previous errors [224]

Index: src/tests/usr.bin/xlint/lint1/decl_struct_member.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.7 src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.8
--- src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.7	Thu Jul 15 19:51:29 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.c	Thu Jul 15 20:05:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_struct_member.c,v 1.7 2021/07/15 19:51:29 rillig Exp $	*/
+/*	$NetBSD: decl_struct_member.c,v 1.8 2021/07/15 20:05:49 rillig Exp $	*/
 # 3 "decl_struct_member.c"
 
 struct multi_attributes {
@@ -52,7 +52,7 @@ struct {
  */
 struct {
 	char a(_)0		/* expect: syntax error '0' */
-}/* expect: ';' after last */
+}
 /*
  * FIXME: adding a semicolon here triggers another assertion:
  *

Index: src/tests/usr.bin/xlint/lint1/decl_struct_member.exp
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.exp:1.6 src/tests/usr.bin/xlint/lint1/decl_struct_member.exp:1.7
--- src/tests/usr.bin/xlint/lint1/decl_struct_member.exp:1.6	Thu Jul 15 19:51:29 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.exp	Thu Jul 15 20:05:49 2021
@@ -4,5 +4,4 @@ decl_struct_member.c(38): error: syntax 
 decl_struct_member.c(38): warning: empty declaration [0]
 decl_struct_member.c(47): error: syntax error 'unnamed member' [249]
 decl_struct_member.c(54): error: syntax error '0' [249]
-decl_struct_member.c(55): warning: syntax requires ';' after last struct/union member [66]
 decl_struct_member.c(62): error: cannot recover from previous errors [224]

Index: src/tests/usr.bin/xlint/lint1/msg_066.c
diff -u src/tests/usr.bin/xlint/lint1/msg_066.c:1.3 src/tests/usr.bin/xlint/lint1/msg_066.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_066.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_066.c	Thu Jul 15 20:05:49 2021
@@ -1,8 +1,15 @@
-/*	$NetBSD: msg_066.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_066.c,v 1.4 2021/07/15 20:05:49 rillig Exp $	*/
 # 3 "msg_066.c"
 
 // Test for message: syntax requires ';' after last struct/union member [66]
 
+/*
+ * This message was removed in cgram.y 1.328 from 2021-07-15 because all
+ * C standards and even K require a semicolon.
+ */
+
 struct number {
 	int value
-};/* expect: 66 */

CVS commit: src

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 19:51:29 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile decl_struct_member.c
decl_struct_member.exp
Added Files:
src/tests/usr.bin/xlint/lint1: decl_struct_c90.c decl_struct_c90.exp

Log Message:
tests/lint: test struct declarations


To generate a diff of this commit:
cvs rdiff -u -r1.1089 -r1.1090 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.90 -r1.91 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/decl_struct_c90.c \
src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/decl_struct_member.exp

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1089 src/distrib/sets/lists/tests/mi:1.1090
--- src/distrib/sets/lists/tests/mi:1.1089	Thu Jul 15 17:09:08 2021
+++ src/distrib/sets/lists/tests/mi	Thu Jul 15 19:51:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1089 2021/07/15 17:09:08 rillig Exp $
+# $NetBSD: mi,v 1.1090 2021/07/15 19:51:29 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6218,6 +6218,8 @@
 ./usr/tests/usr.bin/xlint/lint1/decl.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/decl_arg.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/decl_arg.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/decl_struct_c90.c		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/decl_struct_c90.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/decl_struct_member.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/decl_struct_member.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/emit.ctests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.90 src/tests/usr.bin/xlint/lint1/Makefile:1.91
--- src/tests/usr.bin/xlint/lint1/Makefile:1.90	Thu Jul 15 17:09:08 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Thu Jul 15 19:51:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.90 2021/07/15 17:09:08 rillig Exp $
+# $NetBSD: Makefile,v 1.91 2021/07/15 19:51:29 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -118,6 +118,8 @@ FILES+=		decl.c
 FILES+=		decl.exp
 FILES+=		decl_arg.c
 FILES+=		decl_arg.exp
+FILES+=		decl_struct_c90.c
+FILES+=		decl_struct_c90.exp
 FILES+=		decl_struct_member.c
 FILES+=		decl_struct_member.exp
 FILES+=		emit.c

Index: src/tests/usr.bin/xlint/lint1/decl_struct_member.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.6 src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.7
--- src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.6	Wed Jul 14 20:39:13 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.c	Thu Jul 15 19:51:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_struct_member.c,v 1.6 2021/07/14 20:39:13 rillig Exp $	*/
+/*	$NetBSD: decl_struct_member.c,v 1.7 2021/07/15 19:51:29 rillig Exp $	*/
 # 3 "decl_struct_member.c"
 
 struct multi_attributes {
@@ -29,6 +29,15 @@ struct cover_begin_type_noclass_declmods
 	const volatile m2;
 };
 
+/* cover struct_or_union_specifier: struct_or_union error */
+/* expect+1: error: syntax error 'goto' [249] */
+struct goto {
+	/* expect+1: error: illegal type combination [4] */
+	int member;
+	/* expect+1: error: syntax error '}' [249] */
+};
+/* expect-1: warning: empty declaration [0] */
+
 /*
  * Before cgram.y 1.228 from 2021-06-19, lint ran into an assertion failure:
  *

Index: src/tests/usr.bin/xlint/lint1/decl_struct_member.exp
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.exp:1.5 src/tests/usr.bin/xlint/lint1/decl_struct_member.exp:1.6
--- src/tests/usr.bin/xlint/lint1/decl_struct_member.exp:1.5	Wed Jul 14 20:39:13 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.exp	Thu Jul 15 19:51:29 2021
@@ -1,4 +1,8 @@
-decl_struct_member.c(38): error: syntax error 'unnamed member' [249]
-decl_struct_member.c(45): error: syntax error '0' [249]
-decl_struct_member.c(46): warning: syntax requires ';' after last struct/union member [66]
-decl_struct_member.c(53): error: cannot recover from previous errors [224]
+decl_struct_member.c(34): error: syntax error 'goto' [249]
+decl_struct_member.c(36): error: illegal type combination [4]
+decl_struct_member.c(38): error: syntax error '}' [249]
+decl_struct_member.c(38): warning: empty declaration [0]
+decl_struct_member.c(47): error: syntax error 'unnamed member' [249]
+decl_struct_member.c(54): error: syntax error '0' [249]
+decl_struct_member.c(55): warning: syntax requires 

CVS commit: src/distrib/utils/embedded/files

2021-07-15 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Thu Jul 15 19:03:17 UTC 2021

Modified Files:
src/distrib/utils/embedded/files: ec2_init

Log Message:
Add some OpenStack support.

I found that in the cloud I tried, by the time this script runs, there
is no default route in effect yet. That takes some 5 to 10 seconds
longer. So I added a retry loop, and to make that easier, changed the
order of queries.  To make sure it doesn't wait ~forever for a
non-existent service I added the -q 1 option to ftp invocations.

I also added OpenStack-specific metadata which contains a different
random_seed of 512 bytes every time it is requested.  See
https://github.com/openstack/nova/blob/master/nova/api/metadata/base.py#L355
It may not be trusted data but only in the strictest sense of the word.
The data can only be observed by people with access to the cloud's
overlay network for the particular VM.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/files/ec2_init

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

Modified files:

Index: src/distrib/utils/embedded/files/ec2_init
diff -u src/distrib/utils/embedded/files/ec2_init:1.2 src/distrib/utils/embedded/files/ec2_init:1.3
--- src/distrib/utils/embedded/files/ec2_init:1.2	Thu Jul  1 18:05:45 2021
+++ src/distrib/utils/embedded/files/ec2_init	Thu Jul 15 19:03:17 2021
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ec2_init,v 1.2 2021/07/01 18:05:45 jmcneill Exp $
+# $NetBSD: ec2_init,v 1.3 2021/07/15 19:03:17 rhialto Exp $
 #
 # PROVIDE: ec2_init
 # REQUIRE: NETWORKING
@@ -20,6 +20,8 @@ HOSTNAME_URL="hostname"
 
 SSH_KEY_FILE="/home/${EC2_USER}/.ssh/authorized_keys"
 
+OS_METADATA_URL="http://169.254.169.254/openstack/latest/meta_data.json;
+
 ec2_newuser()
 {
 	echo "Creating EC2 user account ${EC2_USER}"
@@ -31,11 +33,27 @@ ec2_init()
 	(
 	umask 022
 
+	# set hostname; it may be 5-10 seconds for the metadata service
+	# to  become reachable.
+	try=0
+	while [ $((try++)) -lt 20 ]
+	do
+		HOSTNAME=$(ftp -o - -q 1 "${METADATA_URL}${HOSTNAME_URL}")
+		if [ -n "$HOSTNAME" ]; then
+			echo "Setting EC2 hostname: ${HOSTNAME}"
+			echo "$HOSTNAME" > /etc/myname
+			hostname "$HOSTNAME"
+			break
+		fi
+		echo "EC2 hostname not available yet (try $try)"
+		sleep 1
+	done
+
 	# create EC2 user
 	id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser
 
-	# fetch the key pair from Amazon Web Services
-	EC2_SSH_KEY=$(ftp -o - "${METADATA_URL}${SSH_KEY_URL}")
+	# fetch the public key from Amazon Web Services
+	EC2_SSH_KEY=$(ftp -o - -q 1 "${METADATA_URL}${SSH_KEY_URL}")
 
 	if [ -n "$EC2_SSH_KEY" ]; then
 		# A key pair is associated with this instance, add it
@@ -48,16 +66,16 @@ ec2_init()
 
 		grep -q "$EC2_SSH_KEY" "$SSH_KEY_FILE"
 		if [ $? -ne 0 ]; then
-			echo "Setting EC2 SSH key pair: ${EC2_SSH_KEY##* }"
+			echo "Setting EC2 SSH public key for user ${EC2_USER}: ${EC2_SSH_KEY##* }"
 			echo "$EC2_SSH_KEY" >> "$SSH_KEY_FILE"
 		fi
 	fi
 
-	# set hostname
-	HOSTNAME=$(ftp -o - "${METADATA_URL}${HOSTNAME_URL}")
-	echo "Setting EC2 hostname: ${HOSTNAME}"
-	echo "$HOSTNAME" > /etc/myname
-	hostname "$HOSTNAME"
+	# May contain a "random_seed". Everything else doesn't matter.
+	OS_METADATA="$(ftp -o - -q 1 ${OS_METADATA_URL})"
+	if echo "$OS_METADATA" | grep -q random_seed; then
+		echo "$OS_METADATA" >> /dev/urandom
+	fi
 	)
 }
 



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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 18:18:15 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: merge duplicate code in declarations

No functional change, code coverage outside cgram.y stays the same.


To generate a diff of this commit:
cvs rdiff -u -r1.326 -r1.327 src/usr.bin/xlint/lint1/cgram.y

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.326 src/usr.bin/xlint/lint1/cgram.y:1.327
--- src/usr.bin/xlint/lint1/cgram.y:1.326	Thu Jul 15 18:13:25 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Thu Jul 15 18:18:15 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.326 2021/07/15 18:13:25 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.327 2021/07/15 18:18:15 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.326 2021/07/15 18:13:25 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.327 2021/07/15 18:18:15 rillig Exp $");
 #endif
 
 #include 
@@ -1912,27 +1912,7 @@ top_level_declaration:		/* C99 6.9 calls
 			warning(1);
 		}
 	  }
-	| begin_type_declmods end_type T_SEMI {
-		if (dcs->d_scl == TYPEDEF) {
-			/* typedef declares no type name */
-			warning(72);
-		} else {
-			/* empty declaration */
-			warning(2);
-		}
-	  }
-	| begin_type_declmods end_type notype_init_declarators T_SEMI
-	| begin_type_declaration_specifiers end_type T_SEMI {
-		if (dcs->d_scl == TYPEDEF) {
-			/* typedef declares no type name */
-			warning(72);
-		} else if (!dcs->d_nonempty_decl) {
-			/* empty declaration */
-			warning(2);
-		}
-	  }
-	| begin_type_declaration_specifiers end_type
-	type_init_declarators T_SEMI
+	| declaration
 	| error T_SEMI {
 		global_clean_up();
 	  }



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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 18:13:25 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y lint1.h

Log Message:
lint: rename grammar rule 'declaration' to 'declaration_or_error'

This prepares for merging the duplicate code from top_level_declaration.
The code coverage outside cgram.y is exactly the same as before.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.325 -r1.326 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.114 -r1.115 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/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.325 src/usr.bin/xlint/lint1/cgram.y:1.326
--- src/usr.bin/xlint/lint1/cgram.y:1.325	Thu Jul 15 17:20:57 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Thu Jul 15 18:13:25 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.325 2021/07/15 17:20:57 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.326 2021/07/15 18:13:25 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.325 2021/07/15 17:20:57 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.326 2021/07/15 18:13:25 rillig Exp $");
 #endif
 
 #include 
@@ -181,7 +181,7 @@ anonymize(sym_t *s)
 
 /*
  * predefined type keywords (char, int, short, long, unsigned, signed,
- * float, double, void); see T_TYPENAME
+ * float, double, void); see T_TYPENAME for types from typedef
  */
 %token		T_TYPE
 
@@ -527,7 +527,7 @@ gcc_statement_expr_list:
 	;
 
 gcc_statement_expr_item:
-	  declaration {
+	  declaration_or_error {
 		clear_warning_flags();
 		$$ = NULL;
 	  }
@@ -720,6 +720,11 @@ constant_expr:			/* C99 6.6 */
 	  conditional_expression
 	;
 
+declaration_or_error:
+	  declaration
+	| error T_SEMI
+	;
+
 declaration:			/* C99 6.7 */
 	  begin_type_declmods end_type T_SEMI {
 		if (dcs->d_scl == TYPEDEF) {
@@ -742,7 +747,6 @@ declaration:			/* C99 6.7 */
 	  }
 	| begin_type_declaration_specifiers end_type
 	type_init_declarators T_SEMI
-	| error T_SEMI
 	;
 
 begin_type_declaration_specifiers:	/* see C99 6.7 */
@@ -1672,7 +1676,7 @@ block_item_list:		/* C99 6.8.2 */
 	;
 
 block_item:			/* C99 6.8.2 */
-	  declaration {
+	  declaration_or_error {
 		$$ = false;
 		restore_warning_flags();
 	  }

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.114 src/usr.bin/xlint/lint1/lint1.h:1.115
--- src/usr.bin/xlint/lint1/lint1.h:1.114	Sat Jul 10 17:35:54 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Thu Jul 15 18:13:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.114 2021/07/10 17:35:54 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.115 2021/07/15 18:13:25 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -209,11 +209,11 @@ typedef	enum {
 } symt_t;
 
 /*
- * storage classes
+ * storage classes and related things
  */
 typedef enum {
 	NOSCL,
-	EXTERN,		/* external symbols (indep. of decl_t) */
+	EXTERN,		/* external symbols (independent of decl_t) */
 	STATIC,		/* static symbols (local and global) */
 	AUTO,		/* automatic symbols (except register) */
 	REG,		/* register */



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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 17:48:10 UTC 2021

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

Log Message:
tests/lint: explain global variables in __attribute__


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/expr_precedence.c \
src/tests/usr.bin/xlint/lint1/expr_precedence.exp

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.2 src/tests/usr.bin/xlint/lint1/expr_precedence.c:1.3
--- src/tests/usr.bin/xlint/lint1/expr_precedence.c:1.2	Thu Jul 15 17:20:58 2021
+++ src/tests/usr.bin/xlint/lint1/expr_precedence.c	Thu Jul 15 17:48:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: expr_precedence.c,v 1.2 2021/07/15 17:20:58 rillig Exp $	*/
+/*	$NetBSD: expr_precedence.c,v 1.3 2021/07/15 17:48:10 rillig Exp $	*/
 # 3 "expr_precedence.c"
 
 /*
@@ -22,7 +22,15 @@ int init_syntactically_ok = var = 1 ? 2 
  * don't make sense at that point.
  */
 void __attribute__((format(printf,
-/* expect+2: error: 'var' undefined [99] */ /* XXX: why? */
+/*
+ * Inside of __attribute__((...)), symbol lookup works differently.  For
+ * example, 'printf' is a keyword, and since all arguments to
+ * __attribute__ are constant expressions, looking up global variables
+ * would not make sense.  Therefore, 'var' is undefined.
+ *
+ * See lex.c, function 'search', keyword 'attron'.
+ */
+/* expect+2: error: 'var' undefined [99] */
 /* expect+1: syntax error '=' [249] */
 var = 1,
 /* Syntactically ok, must be a constant expression though. */
Index: src/tests/usr.bin/xlint/lint1/expr_precedence.exp
diff -u src/tests/usr.bin/xlint/lint1/expr_precedence.exp:1.2 src/tests/usr.bin/xlint/lint1/expr_precedence.exp:1.3
--- src/tests/usr.bin/xlint/lint1/expr_precedence.exp:1.2	Thu Jul 15 17:20:58 2021
+++ src/tests/usr.bin/xlint/lint1/expr_precedence.exp	Thu Jul 15 17:48:10 2021
@@ -1,4 +1,4 @@
 expr_precedence.c(15): error: syntax error '4' [249]
 expr_precedence.c(18): error: non-constant initializer [177]
-expr_precedence.c(27): error: 'var' undefined [99]
-expr_precedence.c(27): error: syntax error '=' [249]
+expr_precedence.c(35): error: 'var' undefined [99]
+expr_precedence.c(35): error: syntax error '=' [249]



CVS commit: src

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 17:20:58 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: expr_precedence.c expr_precedence.exp
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: in the grammar, replace %prec with explicit rules

This way, in the arguments of __attribute__, where only constant
expressions are expected, a '=' leads to a syntax error.  Previously,
this was not detected.

No noticeable change in practice since these cases are already handled
by the compilers.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/expr_precedence.c \
src/tests/usr.bin/xlint/lint1/expr_precedence.exp
cvs rdiff -u -r1.324 -r1.325 src/usr.bin/xlint/lint1/cgram.y

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.1 src/tests/usr.bin/xlint/lint1/expr_precedence.c:1.2
--- src/tests/usr.bin/xlint/lint1/expr_precedence.c:1.1	Thu Jul 15 17:09:08 2021
+++ src/tests/usr.bin/xlint/lint1/expr_precedence.c	Thu Jul 15 17:20:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: expr_precedence.c,v 1.1 2021/07/15 17:09:08 rillig Exp $	*/
+/*	$NetBSD: expr_precedence.c,v 1.2 2021/07/15 17:20:58 rillig Exp $	*/
 # 3 "expr_precedence.c"
 
 /*
@@ -23,9 +23,8 @@ int init_syntactically_ok = var = 1 ? 2 
  */
 void __attribute__((format(printf,
 /* expect+2: error: 'var' undefined [99] */ /* XXX: why? */
-/* XXX: allow only constant-expression, not assignment-expression */
+/* expect+1: syntax error '=' [249] */
 var = 1,
 /* Syntactically ok, must be a constant expression though. */
-/* expect+1: error: 'var' undefined [99] */
 var > 0 ? 2 : 1)))
 my_printf(const char *, ...);
Index: src/tests/usr.bin/xlint/lint1/expr_precedence.exp
diff -u src/tests/usr.bin/xlint/lint1/expr_precedence.exp:1.1 src/tests/usr.bin/xlint/lint1/expr_precedence.exp:1.2
--- src/tests/usr.bin/xlint/lint1/expr_precedence.exp:1.1	Thu Jul 15 17:09:08 2021
+++ src/tests/usr.bin/xlint/lint1/expr_precedence.exp	Thu Jul 15 17:20:58 2021
@@ -1,4 +1,4 @@
 expr_precedence.c(15): error: syntax error '4' [249]
 expr_precedence.c(18): error: non-constant initializer [177]
 expr_precedence.c(27): error: 'var' undefined [99]
-expr_precedence.c(30): error: 'var' undefined [99]
+expr_precedence.c(27): error: syntax error '=' [249]

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.324 src/usr.bin/xlint/lint1/cgram.y:1.325
--- src/usr.bin/xlint/lint1/cgram.y:1.324	Wed Jul 14 17:19:37 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Thu Jul 15 17:20:57 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.324 2021/07/14 17:19:37 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.325 2021/07/15 17:20:57 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.324 2021/07/14 17:19:37 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.325 2021/07/15 17:20:57 rillig Exp $");
 #endif
 
 #include 
@@ -295,9 +295,10 @@ anonymize(sym_t *s)
 %type		argument_expression_list
 %type		unary_expression
 %type		cast_expression
+%type		conditional_expression
+%type		assignment_expression
 %type		expression_opt
 %type		expression
-%type		assignment_expression
 %type		constant_expr
 
 %type		begin_type_typespec
@@ -562,10 +563,10 @@ point_or_arrow:			/* helper for 'postfix
 
 /* K 7.1, C90 ???, C99 6.5.2, C11 6.5.2 */
 argument_expression_list:
-	  expression %prec T_COMMA {
+	  assignment_expression {
 		$$ = new_function_argument_node(NULL, $1);
 	  }
-	| argument_expression_list T_COMMA expression {
+	| argument_expression_list T_COMMA assignment_expression {
 		$$ = new_function_argument_node($1, $3);
 	  }
 	;
@@ -635,71 +636,74 @@ expression_opt:
 	| expression
 	;
 
-/* 'expression' also implements 'multiplicative_expression'. */
-/* 'expression' also implements 'additive_expression'. */
-/* 'expression' also implements 'shift_expression'. */
-/* 'expression' also implements 'relational_expression'. */
-/* 'expression' also implements 'equality_expression'. */
-/* 'expression' also implements 'AND_expression'. */
-/* 'expression' also implements 'exclusive_OR_expression'. */
-/* 'expression' also implements 'inclusive_OR_expression'. */
-/* 'expression' also implements 'logical_AND_expression'. */
-/* 'expression' also implements 'logical_OR_expression'. */
-/* 'expression' also implements 'conditional_expression'. */
-/* 'expression' also implements 'assignment_expression'. */
-/* K ???, C90 ???, C99 6.5.5 to 6.5.17, C11 ??? */
-expression:
-	  expression T_ASTERISK expression {
+/* 'conditional_expression' also implements 'multiplicative_expression'. */
+/* 'conditional_expression' also implements 'additive_expression'. */
+/* 

CVS commit: src/distrib/amd64/liveimage/emuimage

2021-07-15 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Thu Jul 15 17:20:25 UTC 2021

Modified Files:
src/distrib/amd64/liveimage/emuimage: ec2_init

Log Message:
Recognize OpenStack too (it also has a metadata service).

Typical values for machdep.dmi are:

machdep.dmi.system-vendor = OpenStack Foundation
machdep.dmi.system-product = OpenStack Nova
machdep.dmi.system-version = 17.0.12
machdep.dmi.system-serial = c46130fb-a56e-43f2-9d98-492d24656b9c
machdep.dmi.system-uuid = 680b8119-0d74-4f78-a6fd-e79dfede905c
machdep.dmi.bios-vendor = SeaBIOS
machdep.dmi.bios-version = 1.10.2-1ubuntu1
machdep.dmi.bios-date = 20140401
machdep.dmi.chassis-vendor = QEMU
machdep.dmi.chassis-type = QEMU
machdep.dmi.chassis-version = pc-i440fx-2.8
machdep.dmi.processor-vendor = QEMU
machdep.dmi.processor-version = pc-i440fx-2.8
machdep.dmi.processor-frequency = 2000 MHz


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/amd64/liveimage/emuimage/ec2_init

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

Modified files:

Index: src/distrib/amd64/liveimage/emuimage/ec2_init
diff -u src/distrib/amd64/liveimage/emuimage/ec2_init:1.2 src/distrib/amd64/liveimage/emuimage/ec2_init:1.3
--- src/distrib/amd64/liveimage/emuimage/ec2_init:1.2	Wed Sep  9 13:25:48 2020
+++ src/distrib/amd64/liveimage/emuimage/ec2_init	Thu Jul 15 17:20:25 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ec2_init,v 1.2 2020/09/09 13:25:48 jmcneill Exp $
+# $NetBSD: ec2_init,v 1.3 2021/07/15 17:20:25 rhialto Exp $
 
 is_ec2() {
 	val=NO
@@ -13,6 +13,10 @@ is_ec2() {
 			*amazon*)
 val=YES
 ;;
+			# OpenStack is not EC2 but it does have a metadata service.
+			*openstack*)
+val=YES
+;;
 			esac
 		fi
 	done



CVS commit: src

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 17:09:08 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile
Added Files:
src/tests/usr.bin/xlint/lint1: expr_precedence.c expr_precedence.exp

Log Message:
tests/lint: test precedence of operators


To generate a diff of this commit:
cvs rdiff -u -r1.1088 -r1.1089 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.89 -r1.90 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/expr_precedence.c \
src/tests/usr.bin/xlint/lint1/expr_precedence.exp

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1088 src/distrib/sets/lists/tests/mi:1.1089
--- src/distrib/sets/lists/tests/mi:1.1088	Wed Jul 14 20:39:13 2021
+++ src/distrib/sets/lists/tests/mi	Thu Jul 15 17:09:08 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1088 2021/07/14 20:39:13 rillig Exp $
+# $NetBSD: mi,v 1.1089 2021/07/15 17:09:08 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6224,6 +6224,8 @@
 ./usr/tests/usr.bin/xlint/lint1/emit.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/emit.exp-ln			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/emit.lntests-obsolete		obsolete
+./usr/tests/usr.bin/xlint/lint1/expr_precedence.c		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/expr_precedence.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/expr_range.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/expr_range.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/feat_stacktrace.c		tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.89 src/tests/usr.bin/xlint/lint1/Makefile:1.90
--- src/tests/usr.bin/xlint/lint1/Makefile:1.89	Wed Jul 14 20:39:13 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Thu Jul 15 17:09:08 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.89 2021/07/14 20:39:13 rillig Exp $
+# $NetBSD: Makefile,v 1.90 2021/07/15 17:09:08 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -123,6 +123,8 @@ FILES+=		decl_struct_member.exp
 FILES+=		emit.c
 FILES+=		emit.exp
 FILES+=		emit.exp-ln
+FILES+=		expr_precedence.c
+FILES+=		expr_precedence.exp
 FILES+=		expr_range.c
 FILES+=		expr_range.exp
 FILES+=		feat_stacktrace.c

Added files:

Index: src/tests/usr.bin/xlint/lint1/expr_precedence.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/expr_precedence.c:1.1
--- /dev/null	Thu Jul 15 17:09:08 2021
+++ src/tests/usr.bin/xlint/lint1/expr_precedence.c	Thu Jul 15 17:09:08 2021
@@ -0,0 +1,31 @@
+/*	$NetBSD: expr_precedence.c,v 1.1 2021/07/15 17:09:08 rillig Exp $	*/
+# 3 "expr_precedence.c"
+
+/*
+ * Tests for the precedence among operators.
+ */
+
+int var;
+
+/*
+ * An initializer needs an assignment-expression; the comma must be
+ * interpreted as a separator, not an operator.
+ */
+/* expect+1: error: syntax error '4' [249] */
+int init_error = 3, 4;
+
+/* expect+1: error: non-constant initializer [177] */
+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.
+ */
+void __attribute__((format(printf,
+/* expect+2: error: 'var' undefined [99] */ /* XXX: why? */
+/* XXX: allow only constant-expression, not assignment-expression */
+var = 1,
+/* Syntactically ok, must be a constant expression though. */
+/* expect+1: error: 'var' undefined [99] */
+var > 0 ? 2 : 1)))
+my_printf(const char *, ...);
Index: src/tests/usr.bin/xlint/lint1/expr_precedence.exp
diff -u /dev/null src/tests/usr.bin/xlint/lint1/expr_precedence.exp:1.1
--- /dev/null	Thu Jul 15 17:09:08 2021
+++ src/tests/usr.bin/xlint/lint1/expr_precedence.exp	Thu Jul 15 17:09:08 2021
@@ -0,0 +1,4 @@
+expr_precedence.c(15): error: syntax error '4' [249]
+expr_precedence.c(18): error: non-constant initializer [177]
+expr_precedence.c(27): error: 'var' undefined [99]
+expr_precedence.c(30): error: 'var' undefined [99]



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

2021-07-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jul 15 17:03:50 UTC 2021

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

Log Message:
lint: replace call to ttos with type_name

Since tyname.c 1.20 from 2021-01-02, type_name is as simple to use as
ttos and more expressive.  It can also be called multiple times without
invalidating the returned strings.

Used only in debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.314 -r1.315 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/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.45 src/usr.bin/xlint/lint1/emit1.c:1.46
--- src/usr.bin/xlint/lint1/emit1.c:1.45	Mon Jul  5 19:39:12 2021
+++ src/usr.bin/xlint/lint1/emit1.c	Thu Jul 15 17:03:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.45 2021/07/05 19:39:12 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.46 2021/07/15 17:03:50 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.45 2021/07/05 19:39:12 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.46 2021/07/15 17:03:50 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -158,35 +158,6 @@ outtype(const type_t *tp)
 }
 
 /*
- * type to string
- * used for debugging output
- *
- * it uses its own output buffer for conversion
- */
-const char *
-ttos(const type_t *tp)
-{
-	static	ob_t	tob;
-	ob_t	tmp;
-
-	if (tob.o_buf == NULL) {
-		tob.o_len = 64;
-		tob.o_buf = tob.o_next = xmalloc(tob.o_len);
-		tob.o_end = tob.o_buf + tob.o_len;
-	}
-
-	tmp = ob;
-	ob = tob;
-	ob.o_next = ob.o_buf;
-	outtype(tp);
-	outchar('\0');
-	tob = ob;
-	ob = tmp;
-
-	return tob.o_buf;
-}
-
-/*
  * write the name of a tag or typename
  *
  * if the tag is named, the name of the tag is written,

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.117 src/usr.bin/xlint/lint1/externs1.h:1.118
--- src/usr.bin/xlint/lint1/externs1.h:1.117	Wed Jul 14 17:07:24 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Thu Jul 15 17:03:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.117 2021/07/14 17:07:24 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.118 2021/07/15 17:03:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -314,7 +314,6 @@ extern	void	add_designator_subscript(ran
  * emit.c
  */
 extern	void	outtype(const type_t *);
-extern	const	char *ttos(const type_t *);
 extern	void	outsym(const sym_t *, scl_t, def_t);
 extern	void	outfdef(const sym_t *, const pos_t *, bool, bool,
 		const sym_t *);

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.314 src/usr.bin/xlint/lint1/tree.c:1.315
--- src/usr.bin/xlint/lint1/tree.c:1.314	Wed Jul 14 17:07:24 2021
+++ src/usr.bin/xlint/lint1/tree.c	Thu Jul 15 17:03:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.314 2021/07/14 17:07:24 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.315 2021/07/15 17:03:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.314 2021/07/14 17:07:24 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.315 2021/07/15 17:03:50 rillig Exp $");
 #endif
 
 #include 
@@ -3815,7 +3815,7 @@ display_expression(const tnode_t *tn, in
 		(void)printf("o=%d, l=%d ", tn->tn_type->t_foffs,
 			 tn->tn_type->t_flen);
 	}
-	(void)printf("%s\n", ttos(tn->tn_type));
+	(void)printf("%s\n", type_name(tn->tn_type));
 	if (tn->tn_op == NAME || tn->tn_op == CON || tn->tn_op == STRING)
 		return;
 	display_expression(tn->tn_left, offs + 2);



CVS commit: src/sys/dev/usb

2021-07-15 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Thu Jul 15 15:23:46 UTC 2021

Modified Files:
src/sys/dev/usb: if_mue.c

Log Message:
back out the previous accidental commit


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/usb/if_mue.c

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

Modified files:

Index: src/sys/dev/usb/if_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.61 src/sys/dev/usb/if_mue.c:1.62
--- src/sys/dev/usb/if_mue.c:1.61	Thu Jul 15 03:25:50 2021
+++ src/sys/dev/usb/if_mue.c	Thu Jul 15 15:23:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.61 2021/07/15 03:25:50 nisimura Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.62 2021/07/15 15:23:46 nisimura Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.61 2021/07/15 03:25:50 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.62 2021/07/15 15:23:46 nisimura Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -98,7 +98,7 @@ static void	mue_setmtu_locked(struct usb
 static void	mue_reset(struct usbnet *);
 
 static void	mue_uno_stop(struct ifnet *, int);
-static int	mue_uno_override_ioctl(struct ifnet *, u_long, void *);
+static int	mue_uno_ioctl(struct ifnet *, u_long, void *);
 static int	mue_uno_mii_read_reg(struct usbnet *, int, int, uint16_t *);
 static int	mue_uno_mii_write_reg(struct usbnet *, int, int, uint16_t);
 static void	mue_uno_mii_statchg(struct ifnet *);
@@ -110,7 +110,7 @@ static int	mue_uno_init(struct ifnet *);
 
 static const struct usbnet_ops mue_ops = {
 	.uno_stop = mue_uno_stop,
-	.uno_override_ioctl = mue_uno_override_ioctl,
+	.uno_ioctl = mue_uno_ioctl,
 	.uno_read_reg = mue_uno_mii_read_reg,
 	.uno_write_reg = mue_uno_mii_write_reg,
 	.uno_statchg = mue_uno_mii_statchg,
@@ -137,14 +137,7 @@ static const struct usbnet_ops mue_ops =
 #define ETHER_IS_ZERO(addr) \
 	(!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]))
 
-struct mue_softc {
-	struct usbnet	   sc_un;
-	struct usbnet_intr sc_intr;
-	uint8_t sc_ibuf[8];
-	unsigned sc_flowflags;		/* 802.3x PAUSE flow control */
-};
-
-CFATTACH_DECL_NEW(mue, sizeof(struct mue_softc), mue_match, mue_attach,
+CFATTACH_DECL_NEW(mue, sizeof(struct usbnet), mue_match, mue_attach,
 usbnet_detach, usbnet_activate);
 
 static uint32_t
@@ -767,15 +760,14 @@ static void
 mue_attach(device_t parent, device_t self, void *aux)
 {
 	USBNET_MII_DECL_DEFAULT(unm);
+	struct usbnet * const un = device_private(self);
 	prop_dictionary_t dict = device_properties(self);
-	struct mue_softc * const sc = device_private(self);
 	struct usb_attach_arg *uaa = aux;
 	struct usbd_device *dev = uaa->uaa_device;
-	struct usbnet *un = >sc_un;
 	usb_interface_descriptor_t *id;
 	usb_endpoint_descriptor_t *ed;
-	usbd_status err;
 	char *devinfop;
+	usbd_status err;
 	const char *descr;
 	uint32_t id_rev;
 	uint8_t i;
@@ -790,7 +782,7 @@ mue_attach(device_t parent, device_t sel
 
 	un->un_dev = self;
 	un->un_udev = dev;
-	un->un_sc = sc; /* @@! */
+	un->un_sc = un;
 	un->un_ops = _ops;
 	un->un_rx_xfer_flags = USBD_SHORT_XFER_OK;
 	un->un_tx_xfer_flags = USBD_FORCE_SHORT_XFER;
@@ -892,8 +884,6 @@ mue_attach(device_t parent, device_t sel
 	ec->ec_capabilities = ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU;
 #endif
 
-	unm.un_mii_phyloc = un->un_phyno;	/* use internal PHY 1 */
-	unm.un_mii_flags |= MIIF_DOPAUSE;	/* use PAUSE cap. */
 	usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST,
 	0, );
 }
@@ -1007,93 +997,90 @@ mue_setiff_locked(struct usbnet *un)
 {
 	struct ethercom *ec = usbnet_ec(un);
 	struct ifnet * const ifp = usbnet_ifp(un);
-	struct ether_multistep step;
+	const uint8_t *enaddr = CLLADDR(ifp->if_sadl);
 	struct ether_multi *enm;
-	uint32_t mchash[MUE_DP_SEL_VHF_HASH_LEN];
-	uint32_t rfe, rxfilt, crc, hireg, loreg;
+	struct ether_multistep step;
+	uint32_t pfiltbl[MUE_NUM_ADDR_FILTX][2];
+	uint32_t hashtbl[MUE_DP_SEL_VHF_HASH_LEN];
+	uint32_t reg, rxfilt, h, hireg, loreg;
 	size_t i;
 
 	if (usbnet_isdying(un))
 		return;
 
-	for (i = 1; i < MUE_NUM_ADDR_FILTX; i++) {
-		hireg = (un->un_flags & LAN7500)
-		? MUE_7500_ADDR_FILTX(i) : MUE_7800_ADDR_FILTX(i);
-		mue_csr_write(un, hireg, 0);
-	}
-	memset(mchash, 0, sizeof(mchash));
+	/* Clear perfect filter and hash tables. */
+	memset(pfiltbl, 0, sizeof(pfiltbl));
+	memset(hashtbl, 0, sizeof(hashtbl));
 
-	rfe = (un->un_flags & LAN7500) ? MUE_7500_RFE_CTL : MUE_7800_RFE_CTL;
-	rxfilt = mue_csr_read(un, rfe);
-	rxfilt &= ~(MUE_RFE_CTL_MULTICAST_HASH |
+	reg = (un->un_flags & LAN7500) ? MUE_7500_RFE_CTL : MUE_7800_RFE_CTL;
+	rxfilt = mue_csr_read(un, reg);
+	rxfilt &= ~(MUE_RFE_CTL_PERFECT | MUE_RFE_CTL_MULTICAST_HASH |
 	MUE_RFE_CTL_UNICAST | MUE_RFE_CTL_MULTICAST);
 
-	ETHER_LOCK(ec);
+	/* Always accept broadcast frames. */
+	rxfilt |= MUE_RFE_CTL_BROADCAST;
+
 

CVS commit: src/sys/dev/pci/ixgbe

2021-07-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jul 15 08:09:31 UTC 2021

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
 Add a new sysctl to read rxr->next_to_refresh.


To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.286 src/sys/dev/pci/ixgbe/ixgbe.c:1.287
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.286	Wed Jul  7 08:58:19 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Jul 15 08:09:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.287 2021/07/15 08:09:31 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.287 2021/07/15 08:09:31 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -253,6 +253,7 @@ static int	ixgbe_sysctl_power_state(SYSC
 static int	ixgbe_sysctl_print_rss_config(SYSCTLFN_PROTO);
 #endif
 static int	ixgbe_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
+static int	ixgbe_sysctl_next_to_refresh_handler(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_rdh_handler(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_rdt_handler(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_tdt_handler(SYSCTLFN_PROTO);
@@ -1930,6 +1931,13 @@ ixgbe_add_hw_stats(struct adapter *adapt
 			break;
 
 		if (sysctl_createv(log, 0, , ,
+		CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxrf",
+		SYSCTL_DESCR("Receive Descriptor next to refresh"),
+		ixgbe_sysctl_next_to_refresh_handler, 0, (void *)rxr, 0,
+		CTL_CREATE, CTL_EOL) != 0)
+			break;
+
+		if (sysctl_createv(log, 0, , ,
 		CTLFLAG_READONLY, CTLTYPE_INT, "rxd_head",
 		SYSCTL_DESCR("Receive Descriptor Head"),
 		ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0,
@@ -2302,6 +2310,32 @@ ixgbe_sysctl_next_to_check_handler(SYSCT
 } /* ixgbe_sysctl_next_to_check_handler */
 
 /
+ * ixgbe_sysctl_next_to_refresh_handler - Receive Descriptor next to check
+ * handler function
+ *
+ *   Retrieves the next_to_refresh value
+ /
+static int
+ixgbe_sysctl_next_to_refresh_handler(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
+	struct adapter *adapter;
+	uint32_t val;
+
+	if (!rxr)
+		return (0);
+
+	adapter = rxr->adapter;
+	if (ixgbe_fw_recovery_mode_swflag(adapter))
+		return (EPERM);
+
+	val = rxr->next_to_refresh;
+	node.sysctl_data = 
+	return sysctl_lookup(SYSCTLFN_CALL());
+} /* ixgbe_sysctl_next_to_refresh_handler */
+
+/
  * ixgbe_sysctl_rdh_handler - Receive Descriptor Head handler function
  *
  *   Retrieves the RDH value from the hardware

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.163 src/sys/dev/pci/ixgbe/ixv.c:1.164
--- src/sys/dev/pci/ixgbe/ixv.c:1.163	Wed Jul  7 08:58:19 2021
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Jul 15 08:09:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.163 2021/07/07 08:58:19 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.164 2021/07/15 08:09:31 msaitoh Exp $ */
 
 /**
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.163 2021/07/07 08:58:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.164 2021/07/15 08:09:31 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -144,6 +144,7 @@ static void	ixv_set_sysctl_value(struct 
 		const char *, int *, int);
 static int	ixv_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO);
 static int	ixv_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
+static int	ixv_sysctl_next_to_refresh_handler(SYSCTLFN_PROTO);
 static int	ixv_sysctl_rdh_handler(SYSCTLFN_PROTO);
 static int	ixv_sysctl_rdt_handler(SYSCTLFN_PROTO);
 static int	ixv_sysctl_tdt_handler(SYSCTLFN_PROTO);
@@ -2033,6 +2034,32 @@ ixv_sysctl_next_to_check_handler(SYSCTLF
 } /* ixv_sysctl_next_to_check_handler */
 
 /
+ * ixv_sysctl_next_to_refresh_handler - Receive Descriptor next to refresh
+ * handler function
+ *
+ *   Retrieves the next_to_refresh value
+ /
+static int
+ixv_sysctl_next_to_refresh_handler(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct rx_ring *rxr = (struct rx_ring 

CVS commit: src/doc

2021-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jul 15 08:02:47 UTC 2021

Modified Files:
src/doc: HACKS

Log Message:
PR port-sh3/56311

Document -O0 workaround for initdecl() in doc/HACKS.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.222 src/doc/HACKS:1.223
--- src/doc/HACKS:1.222	Tue Jul  6 12:42:12 2021
+++ src/doc/HACKS	Thu Jul 15 08:02:47 2021
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.222 2021/07/06 12:42:12 thorpej Exp $
+# $NetBSD: HACKS,v 1.223 2021/07/15 08:02:47 rin Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -997,3 +997,13 @@ port	sh3
 
 		https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101177
 kcah
+
+port	sh3
+hack	compile lint1/initdecl() with -O0 for sh3 (port-sh3/56311)
+cdate	Thu Jul 15 07:58:05 UTC 2021
+who	rin
+file	src/usr.bin/xlint/lint1/decl.c: 1.200
+descr	GCC 9 and 10 miscompile initdecl() due to improper use of scratch
+	register, as described in the PR. Compiling this function with -O0
+	works around the problem.
+kcah



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

2021-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jul 15 07:58:05 UTC 2021

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

Log Message:
PR port-sh3/56311

As a workaround for GCC bug, compile initdecl() with -O0 for sh3.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 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/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.199 src/usr.bin/xlint/lint1/decl.c:1.200
--- src/usr.bin/xlint/lint1/decl.c:1.199	Tue Jul 13 22:01:34 2021
+++ src/usr.bin/xlint/lint1/decl.c	Thu Jul 15 07:58:05 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.199 2021/07/13 22:01:34 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.200 2021/07/15 07:58:05 rin Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.199 2021/07/13 22:01:34 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.200 2021/07/15 07:58:05 rin Exp $");
 #endif
 
 #include 
@@ -86,6 +86,10 @@ static	void	check_global_variable_size(c
  * initializes all global vars used in declarations
  */
 void
+#ifdef __sh3__
+/* XXX port-sh3/56311 */
+__attribute__((optimize("O0")))
+#endif
 initdecl(void)
 {
 	int i;



CVS commit: src/usr.bin/aiomixer

2021-07-15 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Jul 15 07:03:14 UTC 2021

Modified Files:
src/usr.bin/aiomixer: draw.c

Log Message:
aiomixer: avoid wasting space


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/aiomixer/draw.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/aiomixer/draw.c
diff -u src/usr.bin/aiomixer/draw.c:1.8 src/usr.bin/aiomixer/draw.c:1.9
--- src/usr.bin/aiomixer/draw.c:1.8	Thu Jul 15 06:59:55 2021
+++ src/usr.bin/aiomixer/draw.c	Thu Jul 15 07:03:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: draw.c,v 1.8 2021/07/15 06:59:55 nia Exp $ */
+/* $NetBSD: draw.c,v 1.9 2021/07/15 07:03:14 nia Exp $ */
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -311,7 +311,7 @@ draw_header(struct aiomixer *aio)
 {
 	wprintw(aio->header, "\n");
 	mvwaddstr(aio->header, 0,
-	getmaxx(aio->header) - ((int)sizeof("NetBSD audio mixer") + 1),
+	getmaxx(aio->header) - (int)sizeof("NetBSD audio mixer"),
 	"NetBSD audio mixer");
 
 	if (aio->mixerdev.version[0] != '\0') {



CVS commit: src/usr.bin/aiomixer

2021-07-15 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Jul 15 06:59:55 UTC 2021

Modified Files:
src/usr.bin/aiomixer: draw.c

Log Message:
aiomixer: fix calculation of maximum screen width


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/aiomixer/draw.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/aiomixer/draw.c
diff -u src/usr.bin/aiomixer/draw.c:1.7 src/usr.bin/aiomixer/draw.c:1.8
--- src/usr.bin/aiomixer/draw.c:1.7	Sat May 29 09:11:41 2021
+++ src/usr.bin/aiomixer/draw.c	Thu Jul 15 06:59:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: draw.c,v 1.7 2021/05/29 09:11:41 nia Exp $ */
+/* $NetBSD: draw.c,v 1.8 2021/07/15 06:59:55 nia Exp $ */
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -311,7 +311,7 @@ draw_header(struct aiomixer *aio)
 {
 	wprintw(aio->header, "\n");
 	mvwaddstr(aio->header, 0,
-	getmaxx(aio->header) - (int)sizeof("NetBSD audio mixer") + 1,
+	getmaxx(aio->header) - ((int)sizeof("NetBSD audio mixer") + 1),
 	"NetBSD audio mixer");
 
 	if (aio->mixerdev.version[0] != '\0') {



CVS commit: src/usr.bin/aiomixer

2021-07-15 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Jul 15 06:57:11 UTC 2021

Modified Files:
src/usr.bin/aiomixer: main.c

Log Message:
aiomixer: Clear screen after device selection


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/aiomixer/main.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/aiomixer/main.c
diff -u src/usr.bin/aiomixer/main.c:1.2 src/usr.bin/aiomixer/main.c:1.3
--- src/usr.bin/aiomixer/main.c:1.2	Sun May  9 15:40:27 2021
+++ src/usr.bin/aiomixer/main.c	Thu Jul 15 06:57:10 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.2 2021/05/09 15:40:27 christos Exp $ */
+/* $NetBSD: main.c,v 1.3 2021/07/15 06:57:10 nia Exp $ */
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -405,6 +405,7 @@ process_device_select(struct aiomixer *a
 	while ((ch = getch()) != ERR) {
 		switch (ch) {
 		case '\n':
+			clear();
 			(void)snprintf(device_path, sizeof(device_path),
 			"/dev/mixer%d", selected_device);
 			open_device(aio, device_path);