Skip to content

Commit 3303b02

Browse files
committed
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.
1 parent a768e12 commit 3303b02

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

Makefile.pre.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ python.worker.js: $(srcdir)/Tools/wasm/python.worker.js
937937

938938
##########################################################################
939939
# Build static libmpdec.a
940-
LIBMPDEC_CFLAGS=@LIBMPDEC_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)
940+
LIBMPDEC_CFLAGS=$(PY_STDMODULE_CFLAGS) @LIBMPDEC_CFLAGS@ $(CCSHARED)
941941

942942
# "%.o: %c" is not portable
943943
Modules/_decimal/libmpdec/basearith.o: $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)

Modules/_decimal/libmpdec/io.c

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 7
4949
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
5050
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
51+
#pragma GCC diagnostic ignored "-Warray-bounds"
5152
#endif
5253

5354

configure

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+5
Original file line numberDiff line numberDiff line change
@@ -3744,6 +3744,11 @@ AS_VAR_IF([with_system_libmpdec], [yes], [
37443744
LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)"
37453745
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
37463746
3747+
dnl see GH-108562
3748+
AS_VAR_IF([ac_cv_cc_supports_fstrict_overflow], [yes], [
3749+
AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -fstrict-overflow"])
3750+
])
3751+
37473752
dnl Disable forced inlining in debug builds, see GH-94847
37483753
AS_VAR_IF([with_pydebug], [yes], [
37493754
AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DTEST_COVERAGE"])

0 commit comments

Comments
 (0)