diff --git a/src/gmpy2.c b/src/gmpy2.c index 6d199ff3..b690af04 100644 --- a/src/gmpy2.c +++ b/src/gmpy2.c @@ -876,7 +876,8 @@ PyMODINIT_FUNC PyInit_gmpy2(void) #ifdef SHARED /* Create the Capsule for the C-API. */ - +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" GMPy_C_API[MPZ_Type_NUM] = (void*)&MPZ_Type; GMPy_C_API[XMPZ_Type_NUM] = (void*)&XMPZ_Type; GMPy_C_API[MPQ_Type_NUM] = (void*)&MPQ_Type; @@ -911,7 +912,7 @@ PyMODINIT_FUNC PyInit_gmpy2(void) GMPy_C_API[GMPy_MPC_NewInit_NUM] = (void*)GMPy_MPC_NewInit; GMPy_C_API[GMPy_MPC_Dealloc_NUM] = (void*)GMPy_MPC_Dealloc; GMPy_C_API[GMPy_MPC_ConvertArg_NUM] = (void*)GMPy_MPC_ConvertArg; - +#pragma GCC diagnostic pop c_api_object = PyCapsule_New((void *)GMPy_C_API, "gmpy2._C_API", NULL); if (c_api_object != NULL) { diff --git a/src/gmpy2_context.c b/src/gmpy2_context.c index fecd79af..9bc7c228 100644 --- a/src/gmpy2_context.c +++ b/src/gmpy2_context.c @@ -83,13 +83,13 @@ GMPy_CTXT_New(void) result->token = NULL; } return (PyObject*)result; -}; +} static void GMPy_CTXT_Dealloc(CTXT_Object *self) { PyObject_Free(self); -}; +} /* Begin support for context vars. */ @@ -654,7 +654,7 @@ static PyObject * \ GMPy_CTXT_Get_##NAME(CTXT_Object *self, void *closure) \ { \ return PyBool_FromLong(self->ctx.NAME); \ -}; \ +} \ static int \ GMPy_CTXT_Set_##NAME(CTXT_Object *self, PyObject *value, void *closure) \ { \ @@ -675,7 +675,7 @@ static PyObject * \ GMPy_CTXT_Get_##NAME(CTXT_Object *self, void *closure) \ { \ return PyBool_FromLong(self->ctx.traps & TRAP); \ -}; \ +} \ static int \ GMPy_CTXT_Set_##NAME(CTXT_Object *self, PyObject *value, void *closure) \ { \ @@ -690,19 +690,19 @@ GMPy_CTXT_Set_##NAME(CTXT_Object *self, PyObject *value, void *closure) \ return 0; \ } -GETSET_BOOLEAN(subnormalize); -GETSET_BOOLEAN(underflow); -GETSET_BOOLEAN(overflow); -GETSET_BOOLEAN(inexact); -GETSET_BOOLEAN(invalid); -GETSET_BOOLEAN(erange); -GETSET_BOOLEAN(divzero); -GETSET_BOOLEAN_BIT(trap_underflow, TRAP_UNDERFLOW); -GETSET_BOOLEAN_BIT(trap_overflow, TRAP_OVERFLOW); -GETSET_BOOLEAN_BIT(trap_inexact, TRAP_INEXACT); -GETSET_BOOLEAN_BIT(trap_invalid, TRAP_INVALID); -GETSET_BOOLEAN_BIT(trap_erange, TRAP_ERANGE); -GETSET_BOOLEAN_BIT(trap_divzero, TRAP_DIVZERO); +GETSET_BOOLEAN(subnormalize) +GETSET_BOOLEAN(underflow) +GETSET_BOOLEAN(overflow) +GETSET_BOOLEAN(inexact) +GETSET_BOOLEAN(invalid) +GETSET_BOOLEAN(erange) +GETSET_BOOLEAN(divzero) +GETSET_BOOLEAN_BIT(trap_underflow, TRAP_UNDERFLOW) +GETSET_BOOLEAN_BIT(trap_overflow, TRAP_OVERFLOW) +GETSET_BOOLEAN_BIT(trap_inexact, TRAP_INEXACT) +GETSET_BOOLEAN_BIT(trap_invalid, TRAP_INVALID) +GETSET_BOOLEAN_BIT(trap_erange, TRAP_ERANGE) +GETSET_BOOLEAN_BIT(trap_divzero, TRAP_DIVZERO) GETSET_BOOLEAN(allow_complex) GETSET_BOOLEAN(rational_division) GETSET_BOOLEAN(allow_release_gil) diff --git a/src/gmpy2_convert_gmp.c b/src/gmpy2_convert_gmp.c index 61fef136..d82d86f1 100644 --- a/src/gmpy2_convert_gmp.c +++ b/src/gmpy2_convert_gmp.c @@ -204,7 +204,7 @@ _get_ieee_context(long bitwidth) } result->ctx.subnormalize = 1; result->ctx.emin = 4 - result->ctx.emax - result->ctx.mpfr_prec; - return (PyObject*)result; + return result; } static PyObject * diff --git a/src/gmpy2_fused.c b/src/gmpy2_fused.c index 3c737e00..d2be3d13 100644 --- a/src/gmpy2_fused.c +++ b/src/gmpy2_fused.c @@ -194,7 +194,7 @@ PyDoc_STRVAR(GMPy_doc_function_fma, "fma(x, y, z, /) -> mpz | mpq | mpfr | mpc\n\n" "Return correctly rounded result of (x * y) + z."); -GMPY_MPFR_MPC_TRIOP_TEMPLATEWT(FMA, fma); +GMPY_MPFR_MPC_TRIOP_TEMPLATEWT(FMA, fma) static PyObject * _GMPy_MPZ_FMS(PyObject *x, PyObject *y, PyObject *z, CTXT_Object *context) @@ -369,7 +369,7 @@ PyDoc_STRVAR(GMPy_doc_function_fms, "fms(x, y, z, /) -> mpz | mpq | mpfr | mpc\n\n" "Return correctly rounded result of (x * y) - z."); -GMPY_MPFR_MPC_TRIOP_TEMPLATEWT(FMS, fms); +GMPY_MPFR_MPC_TRIOP_TEMPLATEWT(FMS, fms) /* Add support for new fmma and fmms functions from MPFR 4. */\ @@ -528,7 +528,7 @@ PyDoc_STRVAR(GMPy_doc_function_fmma, "fmma(x, y, z, t, /) -> mpfr\n\n" "Return correctly rounded result of (x * y) + (z + t)."); -GMPY_MPFR_QUADOP_TEMPLATEWT(FMMA, fmma); +GMPY_MPFR_QUADOP_TEMPLATEWT(FMMA, fmma) static PyObject * _GMPy_MPZ_FMMS(PyObject *x, PyObject *y, PyObject *z, PyObject *t, CTXT_Object *context) @@ -683,6 +683,6 @@ PyDoc_STRVAR(GMPy_doc_function_fmms, "fmms(x, y, z, t, /) -> mpfr\n\n" "Return correctly rounded result of (x * y) - (z + t)."); -GMPY_MPFR_QUADOP_TEMPLATEWT(FMMS, fmms); +GMPY_MPFR_QUADOP_TEMPLATEWT(FMMS, fmms) #endif diff --git a/src/gmpy2_math.c b/src/gmpy2_math.c index deac8c37..72109c58 100644 --- a/src/gmpy2_math.c +++ b/src/gmpy2_math.c @@ -1574,7 +1574,7 @@ PyDoc_STRVAR(GMPy_doc_context_floor, "context.floor(x, /) -> mpfr\n\n" "Return an `mpfr` that is the largest integer <= x."); -GMPY_MPFR_UNIOP_NOROUNDWT(Floor, floor); +GMPY_MPFR_UNIOP_NOROUNDWT(Floor, floor) PyDoc_STRVAR(GMPy_doc_mpfr_trunc_method, "x.__trunc__() -> mpfr\n\n" @@ -1750,7 +1750,7 @@ GMPy_RealWithType_RemQuo(PyObject *x, int xtype, PyObject *y, int ytype, CTXT_Ob return result; } -GMPY_MPFR_BINOP_TEMPLATEWT(RemQuo, remquo); +GMPY_MPFR_BINOP_TEMPLATEWT(RemQuo, remquo) PyDoc_STRVAR(GMPy_doc_function_frexp, "frexp(x, /) -> tuple[int, mpfr]\n\n" diff --git a/src/gmpy2_predicate.c b/src/gmpy2_predicate.c index fd7dd898..d1870a8c 100644 --- a/src/gmpy2_predicate.c +++ b/src/gmpy2_predicate.c @@ -95,7 +95,7 @@ GMPy_ComplexWithType_Is_NAN(PyObject *x, int xtype, CTXT_Object *context) * GMPy_ComplexWithType_Is_NAN(x, xtype, context) */ -GMPY_MPFR_MPC_UNIOP_TEMPLATEWT(Is_NAN, is_nan); +GMPY_MPFR_MPC_UNIOP_TEMPLATEWT(Is_NAN, is_nan) PyDoc_STRVAR(GMPy_doc_function_is_infinite, "is_infinite(x, /) -> bool\n\n" @@ -156,7 +156,7 @@ GMPy_ComplexWithType_Is_Infinite(PyObject *x, int xtype, CTXT_Object *context) Py_RETURN_FALSE; } -GMPY_MPFR_MPC_UNIOP_TEMPLATEWT(Is_Infinite, is_infinite); +GMPY_MPFR_MPC_UNIOP_TEMPLATEWT(Is_Infinite, is_infinite) PyDoc_STRVAR(GMPy_doc_function_is_finite, "is_finite(x, /) -> bool\n\n" @@ -217,7 +217,7 @@ GMPy_ComplexWithType_Is_Finite(PyObject *x, int xtype, CTXT_Object *context) Py_RETURN_FALSE; } -GMPY_MPFR_MPC_UNIOP_TEMPLATEWT(Is_Finite, is_finite); +GMPY_MPFR_MPC_UNIOP_TEMPLATEWT(Is_Finite, is_finite) PyDoc_STRVAR(GMPy_doc_function_is_zero, "is_zero(x, /) -> bool\n\n" @@ -278,7 +278,7 @@ GMPy_ComplexWithType_Is_Zero(PyObject *x, int xtype, CTXT_Object *context) Py_RETURN_FALSE; } -GMPY_MPFR_MPC_UNIOP_TEMPLATEWT(Is_Zero, is_zero); +GMPY_MPFR_MPC_UNIOP_TEMPLATEWT(Is_Zero, is_zero) PyDoc_STRVAR(GMPy_doc_function_is_signed, "is_signed(x, /) -> bool\n\n" @@ -323,7 +323,7 @@ GMPy_MPFR_Is_Signed_Method(PyObject *self, PyObject *args) return GMPy_Number_Is_Signed(self, NULL); } -GMPY_MPFR_UNIOP_TEMPLATEWT(Is_Signed, is_signed); +GMPY_MPFR_UNIOP_TEMPLATEWT(Is_Signed, is_signed) PyDoc_STRVAR(GMPy_doc_function_is_regular, "is_regular(x, /) -> bool\n\n" @@ -368,7 +368,7 @@ GMPy_MPFR_Is_Regular_Method(PyObject *self, PyObject *args) return GMPy_Number_Is_Regular(self, NULL); } -GMPY_MPFR_UNIOP_TEMPLATEWT(Is_Regular, is_regular); +GMPY_MPFR_UNIOP_TEMPLATEWT(Is_Regular, is_regular) PyDoc_STRVAR(GMPy_doc_function_is_integer, "is_integer(x, /) -> bool\n\n" @@ -413,7 +413,7 @@ GMPy_MPFR_Is_Integer_Method(PyObject *self, PyObject *args) return GMPy_Number_Is_Integer(self, NULL); } -GMPY_MPFR_UNIOP_TEMPLATEWT(Is_Integer, is_integer); +GMPY_MPFR_UNIOP_TEMPLATEWT(Is_Integer, is_integer) PyDoc_STRVAR(GMPy_doc_function_is_lessgreater, "is_lessgreater(x,y, /) -> bool\n\n" diff --git a/src/gmpy2_random.c b/src/gmpy2_random.c index 210d1aa9..2b57f492 100644 --- a/src/gmpy2_random.c +++ b/src/gmpy2_random.c @@ -33,20 +33,20 @@ GMPy_RandomState_New(void) gmp_randinit_default(result->state); } return result; -}; +} static void GMPy_RandomState_Dealloc(RandomState_Object *self) { gmp_randclear(self->state); PyObject_Free(self); -}; +} static PyObject * GMPy_RandomState_Repr(RandomState_Object *self) { return PyUnicode_FromString(""); -}; +} PyDoc_STRVAR(GMPy_doc_random_state_factory, "random_state(seed=0, /) -> object\n\n" diff --git a/src/gmpy2_xmpz_misc.c b/src/gmpy2_xmpz_misc.c index 5cf01706..5c467d37 100644 --- a/src/gmpy2_xmpz_misc.c +++ b/src/gmpy2_xmpz_misc.c @@ -333,14 +333,14 @@ GMPy_Iter_New(void) result->iter_type = 1; } return result; -}; +} static void GMPy_Iter_Dealloc(GMPy_Iter_Object *self) { Py_XDECREF((PyObject*)self->bitmap); PyObject_Free(self); -}; +} static PyObject * GMPy_Iter_Next(GMPy_Iter_Object *self) { @@ -399,7 +399,7 @@ static PyObject * GMPy_Iter_Repr(GMPy_Iter_Object *self) { return PyUnicode_FromString(""); -}; +} PyDoc_STRVAR(GMPy_doc_xmpz_method_iter_bits, "x.iter_bits(start=0, stop=-1) -> collections.abc.Iterator\n\n"