1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
Description: Add proper declarations for BLAS/LAPACK functions.
Otherwise, when compiling with C23 (which is the default in GCC 15),
we get "too many arguments to function" errors. We also add
BLAS_FUNC and LAPACK_FUNC macros so we don't need to have four
different declarations for each function.
Author: Doug Torrance <dtorrance@debian.org>
Forwarded: https://github.com/coin-or/Csdp/pull/21
Bug-Debian: https://bugs.debian.org/1096449
Last-Update: 2025-09-03
--- a/include/csdp/declarations.h
+++ b/include/csdp/declarations.h
@@ -217,80 +217,76 @@
#ifdef CAPSBLAS
#ifdef NOUNDERBLAS
-double DNRM2();
-double DASUM();
-double DDOT();
-int IDAMAX();
-void DGEMM();
-void DGEMV();
-void DGER();
-void DTRSM();
-void DTRMV();
-#else
-double DNRM2_();
-double DASUM_();
-double DDOT_();
-int IDAMAX_();
-void DGEMM_();
-void DGEMV_();
-void DGER_();
-void DTRSM_();
-void DTRMV_();
+# define BLAS_FUNC(name, NAME) NAME
+#else
+# define BLAS_FUNC(name, NAME) NAME##_
#endif
#else
#ifdef NOUNDERBLAS
-double dnrm2();
-double dasum();
-double ddot();
-int idamax();
-void dgemm();
-void dgemv();
-void dger();
-void dtrsm();
-void dtrmv();
-#else
-double dnrm2_();
-double dasum_();
-double ddot_();
-int idamax_();
-void dgemm_();
-void dgemv_();
-void dger_();
-void dtrsm_();
-void dtrmv_();
+# define BLAS_FUNC(name, NAME) name
+#else
+# define BLAS_FUNC(name, NAME) name##_
#endif
#endif
+double BLAS_FUNC(dnrm2, DNRM2)(const int *n, const double *x, const int *incx);
+double BLAS_FUNC(dasum, DASUM)(const int *n, const double *x, const int *incx);
+double BLAS_FUNC(ddot, DDOT)(const int *n, const double *x, const int *incx,
+ const double *y, const int *incy);
+int BLAS_FUNC(idamax, IDAMAX)(const int *n, const double *x, const int *incx);
+void BLAS_FUNC(dgemm, DGEMM)(const char *transa, const char *transb,
+ const int *m, const int *n, const int *k,
+ const double *alpha, const double *a,
+ const int *lda, const double *b, const int *ldb,
+ const double *beta, double *c, const int *ldc);
+void BLAS_FUNC(dgemv, DGEMV)(const char *trans, const int *m, const int *n,
+ const double *alpha, const double *a,
+ const int *lda, const double *x, const int *incx,
+ const double *beta, double *y, const int *incy);
+void BLAS_FUNC(dger, DGER)(const int *m, const int *n, const double *alpha,
+ const double *x,const int *incx,
+ const double *y, const int *incy,
+ double *a, const int *lda);
+void BLAS_FUNC(dtrsm, DTRSM)(const char *side, const char *uplo,
+ const char *transa, const char *diag,
+ const int *m, const int *n,
+ const double *alpha,
+ const double *a, const int *lda,
+ double *b, const int *ldb);
+void BLAS_FUNC(dtrmv, DTRMV)(const char *uplo, const char *trans,
+ const char *diag, const int *n, const double *a,
+ const int *lda, double *x, const int *incx);
+
/*
LAPACK next.
*/
#ifdef CAPSLAPACK
#ifdef NOUNDERLAPACK
-void DPOTRF();
-void DPOTRS();
-void DPOTRI();
-void DTRTRI();
-#else
-void DPOTRF_();
-void DPOTRS_();
-void DPOTRI_();
-void DTRTRI_();
+# define LAPACK_FUNC(name, NAME) NAME
+#else
+# define LAPACK_FUNC(name, NAME) NAME##_
#endif
#else
#ifdef NOUNDERLAPACK
-void dpotrf();
-void dpotrs();
-void dpotri();
-void dtrtri();
-#else
-void dpotrf_();
-void dpotrs_();
-void dpotri_();
-void dtrtri_();
+# define LAPACK_FUNC(name, NAME) name
+#else
+# define LAPACK_FUNC(name, NAME) name##_
#endif
#endif
+void LAPACK_FUNC(dpotrf, DPOTRF)(const char *uplo, const int *n,
+ double *a, const int *lda, int *info);
+void LAPACK_FUNC(dpotrs, DPOTRS)(const char *uplo, const int *n,
+ const int *nrhs, const double *a,
+ const int *lda, double *b, const int *ldb,
+ int *info);
+void LAPACK_FUNC(dpotri, DPOTRI)(const char *uplo, const int *n,
+ double *a, const int *lda, int *info);
+void LAPACK_FUNC(dtrtri, DTRTRI)(const char *uplo, const char *diag,
+ const int *n, double *a, const int *lda,
+ int *info);
+
#ifdef __cplusplus
}
#endif
|