silnrsi / graphite

Graphite is a "smart font" system developed specifically to handle the complexities of lesser-known languages of the world.
http://graphite.sil.org/
Other
146 stars 44 forks source link

Deprecation warnings when building with VS 2019 with `/std:c++17` #73

Closed akien-mga closed 1 year ago

akien-mga commented 2 years ago

This was observed downstream in https://github.com/godotengine/godot/issues/66497.

The following warnings are raised by VS 2019 / MSVC 14.29.30133 when building graphite with /std:c++17. I know that graphite's CMake config specify C++11 standard, but in Godot downstream we build everything against C++17.

We're just going to silence that warning downstream (https://github.com/godotengine/godot/pull/66534), but I figured you might be interested in knowing about it to improve forward compatibility with future standards (if this can be fixed easily while still targeting C++11).

cl /Fothirdparty\graphite\src\Segment.windows.tools.x86_64.obj /c thirdparty\graphite\src\Segment.cpp /TP /w /std:c++17 /nologo /Zi /FS /Od /EHsc /MT /Gd /GR /utf-8 /bigobj /wd4267 /wd4244 /wd4305 /wd4018 /wd4800 /EHsc /w -DGRAPHITE2_STATIC -DGRAPHITE2_NTRACING -DGRAPHITE2_NFILEFACE /DDEBUG_ENABLED /DDEV_ENABLED /DNO_EDITOR_SPLASH /DWINDOWS_ENABLED /DWASAPI_ENABLED /DWINMIDI_ENABLED /DTYPED_METHOD_BIND /DWIN32 /DMSVC /DWINVER=0x0601 /D_WIN32_WINNT=0x0601 /DNOMINMAX /D_WIN64 /DVULKAN_ENABLED /DGLES3_ENABLED /DTOOLS_ENABLED /DMINIZIP_ENABLED /DZSTD_STATIC_LINKING_ONLY /DUSE_VOLK /DVK_USE_PLATFORM_WIN32_KHR /DGLAD_ENABLED /DGLES_OVER_GL /Ithirdparty\graphite\src /Ithirdparty\graphite\include /Ithirdparty\libpng /Ithirdparty\glad /Ithirdparty\volk /Ithirdparty\vulkan /Ithirdparty\vulkan\include /Ithirdparty\zstd /Ithirdparty\zlib /Iplatform\windows /I.
Position.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xutility(1169): warning C4996: 'std::iterator<std::input_iterator_tag,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type>,ptrdiff_t,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type> *,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type> &>::iterator_category': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xutility(1189): note: see reference to class template instantiation 'std::_Iterator_traits_base<_Iter,void>' being compiled
        with
        [
            _Iter=`anonymous-namespace'::glat_iterator
        ]
C:\Users\Remi\Documents\Godot\godot.git\thirdparty\graphite\src\inc/Sparse.h(106): note: see reference to class template instantiation 'std::iterator_traits<I>' being compiled
        with
        [
            I=`anonymous-namespace'::glat_iterator
        ]
C:\Users\Remi\Documents\Godot\godot.git\thirdparty\graphite\src\inc/GlyphFace.h(75): note: see reference to function template instantiation 'graphite2::sparse::sparse<I>(I,const I)' being compiled
        with
        [
            I=`anonymous-namespace'::glat_iterator
        ]
thirdparty\graphite\src\GlyphCache.cpp(420): note: see reference to function template instantiation 'graphite2::GlyphFace::GlyphFace<`anonymous-namespace'::glat_iterator>(const graphite2::Rect &,const graphite2::Position &,I,const I)' being compiled
        with
        [
            I=`anonymous-namespace'::glat_iterator
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xutility(1170): warning C4996: 'std::iterator<std::input_iterator_tag,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type>,ptrdiff_t,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type> *,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type> &>::value_type': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
Segment.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xutility(1171): warning C4996: 'std::iterator<std::input_iterator_tag,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type>,ptrdiff_t,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type> *,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type> &>::difference_type': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xutility(1172): warning C4996: 'std::iterator<std::input_iterator_tag,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type>,ptrdiff_t,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type> *,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type> &>::pointer': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xutility(1173): warning C4996: 'std::iterator<std::input_iterator_tag,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type>,ptrdiff_t,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type> *,std::pair<graphite2::sparse::key_type,graphite2::sparse::mapped_type> &>::reference': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
tim-eves commented 1 year ago

Fixed with commit: 94b0bc644d5f93ddfbbc85bafff12ee22fc851cf