Skip to content

Commit

Permalink
build: Disable clang18 warnings about deprecated unicode conversion (A…
Browse files Browse the repository at this point in the history
…cademySoftwareFoundation#4246)

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 <lg@larrygritz.com>
  • Loading branch information
lgritz committed Apr 28, 2024
1 parent 2266543 commit 66576b3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
* The default build mode is C++14. This can be controlled by via the
CMake configuration flag: `-DCMAKE_CXX_STANDARD=17`, etc.
* ADVISORY: We expect that OIIO 2.6 in 2024 will require C++17 or higher.
* Compilers: gcc 6.1 - 13.1, clang 3.4 - 17, MSVS 2017 - 2019,
* Compilers: gcc 6.1 - 13.1, clang 3.4 - 18, MSVS 2017 - 2019,
Intel icc 17+, Intel OneAPI C++ compiler 2022+.
* **CMake >= 3.15** (tested through 3.28)
* **OpenEXR/Imath >= 2.4** (recommended: 3.1 or higher; tested through 3.2
Expand Down
4 changes: 4 additions & 0 deletions src/include/OpenImageIO/detail/fmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 <OpenImageIO/detail/fmt/format.h>
#include <OpenImageIO/detail/fmt/ostream.h>
Expand Down
14 changes: 11 additions & 3 deletions src/libutil/strutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
// https://github.com/AcademySoftwareFoundation/OpenImageIO


#include <cmath>
#include <OpenImageIO/platform.h>

// 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 <codecvt>
#include <locale>
OIIO_PRAGMA_WARNING_POP

#include <algorithm>
#include <cmath>
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <limits>
#include <locale>
#include <mutex>
#include <numeric>
#include <sstream>
Expand All @@ -25,7 +34,6 @@
#include <boost/algorithm/string/find.hpp>

#include <OpenImageIO/dassert.h>
#include <OpenImageIO/platform.h>
#include <OpenImageIO/string_view.h>
#include <OpenImageIO/strutil.h>
#include <OpenImageIO/thread.h>
Expand Down

0 comments on commit 66576b3

Please sign in to comment.