nodejs / nodejs/node

Use of deprecated C++ API in src

未关闭
#62,506 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

c++ lib / src
主要语言
JavaScript
星标
122k
派生
37.3k
平均合并
4 天 2 小时
30 天内合并 PR
283

描述

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)))
      |

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 src/util.h 的 506-507 行附近和 test/cctest/test_util.cc 的第 229 行附近开始,然后在报告中的 macOS 工具链上重现该警告。跟踪 MaybeStackBuffer 的实例化,并确定受支持的 C++ API 路径;当受影响的测试构建不再发出这些弃用警告时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
backend
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
基本清楚
新手友好度
58/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。