From 8e514c5cb64dc88350ded69e2e9e60b546457434 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 30 Jan 2024 15:54:39 +0300 Subject: [PATCH] gh-108562: fix compiler warnings for bundled libmpdec in the main This patch enable (if awailable) -fstrict-overflow for libmpdec and also shut off false positive warnings (-Warray-bounds). The later part was backported from mpdecimal-4.0.0. --- Makefile.pre.in | 2 +- Misc/sbom.spdx.json | 4 ++-- Modules/_decimal/libmpdec/io.c | 1 + configure | 7 +++++++ configure.ac | 5 +++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index 37a8b06987c710..1b805141f4412d 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -937,7 +937,7 @@ python.worker.js: $(srcdir)/Tools/wasm/python.worker.js ########################################################################## # 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 Modules/_decimal/libmpdec/basearith.o: $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS) diff --git a/Misc/sbom.spdx.json b/Misc/sbom.spdx.json index 94566772338b10..e8f415df4eeaaf 100644 --- a/Misc/sbom.spdx.json +++ b/Misc/sbom.spdx.json @@ -1238,11 +1238,11 @@ "checksums": [ { "algorithm": "SHA1", - "checksumValue": "12402bcf7f0161adb83f78163f41cc10a5e5de5f" + "checksumValue": "9dcb50e3f9c3245972731be5da0b28e7583198d9" }, { "algorithm": "SHA256", - "checksumValue": "cba044c76b6bc3ae6cfa49df1121cad7552140157b9e61e11cbb6580cc5d74cf" + "checksumValue": "7cac49fef5e9d952ec9390bf81c54d83f1b5da32fdf76091c2f0770ed943b7fe" } ], "fileName": "Modules/_decimal/libmpdec/io.c" diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c index e7bd6aee170056..4e95b8964c8e5d 100644 --- a/Modules/_decimal/libmpdec/io.c +++ b/Modules/_decimal/libmpdec/io.c @@ -48,6 +48,7 @@ #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 7 #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wmisleading-indentation" + #pragma GCC diagnostic ignored "-Warray-bounds" #endif diff --git a/configure b/configure index b1153df4d7ec52..3df6135a1aeedc 100755 --- a/configure +++ b/configure @@ -14359,6 +14359,13 @@ else $as_nop LIBMPDEC_LDFLAGS="-lm \$(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 then : diff --git a/configure.ac b/configure.ac index 9587e6d63499aa..d18913f12c7297 100644 --- a/configure.ac +++ b/configure.ac @@ -3744,6 +3744,11 @@ AS_VAR_IF([with_system_libmpdec], [yes], [ LIBMPDEC_LDFLAGS="-lm \$(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 AS_VAR_IF([with_pydebug], [yes], [ AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DTEST_COVERAGE"]) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy