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

2021-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr 20 23:30:35 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: Makefile

Log Message:
tests/lint: fix inconsistent operator for emit.ln

The build failed with:

nbmake[8]: "/.../src/share/mk/bsd.files.mk" line 47:
Inconsistent operator for /.../emit.ln


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/tests/usr.bin/xlint/lint1/Makefile

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/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.47 src/tests/usr.bin/xlint/lint1/Makefile:1.48
--- src/tests/usr.bin/xlint/lint1/Makefile:1.47	Tue Apr 20 21:20:24 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Tue Apr 20 23:30:35 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.47 2021/04/20 21:20:24 rillig Exp $
+# $NetBSD: Makefile,v 1.48 2021/04/20 23:30:35 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	343		# see lint1/err.c
@@ -117,7 +117,7 @@ FILES+=		op_colon.exp
 # depend in ${DESTDIR}/emit.c, but these files are not intended to depend on
 # each other, they have these suffixes just for convenience and convention.
 .if make(install)
-${DESTDIR}${FILESDIR}/emit.ln: .PHONY
+${DESTDIR}${FILESDIR}/emit.ln! .PHONY
 .endif
 # - end hack -
 



CVS commit: src/external/bsd/compiler_rt/lib/clang/lib/netbsd

2021-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr 20 23:19:53 UTC 2021

Modified Files:
src/external/bsd/compiler_rt/lib/clang/lib/netbsd: syms.mk

Log Message:
clang: fix build for installing libclang_rt.ubsan_minimal-x86_64.a

The build failed with:

--- install-ubsan_minimal-m64 ---
x86_64--netbsd-install: the last argument
(/.../libclang_rt.ubsan_minimal-x86_64.a.syms)
must name an existing directory

The cause of this is that the suffix transformation rule for .a.a.sym
was active even during 'make install'.

At that point, the make variable .ALLSRC for the target
${DESTDIR}/.../libclang_rt.ubsan_minimal-x86_64.a.sym included not only
the corresponding file from the source directory, but also the potential
source file from the transformation rule, in this case
libclang_rt.ubsan_minimal-x86_64.a.

This led to several file parameters for the command 'install', which is
only allowed if the last parameter names an existing directory.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/compiler_rt/lib/clang/lib/netbsd/syms.mk

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

Modified files:

Index: src/external/bsd/compiler_rt/lib/clang/lib/netbsd/syms.mk
diff -u src/external/bsd/compiler_rt/lib/clang/lib/netbsd/syms.mk:1.3 src/external/bsd/compiler_rt/lib/clang/lib/netbsd/syms.mk:1.4
--- src/external/bsd/compiler_rt/lib/clang/lib/netbsd/syms.mk:1.3	Fri Aug 30 23:36:40 2019
+++ src/external/bsd/compiler_rt/lib/clang/lib/netbsd/syms.mk	Tue Apr 20 23:19:53 2021
@@ -1,7 +1,8 @@
-#	$NetBSD: syms.mk,v 1.3 2019/08/30 23:36:40 kamil Exp $
+#	$NetBSD: syms.mk,v 1.4 2021/04/20 23:19:53 rillig Exp $
 
 here := ${.PARSEDIR}
 
+.if !make(install)		# allow both .a and .a.syms to be installed
 .SUFFIXES: .a .a.syms
 .a.a.syms:
 	${_MKTARGET_CREATE}
@@ -10,3 +11,4 @@ here := ${.PARSEDIR}
 		${here}/gen_dynamic_list.sh \
 		--extra ${SYMS_EXTRA:Q} \
 		${.IMPSRC} > ${.TARGET}
+.endif



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

2021-04-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 20 21:48:39 UTC 2021

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

Log Message:
Add common attribute


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/lint1/lex.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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.219 src/usr.bin/xlint/lint1/cgram.y:1.220
--- src/usr.bin/xlint/lint1/cgram.y:1.219	Sun Apr 18 17:53:37 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Apr 20 17:48:39 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.219 2021/04/18 21:53:37 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.220 2021/04/20 21:48:39 christos 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.219 2021/04/18 21:53:37 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.220 2021/04/20 21:48:39 christos Exp $");
 #endif
 
 #include 
@@ -215,6 +215,7 @@ anonymize(sym_t *s)
 %token 		T_AT_BOUNDED
 %token 		T_AT_BUFFER
 %token 		T_AT_COLD
+%token 		T_AT_COMMON
 %token 		T_AT_CONSTRUCTOR
 %token 		T_AT_DEPRECATED
 %token 		T_AT_DESTRUCTOR
@@ -578,6 +579,7 @@ type_attribute_spec:
 	| T_AT_NORETURN
 	| T_AT_NOTHROW
 	| T_AT_COLD
+	| T_AT_COMMON
 	| T_AT_RETURNS_TWICE
 	| T_AT_PACKED {
 		addpacked();

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.28 src/usr.bin/xlint/lint1/lex.c:1.29
--- src/usr.bin/xlint/lint1/lex.c:1.28	Sun Apr 18 04:00:13 2021
+++ src/usr.bin/xlint/lint1/lex.c	Tue Apr 20 17:48:39 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.28 2021/04/18 08:00:13 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.29 2021/04/20 21:48:39 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.28 2021/04/18 08:00:13 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.29 2021/04/20 21:48:39 christos Exp $");
 #endif
 
 #include 
@@ -157,6 +157,7 @@ static	struct	kwtab {
 	kwdef_token(	"case",		T_CASE,			0,0,0,0,1),
 	kwdef_type(	"char",		CHAR,			0,0,0,0,1),
 	kwdef_token(	"cold",		T_AT_COLD,		0,0,1,1,5),
+	kwdef_token(	"common",	T_AT_COMMON,		0,0,1,1,5),
 	kwdef_tqual(	"const",	CONST,			1,0,0,0,7),
 	kwdef_token(	"constructor",	T_AT_CONSTRUCTOR,	0,0,1,1,5),
 	kwdef_token(	"continue",	T_CONTINUE,		0,0,0,0,1),



CVS commit: src/lib

2021-04-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 20 21:42:32 UTC 2021

Modified Files:
src/lib/csu: Makefile
src/lib/csu/common: crt0-common.c
src/lib/libc: Makefile.inc
src/lib/libc/gen: Makefile.inc getprogname.c setproctitle.c
src/lib/libc/misc: Makefile.inc initfini.c
src/lib/libc/stdlib: _env.c
Added Files:
src/lib/csu/common: csu-common.h

Log Message:
Instead of compiling files with -fcommon, create an include file and declare
the 3 symbols that need to be common using an attribute. Put all the 3 symbol
definitions in libc in one place (initfini.c). Reviewed by joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/csu/Makefile
cvs rdiff -u -r1.23 -r1.24 src/lib/csu/common/crt0-common.c
cvs rdiff -u -r0 -r1.1 src/lib/csu/common/csu-common.h
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/Makefile.inc
cvs rdiff -u -r1.211 -r1.212 src/lib/libc/gen/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gen/getprogname.c
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/gen/setproctitle.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/misc/Makefile.inc
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/misc/initfini.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/stdlib/_env.c

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

Modified files:

Index: src/lib/csu/Makefile
diff -u src/lib/csu/Makefile:1.40 src/lib/csu/Makefile:1.41
--- src/lib/csu/Makefile:1.40	Wed Apr 22 19:32:25 2020
+++ src/lib/csu/Makefile	Tue Apr 20 17:42:31 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.40 2020/04/22 23:32:25 joerg Exp $
+#	$NetBSD: Makefile,v 1.41 2021/04/20 21:42:31 christos Exp $
 
 NOLIBCSANITIZER=	# defined
 NOSANITIZER=		# defined
@@ -18,9 +18,6 @@ ARCHDIR:=	${.CURDIR}/arch/${CSU_MACHINE_
 .error Architecture (${CSU_MACHINE_ARCH} or ${CSU_MACHINE_CPU}) unsupported
 .endif
 
-# Ownership of globals from crt0.o is shared with libc for historic reasons
-COPTS+=		-fcommon
-
 .PATH:	${ARCHDIR}
 .include "${ARCHDIR}/Makefile.inc"
 .include "${.CURDIR}/common/Makefile.inc"

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.23 src/lib/csu/common/crt0-common.c:1.24
--- src/lib/csu/common/crt0-common.c:1.23	Fri Dec 28 15:12:35 2018
+++ src/lib/csu/common/crt0-common.c	Tue Apr 20 17:42:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.23 2018/12/28 20:12:35 christos Exp $ */
+/* $NetBSD: crt0-common.c,v 1.24 2021/04/20 21:42:31 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.23 2018/12/28 20:12:35 christos Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.24 2021/04/20 21:42:31 christos Exp $");
 
 #include 
 #include 
@@ -46,6 +46,8 @@ __RCSID("$NetBSD: crt0-common.c,v 1.23 2
 #include 
 #include 
 
+#include "csu-common.h"
+
 extern int main(int, char **, char **);
 
 typedef void (*fptr_t)(void);
@@ -70,11 +72,11 @@ extern void	_mcleanup(void);
 extern unsigned char __etext, __eprol;
 #endif /* MCRT0 */
 
-char		**environ;
-struct ps_strings *__ps_strings = 0;
-
 static char	 empty_string[] = "";
-char		*__progname = empty_string;
+
+char		**environ __common;
+struct ps_strings *__ps_strings __common = 0;
+char		*__progname __common = empty_string;
 
 __dead __dso_hidden void ___start(void (*)(void), struct ps_strings *);
 

Index: src/lib/libc/Makefile.inc
diff -u src/lib/libc/Makefile.inc:1.19 src/lib/libc/Makefile.inc:1.20
--- src/lib/libc/Makefile.inc:1.19	Sat Jun  9 18:41:55 2018
+++ src/lib/libc/Makefile.inc	Tue Apr 20 17:42:31 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.19 2018/06/09 22:41:55 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.20 2021/04/20 21:42:31 christos Exp $
 #	@(#)Makefile	8.2 (Berkeley) 2/3/94
 #
 # All library objects contain sccsid strings by default; they may be
@@ -34,6 +34,8 @@ CPPFLAGS+=	-D_DIAGNOSTIC
 .if defined(MLIBDIR)
 CPPFLAGS+=	-DMLIBDIR=\"${MLIBDIR}\"
 .endif
+# needed for csu_common.h
+CPPFLAGS+=	-I${NETBSDSRCDIR}/lib/csu/common
 
 .if (${USE_HESIOD} != "no")
 CPPFLAGS+=	-DHESIOD

Index: src/lib/libc/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.211 src/lib/libc/gen/Makefile.inc:1.212
--- src/lib/libc/gen/Makefile.inc:1.211	Sun Apr 11 23:57:07 2021
+++ src/lib/libc/gen/Makefile.inc	Tue Apr 20 17:42:32 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.211 2021/04/12 03:57:07 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.212 2021/04/20 21:42:32 christos Exp $
 #	from: @(#)Makefile.inc	8.6 (Berkeley) 5/4/95
 
 # gen sources
@@ -207,8 +207,3 @@ errlist.c: errlist.awk ${NETBSDSRCDIR}/s
 	${TOOL_AWK} -f ${.ALLSRC} > ${.TARGET}
 
 CLEANFILES+= errlist.c
-
-# Ownership of globals from crt0.o is shared with libc for historic reasons.
-# __progname is also necessary as global here for the nbcompat case.
-COPTS.getprogname.c+=	-fcommon
-COPTS.setproctitle.c+=	-fcommon

Index: src/lib/libc/gen/getprogname.c
diff -u src/lib/libc/gen/getprogname.c:1.4 

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

2021-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr 20 21:20:24 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: Makefile

Log Message:
tests/lint1: fix build error "must name an existing directory"

The build failed with this error message:

x86_64--netbsd-install: the last argument (/.../emit.ln) must
name an existing directory

The cause for this message was that ${DESTDIR}/.../emit.ln has
${DESTDIR}/.../emit.c as implicit target, which is kind of correct but
unintended in this case.  Because of this, the command 'install' was run
like this:

install ${NETBSDSRCDIR}/.../emit.ln ${DESTDIR}/.../emit.c \
${DESTDIR}/.../emit.ln


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/tests/usr.bin/xlint/lint1/Makefile

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/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.46 src/tests/usr.bin/xlint/lint1/Makefile:1.47
--- src/tests/usr.bin/xlint/lint1/Makefile:1.46	Sun Apr 18 23:05:26 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Tue Apr 20 21:20:24 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.46 2021/04/18 23:05:26 rillig Exp $
+# $NetBSD: Makefile,v 1.47 2021/04/20 21:20:24 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	343		# see lint1/err.c
@@ -111,6 +111,16 @@ FILES+=		${:U0 ${:U:${:Urange=${MAX_MESS
 FILES+=		op_colon.c
 FILES+=		op_colon.exp
 
+# - begin hack -
+# Prevent that ${DESTDIR}/emit.ln gets ${DESTDIR}/emit.c as implicit source.
+# The suffix transformation rule '.c.ln' thinks that ${DESTDIR}/emit.ln should
+# depend in ${DESTDIR}/emit.c, but these files are not intended to depend on
+# each other, they have these suffixes just for convenience and convention.
+.if make(install)
+${DESTDIR}${FILESDIR}/emit.ln: .PHONY
+.endif
+# - end hack -
+
 # Note: only works for adding tests.
 # To remove a test, the $$mi file must be edited manually.
 sync-mi: .PHONY



CVS commit: src/external/bsd/tmux/dist

2021-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Apr 20 17:42:31 UTC 2021

Modified Files:
src/external/bsd/tmux/dist: status.c tmux.h

Log Message:
tmux: move __printflike to the declaration in the header

Noted by Akihiko HAYASHI.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/tmux/dist/status.c
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/tmux/dist/tmux.h

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

Modified files:

Index: src/external/bsd/tmux/dist/status.c
diff -u src/external/bsd/tmux/dist/status.c:1.12 src/external/bsd/tmux/dist/status.c:1.13
--- src/external/bsd/tmux/dist/status.c:1.12	Mon Apr 19 21:52:17 2021
+++ src/external/bsd/tmux/dist/status.c	Tue Apr 20 17:42:31 2021
@@ -422,7 +422,7 @@ status_redraw(struct client *c)
 }
 
 /* Set a status line message. */
-void __printflike(5, 0)
+void
 status_message_set(struct client *c, int delay, int ignore_styles,
 int ignore_keys, const char *fmt, ...)
 {

Index: src/external/bsd/tmux/dist/tmux.h
diff -u src/external/bsd/tmux/dist/tmux.h:1.18 src/external/bsd/tmux/dist/tmux.h:1.19
--- src/external/bsd/tmux/dist/tmux.h:1.18	Sat Apr 17 20:42:09 2021
+++ src/external/bsd/tmux/dist/tmux.h	Tue Apr 20 17:42:31 2021
@@ -2492,7 +2492,8 @@ struct style_range *status_get_range(str
 void	 status_init(struct client *);
 void	 status_free(struct client *);
 int	 status_redraw(struct client *);
-void status_message_set(struct client *, int, int, int, const char *, ...);
+void status_message_set(struct client *, int, int, int, const char *, ...)
+	__printflike(5, 0);
 void	 status_message_clear(struct client *);
 int	 status_message_redraw(struct client *);
 void	 status_prompt_set(struct client *, struct cmd_find_state *,



CVS commit: src/external/gpl3/gcc/dist/gcc/config/aarch64

2021-04-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Apr 20 10:39:59 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/aarch64: aarch64-builtins.c

Log Message:
give a structure a name.

it makes GCC 10 less unhappy about building arm64 GCC 10.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.10 -r1.2 \
src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.c
diff -u src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.c:1.1.1.10 src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.c:1.2
--- src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.c:1.1.1.10	Sat Apr 10 22:09:46 2021
+++ src/external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-builtins.c	Tue Apr 20 10:39:58 2021
@@ -1206,7 +1206,7 @@ aarch64_init_rng_builtins (void)
 }
 
 /* Initialize the memory tagging extension (MTE) builtins.  */
-struct
+struct aarch64_mte
 {
   tree ftype;
   enum insn_code icode;



CVS commit: src/sys/arch/riscv/riscv

2021-04-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr 20 10:15:34 UTC 2021

Modified Files:
src/sys/arch/riscv/riscv: db_disasm.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/db_disasm.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/arch/riscv/riscv/db_disasm.c
diff -u src/sys/arch/riscv/riscv/db_disasm.c:1.5 src/sys/arch/riscv/riscv/db_disasm.c:1.6
--- src/sys/arch/riscv/riscv/db_disasm.c:1.5	Tue Apr 20 10:01:37 2021
+++ src/sys/arch/riscv/riscv/db_disasm.c	Tue Apr 20 10:15:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.5 2021/04/20 10:01:37 skrll Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.6 2021/04/20 10:15:34 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__RCSID("$NetBSD: db_disasm.c,v 1.5 2021/04/20 10:01:37 skrll Exp $");
+__RCSID("$NetBSD: db_disasm.c,v 1.6 2021/04/20 10:15:34 skrll Exp $");
 
 #include 
 #include 
@@ -114,8 +114,7 @@ db_print_addr(db_addr_t loc)
  * 32 to 64 for RV64. (And bail on RV128 since it's not clear what
  * the C type sizes are going to be there anyway...)
  */
-static
-unsigned long
+static unsigned long
 maybe_signext64(uint32_t x)
 {
 #if __riscv_xlen == 32
@@ -130,8 +129,7 @@ maybe_signext64(uint32_t x)
 #endif
 }
 
-static
-int
+static int
 db_disasm_16(db_addr_t loc, uint32_t insn, bool altfmt)
 {
 	/* note: insn needs to be uint32_t for immediate computations */
@@ -221,16 +219,13 @@ db_disasm_16(db_addr_t loc, uint32_t ins
 		imm = INSN16_IMM_CI_K(insn);
 		if (rd == 0 && imm == 0) {
 			db_printf("c.nop\n");
-		}
-		else if (rd == 0 && imm != 0) {
+		} else if (rd == 0 && imm != 0) {
 			/* undefined hint */
 			return EINVAL;
-		}
-		else if (rd != 0 && imm == 0) {
+		} else if (rd != 0 && imm == 0) {
 			/* undefined hint */
 			return EINVAL;
-		}
-		else {
+		} else {
 			db_printf("c.addi %s, %s, 0x%lx\n",
   riscv_registers[rd],
   riscv_registers[rd],
@@ -420,11 +415,9 @@ db_disasm_16(db_addr_t loc, uint32_t ins
 		case Q2MISC_JR_MV:
 			if (rs1 == 0) {
 return EINVAL;
-			}
-			else if (rs2 == 0) {
+			} else if (rs2 == 0) {
 db_printf("c.jr %s\n", riscv_registers[rs1]);
-			}
-			else {
+			} else {
 db_printf("c.mv %s, %s\n",
 	  riscv_registers[rs1],
 	  riscv_registers[rs2]);
@@ -433,14 +426,11 @@ db_disasm_16(db_addr_t loc, uint32_t ins
 		case Q2MISC_EBREAK_JALR_ADD:
 			if (rs1 == 0 && rs2 == 0) {
 db_printf("c.ebreak\n");
-			}
-			else if (rs2 == 0) {
+			} else if (rs2 == 0) {
 db_printf("c.jalr %s\n", riscv_registers[rs1]);
-			}
-			else if (rs1 == 0) {
+			} else if (rs1 == 0) {
 return EINVAL;
-			}
-			else {
+			} else {
 db_printf("c.add %s, %s, %s\n",
 	  riscv_registers[rs1],
 	  riscv_registers[rs1],
@@ -836,8 +826,7 @@ static const struct riscv_disasm32_entry
 	[OPCODE_X80] = { .fmt = FMT_ASSERT },
 };
 
-static
-const struct riscv_disasm_insn *
+static const struct riscv_disasm_insn *
 riscv_disasm_match(const struct riscv_disasm_insn *table, unsigned num,
 		   uint32_t insn, uint32_t imm)
 {
@@ -978,8 +967,7 @@ riscv_disasm_match(const struct riscv_di
 	return NULL;
 }
 
-static
-void
+static void
 db_print_riscv_fencebits(unsigned bits)
 {
 	if (bits == 0) {
@@ -994,8 +982,7 @@ db_print_riscv_fencebits(unsigned bits)
 	}
 }
 
-static
-void
+static void
 db_print_riscv_reg(unsigned reg, bool isfreg)
 {
 	if (isfreg) {
@@ -1006,8 +993,7 @@ db_print_riscv_reg(unsigned reg, bool is
 	}
 }
 
-static
-const char *
+static const char *
 riscv_int_size(unsigned fpsize)
 {
 	switch (fpsize) {
@@ -1022,8 +1008,7 @@ riscv_int_size(unsigned fpsize)
 	}
 }
 
-static
-const char *
+static const char *
 riscv_fp_size(unsigned fpsize)
 {
 	switch (fpsize) {
@@ -1037,8 +1022,8 @@ riscv_fp_size(unsigned fpsize)
 	}
 }
 
-static
-bool larger_f_i(unsigned sz1, unsigned sz2)
+static bool
+larger_f_i(unsigned sz1, unsigned sz2)
 {
 	switch (sz1) {
 	case OPFP_S:
@@ -1071,8 +1056,8 @@ bool larger_f_i(unsigned sz1, unsigned s
 	return false;
 }
 
-static
-bool larger_f_f(unsigned sz1, unsigned sz2)
+static bool
+larger_f_f(unsigned sz1, unsigned sz2)
 {
 	switch (sz1) {
 	case OPFP_S:
@@ -1102,8 +1087,7 @@ bool larger_f_f(unsigned sz1, unsigned s
 	return false;
 }
 
-static
-void
+static void
 db_print_riscv_fpround(const char *sep, unsigned round)
 {
 	switch (round) {
@@ -1122,8 +1106,7 @@ db_print_riscv_fpround(const char *sep, 
 }
 
 
-static
-void
+static void
 db_print_riscv_insnname(uint32_t insn, const struct riscv_disasm_insn *info)
 {
 	db_printf("%s", info->name);
@@ -1171,8 +1154,7 @@ db_print_riscv_insnname(uint32_t insn, c
 	}
 }
 
-static
-int
+static int
 db_disasm_32(db_addr_t loc, uint32_t insn, bool altfmt)
 {
 	unsigned opcode;
@@ -1217,8 +1199,7 @@ db_disasm_32(db_addr_t loc, uint32_t ins
 			db_printf("%s0x%x, ", sep, 

CVS commit: src/sys/arch/riscv/riscv

2021-04-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr 20 10:01:37 UTC 2021

Modified Files:
src/sys/arch/riscv/riscv: db_disasm.c

Log Message:
compile fixes


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/riscv/db_disasm.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/arch/riscv/riscv/db_disasm.c
diff -u src/sys/arch/riscv/riscv/db_disasm.c:1.4 src/sys/arch/riscv/riscv/db_disasm.c:1.5
--- src/sys/arch/riscv/riscv/db_disasm.c:1.4	Mon Apr 19 07:55:59 2021
+++ src/sys/arch/riscv/riscv/db_disasm.c	Tue Apr 20 10:01:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.4 2021/04/19 07:55:59 dholland Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.5 2021/04/20 10:01:37 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__RCSID("$NetBSD: db_disasm.c,v 1.4 2021/04/19 07:55:59 dholland Exp $");
+__RCSID("$NetBSD: db_disasm.c,v 1.5 2021/04/20 10:01:37 skrll Exp $");
 
 #include 
 #include 
@@ -1015,6 +1015,10 @@ riscv_int_size(unsigned fpsize)
 	case OPFP_WU: return ".wu";
 	case OPFP_L: return ".l";
 	case OPFP_LU: return ".lu";
+	default:
+		/* matching should prevent it coming here */
+		KASSERT(0);
+		return ".?";
 	}
 }
 
@@ -1400,7 +1404,7 @@ db_disasm_32(db_addr_t loc, uint32_t ins
 
 		db_print_riscv_reg(INSN_RS2(insn),
    info->printflags & RS2_FREG);
-		db_printf(", ", sep);
+		db_printf("%s", sep);
 
 		db_printf("%d(", (int32_t)imm);
 		db_print_riscv_reg(INSN_RS1(insn),