[ox/clargs] Enable unsafe buffer warnings
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
parent
9b8a8c4e46
commit
dbbaaa46b9
7
deps/ox/src/ox/clargs/CMakeLists.txt
vendored
7
deps/ox/src/ox/clargs/CMakeLists.txt
vendored
@ -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
|
||||
|
7
deps/ox/src/ox/clargs/clargs.cpp
vendored
7
deps/ox/src/ox/clargs/clargs.cpp
vendored
@ -12,16 +12,17 @@
|
||||
namespace ox {
|
||||
|
||||
ClArgs::ClArgs(int argc, const char **args) noexcept {
|
||||
auto const argv = ox::SpanView{args, static_cast<size_t>(argc)};
|
||||
for (auto i = 0u; i < static_cast<unsigned>(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<unsigned>(argc) && args[i + 1]) {
|
||||
auto val = String(args[i + 1]);
|
||||
if (i < static_cast<unsigned>(argc) && argv[i + 1]) {
|
||||
auto val = String(argv[i + 1]);
|
||||
if (val.len() && val[i] != '-') {
|
||||
if (val == "false") {
|
||||
m_bools[arg] = false;
|
||||
|
5
deps/ox/src/ox/std/span.hpp
vendored
5
deps/ox/src/ox/std/span.hpp
vendored
@ -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<typename T>
|
||||
@ -258,3 +261,5 @@ class Span {
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
OX_CLANG_NOWARN_END
|
||||
|
Loading…
Reference in New Issue
Block a user