Skip to content

Commit c918666

Browse files
committed
resolving build warnings
1 parent e5c6361 commit c918666

File tree

6 files changed

+14
-80
lines changed

6 files changed

+14
-80
lines changed

quaddtype/meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ if not is_windows
104104
if cpp.has_argument('-fext-numeric-literals')
105105
add_project_arguments('-fext-numeric-literals', language: 'cpp')
106106
endif
107+
108+
# Suppress warnings from system headers (sleefquad.h has many unused inline functions)
109+
if cpp.has_argument('-Wno-unused-function')
110+
add_project_arguments('-Wno-unused-function', language: ['c', 'cpp'])
111+
endif
107112
endif
108113

109114
# Thread-local storage detection (borrowed from NumPy)

quaddtype/numpy_quaddtype/src/dragon4.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ Modifications are specific to support the SLEEF_QUAD
2626
#include "scalar.h"
2727

2828

29+
// Undefine NPY_TLS if already defined (avoid redefinition warning)
30+
#ifdef NPY_TLS
31+
#undef NPY_TLS
32+
#endif
33+
2934
#ifdef __cplusplus
3035
#define NPY_TLS thread_local
3136
#elif defined(HAVE_THREAD_LOCAL)
@@ -2005,8 +2010,6 @@ PyObject *
20052010
Dragon4_Positional(PyObject *obj, DigitMode digit_mode, CutoffMode cutoff_mode, int precision,
20062011
int min_digits, int sign, TrimMode trim, int pad_left, int pad_right)
20072012
{
2008-
npy_double v;
2009-
20102013
if (PyObject_TypeCheck(obj, &QuadPrecision_Type)) {
20112014
QuadPrecisionObject *quad_obj = (QuadPrecisionObject *)obj;
20122015
if (quad_obj->backend == BACKEND_SLEEF) {
@@ -2028,8 +2031,6 @@ PyObject *
20282031
Dragon4_Scientific(PyObject *obj, DigitMode digit_mode, int precision, int min_digits, int sign,
20292032
TrimMode trim, int pad_left, int exp_digits)
20302033
{
2031-
npy_double val;
2032-
20332034
if (PyObject_TypeCheck(obj, &QuadPrecision_Type)) {
20342035
QuadPrecisionObject *quad_obj = (QuadPrecisionObject *)obj;
20352036
if (quad_obj->backend == BACKEND_SLEEF) {

quaddtype/numpy_quaddtype/src/ops.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ typedef Sleef_quad (*unary_op_quad_def)(const Sleef_quad *);
1313
// Unary Quad operations with 2 outputs (for modf, frexp)
1414
typedef void (*unary_op_2out_quad_def)(const Sleef_quad *, Sleef_quad *, Sleef_quad *);
1515

16-
static Sleef_quad
16+
[[maybe_unused]] static Sleef_quad
1717
quad_negative(const Sleef_quad *op)
1818
{
1919
return Sleef_negq1(*op);
2020
}
2121

22-
static Sleef_quad
22+
[[maybe_unused]] static Sleef_quad
2323
quad_positive(const Sleef_quad *op)
2424
{
2525
return *op;
@@ -929,15 +929,15 @@ static inline Sleef_quad quad_set_words64(int64_t hx, uint64_t lx)
929929
static inline Sleef_quad
930930
quad_nextafter(const Sleef_quad *x, const Sleef_quad *y)
931931
{
932-
int64_t hx, hy, ix, iy;
932+
int64_t hx, hy, ix;
933933
uint64_t lx, ly;
934934

935935
quad_get_words64(&hx, &lx, *x);
936936
quad_get_words64(&hy, &ly, *y);
937937

938938
// extracting absolute value
939939
ix = hx & 0x7fffffffffffffffLL;
940-
iy = hy & 0x7fffffffffffffffLL;
940+
(void)ly; // unused but needed for quad_get_words64
941941

942942
// NaN if either is NaN
943943
if (Sleef_iunordq1(*x, *y)) {

quaddtype/numpy_quaddtype/src/scalar.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -338,19 +338,6 @@ QuadPrecision_str(QuadPrecisionObject *self)
338338
return PyUnicode_FromString(buffer);
339339
}
340340

341-
static PyObject *
342-
QuadPrecision_repr(QuadPrecisionObject *self)
343-
{
344-
PyObject *str = QuadPrecision_str(self);
345-
if (str == NULL) {
346-
return NULL;
347-
}
348-
const char *backend_str = (self->backend == BACKEND_SLEEF) ? "sleef" : "longdouble";
349-
PyObject *res = PyUnicode_FromFormat("QuadPrecision('%S', backend='%s')", str, backend_str);
350-
Py_DECREF(str);
351-
return res;
352-
}
353-
354341
static PyObject *
355342
QuadPrecision_repr_dragon4(QuadPrecisionObject *self)
356343
{

quaddtype/numpy_quaddtype/src/umath/umath.cpp

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -25,60 +25,6 @@ extern "C" {
2525
#include "comparison_ops.h"
2626
#include "matmul.h"
2727

28-
// helper debugging function
29-
static const char *
30-
get_dtype_name(PyArray_DTypeMeta *dtype)
31-
{
32-
if (dtype == &QuadPrecDType) {
33-
return "QuadPrecDType";
34-
}
35-
else if (dtype == &PyArray_BoolDType) {
36-
return "BoolDType";
37-
}
38-
else if (dtype == &PyArray_ByteDType) {
39-
return "ByteDType";
40-
}
41-
else if (dtype == &PyArray_UByteDType) {
42-
return "UByteDType";
43-
}
44-
else if (dtype == &PyArray_ShortDType) {
45-
return "ShortDType";
46-
}
47-
else if (dtype == &PyArray_UShortDType) {
48-
return "UShortDType";
49-
}
50-
else if (dtype == &PyArray_IntDType) {
51-
return "IntDType";
52-
}
53-
else if (dtype == &PyArray_UIntDType) {
54-
return "UIntDType";
55-
}
56-
else if (dtype == &PyArray_LongDType) {
57-
return "LongDType";
58-
}
59-
else if (dtype == &PyArray_ULongDType) {
60-
return "ULongDType";
61-
}
62-
else if (dtype == &PyArray_LongLongDType) {
63-
return "LongLongDType";
64-
}
65-
else if (dtype == &PyArray_ULongLongDType) {
66-
return "ULongLongDType";
67-
}
68-
else if (dtype == &PyArray_FloatDType) {
69-
return "FloatDType";
70-
}
71-
else if (dtype == &PyArray_DoubleDType) {
72-
return "DoubleDType";
73-
}
74-
else if (dtype == &PyArray_LongDoubleDType) {
75-
return "LongDoubleDType";
76-
}
77-
else {
78-
return "UnknownDType";
79-
}
80-
}
81-
8228
int
8329
init_quad_umath(void)
8430
{

quaddtype/numpy_quaddtype/src/utilities.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,13 @@ char **endptr, bool require_full_parse)
173173
p++;
174174
}
175175

176-
// Track start of number (after whitespace)
177-
const char *num_start = p;
178-
179176
// Handle optional sign
180177
if (*p == '+' || *p == '-') {
181178
p++;
182179
}
183180

184181
// Must have at least one digit or decimal point followed by digit
185182
int has_digits = 0;
186-
int has_decimal = 0;
187183

188184
// Parse integer part
189185
while (ascii_isdigit(*p)) {
@@ -193,7 +189,6 @@ char **endptr, bool require_full_parse)
193189

194190
// Parse decimal point and fractional part
195191
if (*p == '.') {
196-
has_decimal = 1;
197192
p++;
198193
while (ascii_isdigit(*p)) {
199194
has_digits = 1;

0 commit comments

Comments
 (0)