Skip to content

Fix gcc-14 -Wincompatible-pointer-types #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/gsl_native/alf.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ void Init_alf(VALUE module)
VALUE mALF;
mALF = rb_define_module_under(module, "ALF");
cWspace = rb_define_class_under(mALF, "Workspace", cGSL_Object);
rb_undef_alloc_func(cWspace);
rb_define_singleton_method(cWspace, "alloc", rb_alf_alloc, 1);
rb_define_singleton_method(mALF, "alloc", rb_alf_alloc, 1);
rb_define_module_function(module, "alf_alloc", rb_alf_alloc, 1);
Expand Down
48 changes: 47 additions & 1 deletion ext/gsl_native/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,69 +474,115 @@ void Init_gsl_array(VALUE module)
{
cgsl_block = rb_define_class_under(module, "Block",
cGSL_Object);
rb_undef_alloc_func(cgsl_block);
cgsl_block_int = rb_define_class_under(cgsl_block, "Int",
cGSL_Object);
rb_undef_alloc_func(cgsl_block_int);
cgsl_block_uchar = rb_define_class_under(cgsl_block, "Byte",
cGSL_Object);
rb_undef_alloc_func(cgsl_block_uchar);

cgsl_block_complex = rb_define_class_under(cgsl_block, "Complex", cgsl_block);
rb_undef_alloc_func(cgsl_block_complex);

cgsl_vector = rb_define_class_under(module, "Vector",
cGSL_Object);
rb_undef_alloc_func(cgsl_vector);

cgsl_vector_col = rb_define_class_under(cgsl_vector, "Col",
cgsl_vector);
rb_undef_alloc_func(cgsl_vector_col);

cgsl_vector_complex = rb_define_class_under(cgsl_vector, "Complex",
cGSL_Object);
rb_undef_alloc_func(cgsl_vector_complex);

cgsl_vector_complex_col = rb_define_class_under(cgsl_vector_complex, "Col",
cgsl_vector_complex);
rb_undef_alloc_func(cgsl_vector_complex_col);

cgsl_matrix = rb_define_class_under(module, "Matrix", cGSL_Object);
rb_undef_alloc_func(cgsl_matrix);

cgsl_matrix_complex = rb_define_class_under(cgsl_matrix, "Complex", cGSL_Object);
rb_undef_alloc_func(cgsl_matrix_complex);

cgsl_vector_view = rb_define_class_under(cgsl_vector, "View", cgsl_vector);
rb_undef_alloc_func(cgsl_vector_view);

cgsl_vector_col_view = rb_define_class_under(cgsl_vector_col, "View", cgsl_vector_col);
rb_undef_alloc_func(cgsl_vector_col_view);

cgsl_vector_complex_view = rb_define_class_under(cgsl_vector_complex, "View",
cgsl_vector_complex);
rb_undef_alloc_func(cgsl_vector_complex_view);
cgsl_vector_complex_col_view = rb_define_class_under(cgsl_vector_complex_col, "View",
cgsl_vector_complex_col);
rb_undef_alloc_func(cgsl_vector_complex_col_view);

cgsl_vector_int = rb_define_class_under(cgsl_vector, "Int", cGSL_Object);
rb_undef_alloc_func(cgsl_vector_int);
cgsl_vector_int_col = rb_define_class_under(cgsl_vector_int, "Col", cgsl_vector_int);
rb_undef_alloc_func(cgsl_vector_int_col);
cgsl_vector_int_view = rb_define_class_under(cgsl_vector_int, "View", cgsl_vector_int);
rb_undef_alloc_func(cgsl_vector_int_view);
cgsl_vector_int_col_view = rb_define_class_under(cgsl_vector_int_col, "View", cgsl_vector_int_col);

rb_undef_alloc_func(cgsl_vector_int_col_view);

/*****/

cgsl_matrix_view = rb_define_class_under(cgsl_matrix, "View",
cgsl_matrix);
rb_undef_alloc_func(cgsl_matrix_view);

cgsl_matrix_complex_view = rb_define_class_under(cgsl_matrix_complex, "View",
cgsl_matrix_complex);
rb_undef_alloc_func(cgsl_matrix_complex_view);
cgsl_permutation = rb_define_class_under(module, "Permutation", cGSL_Object);
rb_undef_alloc_func(cgsl_permutation);

cgsl_index = rb_define_class_under(module, "Index", cgsl_permutation);
rb_undef_alloc_func(cgsl_index);

cgsl_vector_view_ro = rb_define_class_under(cgsl_vector_view, "ReadOnly",
cgsl_vector_view);
rb_undef_alloc_func(cgsl_vector_view_ro);

cgsl_vector_col_view_ro = rb_define_class_under(cgsl_vector_col_view, "ReadOnly",
cgsl_vector_col_view);
rb_undef_alloc_func(cgsl_vector_col_view_ro);

cgsl_vector_int_view_ro = rb_define_class_under(cgsl_vector_int_view, "ReadOnly",
cgsl_vector_int_view);
rb_undef_alloc_func(cgsl_vector_int_view_ro);

cgsl_vector_int_col_view_ro = rb_define_class_under(cgsl_vector_int_col_view, "ReadOnly",
cgsl_vector_int_col_view);
rb_undef_alloc_func(cgsl_vector_int_col_view_ro);

cgsl_matrix_view_ro = rb_define_class_under(cgsl_matrix_view, "ReadOnly",
cgsl_matrix_view);
rb_undef_alloc_func(cgsl_matrix_view_ro);

cgsl_vector_complex_view_ro = rb_define_class_under(cgsl_vector_complex_view,
"ReadOnly",
cgsl_vector_complex_view);
rb_undef_alloc_func(cgsl_vector_complex_view_ro);

cgsl_matrix_complex_view_ro = rb_define_class_under(cgsl_matrix_complex_view,
"ReadOnly",
cgsl_matrix_complex_view);
rb_undef_alloc_func(cgsl_matrix_complex_view_ro);

/*****/
cgsl_matrix_int = rb_define_class_under(cgsl_matrix, "Int", cGSL_Object);
rb_undef_alloc_func(cgsl_matrix_int);
cgsl_matrix_int_view = rb_define_class_under(cgsl_matrix_int, "View", cgsl_matrix_int);
rb_undef_alloc_func(cgsl_matrix_int_view);
cgsl_matrix_int_view_ro = rb_define_class_under(cgsl_matrix_int_view, "ReadOnly",
cgsl_matrix_int_view);
rb_undef_alloc_func(cgsl_matrix_int_view_ro);

/*****/
Init_gsl_block_init(module);
Init_gsl_block_int_init(module);
Expand Down
8 changes: 4 additions & 4 deletions ext/gsl_native/blas2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,8 @@ void Init_gsl_blas2(VALUE module)
rb_define_module_function(module, "zher!", rb_gsl_blas_zher, 4);
rb_define_module_function(module, "zher", rb_gsl_blas_zher_a, 4);

rb_define_module_function(module, "dsyr2!", rb_gsl_blas_dsyr2, 4);
rb_define_module_function(module, "dsyr2", rb_gsl_blas_dsyr2_a, 4);
rb_define_module_function(module, "zher2!", rb_gsl_blas_zher2, 4);
rb_define_module_function(module, "zher2", rb_gsl_blas_zher2_a, 4);
rb_define_module_function(module, "dsyr2!", rb_gsl_blas_dsyr2, 5);
rb_define_module_function(module, "dsyr2", rb_gsl_blas_dsyr2_a, 5);
rb_define_module_function(module, "zher2!", rb_gsl_blas_zher2, 5);
rb_define_module_function(module, "zher2", rb_gsl_blas_zher2_a, 5);
}
7 changes: 4 additions & 3 deletions ext/gsl_native/bspline.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ static VALUE rb_gsl_bspline_knots(VALUE obj, VALUE b)
nm_bpts = NM_STORAGE_DENSE(b);
v = gsl_vector_view_array((double*) nm_bpts->elements, NM_DENSE_COUNT(b));
gsl_bspline_knots(&v.vector, w);
return Data_Wrap_Struct(cgsl_vector_view_ro, 0, NULL, w->knots);
return Data_Wrap_Struct(cgsl_vector_view_ro, 0, NULL, w->knots);
}
#endif

gsl_vector *bpts;
CHECK_VECTOR(b);
Data_Get_Struct(b, gsl_vector, bpts);
gsl_bspline_knots(bpts, w);
return Data_Wrap_Struct(cgsl_vector_view_ro, 0, NULL, w->knots);
return Data_Wrap_Struct(cgsl_vector_view_ro, 0, NULL, w->knots);
}
static VALUE rb_gsl_bspline_knots_uniform(int argc, VALUE *argv, VALUE obj)
{
Expand Down Expand Up @@ -120,6 +120,7 @@ static VALUE rb_gsl_bspline_greville_abscissa(VALUE obj, VALUE i)
void Init_bspline(VALUE module)
{
cBSWS = rb_define_class_under(module, "BSpline", cGSL_Object);
rb_undef_alloc_func(cBSWS);

rb_define_singleton_method(cBSWS, "alloc", rb_gsl_bspline_alloc, 2);

Expand Down
3 changes: 2 additions & 1 deletion ext/gsl_native/cheb.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static VALUE rb_gsl_cheb_eval(VALUE obj, VALUE xx)
gsl_vector_set(vnew, i, gsl_cheb_eval(p, gsl_vector_get(v, i)));
}
return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vnew);
}
}
#ifdef HAVE_NMATRIX_H
else if (NM_IsNMatrix(xx)) {
NM_DENSE_STORAGE *nm;
Expand Down Expand Up @@ -574,6 +574,7 @@ static VALUE rb_gsl_cheb_calc_integ(int argc, VALUE *argv, VALUE obj)
void Init_gsl_cheb(VALUE module)
{
cgsl_cheb = rb_define_class_under(module, "Cheb", cGSL_Object);
rb_undef_alloc_func(cgsl_cheb);
rb_define_singleton_method(cgsl_cheb, "new", rb_gsl_cheb_new, 1);
rb_define_singleton_method(cgsl_cheb, "alloc", rb_gsl_cheb_new, 1);
rb_define_method(cgsl_cheb, "order", rb_gsl_cheb_order, 0);
Expand Down
4 changes: 3 additions & 1 deletion ext/gsl_native/combination.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,11 @@ void Init_gsl_combination(VALUE module)
{
VALUE cgsl_combination;
cgsl_combination = rb_define_class_under(module, "Combination", cGSL_Object);
rb_undef_alloc_func(cgsl_combination);
cgsl_combination_data = rb_define_class_under(cgsl_combination, "Data",
cgsl_permutation);
rb_undef_alloc_func(cgsl_combination_data);

rb_define_singleton_method(cgsl_combination, "new", rb_gsl_combination_new, 2);
rb_define_singleton_method(cgsl_combination, "alloc", rb_gsl_combination_new, 2);
rb_define_singleton_method(cgsl_combination, "calloc", rb_gsl_combination_calloc, 2);
Expand Down Expand Up @@ -272,4 +275,3 @@ void Init_gsl_combination(VALUE module)
rb_define_method(cgsl_combination, "equal?", rb_gsl_combination_equal, 1);
rb_define_alias(cgsl_combination, "==", "equal?");
}

1 change: 1 addition & 0 deletions ext/gsl_native/complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ static VALUE rb_gsl_complex_inspect(VALUE obj)
void Init_gsl_complex(VALUE module)
{
cgsl_complex = rb_define_class_under(module, "Complex", rb_cNumeric);
rb_undef_alloc_func(cgsl_complex);
rb_define_singleton_method(cgsl_complex, "alloc", rb_gsl_complex_new, -1);
rb_define_singleton_method(cgsl_complex, "rect", rb_gsl_complex_new, -1);
rb_define_singleton_method(cgsl_complex, "[]", rb_gsl_complex_new, -1);
Expand Down
3 changes: 2 additions & 1 deletion ext/gsl_native/cqp.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ void Init_cqp(VALUE module)

mCQP = rb_define_module_under(module, "CQP");
cMinimizer = rb_define_class_under(mCQP, "Minimizer", cGSL_Object);
rb_undef_alloc_func(cMinimizer);
cData = rb_define_class_under(mCQP, "Data", cGSL_Object);
rb_undef_alloc_func(cData);

rb_define_singleton_method(cMinimizer, "alloc", rb_cqpminimizer_alloc, 4);

Expand Down Expand Up @@ -280,4 +282,3 @@ void Init_cqp(VALUE module)
}

#endif

2 changes: 2 additions & 0 deletions ext/gsl_native/dht.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ void Init_gsl_dht(VALUE module)
{
VALUE cgsl_dht;
cgsl_dht = rb_define_class_under(module, "Dht", cGSL_Object);
rb_undef_alloc_func(cgsl_dht);

rb_define_singleton_method(cgsl_dht, "alloc", rb_gsl_dht_alloc, -1);
rb_define_method(cgsl_dht, "init", rb_gsl_dht_init, 2);
rb_define_method(cgsl_dht, "apply", rb_gsl_dht_apply, -1);
Expand Down
5 changes: 5 additions & 0 deletions ext/gsl_native/dirac.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,18 @@ static void Init_gsl_dirac_common(VALUE module)

cgsl_matrix_complex_const = rb_define_class_under(module, "Const",
cgsl_matrix_complex);
rb_undef_alloc_func(cgsl_matrix_complex_const);
rb_define_method(cgsl_matrix_complex_const, "set", rb_dirac_refuse_set, -1);

cPauli = rb_define_class_under(module, "Pauli", cgsl_matrix_complex_const);
rb_undef_alloc_func(cPauli);
cAlpha = rb_define_class_under(module, "Alpha", cgsl_matrix_complex_const);
rb_undef_alloc_func(cAlpha);
/* cBeta = rb_define_class_under(module, "BetaMatrix", cgsl_matrix_complex_const);*/
cGamma = rb_define_class_under(module, "Gamma", cgsl_matrix_complex_const);
rb_undef_alloc_func(cGamma);
cLambda = rb_define_class_under(module, "Lambda", cgsl_matrix_complex_const);
rb_undef_alloc_func(cLambda);
}


Expand Down
32 changes: 31 additions & 1 deletion ext/gsl_native/eigen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2221,23 +2221,39 @@ void Init_gsl_eigen(VALUE module)

cgsl_eigen_values = rb_define_class_under(mgsl_eigen, "EigenValues",
cgsl_vector);
rb_undef_alloc_func(cgsl_eigen_values);

cgsl_eigen_vectors = rb_define_class_under(mgsl_eigen, "EigenVectors",
cgsl_matrix);
rb_undef_alloc_func(cgsl_eigen_vectors);

cgsl_eigen_vector = rb_define_class_under(mgsl_eigen, "EigenVector",
cgsl_vector);
rb_undef_alloc_func(cgsl_eigen_vector);

cgsl_eigen_herm_vectors = rb_define_class_under(mgsl_eigen, "ComplexEigenVectors",
cgsl_matrix_complex);
rb_undef_alloc_func(cgsl_eigen_herm_vectors);

cgsl_eigen_vector_complex = rb_define_class_under(mgsl_eigen, "ComplexEigenVector",
cgsl_vector_complex);
rb_undef_alloc_func(cgsl_eigen_vector_complex);

cgsl_eigen_symm_workspace = rb_define_class_under(mgsl_eigen_symm,
"Workspace", cGSL_Object);
rb_undef_alloc_func(cgsl_eigen_symm_workspace);

cgsl_eigen_symmv_workspace = rb_define_class_under(mgsl_eigen_symmv,
"Workspace", cGSL_Object);
rb_undef_alloc_func(cgsl_eigen_symmv_workspace);

cgsl_eigen_herm_workspace = rb_define_class_under(mgsl_eigen_herm,
"Workspace", cGSL_Object);
rb_undef_alloc_func(cgsl_eigen_herm_workspace);

cgsl_eigen_hermv_workspace = rb_define_class_under(mgsl_eigen_hermv,
"Workspace", cGSL_Object);
rb_undef_alloc_func(cgsl_eigen_hermv_workspace);

rb_define_singleton_method(cgsl_eigen_symm_workspace, "alloc",
rb_gsl_eigen_symm_alloc, 1);
Expand Down Expand Up @@ -2298,6 +2314,8 @@ void Init_gsl_eigen(VALUE module)
mgsl_eigen_francis = rb_define_module_under(mgsl_eigen, "francis");
cgsl_eigen_francis_workspace = rb_define_class_under(mgsl_eigen_francis,
"Workspace", cGSL_Object);
rb_undef_alloc_func(cgsl_eigen_francis_workspace);

rb_define_singleton_method(cgsl_eigen_francis_workspace, "alloc",
rb_gsl_eigen_francis_alloc, 0);

Expand All @@ -2317,6 +2335,8 @@ void Init_gsl_eigen(VALUE module)
mgsl_eigen_nonsymmv = rb_define_module_under(mgsl_eigen, "Nonsymmv");
cgsl_eigen_nonsymm_workspace = rb_define_class_under(mgsl_eigen_nonsymm,
"Workspace", cGSL_Object);
rb_undef_alloc_func(cgsl_eigen_nonsymm_workspace);

rb_define_singleton_method(cgsl_eigen_nonsymm_workspace, "alloc",
rb_gsl_eigen_nonsymm_alloc, 1);
rb_define_singleton_method(mgsl_eigen_nonsymm, "alloc",
Expand All @@ -2334,6 +2354,8 @@ void Init_gsl_eigen(VALUE module)

cgsl_eigen_nonsymmv_workspace = rb_define_class_under(mgsl_eigen_nonsymmv,
"Workspace", cGSL_Object);
rb_undef_alloc_func(cgsl_eigen_nonsymmv_workspace);

rb_define_singleton_method(cgsl_eigen_nonsymmv_workspace, "alloc",
rb_gsl_eigen_nonsymmv_alloc, 1);
rb_define_singleton_method(mgsl_eigen_nonsymmv, "alloc",
Expand All @@ -2357,8 +2379,11 @@ void Init_gsl_eigen(VALUE module)
/** gensymm, gensymmv **/
mgensymm = rb_define_module_under(mgsl_eigen, "Gensymm");
cgensymm = rb_define_class_under(mgensymm, "Workspace", cGSL_Object);
rb_undef_alloc_func(cgensymm);

mgensymmv = rb_define_module_under(mgsl_eigen, "Gensymmv");
cgensymmv = rb_define_class_under(mgensymmv, "Workspace", cGSL_Object);
rb_undef_alloc_func(cgensymmv);

rb_define_singleton_method(cgensymm, "alloc", rb_gsl_eigen_gensymm_alloc, 1);
rb_define_singleton_method(cgensymmv, "alloc", rb_gsl_eigen_gensymmv_alloc, 1);
Expand All @@ -2385,8 +2410,11 @@ void Init_gsl_eigen(VALUE module)
/** genherm, genhermv **/
mgenherm = rb_define_module_under(mgsl_eigen, "Genherm");
cgenherm = rb_define_class_under(mgenherm, "Workspace", cGSL_Object);
rb_undef_alloc_func(cgenherm);

mgenhermv = rb_define_module_under(mgsl_eigen, "Genhermv");
cgenhermv = rb_define_class_under(mgenhermv, "Workspace", cGSL_Object);
rb_undef_alloc_func(cgenhermv);

rb_define_singleton_method(cgenherm, "alloc", rb_gsl_eigen_genherm_alloc, 1);
rb_define_singleton_method(cgenhermv, "alloc", rb_gsl_eigen_genhermv_alloc, 1);
Expand Down Expand Up @@ -2414,7 +2442,10 @@ void Init_gsl_eigen(VALUE module)
mgen = rb_define_module_under(mgsl_eigen, "Gen");
mgenv = rb_define_module_under(mgsl_eigen, "Genv");
cgenw = rb_define_class_under(mgen, "Workspace", cGSL_Object);
rb_undef_alloc_func(cgenw);
cgenvw = rb_define_class_under(mgenv, "Workspace", cGSL_Object);
rb_undef_alloc_func(cgenvw);

rb_define_singleton_method(mgen, "alloc", rb_gsl_eigen_gen_alloc, 1);
rb_define_singleton_method(cgenw, "alloc", rb_gsl_eigen_gen_alloc, 1);
rb_define_singleton_method(mgenv, "alloc", rb_gsl_eigen_genv_alloc, 1);
Expand Down Expand Up @@ -2448,4 +2479,3 @@ void Init_gsl_eigen(VALUE module)
rb_define_module_function(module, "eigen_genv_sort",
rb_gsl_eigen_genv_sort, -1);
}

Loading