Coverity flags some functions marked `noexcept` that call `fmt::format`,
since `fmt::format` can throw `fmt::format_error` exceptions. We're not
interested in handling format errors at runtime, we'd rather just get a
crash and fix it. Build the entire project (including `libfmt.la`) with
`-DFMT_EXCEPTIONS=0` to make {fmt} crash instead of throw, should a
format error occur.
Tested by introducing a format error somewhere and running to it. The
result is very pretty:
$ tests/plugins/flt.utils.muxer/test-clock-compatibility
1..150
/home/smarchi/src/babeltrace/src/cpp-common/vendor/fmt/format-inl.h:40: assertion failed: invalid format stringterminate called without an active exception
[1]
1189949 IOT instruction tests/plugins/flt.utils.muxer/test-clock-compatibility
Change-Id: Ibcb0104a6bf644b025112d0b35e4fbe622c20be9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12194
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
# Add glib to global link libs
LIBS="$LIBS $GLIB_LIBS"
+# Disable exceptions for the {fmt} library. This means, for example, that a
+# format error will result in an assertion failure (instead of throwing an
+# `fmt::format_error` exception).
+AC_DEFINE_UNQUOTED([FMT_EXCEPTIONS], 0, [Disable {fmt} exceptions.])
+
# Abuse autoconf's AC_ARG_PROGRAM output variable 'program_transform_name'
# to rename babeltrace2.bin to babeltrace2 at install time.
program_transform_name="s&babeltrace2\.bin&babeltrace2&;$program_transform_name"