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

2023-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 14 18:42:31 UTC 2023

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

Log Message:
lint: document suppressed LDBL_MAX warning more accurately

The crucial point is not that lint is cross-compiled but that tools/lint
is run on the usr.bin/xlint code, and in that situation, the platform
mismatch happens.


To generate a diff of this commit:
cvs rdiff -u -r1.512 -r1.513 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/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.512 src/usr.bin/xlint/lint1/tree.c:1.513
--- src/usr.bin/xlint/lint1/tree.c:1.512	Wed Apr 12 19:09:48 2023
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr 14 18:42:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.512 2023/04/12 19:09:48 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.513 2023/04/14 18:42:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.512 2023/04/12 19:09:48 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.513 2023/04/14 18:42:31 rillig Exp $");
 #endif
 
 #include 
@@ -1508,18 +1508,21 @@ floating_error_value(tspec_t t, ldbl_t l
 	if (t == DOUBLE)
 		return lv < 0 ? -DBL_MAX : DBL_MAX;
 	/*
-	 * When lint is compiled on x86_64 to check for sparc64, it uses the
-	 * type 'long double' from x86_64, which is the Intel 80-bit format.
-	 * The constant LDBL_MAX comes from the sparc64 preprocessor though
-	 * and uses the IEEE-754-binary128 format, with the same exponent
-	 * range but a wider mantissa.
+	 * When NetBSD is cross-built in MKLINT=yes mode on x86_64 for
+	 * sparc64, tools/lint checks this code while building usr.bin/xlint.
+	 * In that situation, lint uses the preprocessor for sparc64, in which
+	 * the type 'long double' is IEEE-754-binary128, affecting the macro
+	 * LDBL_MAX below. The type 'long double', as well as the strtold
+	 * implementation, comes from the host platform x86_64 though, where
+	 * 'long double' consumes 128 bits as well but only uses 80 of them.
+	 * The exponent range of the two 'long double' types is the same, but
+	 * the maximum finite value differs due to the extended precision on
+	 * sparc64.
 	 *
-	 * To properly handle this situation, lint would have to implement the
-	 * floating-point types in a platform-independent way, which is not
-	 * worth the effort, given how few programs practically use 'long
-	 * double'.
-	 *
-	 * This caveat only affects cross builds.
+	 * To properly handle the data types of the target platform, lint
+	 * would have to implement the floating-point types in a
+	 * platform-independent way, which is not worth the effort, given how
+	 * few programs practically use 'long double'.
 	 */
 	/* LINTED 248: floating-point constant out of range */
 	ldbl_t max = LDBL_MAX;



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

2023-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 14 18:42:31 UTC 2023

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

Log Message:
lint: document suppressed LDBL_MAX warning more accurately

The crucial point is not that lint is cross-compiled but that tools/lint
is run on the usr.bin/xlint code, and in that situation, the platform
mismatch happens.


To generate a diff of this commit:
cvs rdiff -u -r1.512 -r1.513 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src/sys/arch/arm/nxp

2023-04-14 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Apr 14 17:46:00 UTC 2023

Modified Files:
src/sys/arch/arm/nxp: imx6_ccm.c imx6_ccmvar.h imx6_clk.c

Log Message:
In preparation of imx6sx support, move imx6q-specific definitions from
imx6_ccm.c to imx6_clk.c, and prefix with IMX6Q/imx6q:
- Clock IDs and related struct imx_clock_id
- Clock Parents and Divider Tables
- struct imx6_clk
and related static functions

Add a pointer to struct imx6_clk, and it's size to imx6ccm_softc
Pass a pointer to imx6ccm_softc to all functions from imx6_ccm.c

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/nxp/imx6_ccm.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/nxp/imx6_ccmvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/nxp/imx6_clk.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/arm/nxp/imx6_ccm.c
diff -u src/sys/arch/arm/nxp/imx6_ccm.c:1.2 src/sys/arch/arm/nxp/imx6_ccm.c:1.3
--- src/sys/arch/arm/nxp/imx6_ccm.c:1.2	Tue Sep 27 06:36:42 2022
+++ src/sys/arch/arm/nxp/imx6_ccm.c	Fri Apr 14 17:45:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.2 2022/09/27 06:36:42 skrll Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.3 2023/04/14 17:45:59 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2010-2012, 2014  Genetec Corporation.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.2 2022/09/27 06:36:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.3 2023/04/14 17:45:59 bouyer Exp $");
 
 #include "opt_imx.h"
 #include "opt_cputypes.h"
@@ -52,844 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v
 
 #include 
 
-/* Clock Parents Tables */
-static const char *step_p[] = {
-	"osc",
-	"pll2_pfd2_396m"
-};
-
-static const char *pll1_sw_p[] = {
-	"pll1_sys",
-	"step"
-};
-
-static const char *periph_pre_p[] = {
-	"pll2_bus",
-	"pll2_pfd2_396m",
-	"pll2_pfd0_352m",
-	"pll2_198m"
-};
-
-static const char *periph_clk2_p[] = {
-	"pll3_usb_otg",
-	"osc",
-	"osc",
-	"dummy"
-};
-
-static const char *periph2_clk2_p[] = {
-	"pll3_usb_otg",
-	"pll2_bus"
-};
-
-static const char *axi_p[] = {
-	"periph",
-	"pll2_pfd2_396m",
-	"periph",
-	"pll3_pfd1_540m"
-};
-
-static const char *audio_p[] = {
-	"pll4_audio_div",
-	"pll3_pfd2_508m",
-	"pll3_pfd3_454m",
-	"pll3_usb_otg"
-};
-
-static const char *gpu2d_core_p[] = {
-	"axi",
-	"pll3_usb_otg",
-	"pll2_pfd0_352m",
-	"pll2_pfd2_396m"
-};
-
-static const char *gpu3d_core_p[] = {
-	"mmdc_ch0_axi",
-	"pll3_usb_otg",
-	"pll2_pfd1_594m",
-	"pll2_pfd2_396m"
-};
-
-static const char *gpu3d_shader_p[] = {
-	"mmdc_ch0_axi",
-	"pll3_usb_otg",
-	"pll2_pfd1_594m",
-	"pll3_pfd0_720m"
-};
-
-static const char *ipu_p[] = {
-	"mmdc_ch0_axi",
-	"pll2_pfd2_396m",
-	"pll3_120m",
-	"pll3_pfd1_540m"
-};
-
-static const char *pll_bypass_src_p[] = {
-	"osc",
-	"lvds1_in",
-	"lvds2_in",
-	"dummy"
-};
-
-static const char *pll1_bypass_p[] = {
-	"pll1",
-	"pll1_bypass_src"
-};
-
-static const char *pll2_bypass_p[] = {
-	"pll2",
-	"pll2_bypass_src"
-};
-
-static const char *pll3_bypass_p[] = {
-	"pll3",
-	"pll3_bypass_src"
-};
-
-static const char *pll4_bypass_p[] = {
-	"pll4",
-	"pll4_bypass_src"
-};
-
-static const char *pll5_bypass_p[] = {
-	"pll5",
-	"pll5_bypass_src"
-};
-
-static const char *pll6_bypass_p[] = {
-	"pll6",
-	"pll6_bypass_src"
-};
-
-static const char *pll7_bypass_p[] = {
-	"pll7",
-	"pll7_bypass_src"
-};
-
-static const char *ipu_di_pre_p[] = {
-	"mmdc_ch0_axi",
-	"pll3_usb_otg",
-	"pll5_video_div",
-	"pll2_pfd0_352m",
-	"pll2_pfd2_396m",
-	"pll3_pfd1_540m"
-};
-
-static const char *ipu1_di0_p[] = {
-	"ipu1_di0_pre",
-	"dummy",
-	"dummy",
-	"ldb_di0",
-	"ldb_di1"
-};
-
-static const char *ipu1_di1_p[] = {
-	"ipu1_di1_pre",
-	"dummy",
-	"dummy",
-	"ldb_di0",
-	"ldb_di1"
-};
-
-static const char *ipu2_di0_p[] = {
-	"ipu2_di0_pre",
-	"dummy",
-	"dummy",
-	"ldb_di0",
-	"ldb_di1"
-};
-
-static const char *ipu2_di1_p[] = {
-	"ipu2_di1_pre",
-	"dummy",
-	"dummy",
-	"ldb_di0",
-	"ldb_di1"
-};
-
-static const char *ldb_di_p[] = {
-	"pll5_video_div",
-	"pll2_pfd0_352m",
-	"pll2_pfd2_396m",
-	"mmdc_ch1_axi",
-	"pll3_usb_otg"
-};
-
-static const char *periph_p[] = {
-	"periph_pre",
-	"periph_clk2"
-};
-
-static const char *periph2_p[] = {
-	"periph2_pre",
-	"periph2_clk2"
-};
-
-static const char *vdo_axi_p[] = {
-	"axi",
-	"ahb"
-};
-
-static const char *vpu_axi_p[] = {
-	"axi",
-	"pll2_pfd2_396m",
-	"pll2_pfd0_352m"
-};
-
-static const char *cko1_p[] = {
-	"pll3_usb_otg",
-	"pll2_bus",
-	"pll1_sys",
-	"pll5_video_div",
-	"dummy",
-	"axi",
-	"enfc",
-	"ipu1_di0",
-	"ipu1_di1",
-	"ipu2_di0",
-	"ipu2_di1",
-	"ahb",
-	"ipg",
-	"ipg_per",
-	"ckil",
-	"pll4_audio_div"
-};
-
-static const char *cko2_p[] = {
-	"mmdc_ch0_axi",
-	"mmdc_ch1_axi",
-	"usdhc4",
-	"usdhc1",
-	"gpu2d_axi",
-	"dummy",
-	"ecspi_root",
-	"gpu3d_axi",
-	"usdhc3",
-	"dummy",
-	"arm",
-	"ipu1",
-	"ipu2",
-	"vdo_axi",
-	"osc",
-	"gpu2d_core",
-	

CVS commit: src/sys/arch/arm/nxp

2023-04-14 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Apr 14 17:46:00 UTC 2023

Modified Files:
src/sys/arch/arm/nxp: imx6_ccm.c imx6_ccmvar.h imx6_clk.c

Log Message:
In preparation of imx6sx support, move imx6q-specific definitions from
imx6_ccm.c to imx6_clk.c, and prefix with IMX6Q/imx6q:
- Clock IDs and related struct imx_clock_id
- Clock Parents and Divider Tables
- struct imx6_clk
and related static functions

Add a pointer to struct imx6_clk, and it's size to imx6ccm_softc
Pass a pointer to imx6ccm_softc to all functions from imx6_ccm.c

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/nxp/imx6_ccm.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/nxp/imx6_ccmvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/nxp/imx6_clk.c

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



CVS commit: src/share/misc

2023-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 14 16:53:14 UTC 2023

Modified Files:
src/share/misc: style

Log Message:
style: don't require sorting variables in functions

Sorting the variables by size would be platform-dependent and thus is
not possible.

Sorting the variables alphabetically may or may not make the code easier
to read, and the example given below that rule doesn't follow it,
otherwise the correct order would be 'eight, eleven, nine, ten,
thirteen, twelve'.

https://mail-index.netbsd.org/tech-userlevel/2023/04/11/msg013749.html


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/share/misc/style

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

Modified files:

Index: src/share/misc/style
diff -u src/share/misc/style:1.70 src/share/misc/style:1.71
--- src/share/misc/style:1.70	Tue Apr 11 14:22:10 2023
+++ src/share/misc/style	Fri Apr 14 16:53:13 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: style,v 1.70 2023/04/11 14:22:10 riastradh Exp $ */
+/* $NetBSD: style,v 1.71 2023/04/14 16:53:13 rillig Exp $ */
 
 /*
  * The revision control tag appears first, with a blank line after it.
@@ -30,7 +30,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: style,v 1.70 2023/04/11 14:22:10 riastradh Exp $");
+__RCSID("$NetBSD: style,v 1.71 2023/04/14 16:53:13 rillig Exp $");
 
 /*
  * VERY important single-line comments look like this.
@@ -353,10 +353,10 @@ static char *
 function(int a1, int a2, float fl, int a4)
 {
 	/*
-	 * When declaring variables in functions declare them sorted by size,
-	 * then in alphabetical order; multiple ones per line are okay.
+	 * When declaring variables in functions, multiple variables per line
+	 * are okay. If a line overflows reuse the type keyword.
+	 *
 	 * Function prototypes should go in the include file "extern.h".
-	 * If a line overflows reuse the type keyword.
 	 *
 	 * Avoid initializing variables in the declarations; move
 	 * declarations next to their first use, and initialize



CVS commit: src/share/misc

2023-04-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 14 16:53:14 UTC 2023

Modified Files:
src/share/misc: style

Log Message:
style: don't require sorting variables in functions

Sorting the variables by size would be platform-dependent and thus is
not possible.

Sorting the variables alphabetically may or may not make the code easier
to read, and the example given below that rule doesn't follow it,
otherwise the correct order would be 'eight, eleven, nine, ten,
thirteen, twelve'.

https://mail-index.netbsd.org/tech-userlevel/2023/04/11/msg013749.html


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/share/misc/style

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



CVS commit: src/sys/kern

2023-04-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr 14 16:51:46 UTC 2023

Modified Files:
src/sys/kern: subr_pserialize.c

Log Message:
pserialize(9): Fix bug in recent micro-optimization.

curcpu() is always a valid struct cpu_info pointer, but curlwp->l_cpu
is not necessarily -- early at boot on some architectures (like x86,
apparently) it may be null.

Not clear that l->l_cpu is always a cost win over curcpu(): on some
architectures curcpu() is basically a macro for curlwp->l_cpu, while
on others it is a fixed VA.  So let's use the one that always works
instead of the one that's sometimes cheaper and sometimes crashier.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/subr_pserialize.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/kern/subr_pserialize.c
diff -u src/sys/kern/subr_pserialize.c:1.21 src/sys/kern/subr_pserialize.c:1.22
--- src/sys/kern/subr_pserialize.c:1.21	Sun Apr  9 08:28:24 2023
+++ src/sys/kern/subr_pserialize.c	Fri Apr 14 16:51:46 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pserialize.c,v 1.21 2023/04/09 08:28:24 riastradh Exp $	*/
+/*	$NetBSD: subr_pserialize.c,v 1.22 2023/04/14 16:51:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.21 2023/04/09 08:28:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.22 2023/04/14 16:51:46 riastradh Exp $");
 
 #include 
 
@@ -180,7 +180,7 @@ pserialize_not_in_read_section(void)
 
 	ncsw = l->l_ncsw;
 	__insn_barrier();
-	notin = __predict_true(l->l_cpu->ci_psz_read_depth == 0);
+	notin = __predict_true(curcpu()->ci_psz_read_depth == 0);
 	__insn_barrier();
 
 	/*



CVS commit: src/sys/kern

2023-04-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr 14 16:51:46 UTC 2023

Modified Files:
src/sys/kern: subr_pserialize.c

Log Message:
pserialize(9): Fix bug in recent micro-optimization.

curcpu() is always a valid struct cpu_info pointer, but curlwp->l_cpu
is not necessarily -- early at boot on some architectures (like x86,
apparently) it may be null.

Not clear that l->l_cpu is always a cost win over curcpu(): on some
architectures curcpu() is basically a macro for curlwp->l_cpu, while
on others it is a fixed VA.  So let's use the one that always works
instead of the one that's sometimes cheaper and sometimes crashier.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/subr_pserialize.c

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