bytedeco / javacpp

The missing bridge between Java and native C++
Other
4.46k stars 581 forks source link

Warning with "JavaCPP_createStringFromUTF16" method on Mac clang 15 #710

Open argonium opened 11 months ago

argonium commented 11 months ago

I'm running clang / g++ v.15 on a MacBook. When I compile my code with Java 11 and JavaCPP 1.5.9, I get this warning:

.../build/javacpp/jniNativeLexiconProviderLib.cpp:314:57: error: 'char_traits<unsigned short>' is deprecated: char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it. [-Werror,-Wdeprecated-declarations]
    return JavaCPP_createStringFromUTF16(env, ptr, std::char_traits<unsigned short>::length(ptr));
                                                        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__string/char_traits.h:79:8: note: 'char_traits<unsigned short>' has been explicitly marked deprecated here
struct _LIBCPP_DEPRECATED_("char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it.")
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__config:836:53: note: expanded from macro '_LIBCPP_DEPRECATED_'
#      define _LIBCPP_DEPRECATED_(m) __attribute__((deprecated(m)))
                                                    ^

The warning seems to originate with this line of code from JavaCPP: https://github.com/bytedeco/javacpp/blob/master/src/main/java/org/bytedeco/javacpp/tools/Generator.java#L1043

The exact version of llvm on my Mac is:

$ llvm-g++ --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin23.0.0
Thread model: posix
...