From 9baf67f000172cf4a7ed138325d5df190112dc92 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Wed, 28 May 2025 12:47:54 +0900 Subject: [PATCH 1/2] Fix old-style function definitions --- ext/numo/narray/array.c | 2 +- ext/numo/narray/data.c | 2 +- ext/numo/narray/gen/tmpl_bit/mask.c | 2 +- ext/numo/narray/index.c | 2 +- ext/numo/narray/math.c | 2 +- ext/numo/narray/narray.c | 2 +- ext/numo/narray/ndloop.c | 2 +- ext/numo/narray/numo/types/complex.h | 4 ++-- ext/numo/narray/rand.c | 4 ++-- ext/numo/narray/step.c | 2 +- ext/numo/narray/struct.c | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ext/numo/narray/array.c b/ext/numo/narray/array.c index 1a7dae48..0a8807dc 100644 --- a/ext/numo/narray/array.c +++ b/ext/numo/narray/array.c @@ -620,7 +620,7 @@ na_ary_composition_for_struct(VALUE nstruct, VALUE ary) void -Init_nary_array() +Init_nary_array(void) { rb_define_singleton_method(cNArray, "array_shape", na_s_array_shape, 1); rb_define_singleton_method(cNArray, "array_type", na_s_array_type, 1); diff --git a/ext/numo/narray/data.c b/ext/numo/narray/data.c index 7fc087f1..b12532c1 100644 --- a/ext/numo/narray/data.c +++ b/ext/numo/narray/data.c @@ -945,7 +945,7 @@ numo_na_dot(VALUE self, VALUE other) #endif void -Init_nary_data() +Init_nary_data(void) { rb_define_method(cNArray, "copy", na_copy, 0); // deprecated diff --git a/ext/numo/narray/gen/tmpl_bit/mask.c b/ext/numo/narray/gen/tmpl_bit/mask.c index 84a46ca7..0e9f48b2 100644 --- a/ext/numo/narray/gen/tmpl_bit/mask.c +++ b/ext/numo/narray/gen/tmpl_bit/mask.c @@ -75,7 +75,7 @@ static void #define cIndex numo_cInt32 #endif -static void shape_error() { +static void shape_error(void) { rb_raise(nary_eShapeError,"mask and masked arrays must have the same shape"); } diff --git a/ext/numo/narray/index.c b/ext/numo/narray/index.c index 4ec1997e..9b19b9d5 100644 --- a/ext/numo/narray/index.c +++ b/ext/numo/narray/index.c @@ -1144,7 +1144,7 @@ static VALUE na_at(int argc, VALUE *argv, VALUE self) } void -Init_nary_index() +Init_nary_index(void) { rb_define_method(cNArray, "slice", na_slice, -1); rb_define_method(cNArray, "[]", na_aref, -1); diff --git a/ext/numo/narray/math.c b/ext/numo/narray/math.c index 9c322b4b..12c24c75 100644 --- a/ext/numo/narray/math.c +++ b/ext/numo/narray/math.c @@ -109,7 +109,7 @@ static VALUE nary_math_method_missing(int argc, VALUE *argv, VALUE mod) void -Init_nary_math() +Init_nary_math(void) { VALUE hCast; diff --git a/ext/numo/narray/narray.c b/ext/numo/narray/narray.c index a66ad70a..e33311c7 100644 --- a/ext/numo/narray/narray.c +++ b/ext/numo/narray/narray.c @@ -1987,7 +1987,7 @@ na_equal(VALUE self, volatile VALUE other) /* initialization of NArray Class */ void -Init_narray() +Init_narray(void) { #ifdef HAVE_RB_EXT_RACTOR_SAFE rb_ext_ractor_safe(true); diff --git a/ext/numo/narray/ndloop.c b/ext/numo/narray/ndloop.c index 58cc0b52..6f0d91ac 100644 --- a/ext/numo/narray/ndloop.c +++ b/ext/numo/narray/ndloop.c @@ -1965,7 +1965,7 @@ na_ndloop_with_index(nf, argc, va_alist) void -Init_nary_ndloop() +Init_nary_ndloop(void) { id_cast = rb_intern("cast"); id_extract = rb_intern("extract"); diff --git a/ext/numo/narray/numo/types/complex.h b/ext/numo/narray/numo/types/complex.h index 96f720db..e2d1fbf7 100644 --- a/ext/numo/narray/numo/types/complex.h +++ b/ext/numo/narray/numo/types/complex.h @@ -47,14 +47,14 @@ static inline dtype NUM2COMP(VALUE v) { (isinf(IMAG(x)) && signbit(IMAG(x)))) #define c_isfinite(x) (isfinite(REAL(x)) && isfinite(IMAG(x))) -static inline dtype c_zero() { +static inline dtype c_zero(void) { dtype z; REAL(z) = 0; IMAG(z) = 0; return z; } -static inline dtype c_one() { +static inline dtype c_one(void) { dtype z; REAL(z) = 1; IMAG(z) = 0; diff --git a/ext/numo/narray/rand.c b/ext/numo/narray/rand.c index ac847456..eef41e89 100644 --- a/ext/numo/narray/rand.c +++ b/ext/numo/narray/rand.c @@ -11,7 +11,7 @@ #endif static u_int64_t -random_seed() +random_seed(void) { static int n = 0; struct timeval tv; @@ -39,7 +39,7 @@ nary_s_srand(int argc, VALUE *argv, VALUE obj) } void -Init_nary_rand() { +Init_nary_rand(void) { rb_define_singleton_method(cNArray, "srand", nary_s_srand, -1); init_gen_rand(0); } diff --git a/ext/numo/narray/step.c b/ext/numo/narray/step.c index a55460b1..6dfb063f 100644 --- a/ext/numo/narray/step.c +++ b/ext/numo/narray/step.c @@ -269,7 +269,7 @@ nary_step_sequence( VALUE obj, size_t *plen, double *pbeg, double *pstep ) } void -Init_nary_step() +Init_nary_step(void) { rb_define_alias(rb_cRange, "%", "step"); diff --git a/ext/numo/narray/struct.c b/ext/numo/narray/struct.c index b5986a5b..c9369cf8 100644 --- a/ext/numo/narray/struct.c +++ b/ext/numo/narray/struct.c @@ -836,7 +836,7 @@ NST_TYPEDEF(scomplex,numo_cSComplex) rb_define_alias(rb_singleton_class(klass),name1,name2) void -Init_nary_struct() +Init_nary_struct(void) { cT = rb_define_class_under(mNumo, "Struct", numo_cNArray); //cNStMember = rb_define_class_under(cT, "Member", rb_cObject); From 3daaa9c64589efae11be9fc5a59a8fc1a04c2962 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Wed, 28 May 2025 12:48:17 +0900 Subject: [PATCH 2/2] Fix old-style function definition in qsort.c --- ext/numo/narray/gen/tmpl/qsort.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ext/numo/narray/gen/tmpl/qsort.c b/ext/numo/narray/gen/tmpl/qsort.c index d478fef4..7d51ec41 100644 --- a/ext/numo/narray/gen/tmpl/qsort.c +++ b/ext/numo/narray/gen/tmpl/qsort.c @@ -76,11 +76,7 @@ (es) % sizeof(long) ? 2 : (es) == sizeof(long)? 0 : 1; static inline void -swapfunc(a, b, n, swaptype) - char *a, - *b; - size_t n; - int swaptype; +swapfunc(char *a, char *b, size_t n, int swaptype) { if (swaptype <= 1) swapcode(long, a, b, n);