Skip to content

Commit 262fb1f

Browse files
authored
chore: suppress more warnings on Windows (#2173)
1 parent 45b2706 commit 262fb1f

File tree

12 files changed

+17
-43
lines changed

12 files changed

+17
-43
lines changed

engine/CMakeLists.txt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,9 @@ project(cortex-server C CXX)
44

55
include(CheckIncludeFileCXX)
66

7-
check_include_file_cxx(any HAS_ANY)
8-
check_include_file_cxx(string_view HAS_STRING_VIEW)
9-
check_include_file_cxx(coroutine HAS_COROUTINE)
10-
if(HAS_ANY
11-
AND HAS_STRING_VIEW
12-
AND HAS_COROUTINE)
13-
set(CMAKE_CXX_STANDARD 20)
14-
elseif(HAS_ANY AND HAS_STRING_VIEW)
15-
set(CMAKE_CXX_STANDARD 17)
16-
else()
17-
set(CMAKE_CXX_STANDARD 14)
18-
endif()
19-
7+
set(CMAKE_CXX_STANDARD 17)
208
set(CMAKE_CXX_STANDARD_REQUIRED ON)
219
set(CMAKE_CXX_EXTENSIONS OFF)
22-
set(OPENSSL_USE_STATIC_LIBS TRUE)
2310
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2411

2512
# Add CORTEX_CQA option

engine/cli/CMakeLists.txt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,9 @@ project(cortex C CXX)
22

33
include(CheckIncludeFileCXX)
44

5-
check_include_file_cxx(any HAS_ANY)
6-
check_include_file_cxx(string_view HAS_STRING_VIEW)
7-
check_include_file_cxx(coroutine HAS_COROUTINE)
8-
if(HAS_ANY
9-
AND HAS_STRING_VIEW
10-
AND HAS_COROUTINE)
11-
set(CMAKE_CXX_STANDARD 20)
12-
elseif(HAS_ANY AND HAS_STRING_VIEW)
13-
set(CMAKE_CXX_STANDARD 17)
14-
else()
15-
set(CMAKE_CXX_STANDARD 14)
16-
endif()
17-
5+
set(CMAKE_CXX_STANDARD 17)
186
set(CMAKE_CXX_STANDARD_REQUIRED ON)
197
set(CMAKE_CXX_EXTENSIONS OFF)
20-
set(OPENSSL_USE_STATIC_LIBS TRUE)
218
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
229

2310
if(MSVC)

engine/cli/commands/engine_update_cmd.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool EngineUpdateCmd::Exec(const std::string& host, int port,
4545
try {
4646
Json::Value json = json_helper::ParseJsonString(update_result.error());
4747
std::cout << json["message"].asString() << std::endl;
48-
} catch (const std::exception& e) {
48+
} catch (const std::exception&) {
4949
CTL_ERR(update_result.error());
5050
}
5151

engine/config/gguf_parser.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void GGUFHandler::OpenFile(const std::string& file_path) {
8686
#endif
8787
}
8888

89-
void GGUFHandler::CheckOffset(int offset) const {
89+
void GGUFHandler::CheckOffset(size_t offset) const {
9090
if (offset > file_size_)
9191
throw std::runtime_error("Unexpected EOF");
9292
}

engine/config/gguf_parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class GGUFHandler {
4646
size_t ReadArray(std::size_t offset, const std::string& key);
4747
void ModelConfigFromMetadata();
4848
void OpenFile(const std::string& file_path);
49-
void CheckOffset(int offset) const;
49+
void CheckOffset(size_t offset) const;
5050

5151
uint8_t* data_;
5252
size_t file_size_;

engine/config/yaml_config.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void YamlHandler::ReadYamlFile(const std::string& file_path) {
5555
}
5656
}
5757

58-
} catch (const YAML::BadFile& e) {
58+
} catch (const YAML::BadFile&) {
5959
throw;
6060
}
6161
}

engine/database/engines.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ std::optional<EngineEntry> Engines::UpsertEngine(
6060
} else {
6161
return std::nullopt;
6262
}
63-
} catch (const std::exception& e) {
63+
} catch (const std::exception&) {
6464
return std::nullopt;
6565
}
6666
}
@@ -87,7 +87,7 @@ std::optional<std::vector<EngineEntry>> Engines::GetEngines() const {
8787
}
8888

8989
return engines;
90-
} catch (const std::exception& e) {
90+
} catch (const std::exception&) {
9191
return std::nullopt;
9292
}
9393
}
@@ -115,7 +115,7 @@ std::optional<EngineEntry> Engines::GetEngineById(int id) const {
115115
} else {
116116
return std::nullopt;
117117
}
118-
} catch (const std::exception& e) {
118+
} catch (const std::exception&) {
119119
return std::nullopt;
120120
}
121121
}
@@ -155,7 +155,7 @@ std::optional<EngineEntry> Engines::GetEngineByNameAndVariant(
155155
} else {
156156
return std::nullopt;
157157
}
158-
} catch (const std::exception& e) {
158+
} catch (const std::exception&) {
159159
return std::nullopt;
160160
}
161161
}

engine/migrations/migration_manager.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int GetSchemaVersion(SQLite::Database& db) {
2424
version =
2525
query.getColumn(0).getInt(); // Get the version from the first column
2626
}
27-
} catch (const std::exception& e) {
27+
} catch (const std::exception&) {
2828
// CTL_WRN("SQLite error: " << e.what());
2929
}
3030

engine/repositories/assistant_fs_repository.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ cpp::result<void, std::string> AssistantFsRepository::DeleteAssistant(
103103
}
104104
try {
105105
std::filesystem::remove_all(path);
106-
} catch (const std::exception& e) {
106+
} catch (const std::exception&) {
107107
return cpp::fail("");
108108
}
109109
}

engine/test/components/test_download_task_queue.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ TEST_F(DownloadTaskQueueTest, ConcurrentPushAndPop) {
107107
std::atomic<int> poppedTasks{0};
108108

109109
for (int i = 0; i < 4; ++i) {
110-
pushThreads.emplace_back([this, i, &pushedTasks]() {
110+
pushThreads.emplace_back([this, i, numTasks, &pushedTasks]() {
111111
for (int j = 0; j < numTasks; ++j) {
112112
queue.push(CreateDownloadTask("task_" + std::to_string(i) + "_" +
113113
std::to_string(j)));
114114
pushedTasks++;
115115
}
116116
});
117117

118-
popThreads.emplace_back([this, &poppedTasks, &pushedTasks]() {
118+
popThreads.emplace_back([this, numTasks, &poppedTasks, &pushedTasks]() {
119119
while (poppedTasks.load() < pushedTasks.load() ||
120120
pushedTasks.load() < numTasks * 4) {
121121
if (auto task = queue.pop()) {

engine/utils/dylib_path_manager.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "dylib_path_manager.h"
22
#include "utils/logging_utils.h"
3+
#include "utils/widechar_conv.h"
34

45
namespace cortex {
56

@@ -12,8 +13,7 @@ cpp::result<void, std::string> DylibPathManager::RegisterPath(
1213
return cpp::fail("Path does not exist: " + path.string());
1314
}
1415

15-
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
16-
std::wstring wide_path = converter.from_bytes(path.string());
16+
auto wide_path = cortex::wc::Utf8ToWstring(path.string());
1717

1818
auto cookie = AddDllDirectory(wide_path.c_str());
1919
if (cookie == nullptr) {

engine/utils/huggingface_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ inline cpp::result<std::string, std::string> GetModelAuthorCortexsoHub(
339339
return author.as<std::string>();
340340
}
341341
return "";
342-
} catch (const std::exception& e) {
342+
} catch (const std::exception&) {
343343
return "";
344344
}
345345
}

0 commit comments

Comments
 (0)