]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
whisper: remove MSVC warnings pragmas (#3090)
authorDaniel Bevenius <redacted>
Mon, 5 May 2025 11:09:35 +0000 (13:09 +0200)
committerGitHub <redacted>
Mon, 5 May 2025 11:09:35 +0000 (13:09 +0200)
* ggml : remove MSVC warnings pragmas

This commit removes the MSVC-specific pragmas as these are now handled
in CMakeLists.txt.

* whisper : remove MSVC warning pragmas

This commit removes the MSVC-specific pragmas. These are now handled in
the CMakeLists.txt file.

16 files changed:
CMakeLists.txt
examples/cli/cli.cpp
examples/common-whisper.cpp
examples/common.cpp
examples/server/server.cpp
examples/talk-llama/llama.cpp
ggml/CMakeLists.txt
ggml/src/ggml-cpu/ggml-cpu-aarch64.cpp
ggml/src/ggml-cpu/ggml-cpu-quants.c
ggml/src/ggml-cpu/ggml-cpu.c
ggml/src/ggml-cpu/ops.cpp
ggml/src/ggml-cpu/vec.cpp
ggml/src/ggml-cuda/common.cuh
ggml/src/ggml-quants.c
ggml/src/ggml-sycl/common.hpp
src/whisper.cpp

index fe82c65d103b7a40d2171e324c1dacb39ba72a33..b8ab1cced26067368cc4a391a63cd42747ac7f60 100644 (file)
@@ -232,6 +232,7 @@ if (MSVC)
     endfunction()
 
     if (WHISPER_BUILD_EXAMPLES)
+        disable_msvc_warnings(whisper)
         disable_msvc_warnings(common)
         disable_msvc_warnings(common-sdl)
         disable_msvc_warnings(lsp)
index b0acefd0d2f951da1c49338fa1b16fc6a2216564..f202ebd52595266e84918fb70bcaaca6b8986e81 100644 (file)
 #include <windows.h>
 #endif
 
-#if defined(_MSC_VER)
-#pragma warning(disable: 4244 4267) // possible loss of data
-#endif
-
 // helper function to replace substrings
 static void replace_all(std::string & s, const std::string & search, const std::string & replace) {
     for (size_t pos = 0; ; pos += replace.length()) {
index 6a9b58e00ff2818518f9e63e872861c91e7b1c37..8b9229edaf9dbc271c9a92248abc26dc28aeef35 100644 (file)
 #define MINIAUDIO_IMPLEMENTATION
 #include "miniaudio.h"
 
-#if defined(_MSC_VER)
-#pragma warning(disable: 4244 4267) // possible loss of data
-#endif
-
 #ifdef _WIN32
 #include <fcntl.h>
 #include <io.h>
index d23709d2144bf892f7c7da199b50604d9789f366..8eb633e58f4a6e8c03a5642bdaa9131900c00fc2 100644 (file)
 #include <regex>
 #include <sstream>
 
-#if defined(_MSC_VER)
-#pragma warning(disable: 4244 4267) // possible loss of data
-#endif
-
 // Function to check if the next argument exists
 static std::string get_next_arg(int& i, int argc, char** argv, const std::string& flag, gpt_params& params) {
     if (i + 1 < argc && argv[i + 1][0] != '-') {
index 97c12bdbce034869b68973139bae628c075dfee1..14462707ef181d3677bc732f72f9f0d592f2e16c 100644 (file)
 #include <thread>
 #include <vector>
 
-#if defined(_MSC_VER)
-#pragma warning(disable: 4244 4267) // possible loss of data
-#endif
-
 using namespace httplib;
 using json = nlohmann::ordered_json;
 
index d5164720b21962869b73483f21e49d4e3264272f..c52bbe5f2804f918afb0f49726c54497a998d670 100644 (file)
 #include <cstring>
 #include <ctime>
 
-#if defined(_MSC_VER)
-#pragma warning(disable: 4244 4267) // possible loss of data
-#endif
-
 //
 // interface implementation
 //
index b463cbd9b3c397c3985e00fc448e90a0a230c383..a8300e16d87fe19e72d4d6fe8d8de00c06baa316 100644 (file)
@@ -366,6 +366,8 @@ if (MSVC)
         /wd4005  # Macro redefinition
         /wd4244  # Conversion from one type to another type, possible loss of data
         /wd4267  # Conversion from 'size_t' to a smaller type, possible loss of data
+        /wd4996  # Disable POSIX deprecation warnings
+        /wd4702  # Unreachable code warnings
     )
     function(disable_msvc_warnings target_name)
         if(TARGET ${target_name})
index 175cba329b7474f1db17aca794b79e92a83e68cc..8ff6d64a4d0d153e18daa4c02e7f4a2111b94a5f 100644 (file)
@@ -72,8 +72,6 @@ static_assert(sizeof(block_iq4_nlx4) == 4 * sizeof(ggml_half) + QK4_NL * 2, "wro
 
 #if defined(__GNUC__)
 #pragma GCC diagnostic ignored "-Woverlength-strings"
-#elif defined(_MSC_VER)
-#pragma warning(disable: 4244 4267) // possible loss of data
 #endif
 
 #define UNUSED GGML_UNUSED
index 91a81bdc3ccd07c1e58287b00bdfbc97540720b8..aac589af916cd09c58fd2399952eda0dd0ad5724 100644 (file)
 #define GROUP_MAX_EPS_IQ1_M 1e-7f
 #define GROUP_MAX_EPS_IQ1_S 1e-12f
 
-#if defined(_MSC_VER)
-// disable "possible loss of data" to avoid warnings for hundreds of casts
-// we should just be careful :)
-#pragma warning(disable: 4244 4267)
-#endif
-
 #define UNUSED GGML_UNUSED
 
 // some compilers don't provide _mm256_set_m128i, e.g. gcc 7
index 64405449e2467f03c876e28a1982627b0e5c98f0..a30e67f22790015b4ac259150fa3962d0e798a4b 100644 (file)
 #include "llamafile/sgemm.h"
 #endif
 
-#if defined(_MSC_VER)
-// disable "possible loss of data" to avoid hundreds of casts
-// we should just be careful :)
-#pragma warning(disable: 4244 4267)
-
-// disable POSIX deprecation warnings
-// these functions are never going away, anyway
-#pragma warning(disable: 4996)
-
-// unreachable code because of multiple instances of code after GGML_ABORT
-#pragma warning(disable: 4702)
-#endif
-
 // Note: once we move threading into a separate C++ file
 // will use std::hardware_destructive_interference_size instead of hardcoding it here
 // and we'll use C++ attribute syntax.
index 7413192b746b62ad621dd0bdfcae43c818a5f9f9..955fec59a6e93e9a0d793c6a2bcddd94b7c00a64 100644 (file)
@@ -8,19 +8,6 @@
 
 #include <float.h>
 
-#if defined(_MSC_VER)
-// disable "possible loss of data" to avoid hundreds of casts
-// we should just be careful :)
-#pragma warning(disable: 4244 4267)
-
-// disable POSIX deprecation warnings
-// these functions are never going away, anyway
-#pragma warning(disable: 4996)
-
-// unreachable code because of multiple instances of code after GGML_ABORT
-#pragma warning(disable: 4702)
-#endif
-
 // ggml_compute_forward_dup
 
 static void ggml_compute_forward_dup_same_cont(
index dfe2218e309c461339c75d743cb70f2f17cc2a0c..02d4061822624ce11a47c0c1e33053e4658ca405 100644 (file)
@@ -2,12 +2,6 @@
 
 #include <cassert>
 
-#if defined(_MSC_VER)
-// disable "possible loss of data" to avoid hundreds of casts
-// we should just be careful :)
-#pragma warning(disable: 4244 4267)
-#endif
-
 // precomputed gelu table for f16 (128 KB)
 ggml_fp16_t ggml_table_gelu_f16[1 << 16];
 
index 2ea014e6476a7c08114329d78bbd103870c4dbec..919217dfaeed27f1cab4a3a313a43aaead4fb36a 100644 (file)
@@ -130,10 +130,6 @@ static int ggml_cuda_highest_compiled_arch(const int arch) {
 
 #define MATRIX_ROW_PADDING 512 // last row of quant. matrices is a multiple of this to avoid out-of-bounds memory accesses
 
-#if defined(_MSC_VER)
-#pragma warning(disable: 4244 4267) // possible loss of data
-#endif
-
 #define GGML_CUDA_MAX_STREAMS 8
 
 [[noreturn]]
index ac918a60d9eceb98a65ee934f4fcbef1cd2ed9e8..84ec6dfe31bfc1d3b085ec2e841371ecb3c000d6 100644 (file)
 #define GROUP_MAX_EPS_IQ1_M 1e-7f
 #define GROUP_MAX_EPS_IQ1_S 1e-12f
 
-#if defined(_MSC_VER)
-// disable "possible loss of data" to avoid warnings for hundreds of casts
-// we should just be careful :)
-#pragma warning(disable: 4244 4267)
-#endif
-
 #define UNUSED GGML_UNUSED
 
 // reference implementation for deterministic creation of model files
index c3d9d186456accfa9c34666ee153d4b4b29eb071..c71cc89c09eac55786590576e649acaa4b136653 100644 (file)
@@ -80,10 +80,6 @@ extern int g_ggml_sycl_disable_optimize;
 // max batch size to use MMQ kernels when tensor cores are available
 #define MMQ_MAX_BATCH_SIZE 32
 
-#if defined(_MSC_VER)
-#pragma warning(disable : 4244 4267) // possible loss of data
-#endif
-
 // dmmv = dequantize_mul_mat_vec
 #ifndef GGML_SYCL_DMMV_X
 #define GGML_SYCL_DMMV_X 32
index 53b0759238d16836b952b5a008acba4422b5af09..f8707e73098af60a4a7076f56115e065f39de66a 100644 (file)
 
 // dummy
 
-#if defined(_MSC_VER)
-#pragma warning(disable: 4244 4267) // possible loss of data
-#endif
-
 #if defined(WHISPER_BIG_ENDIAN)
 template<typename T>
 static T byteswap(T value) {