Skip to content

Commit 09846f4

Browse files
authored
whisper: remove MSVC warnings pragmas (ggml-org#3090)
* 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.
1 parent bcf1ed0 commit 09846f4

File tree

16 files changed

+3
-78
lines changed

16 files changed

+3
-78
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ if (MSVC)
232232
endfunction()
233233

234234
if (WHISPER_BUILD_EXAMPLES)
235+
disable_msvc_warnings(whisper)
235236
disable_msvc_warnings(common)
236237
disable_msvc_warnings(common-sdl)
237238
disable_msvc_warnings(lsp)

examples/cli/cli.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
#include <windows.h>
2121
#endif
2222

23-
#if defined(_MSC_VER)
24-
#pragma warning(disable: 4244 4267) // possible loss of data
25-
#endif
26-
2723
// helper function to replace substrings
2824
static void replace_all(std::string & s, const std::string & search, const std::string & replace) {
2925
for (size_t pos = 0; ; pos += replace.length()) {

examples/common-whisper.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
#define MINIAUDIO_IMPLEMENTATION
2727
#include "miniaudio.h"
2828

29-
#if defined(_MSC_VER)
30-
#pragma warning(disable: 4244 4267) // possible loss of data
31-
#endif
32-
3329
#ifdef _WIN32
3430
#include <fcntl.h>
3531
#include <io.h>

examples/common.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
#include <regex>
1111
#include <sstream>
1212

13-
#if defined(_MSC_VER)
14-
#pragma warning(disable: 4244 4267) // possible loss of data
15-
#endif
16-
1713
// Function to check if the next argument exists
1814
static std::string get_next_arg(int& i, int argc, char** argv, const std::string& flag, gpt_params& params) {
1915
if (i + 1 < argc && argv[i + 1][0] != '-') {

examples/server/server.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
#include <thread>
1515
#include <vector>
1616

17-
#if defined(_MSC_VER)
18-
#pragma warning(disable: 4244 4267) // possible loss of data
19-
#endif
20-
2117
using namespace httplib;
2218
using json = nlohmann::ordered_json;
2319

examples/talk-llama/llama.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
#include <cstring>
1717
#include <ctime>
1818

19-
#if defined(_MSC_VER)
20-
#pragma warning(disable: 4244 4267) // possible loss of data
21-
#endif
22-
2319
//
2420
// interface implementation
2521
//

ggml/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ if (MSVC)
366366
/wd4005 # Macro redefinition
367367
/wd4244 # Conversion from one type to another type, possible loss of data
368368
/wd4267 # Conversion from 'size_t' to a smaller type, possible loss of data
369+
/wd4996 # Disable POSIX deprecation warnings
370+
/wd4702 # Unreachable code warnings
369371
)
370372
function(disable_msvc_warnings target_name)
371373
if(TARGET ${target_name})

ggml/src/ggml-cpu/ggml-cpu-aarch64.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ static_assert(sizeof(block_iq4_nlx4) == 4 * sizeof(ggml_half) + QK4_NL * 2, "wro
7272

7373
#if defined(__GNUC__)
7474
#pragma GCC diagnostic ignored "-Woverlength-strings"
75-
#elif defined(_MSC_VER)
76-
#pragma warning(disable: 4244 4267) // possible loss of data
7775
#endif
7876

7977
#define UNUSED GGML_UNUSED

ggml/src/ggml-cpu/ggml-cpu-quants.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
#define GROUP_MAX_EPS_IQ1_M 1e-7f
2121
#define GROUP_MAX_EPS_IQ1_S 1e-12f
2222

23-
#if defined(_MSC_VER)
24-
// disable "possible loss of data" to avoid warnings for hundreds of casts
25-
// we should just be careful :)
26-
#pragma warning(disable: 4244 4267)
27-
#endif
28-
2923
#define UNUSED GGML_UNUSED
3024

3125
// some compilers don't provide _mm256_set_m128i, e.g. gcc 7

ggml/src/ggml-cpu/ggml-cpu.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,6 @@
5050
#include "llamafile/sgemm.h"
5151
#endif
5252

53-
#if defined(_MSC_VER)
54-
// disable "possible loss of data" to avoid hundreds of casts
55-
// we should just be careful :)
56-
#pragma warning(disable: 4244 4267)
57-
58-
// disable POSIX deprecation warnings
59-
// these functions are never going away, anyway
60-
#pragma warning(disable: 4996)
61-
62-
// unreachable code because of multiple instances of code after GGML_ABORT
63-
#pragma warning(disable: 4702)
64-
#endif
65-
6653
// Note: once we move threading into a separate C++ file
6754
// will use std::hardware_destructive_interference_size instead of hardcoding it here
6855
// and we'll use C++ attribute syntax.

0 commit comments

Comments
 (0)