Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning警告排除deprecated #106

Merged
merged 2 commits into from Apr 28, 2023
Merged

warning警告排除deprecated #106

merged 2 commits into from Apr 28, 2023

Conversation

coseyo
Copy link
Contributor

@coseyo coseyo commented Apr 23, 2023

不加的情况在最新版的 x86_64-w64-mingw32/12.2.0 会报如下信息:

github.com/yanyiwu/gojieba

In file included from vendor\github.com\yanyiwu\gojieba\deps/cppjieba/DictTrie.hpp:13,
from vendor\github.com\yanyiwu\gojieba\deps/cppjieba/QuerySegment.hpp:8,
from vendor\github.com\yanyiwu\gojieba\deps/cppjieba/Jieba.hpp:4,
from jieba.cpp:5:
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp: In function 'std::string& limonp::LTrim(std::string&)':
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp:87:93: warning: 'std::pointer_to_unary_function<_Arg, _Result> std::ptr_fun(_Result ()(_Arg)) [with _Arg = unsigned int; _Result = bool]' is deprecated: use 'std::function' instead [-Wdeprecated-declarations]
87 | s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<unsigned, bool>(IsSpace))));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/stl_tree.h:65,
from E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/set:60,
from vendor\github.com\yanyiwu\gojieba\deps/cppjieba/QuerySegment.hpp:5:
E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/stl_function.h:1126:5: note: declared here
1126 | ptr_fun(_Result (
__x)(_Arg))
| ^~~~~~~
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp:87:64: warning: 'constexpr std::unary_negate<_Predicate> std::not1(const _Predicate&) [with _Predicate = pointer_to_unary_function<unsigned int, bool>]' is deprecated: use 'std::not_fn' instead [-Wdeprecated-declarations]
87 | s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<unsigned, bool>(IsSpace))));
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/stl_function.h:1046:5: note: declared here
1046 | not1(const _Predicate& __pred)
| ^~~~
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp: In function 'std::string& limonp::RTrim(std::string&)':
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp:92:84: warning: 'std::pointer_to_unary_function<_Arg, _Result> std::ptr_fun(_Result ()(_Arg)) [with _Arg = unsigned int; _Result = bool]' is deprecated: use 'std::function' instead [-Wdeprecated-declarations]
92 | s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<unsigned, bool>(IsSpace))).base(), s.end());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/stl_function.h:1126:5: note: declared here
1126 | ptr_fun(_Result (
__x)(_Arg))
| ^~~~~~~
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp:92:55: warning: 'constexpr std::unary_negate<_Predicate> std::not1(const _Predicate&) [with _Predicate = pointer_to_unary_function<unsigned int, bool>]' is deprecated: use 'std::not_fn' instead [-Wdeprecated-declarations]
92 | s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<unsigned, bool>(IsSpace))).base(), s.end());
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/stl_function.h:1046:5: note: declared here
1046 | not1(const _Predicate& __pred)
| ^~~~
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp: In function 'std::string& limonp::LTrim(std::string&, char)':
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp:101:77: warning: 'std::binder2nd<_Operation> std::bind2nd(const _Operation&, const _Tp&) [with _Operation = equal_to; _Tp = char]' is deprecated: use 'std::bind' instead [-Wdeprecated-declarations]
101 | s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::bind2nd(std::equal_to(), x))));
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/stl_function.h:1438:
E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/backward/binders.h:172:5: note: declared here
172 | bind2nd(const _Operation& __fn, const _Tp& __x)
| ^~~~~~~
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp:101:64: warning: 'constexpr std::unary_negate<_Predicate> std::not1(const _Predicate&) [with _Predicate = binder2nd<equal_to >]' is deprecated: use 'std::not_fn' instead [-Wdeprecated-declarations]
101 | s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::bind2nd(std::equal_to(), x))));
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/stl_function.h:1046:5: note: declared here
1046 | not1(const _Predicate& __pred)
| ^~~~
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp: In function 'std::string& limonp::RTrim(std::string&, char)':
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp:106:68: warning: 'std::binder2nd<_Operation> std::bind2nd(const _Operation&, const _Tp&) [with _Operation = equal_to; _Tp = char]' is deprecated: use 'std::bind' instead [-Wdeprecated-declarations]
106 | s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::bind2nd(std::equal_to(), x))).base(), s.end());
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/backward/binders.h:172:5: note: declared here
172 | bind2nd(const _Operation& __fn, const _Tp& __x)
| ^~~~~~~
vendor\github.com\yanyiwu\gojieba\deps/limonp/StringUtil.hpp:106:55: warning: 'constexpr std::unary_negate<_Predicate> std::not1(const _Predicate&) [with _Predicate = binder2nd<equal_to >]' is deprecated: use 'std::not_fn' instead [-Wdeprecated-declarations]
106 | s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::bind2nd(std::equal_to(), x))).base(), s.end());
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E:/soft/mingw64/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/bits/stl_function.h:1046:5: note: declared here
1046 | not1(const _Predicate& __pred)

新增 -Wno-deprecated 后即可隐藏

使用 go test 测试分词时会展示多行 deprecated 的warning信息,新增 CXXFLAGS  -Wno-deprecated 可以隐藏相关信息展示,避免干扰正常信息的返回。
@yanyiwu yanyiwu merged commit ef2f64b into yanyiwu:master Apr 28, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants