From a2d37ddbb12626a92a63ad612148e89540022597 Mon Sep 17 00:00:00 2001 From: Larry Gritz Date: Sat, 27 Apr 2024 08:21:54 -0700 Subject: [PATCH] build: Disable clang18 warnings about deprecated unicode conversion clang/llvm 18 (and probably other compilers soon) has made noisy warnings about the C++17-deprecated unicode conversions. Actually replacing them enirely with something else is rather hairy, we will tackle that later. In the mean time, this patch seems to be the minimal change to disable the warnings that should be totally easy to backport. These seem to be the only changes necessary to make a clean build with clang 18. Signed-off-by: Larry Gritz --- INSTALL.md | 2 +- src/include/OpenImageIO/detail/fmt.h | 4 ++++ src/libutil/strutil.cpp | 13 ++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 501f8017cd..a01b04ae1e 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -17,7 +17,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**. * **C++17 or higher** (also builds with C++20) * The default build mode is C++17. This can be controlled by via the CMake configuration flag: `-DCMAKE_CXX_STANDARD=20`, etc. - * Compilers: **gcc 9.3** - 13.1, **clang 5** - 17, MSVS 2017 - 2019 (**v19.14 + * Compilers: **gcc 9.3** - 13.1, **clang 5** - 18, MSVS 2017 - 2019 (**v19.14 and up**), **Intel icc 19+**, Intel OneAPI C++ compiler 2022+. * **CMake >= 3.15** (tested through 3.28) * **OpenEXR/Imath >= 3.1** (tested through 3.2 diff --git a/src/include/OpenImageIO/detail/fmt.h b/src/include/OpenImageIO/detail/fmt.h index 4d9456ebdb..74e6fae78c 100644 --- a/src/include/OpenImageIO/detail/fmt.h +++ b/src/include/OpenImageIO/detail/fmt.h @@ -48,6 +48,7 @@ # define FMT_USE_FLOAT128 0 #endif +// Suppress certain warnings generated in the fmt headers themselves OIIO_PRAGMA_WARNING_PUSH #if OIIO_GNUC_VERSION >= 70000 # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" @@ -58,6 +59,9 @@ OIIO_PRAGMA_WARNING_PUSH #if OIIO_INTEL_LLVM_COMPILER # pragma GCC diagnostic ignored "-Wtautological-constant-compare" #endif +#if OIIO_CLANG_VERSION >= 180000 +# pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif #include #include diff --git a/src/libutil/strutil.cpp b/src/libutil/strutil.cpp index 2ac8f561e9..4c8ded417c 100644 --- a/src/libutil/strutil.cpp +++ b/src/libutil/strutil.cpp @@ -3,16 +3,24 @@ // https://github.com/AcademySoftwareFoundation/OpenImageIO +#include + +// Special dance to disable warnings in the included files related to +// the deprecation of unicode conversion functions. +OIIO_PRAGMA_WARNING_PUSH +OIIO_CLANG_PRAGMA(clang diagnostic ignored "-Wdeprecated-declarations") +#include +#include +OIIO_PRAGMA_WARNING_POP + #include #include -#include #include #include #include #include #include #include -#include #include #include #include @@ -23,7 +31,6 @@ #endif #include -#include #include #include #include