Skip to content

Commit

Permalink
Turn on Werror for MSVC (#31)
Browse files Browse the repository at this point in the history
* werror turn on for msvc

* patch for msvc build

* include etl lib as system for safety
  • Loading branch information
kh9sd authored Nov 1, 2023
1 parent 71b42f1 commit a956320
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ string(JOIN ";" private_CLANG_WARNINGS_LIST
string(JOIN ";" private_MSVC_WARNINGS_LIST # msvc specifies warning levels, not individual flags
/W4 # general warning set
/permissive- # makes msvc warn about non-standard code
# /WX # makes warnings errors # cannot currently use this flag,
# msvc warns on external libs for some reason
/WX # makes warnings errors
)

# warnings list to use, will apply correct set of flags depending on current compiler
Expand All @@ -112,6 +111,8 @@ include_directories(src)
# typically we would prefer target_link_libraries, except it makes
# sense to treat etl as the stdlib, which we never have to explicitly link to
link_libraries(etl::etl)
# include as system in case it warnings
include_directories(SYSTEM etl::etl)

# when adding a new subdirectory, don't forget to compile it with WARNINGS_LIST if appropriate
add_subdirectory(catch_tests)
Expand All @@ -120,7 +121,7 @@ add_subdirectory(external)

add_executable(ecs_quick main_tweak.cpp)
target_link_libraries(ecs_quick PUBLIC
watchdog
fake-watchdog
constants)

add_executable(ecs_pi main_pi.cpp)
Expand Down
3 changes: 2 additions & 1 deletion src/utils/SensorDataUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ namespace{
total += selectorFct(sensorData);
}

return total / datas.size();
// TODO: this cast is technically iffy, but once we switch to fixed size vectors we should be safe
return total / static_cast<int>(datas.size());
}
}

Expand Down

0 comments on commit a956320

Please sign in to comment.