mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-05-29 22:18:54 +02:00
whisper : fix grammar advance stack warning (#3087)
This commit addresses a warnings that is present for Release builds: ```console [ 30%] Building CXX object src/CMakeFiles/whisper.dir/whisper.cpp.o In file included from /usr/include/c++/13/bits/stl_tree.h:63, from /usr/include/c++/13/map:62, from /home/danbev/work/ai/whisper.cpp/src/whisper-arch.h:5, from /home/danbev/work/ai/whisper.cpp/src/whisper.cpp:2: In static member function ‘static void std::__copy_move<false, false, std::random_access_iterator_tag>::__assign_one(_Tp*, _Up*) [with _Tp = const whisper_grammar_element*; _Up = const whisper_grammar_element* const]’, inlined from ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = const whisper_grammar_element* const; _Up = const whisper_grammar_element*; bool _IsMove = false]’ at /usr/include/c++/13/bits/stl_algobase.h:440:20, inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = const whisper_grammar_element* const*; _OI = const whisper_grammar_element**]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30, inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = const whisper_grammar_element* const*; _OI = const whisper_grammar_element**]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42, ... ``` This warning is caused by the fact that the `stack` vector is empty when it is passed to `new_stacks.push_back(stack);`. The suggested fix is to use `new_stacks.emplace_back();` instead of `new_stacks.push_back(stack);`.
This commit is contained in:
parent
f0171f0616
commit
2e30e6df59
@ -4501,7 +4501,7 @@ static void whisper_grammar_advance_stack(
|
|||||||
std::vector<std::vector<const whisper_grammar_element *>> & new_stacks) {
|
std::vector<std::vector<const whisper_grammar_element *>> & new_stacks) {
|
||||||
|
|
||||||
if (stack.empty()) {
|
if (stack.empty()) {
|
||||||
new_stacks.push_back(stack);
|
new_stacks.emplace_back();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user