Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
skirpichev committed Jan 30, 2024
commit 8e514c5cb64dc88350ded69e2e9e60b546457434
2 changes: 1 addition & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Misc/sbom.spdx.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Modules/_decimal/libmpdec/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
7 changes: 7 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down