mirror of https://github.com/python/cpython
gh-108562: Fix compiler warnings for libmpdec (#114751)
If awailable, enable -fstrict-overflow for libmpdec. Also shut off false positive warnings (-Warray-bounds). The later was backported from mpdecimal-4.0.0.
This commit is contained in:
parent
67f742e03a
commit
002a5948fc
|
@ -1213,7 +1213,7 @@ PYTHON_HEADERS= \
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# Build static libmpdec.a
|
# Build static libmpdec.a
|
||||||
LIBMPDEC_CFLAGS=@LIBMPDEC_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)
|
LIBMPDEC_CFLAGS=$(PY_STDMODULE_CFLAGS) @LIBMPDEC_CFLAGS@ $(CCSHARED)
|
||||||
|
|
||||||
# "%.o: %c" is not portable
|
# "%.o: %c" is not portable
|
||||||
Modules/_decimal/libmpdec/basearith.o: $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
Modules/_decimal/libmpdec/basearith.o: $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
|
|
@ -1224,11 +1224,11 @@
|
||||||
"checksums": [
|
"checksums": [
|
||||||
{
|
{
|
||||||
"algorithm": "SHA1",
|
"algorithm": "SHA1",
|
||||||
"checksumValue": "12402bcf7f0161adb83f78163f41cc10a5e5de5f"
|
"checksumValue": "9dcb50e3f9c3245972731be5da0b28e7583198d9"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"algorithm": "SHA256",
|
"algorithm": "SHA256",
|
||||||
"checksumValue": "cba044c76b6bc3ae6cfa49df1121cad7552140157b9e61e11cbb6580cc5d74cf"
|
"checksumValue": "7cac49fef5e9d952ec9390bf81c54d83f1b5da32fdf76091c2f0770ed943b7fe"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fileName": "Modules/_decimal/libmpdec/io.c"
|
"fileName": "Modules/_decimal/libmpdec/io.c"
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 7
|
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 7
|
||||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||||
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
|
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
|
||||||
|
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14516,6 +14516,13 @@ else $as_nop
|
||||||
LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)"
|
LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)"
|
||||||
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
|
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
|
||||||
|
|
||||||
|
if test "x$ac_cv_cc_supports_fstrict_overflow" = xyes
|
||||||
|
then :
|
||||||
|
|
||||||
|
as_fn_append LIBMPDEC_CFLAGS " -fstrict-overflow"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
if test "x$with_pydebug" = xyes
|
if test "x$with_pydebug" = xyes
|
||||||
then :
|
then :
|
||||||
|
|
||||||
|
|
|
@ -3896,6 +3896,11 @@ AS_VAR_IF([with_system_libmpdec], [yes], [
|
||||||
LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)"
|
LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)"
|
||||||
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
|
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
|
||||||
|
|
||||||
|
dnl Enable strict-overflow for libmpdec, if available, see GH-108562
|
||||||
|
AS_VAR_IF([ac_cv_cc_supports_fstrict_overflow], [yes], [
|
||||||
|
AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -fstrict-overflow"])
|
||||||
|
])
|
||||||
|
|
||||||
dnl Disable forced inlining in debug builds, see GH-94847
|
dnl Disable forced inlining in debug builds, see GH-94847
|
||||||
AS_VAR_IF([with_pydebug], [yes], [
|
AS_VAR_IF([with_pydebug], [yes], [
|
||||||
AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DTEST_COVERAGE"])
|
AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DTEST_COVERAGE"])
|
||||||
|
|
Loading…
Reference in New Issue