Skip to content

deprecation of wstring_convert #90

@flammie

Description

@flammie

The compilation failed on my new laptop and gcc since it autodetected c++ 26(?) and some deprecated stuff that gets used is removed:

Making all in src
make[1]: Entering directory '/Users/tpi006/github/divvun/libdivvun/src'
g++ -DPACKAGE_NAME=\"libdivvun\" -DPACKAGE_TARNAME=\"libdivvun\" -DPACKAGE_VERSION=\"0.3.12-alpha\" -DPACKAGE_STRING=\"libdivvun\ 0.3.12-alpha\" -DPACKAGE_BUGREPORT=\"unhammer+apertium@mm.st\" -DPACKAGE_URL=\"https://github.com/divvun/libdivvun\" -DPACKAGE=\"libdivvun\" -DVERSION=\"0.3.12-alpha\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_LIBPUGIXML=1 -DHAVE_CGSPELL=1 -DHAVE_LIBARCHIVE=1 -DHAVE_CHECKER=1 -DHAVE_PYTHON_H=1 -I.  -DPREFIX="\"/usr/local\"" -I/opt/homebrew/include/utf8cpp/ -I/opt/homebrew/opt/libarchive/include -I/opt/homebrew/opt/icu4c@77/include -I/opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/include/python3.13 -I/opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/include/python3.13 -I/usr/local/include/hfst/ -I/opt/homebrew/Cellar/pugixml/1.15/include -g -O2 -Wall -Werror=switch -I/usr/local/include/hfst/ -I/usr/local/include/ -fstack-protector-strong -std=c++26 -MT divvun_suggest-main_suggest.o -MD -MP -MF .deps/divvun_suggest-main_suggest.Tpo -c -o divvun_suggest-main_suggest.o `test -f 'main_suggest.cpp' || echo './'`main_suggest.cpp
In file included from main_suggest.cpp:22:
In file included from ./suggest.hpp:32:
./util.hpp:87:7: error: no member named 'wstring_convert' in namespace 'std'
   87 |         std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
      |         ~~~~~^
./util.hpp:87:28: error: no member named 'codecvt_utf8' in namespace 'std'
   87 |         std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
      |                              ~~~~~^
./util.hpp:87:48: error: expected '(' for function-style cast or type construction
   87 |         std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
      |                                                ~~~~~~~^
./util.hpp:87:51: error: use of undeclared identifier 'myconv'
   87 |         std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
      |                                                          ^
./util.hpp:88:9: error: use of undeclared identifier 'myconv'
   88 |         return myconv.from_bytes(str);
      |                ^
./util.hpp:92:7: error: no member named 'wstring_convert' in namespace 'std'
   92 |         std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
      |         ~~~~~^
./util.hpp:92:28: error: no member named 'codecvt_utf8' in namespace 'std'
   92 |         std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
      |                              ~~~~~^
./util.hpp:92:48: error: expected '(' for function-style cast or type construction
   92 |         std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
      |                                                ~~~~~~~^
./util.hpp:92:51: error: use of undeclared identifier 'myconv'
   92 |         std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
      |                                                          ^
./util.hpp:93:9: error: use of undeclared identifier 'myconv'
   93 |         return myconv.to_bytes(str);
      |                ^
...

This is a compilation after removing c++ 26 for reference:

$ make
...
g++ -DPACKAGE_NAME=\"libdivvun\" -DPACKAGE_TARNAME=\"libdivvun\" -DPACKAGE_VERSION=\"0.3.12-alpha\" -DPACKAGE_STRING=\"libdivvun\ 0.3.12-alpha\" -DPACKAGE_BUGREPORT=\"unhammer+apertium@mm.st\" -DPACKAGE_URL=\"https://github.com/divvun/libdivvun\" -DPACKAGE=\"libdivvun\" -DVERSION=\"0.3.12-alpha\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_LIBPUGIXML=1 -DHAVE_CGSPELL=1 -DHAVE_LIBARCHIVE=1 -DHAVE_CHECKER=1 -DHAVE_PYTHON_H=1 -I.  -DPREFIX="\"/usr/local\"" -I/opt/homebrew/include/utf8cpp/ -I/opt/homebrew/opt/libarchive/include -I/opt/homebrew/opt/icu4c@77/include -I/opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/include/python3.13 -I/opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/include/python3.13 -I/usr/local/include/ -I/opt/homebrew/Cellar/pugixml/1.15/include -I/opt/homebrew/opt/libarchive/include -I/usr/local/include/hfst/ -I/opt/homebrew/Cellar/pugixml/1.15/include -I/usr/local/include  -g -O2 -Wall -Werror=switch -I/usr/local/include/hfst/ -I/usr/local/include/ -fstack-protector-strong -std=c++23 -MT divvun_normaliser-main_normaliser.o -MD -MP -MF .deps/divvun_normaliser-main_normaliser.Tpo -c -o divvun_normaliser-main_normaliser.o `test -f 'main_normaliser.cpp' || echo './'`main_normaliser.cppIn file included from main_normaliser.cpp:22:
In file included from ./normaliser.hpp:30:
./util.hpp:87:28: warning: 'codecvt_utf8<wchar_t>' is deprecated [-Wdeprecated-declarations]
   87 |         std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
      |                                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/codecvt:193:28: note: 'codecvt_utf8<wchar_t>' has been explicitly marked deprecated here
  193 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8 : public __codecvt_utf8<_Elem> {
      |                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:731:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
  731 | #    define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
      |                                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:696:49: note: expanded from macro '_LIBCPP_DEPRECATED'
  696 | #      define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
      |                                                 ^
In file included from main_normaliser.cpp:22:
In file included from ./normaliser.hpp:30:
...

I am not very familiar with the code that needs to do various char formats, I usually try to avoid all wchars and wstrings in c++,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions