From 07c6072dce70fc93b73e7ec94c8446bd764061d7 Mon Sep 17 00:00:00 2001 From: Navyansh Kesarwani Date: Wed, 29 Oct 2025 09:55:00 +0530 Subject: [PATCH 1/2] chore: fix C lint errors #8308 --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: missing_dependencies - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../base/bind2vind/benchmark/c/benchmark.c | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/base/bind2vind/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/ndarray/base/bind2vind/benchmark/c/benchmark.c index 6abc862b08d6..fc08029ad8ab 100644 --- a/lib/node_modules/@stdlib/ndarray/base/bind2vind/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/ndarray/base/bind2vind/benchmark/c/benchmark.c @@ -100,8 +100,8 @@ static double benchmark1( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 100, -10, 1 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 100, -10, 1 }; int64_t offset = 90; int64_t len = 1000; @@ -134,8 +134,8 @@ static double benchmark2( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 1, -10, 100 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 1, -10, 100 }; int64_t offset = 90; int64_t len = 1000; @@ -168,8 +168,8 @@ static double benchmark3( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 100, 10, 1 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 100, 10, 1 }; int64_t offset = 0; int64_t len = 1000; @@ -202,8 +202,8 @@ static double benchmark4( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 1, 10, 100 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 1, 10, 100 }; int64_t offset = 0; int64_t len = 1000; @@ -236,8 +236,8 @@ static double benchmark5( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 100, -10, 1 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 100, -10, 1 }; int64_t offset = 90; int64_t len = 1000; @@ -270,8 +270,8 @@ static double benchmark6( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 1, -10, 100 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 1, -10, 100 }; int64_t offset = 90; int64_t len = 1000; @@ -304,8 +304,8 @@ static double benchmark7( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 100, 10, 1 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 100, 10, 1 }; int64_t offset = 0; int64_t len = 1000; @@ -338,8 +338,8 @@ static double benchmark8( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 1, 10, 100 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 1, 10, 100 }; int64_t offset = 0; int64_t len = 1000; @@ -372,8 +372,8 @@ static double benchmark9( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 100, -10, 1 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 100, -10, 1 }; int64_t offset = 90; int64_t len = 1000; @@ -406,8 +406,8 @@ static double benchmark10( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 1, -10, 100 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 1, -10, 100 }; int64_t offset = 90; int64_t len = 1000; @@ -440,8 +440,8 @@ static double benchmark11( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 100, 10, 1 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 100, 10, 1 }; int64_t offset = 0; int64_t len = 1000; @@ -474,8 +474,8 @@ static double benchmark12( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 1, 10, 100 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 1, 10, 100 }; int64_t offset = 0; int64_t len = 1000; @@ -508,8 +508,8 @@ static double benchmark13( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 100, -10, 1 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 100, -10, 1 }; int64_t offset = 90; int64_t len = 1000; @@ -542,8 +542,8 @@ static double benchmark14( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 1, -10, 100 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 1, -10, 100 }; int64_t offset = 90; int64_t len = 1000; @@ -576,8 +576,8 @@ static double benchmark15( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 100, 10, 1 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 100, 10, 1 }; int64_t offset = 0; int64_t len = 1000; @@ -610,8 +610,8 @@ static double benchmark16( void ) { int i; int64_t ndims = 3; - int64_t shape[] = { 10, 10, 10 }; - int64_t strides[] = { 1, 10, 100 }; + const int64_t shape[] = { 10, 10, 10 }; + const int64_t strides[] = { 1, 10, 100 }; int64_t offset = 0; int64_t len = 1000; From 0d09cce477e4b5a4c0902f4e097fda65aebdb0c1 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 29 Oct 2025 17:52:23 -0700 Subject: [PATCH 2/2] bench: add `const` qualifiers Signed-off-by: Athan --- .../base/bind2vind/benchmark/c/benchmark.c | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/base/bind2vind/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/ndarray/base/bind2vind/benchmark/c/benchmark.c index fc08029ad8ab..a1b9c39b721d 100644 --- a/lib/node_modules/@stdlib/ndarray/base/bind2vind/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/ndarray/base/bind2vind/benchmark/c/benchmark.c @@ -99,11 +99,11 @@ static double benchmark1( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 100, -10, 1 }; - int64_t offset = 90; - int64_t len = 1000; + const int64_t offset = 90; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -133,11 +133,11 @@ static double benchmark2( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 1, -10, 100 }; - int64_t offset = 90; - int64_t len = 1000; + const int64_t offset = 90; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -167,11 +167,11 @@ static double benchmark3( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 100, 10, 1 }; - int64_t offset = 0; - int64_t len = 1000; + const int64_t offset = 0; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -201,11 +201,11 @@ static double benchmark4( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 1, 10, 100 }; - int64_t offset = 0; - int64_t len = 1000; + const int64_t offset = 0; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -235,11 +235,11 @@ static double benchmark5( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 100, -10, 1 }; - int64_t offset = 90; - int64_t len = 1000; + const int64_t offset = 90; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -269,11 +269,11 @@ static double benchmark6( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 1, -10, 100 }; - int64_t offset = 90; - int64_t len = 1000; + const int64_t offset = 90; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -303,11 +303,11 @@ static double benchmark7( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 100, 10, 1 }; - int64_t offset = 0; - int64_t len = 1000; + const int64_t offset = 0; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -337,11 +337,11 @@ static double benchmark8( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 1, 10, 100 }; - int64_t offset = 0; - int64_t len = 1000; + const int64_t offset = 0; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -371,11 +371,11 @@ static double benchmark9( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 100, -10, 1 }; - int64_t offset = 90; - int64_t len = 1000; + const int64_t offset = 90; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -405,11 +405,11 @@ static double benchmark10( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 1, -10, 100 }; - int64_t offset = 90; - int64_t len = 1000; + const int64_t offset = 90; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -439,11 +439,11 @@ static double benchmark11( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 100, 10, 1 }; - int64_t offset = 0; - int64_t len = 1000; + const int64_t offset = 0; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -473,11 +473,11 @@ static double benchmark12( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 1, 10, 100 }; - int64_t offset = 0; - int64_t len = 1000; + const int64_t offset = 0; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -507,11 +507,11 @@ static double benchmark13( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 100, -10, 1 }; - int64_t offset = 90; - int64_t len = 1000; + const int64_t offset = 90; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -541,11 +541,11 @@ static double benchmark14( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 1, -10, 100 }; - int64_t offset = 90; - int64_t len = 1000; + const int64_t offset = 90; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -575,11 +575,11 @@ static double benchmark15( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 100, 10, 1 }; - int64_t offset = 0; - int64_t len = 1000; + const int64_t offset = 0; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { @@ -609,11 +609,11 @@ static double benchmark16( void ) { double t; int i; - int64_t ndims = 3; + const int64_t ndims = 3; const int64_t shape[] = { 10, 10, 10 }; const int64_t strides[] = { 1, 10, 100 }; - int64_t offset = 0; - int64_t len = 1000; + const int64_t offset = 0; + const int64_t len = 1000; t = tic(); for ( i = 0; i < ITERATIONS; i++ ) {