nodejs / nodejs/node

Use of deprecated C++ API in src

Open
#62,506 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

c++ lib / src
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

In file included from ../../test/cctest/test_util.cc:1:
In file included from ../../src/debug_utils-inl.h:6:
In file included from ../../src/debug_utils.h:6:
In file included from ../../src/async_wrap.h:27:
In file included from ../../src/base_object.h:29:
In file included from ../../src/memory_tracker.h:5:
In file included from ../../deps/v8/include/v8-profiler.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:950:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/inout_ptr.h:16:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:22:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__fwd/ostream.h:13:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__fwd/string.h:45:41: warning: 'char_traits<unsigned char>' is deprecated: char_traits<T> for T not equ
al 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 a future release, so please migrate off of it. [-Wdeprecated-declarations]
   45 | template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
      |                                         ^
../../src/util.h:506:15: note: in instantiation of default argument for 'basic_string<unsigned char>' required here
  506 |   inline std::basic_string<T> ToString() const { return {out(), length()}; }
      |               ^~~~~~~~~~~~~~~
../../test/cctest/test_util.cc:229:37: note: in instantiation of template class 'node::MaybeStackBuffer<unsigned char>' requested here
  229 |     MaybeStackBuffer<unsigned char> buf(100);
      |                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__fwd/string.h:24:8: note: 'char_traits<unsigned char>' has been explicitly marked deprecated here
   24 | struct _LIBCPP_DEPRECATED_(
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:555:53: note: expanded from macro '_LIBCPP_DEPRECATED_'
  555 | #      define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m)))
      |                                                     ^
In file included from ../../test/cctest/test_util.cc:1:
In file included from ../../src/debug_utils-inl.h:6:
In file included from ../../src/debug_utils.h:6:
In file included from ../../src/async_wrap.h:27:
In file included from ../../src/base_object.h:29:
In file included from ../../src/memory_tracker.h:5:
In file included from ../../deps/v8/include/v8-profiler.h:11:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/unordered_set:1846:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:601:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:363:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:197:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:28:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string:654:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:221:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__fwd/string_view.h:22:41: warning: 'char_traits<unsigned char>' is deprecated: char_traits<T> for T no
t 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 a future release, so please migrate off of it. [-Wdeprecated-declarations]
   22 | template <class _CharT, class _Traits = char_traits<_CharT> >
      |                                         ^
../../src/util.h:507:15: note: in instantiation of default argument for 'basic_string_view<unsigned char>' required here
  507 |   inline std::basic_string_view<T> ToStringView() const {
      |               ^~~~~~~~~~~~~~~~~~~~
../../test/cctest/test_util.cc:229:37: note: in instantiation of template class 'node::MaybeStackBuffer<unsigned char>' requested here
  229 |     MaybeStackBuffer<unsigned char> buf(100);
      |                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__fwd/string.h:24:8: note: 'char_traits<unsigned char>' has been explicitly marked deprecated here
   24 | struct _LIBCPP_DEPRECATED_(
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:555:53: note: expanded from macro '_LIBCPP_DEPRECATED_'
  555 | #      define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m)))
      |

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/util.h around lines 506-507 and test/cctest/test_util.cc around line 229, then reproduce the warning on the reported macOS toolchain. Trace the MaybeStackBuffer instantiation and identify the supported C++ API path; done means the affected test build no longer emits these deprecation warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.