diff --git a/deps/ox/src/ox/clargs/CMakeLists.txt b/deps/ox/src/ox/clargs/CMakeLists.txt index e2899f95..06c399eb 100644 --- a/deps/ox/src/ox/clargs/CMakeLists.txt +++ b/deps/ox/src/ox/clargs/CMakeLists.txt @@ -1,4 +1,9 @@ -cmake_minimum_required(VERSION 3.10) + +if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") + # enable warnings + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunsafe-buffer-usage") +endif() + add_library( OxClArgs diff --git a/deps/ox/src/ox/clargs/clargs.cpp b/deps/ox/src/ox/clargs/clargs.cpp index 7cb8033a..bdf77939 100644 --- a/deps/ox/src/ox/clargs/clargs.cpp +++ b/deps/ox/src/ox/clargs/clargs.cpp @@ -12,16 +12,17 @@ namespace ox { ClArgs::ClArgs(int argc, const char **args) noexcept { + auto const argv = ox::SpanView{args, static_cast(argc)}; for (auto i = 0u; i < static_cast(argc); ++i) { - auto arg = String(args[i]); + auto arg = String(argv[i]); if (arg[0] == '-') { while (arg[0] == '-' && arg.len()) { arg = arg.substr(1); } m_bools[arg] = true; // parse additional arguments - if (i < static_cast(argc) && args[i + 1]) { - auto val = String(args[i + 1]); + if (i < static_cast(argc) && argv[i + 1]) { + auto val = String(argv[i + 1]); if (val.len() && val[i] != '-') { if (val == "false") { m_bools[arg] = false; diff --git a/deps/ox/src/ox/std/span.hpp b/deps/ox/src/ox/std/span.hpp index 8a229abb..68fa6c02 100644 --- a/deps/ox/src/ox/std/span.hpp +++ b/deps/ox/src/ox/std/span.hpp @@ -10,9 +10,12 @@ #include "array.hpp" #include "bit.hpp" +#include "def.hpp" #include "iterator.hpp" #include "vector.hpp" +OX_CLANG_NOWARN_BEGIN(-Wunsafe-buffer-usage) + namespace ox { template @@ -258,3 +261,5 @@ class Span { }; } + +OX_CLANG_NOWARN_END