Skip to content

chore: suppress more warnings on Windows #2173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,9 @@ project(cortex-server C CXX)

include(CheckIncludeFileCXX)

check_include_file_cxx(any HAS_ANY)
check_include_file_cxx(string_view HAS_STRING_VIEW)
check_include_file_cxx(coroutine HAS_COROUTINE)
if(HAS_ANY
AND HAS_STRING_VIEW
AND HAS_COROUTINE)
set(CMAKE_CXX_STANDARD 20)
elseif(HAS_ANY AND HAS_STRING_VIEW)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 14)
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(OPENSSL_USE_STATIC_LIBS TRUE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Add CORTEX_CQA option
Expand Down
15 changes: 1 addition & 14 deletions engine/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,9 @@ project(cortex C CXX)

include(CheckIncludeFileCXX)

check_include_file_cxx(any HAS_ANY)
check_include_file_cxx(string_view HAS_STRING_VIEW)
check_include_file_cxx(coroutine HAS_COROUTINE)
if(HAS_ANY
AND HAS_STRING_VIEW
AND HAS_COROUTINE)
set(CMAKE_CXX_STANDARD 20)
elseif(HAS_ANY AND HAS_STRING_VIEW)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 14)
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(OPENSSL_USE_STATIC_LIBS TRUE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(MSVC)
Expand Down
2 changes: 1 addition & 1 deletion engine/cli/commands/engine_update_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool EngineUpdateCmd::Exec(const std::string& host, int port,
try {
Json::Value json = json_helper::ParseJsonString(update_result.error());
std::cout << json["message"].asString() << std::endl;
} catch (const std::exception& e) {
} catch (const std::exception&) {
CTL_ERR(update_result.error());
}

Expand Down
2 changes: 1 addition & 1 deletion engine/config/gguf_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void GGUFHandler::OpenFile(const std::string& file_path) {
#endif
}

void GGUFHandler::CheckOffset(int offset) const {
void GGUFHandler::CheckOffset(size_t offset) const {
if (offset > file_size_)
throw std::runtime_error("Unexpected EOF");
}
Expand Down
2 changes: 1 addition & 1 deletion engine/config/gguf_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class GGUFHandler {
size_t ReadArray(std::size_t offset, const std::string& key);
void ModelConfigFromMetadata();
void OpenFile(const std::string& file_path);
void CheckOffset(int offset) const;
void CheckOffset(size_t offset) const;

uint8_t* data_;
size_t file_size_;
Expand Down
2 changes: 1 addition & 1 deletion engine/config/yaml_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void YamlHandler::ReadYamlFile(const std::string& file_path) {
}
}

} catch (const YAML::BadFile& e) {
} catch (const YAML::BadFile&) {
throw;
}
}
Expand Down
8 changes: 4 additions & 4 deletions engine/database/engines.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ std::optional<EngineEntry> Engines::UpsertEngine(
} else {
return std::nullopt;
}
} catch (const std::exception& e) {
} catch (const std::exception&) {
return std::nullopt;
}
}
Expand All @@ -87,7 +87,7 @@ std::optional<std::vector<EngineEntry>> Engines::GetEngines() const {
}

return engines;
} catch (const std::exception& e) {
} catch (const std::exception&) {
return std::nullopt;
}
}
Expand Down Expand Up @@ -115,7 +115,7 @@ std::optional<EngineEntry> Engines::GetEngineById(int id) const {
} else {
return std::nullopt;
}
} catch (const std::exception& e) {
} catch (const std::exception&) {
return std::nullopt;
}
}
Expand Down Expand Up @@ -155,7 +155,7 @@ std::optional<EngineEntry> Engines::GetEngineByNameAndVariant(
} else {
return std::nullopt;
}
} catch (const std::exception& e) {
} catch (const std::exception&) {
return std::nullopt;
}
}
Expand Down
2 changes: 1 addition & 1 deletion engine/migrations/migration_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int GetSchemaVersion(SQLite::Database& db) {
version =
query.getColumn(0).getInt(); // Get the version from the first column
}
} catch (const std::exception& e) {
} catch (const std::exception&) {
// CTL_WRN("SQLite error: " << e.what());
}

Expand Down
2 changes: 1 addition & 1 deletion engine/repositories/assistant_fs_repository.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ cpp::result<void, std::string> AssistantFsRepository::DeleteAssistant(
}
try {
std::filesystem::remove_all(path);
} catch (const std::exception& e) {
} catch (const std::exception&) {
return cpp::fail("");
}
}
Expand Down
4 changes: 2 additions & 2 deletions engine/test/components/test_download_task_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ TEST_F(DownloadTaskQueueTest, ConcurrentPushAndPop) {
std::atomic<int> poppedTasks{0};

for (int i = 0; i < 4; ++i) {
pushThreads.emplace_back([this, i, &pushedTasks]() {
pushThreads.emplace_back([this, i, numTasks, &pushedTasks]() {
for (int j = 0; j < numTasks; ++j) {
queue.push(CreateDownloadTask("task_" + std::to_string(i) + "_" +
std::to_string(j)));
pushedTasks++;
}
});

popThreads.emplace_back([this, &poppedTasks, &pushedTasks]() {
popThreads.emplace_back([this, numTasks, &poppedTasks, &pushedTasks]() {
while (poppedTasks.load() < pushedTasks.load() ||
pushedTasks.load() < numTasks * 4) {
if (auto task = queue.pop()) {
Expand Down
4 changes: 2 additions & 2 deletions engine/utils/dylib_path_manager.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "dylib_path_manager.h"
#include "utils/logging_utils.h"
#include "utils/widechar_conv.h"

namespace cortex {

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

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

auto cookie = AddDllDirectory(wide_path.c_str());
if (cookie == nullptr) {
Expand Down
2 changes: 1 addition & 1 deletion engine/utils/huggingface_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ inline cpp::result<std::string, std::string> GetModelAuthorCortexsoHub(
return author.as<std::string>();
}
return "";
} catch (const std::exception& e) {
} catch (const std::exception&) {
return "";
}
}
Expand Down
Loading