Skip to content

Commit 002a594

Browse files
authored
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.
1 parent 67f742e commit 002a594

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

Makefile.pre.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ PYTHON_HEADERS= \
12131213

12141214
##########################################################################
12151215
# Build static libmpdec.a
1216-
LIBMPDEC_CFLAGS=@LIBMPDEC_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)
1216+
LIBMPDEC_CFLAGS=$(PY_STDMODULE_CFLAGS) @LIBMPDEC_CFLAGS@ $(CCSHARED)
12171217

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

Misc/sbom.spdx.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_decimal/libmpdec/io.c

Lines changed: 1 addition & 0 deletions
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

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3896,6 +3896,11 @@ AS_VAR_IF([with_system_libmpdec], [yes], [
38963896
LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)"
38973897
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
38983898
3899+
dnl Enable strict-overflow for libmpdec, if available, see GH-108562
3900+
AS_VAR_IF([ac_cv_cc_supports_fstrict_overflow], [yes], [
3901+
AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -fstrict-overflow"])
3902+
])
3903+
38993904
dnl Disable forced inlining in debug builds, see GH-94847
39003905
AS_VAR_IF([with_pydebug], [yes], [
39013906
AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DTEST_COVERAGE"])

0 commit comments

Comments
 (0)