Skip to content

Commit

Permalink
Fix gcc warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Dec 23, 2023
1 parent 2c533c3 commit 435dda1
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 32 deletions.
1 change: 0 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
run: >
sudo apt update &&
sudo apt install
cmake
ninja-build
gcovr
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: Install dependencies
run: |
sudo apt install ninja-build cmake wget
sudo apt install ninja-build wget
- name: Install GCC
run: |
Expand Down
25 changes: 24 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.23)
cmake_minimum_required(VERSION 3.23...3.27)

file(STRINGS VERSION CURRENT_VERSION)
project(patch-init-firmware VERSION ${CURRENT_VERSION} LANGUAGES C CXX)
Expand Down Expand Up @@ -35,3 +35,26 @@ if(CMAKE_CROSSCOMPILING)
add_subdirectory(src/hades)
add_subdirectory(src/kyma)
endif()

if(NOT CMAKE_CROSSCOMPILING)
add_executable(gw-eurorack-tests)
add_test(NAME gw-eurorack-tests COMMAND gw-eurorack-tests)
target_link_libraries(gw-eurorack-tests PRIVATE gw::eurorack)
target_compile_options(gw-eurorack-tests PRIVATE "-Wall" "-Wextra" "-Wpedantic")
target_sources(gw-eurorack-tests
PRIVATE
"lib/main_test.cpp"

"lib/gw/audio/delay/static_delay_line_test.cpp"
"lib/gw/audio/dither/no_dither_test.cpp"
"lib/gw/audio/dither/rectangle_dither_test.cpp"
"lib/gw/audio/dither/triangle_dither_test.cpp"
"lib/gw/audio/envelope/envelope_follower_test.cpp"
"lib/gw/audio/music/note_test.cpp"
"lib/gw/audio/noise/white_noise_test.cpp"
"lib/gw/audio/unit/decibel_test.cpp"
"lib/gw/fft/fft_test.cpp"
"lib/gw/math/ilog2_test.cpp"
"lib/gw/math/ipow_test.cpp"
)
endif()
71 changes: 46 additions & 25 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,51 @@
project(gw_eurorack)
cmake_minimum_required(VERSION 3.23...3.27)
project(gw-eurorack)

add_library(gw_eurorack INTERFACE)
add_library(gw::eurorack ALIAS gw_eurorack)
target_include_directories(gw_eurorack INTERFACE ${PROJECT_SOURCE_DIR})
target_link_libraries(gw_eurorack INTERFACE tetl::etl)
add_library(gw-eurorack INTERFACE)
add_library(gw::eurorack ALIAS gw-eurorack)
target_compile_features(gw-eurorack INTERFACE cxx_std_20)
target_link_libraries(gw-eurorack INTERFACE tetl::etl)

if(CMAKE_CROSSCOMPILING)
return()
endif()
target_sources(gw-eurorack INTERFACE
FILE_SET
HEADERS
BASE_DIRS
${PROJECT_SOURCE_DIR}
FILES
"gw/audio/delay/delay_line.hpp"
"gw/audio/delay/static_delay_line.hpp "
"gw/audio/dither/no_dither.hpp"
"gw/audio/dither/rectangle_dither.hpp"
"gw/audio/dither/triangle_dither.hpp"
"gw/audio/dynamic/compressor.hpp"
"gw/audio/envelope/adsr.hpp"
"gw/audio/mix/cross_fade.hpp"
"gw/audio/music/note.hpp"
"gw/audio/noise/white_noise.hpp"
"gw/audio/oscillator/oscillator.hpp"
"gw/audio/oscillator/variable_shape_oscillator.hpp"
"gw/audio/oscillator/wavetable_oscillator.hpp"
"gw/audio/unit/time.hpp"
"gw/audio/waveshape/wave_shaper.hpp"

add_executable(gw_eurorack_tests)
add_test(NAME gw_eurorack_tests COMMAND gw_eurorack_tests)
target_link_libraries(gw_eurorack_tests PRIVATE gw::eurorack)
target_sources(gw_eurorack_tests
PRIVATE
main_test.cpp
"gw/core/arm.hpp"
"gw/core/benchmark.hpp"
"gw/core/config.hpp"
"gw/core/mdspan.hpp"

gw/audio/delay/static_delay_line_test.cpp
gw/audio/dither/no_dither_test.cpp
gw/audio/dither/rectangle_dither_test.cpp
gw/audio/dither/triangle_dither_test.cpp
gw/audio/envelope/envelope_follower_test.cpp
gw/audio/music/note_test.cpp
gw/audio/noise/white_noise_test.cpp
gw/audio/unit/decibel_test.cpp
gw/fft/fft_test.cpp
gw/math/ilog2_test.cpp
gw/math/ipow_test.cpp
"gw/eurorack/hades.hpp"

"gw/fft/bitrevorder.hpp"
"gw/fft/direction.hpp"
"gw/fft/fft.hpp"

"gw/math/buffer_interpolation.hpp"
"gw/math/dynamic_smoothing.hpp"
"gw/math/fast_lerp.hpp"
"gw/math/hermite_interpolation.hpp"
"gw/math/ilog2.hpp"
"gw/math/ipow.hpp"
"gw/math/range.hpp"

"gw/testing/approx.hpp"
)
3 changes: 2 additions & 1 deletion lib/gw/audio/dither/no_dither_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ template<typename URNG>
auto dither = gw::NoDither<URNG>{std::random_device{}()};
for (auto i{0}; i < 100; ++i) {
auto const val = dither(1.0F);
assert(0.5 <= val <= 1.5);
assert(val >= 0.5);
assert(val <= 1.5);
assert(gw::approx(val, 1.0F));
}

Expand Down
4 changes: 3 additions & 1 deletion lib/gw/audio/dither/rectangle_dither_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ template<typename URNG>
{
auto dither = gw::RectangleDither<URNG>{std::random_device{}()};
for (auto i{0}; i < 100; ++i) {
assert(0.5 <= dither(1.0F) <= 1.5);
auto const val = dither(1.0F);
assert(val >= 0.5);
assert(val <= 1.5);
}

return true;
Expand Down
4 changes: 3 additions & 1 deletion lib/gw/audio/dither/triangle_dither_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ template<typename URNG>
{
auto dither = gw::TriangleDither<URNG>{std::random_device{}()};
for (auto i{0}; i < 100; ++i) {
assert(0.5 <= dither(1.0F) <= 1.5);
auto const val = dither(1.0F);
assert(val >= 0.5);
assert(val <= 1.5);
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion lib/gw/fft/fft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ struct static_c2c_dit2_stage

template<int Stage, etl::linalg::inout_vector InOutVec, etl::linalg::in_vector InVec>
requires(Stage == 0)
[[gnu::noinline]] auto static_dit2_stage_v2(InOutVec x, InVec w, int order) -> void
[[gnu::noinline]] auto static_dit2_stage_v2(InOutVec x, InVec /*w*/, int order) -> void
{
static constexpr auto const stage_length = 1; // ipow<2>(0)
static constexpr auto const stride = 2; // ipow<2>(0 + 1)
Expand Down
1 change: 1 addition & 0 deletions src/astra/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cmake_minimum_required(VERSION 3.23...3.27)
project(astra)

add_baremetal_executable(${PROJECT_NAME} ${LINKER_SCRIPT})
Expand Down
1 change: 1 addition & 0 deletions src/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cmake_minimum_required(VERSION 3.23...3.27)
project(benchmark)

add_baremetal_executable(${PROJECT_NAME} ${LINKER_SCRIPT})
Expand Down
1 change: 1 addition & 0 deletions src/hades/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cmake_minimum_required(VERSION 3.23...3.27)
project(hades)

add_baremetal_executable(${PROJECT_NAME} ${LINKER_SCRIPT})
Expand Down
1 change: 1 addition & 0 deletions src/kyma/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cmake_minimum_required(VERSION 3.23...3.27)
project(kyma)

add_baremetal_executable(${PROJECT_NAME} ${LINKER_SCRIPT})
Expand Down

0 comments on commit 435dda1

Please sign in to comment.