From 3060592fbeb5b760f754aa062321aca0fb1e53b9 Mon Sep 17 00:00:00 2001 From: Gopi Kishan Date: Thu, 13 Feb 2025 01:35:03 +0530 Subject: [PATCH 1/2] chore: fix C lint errors --- .../@stdlib/stats/base/dnanvariancetk/examples/c/example.c | 2 +- .../@stdlib/stats/base/dsnanmean/benchmark/c/benchmark.length.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dnanvariancetk/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dnanvariancetk/examples/c/example.c index 5f28159aad83..09d473b8c06b 100644 --- a/lib/node_modules/@stdlib/stats/base/dnanvariancetk/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dnanvariancetk/examples/c/example.c @@ -22,7 +22,7 @@ int main( void ) { // Create a strided array: - double x[] = { 1.0, 2.0, 0.0/0.0, 3.0, 0.0/0.0, 4.0, 5.0, 6.0, 0.0/0.0, 7.0, 8.0, 0.0/0.0 }; + const double x[] = { 1.0, 2.0, 0.0/0.0, 3.0, 0.0/0.0, 4.0, 5.0, 6.0, 0.0/0.0, 7.0, 8.0, 0.0/0.0 }; // Specify the number of elements: int64_t N = 6; diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmean/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/base/dsnanmean/benchmark/c/benchmark.length.c index 5c8e10021a94..f02aad0b76b4 100644 --- a/lib/node_modules/@stdlib/stats/base/dsnanmean/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/base/dsnanmean/benchmark/c/benchmark.length.c @@ -96,7 +96,7 @@ static float rand_float( void ) { */ static double benchmark( int iterations, int len ) { double elapsed; - float x[ len ]; + float x[ len ] = {0}; /* Initialize array to silence warning */ double v; double t; int i; From 528a1b41768eb673258d258316b4f2448af1cec0 Mon Sep 17 00:00:00 2001 From: Gopi Kishan Date: Mon, 17 Feb 2025 03:31:43 +0530 Subject: [PATCH 2/2] chore: fix C lint errors --- .../stats/base/dsnanmean/benchmark/c/benchmark.length.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmean/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/base/dsnanmean/benchmark/c/benchmark.length.c index f02aad0b76b4..f21bbad95476 100644 --- a/lib/node_modules/@stdlib/stats/base/dsnanmean/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/base/dsnanmean/benchmark/c/benchmark.length.c @@ -96,7 +96,7 @@ static float rand_float( void ) { */ static double benchmark( int iterations, int len ) { double elapsed; - float x[ len ] = {0}; /* Initialize array to silence warning */ + float x[ len ]; double v; double t; int i; @@ -107,6 +107,7 @@ static double benchmark( int iterations, int len ) { v = 0.0; t = tic(); for ( i = 0; i < iterations; i++ ) { + // cppcheck-suppress uninitvar v = stdlib_strided_dsnanmean( len, x, 1 ); if ( v != v ) { printf( "should not return NaN\n" );