From a4f761574098131c6196659e0dd4f31bb924c5a5 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Tue, 18 Oct 2022 10:56:37 +0300 Subject: [PATCH] ref #62 : fix build for some compilers For some reason, new version of GCC panic when the struct type is not specified explicitly --- .gitignore | 2 ++ whisper.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b34c5126fb1..f7e302c4657 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ stream .cache build/ build-em/ +build-debug/ +build-release/ out/ .vs/ .vscode/ diff --git a/whisper.cpp b/whisper.cpp index 8ef20cb85e6..61d0a8a249d 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -2262,7 +2262,11 @@ struct whisper_full_params whisper_full_default_params(enum whisper_decode_strat switch (strategy) { case WHISPER_DECODE_GREEDY: { +#if defined(_MSC_VER) result = { +#else + result = (struct whisper_full_params) { +#endif .strategy = WHISPER_DECODE_GREEDY, .n_threads = std::min(4, (int32_t) std::thread::hardware_concurrency()), .offset_ms = 0, @@ -2283,8 +2287,12 @@ struct whisper_full_params whisper_full_default_params(enum whisper_decode_strat } break; case WHISPER_DECODE_BEAM_SEARCH: { +#if defined(_MSC_VER) result = { - .strategy = WHISPER_DECODE_GREEDY, +#else + result = (struct whisper_full_params) { +#endif + .strategy = WHISPER_DECODE_BEAM_SEARCH, .n_threads = std::min(4, (int32_t) std::thread::hardware_concurrency()), .offset_ms = 0,