Skip to content

Commit 096ffcf

Browse files
lgritzscott-wilson
authored andcommitted
build: fix fmt throwing behavior warnings (AcademySoftwareFoundation#4730)
Certain version combinations of fmt and gcc were warning, and it all boiled down to the knots we tied ourselves into to replace the function fmt uses instead of throwing exceptions, when they are disabled. I can't seem to find any harm in letting it do its default thing, so simplify our side to silence the warnings. Signed-off-by: Larry Gritz <lg@larrygritz.com> Signed-off-by: Scott Wilson <scott@propersquid.com>
1 parent 5801e82 commit 096ffcf

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

src/include/OpenImageIO/detail/fmt.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,14 @@
1919
# define FMT_EXCEPTIONS 0
2020
#endif
2121

22+
#if OIIO_VERSION_LESS(3, 1, 2)
23+
/* DEPRECATED -- remove at next ABI compatibility boundary */
2224
OIIO_NAMESPACE_BEGIN
2325
namespace pvt {
2426
OIIO_UTIL_API void
2527
log_fmt_error(const char* message);
2628
};
2729
OIIO_NAMESPACE_END
28-
29-
// Redefining FMT_THROW to print and log the error. This should only occur if
30-
// we've made a mistake and mismatched a format string and its arguments.
31-
// Hopefully this will help us track it down.
32-
#if !defined(FMT_THROW) && !FMT_EXCEPTIONS
33-
# define FMT_THROW(x) OIIO::pvt::log_fmt_error((x).what())
3430
#endif
3531

3632
// Use the grisu fast floating point formatting for old fmt versions
@@ -67,12 +63,6 @@ OIIO_PRAGMA_WARNING_PUSH
6763
#if OIIO_CLANG_VERSION >= 180000
6864
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
6965
#endif
70-
#if OIIO_CLANG_VERSION || OIIO_APPLE_CLANG_VERSION
71-
# pragma clang diagnostic ignored "-Winvalid-noreturn"
72-
#endif
73-
// #if OIIO_GNUC_VERSION
74-
// # pragma gcc diagnostic ignored "-Winvalid-noreturn"
75-
// #endif
7666

7767
#include <OpenImageIO/detail/fmt/format.h>
7868
#include <OpenImageIO/detail/fmt/ostream.h>

src/libutil/strutil.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,14 @@ Strutil::pvt::geterror(bool clear)
246246
}
247247

248248

249+
#if OIIO_VERSION_LESS(3, 1, 2) /* remove at next ABI compatibility boundary */
249250
void
250251
pvt::log_fmt_error(const char* message)
251252
{
252253
print("fmt exception: {}\n", message);
253254
Strutil::pvt::append_error(std::string("fmt exception: ") + message);
254255
}
256+
#endif
255257

256258

257259

0 commit comments

Comments
 (0)