diff --git a/.clang-tidy b/.clang-tidy index 1660a0d52..488d0ab2f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -9,7 +9,6 @@ Checks: > WarningsAsErrors: '*' HeaderFilterRegex: '.*' -AnalyzeTemporaryDtors: false FormatStyle: none User: john CheckOptions: diff --git a/.github/workflows/real-time-cpp-benchmarks.yml b/.github/workflows/real-time-cpp-benchmarks.yml index 98eb3c3e5..0fc40a38d 100644 --- a/.github/workflows/real-time-cpp-benchmarks.yml +++ b/.github/workflows/real-time-cpp-benchmarks.yml @@ -189,7 +189,7 @@ jobs: ./bin/app_benchmark_cnl_scaled_integer.exe working-directory: ./ref_app/ benchmark_single-stm32f429-qemu-cnl: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 defaults: run: shell: bash @@ -226,7 +226,7 @@ jobs: echo "qemu_result" "$qemu_result" | grep 'qemu_result 0' working-directory: ./ref_app/ benchmark_single-stm32f429-qemu: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 defaults: run: shell: bash diff --git a/.tidy/make/make_tidy_03_flags.gmk b/.tidy/make/make_tidy_03_flags.gmk index bf8fe8270..a1866054a 100644 --- a/.tidy/make/make_tidy_03_flags.gmk +++ b/.tidy/make/make_tidy_03_flags.gmk @@ -1,5 +1,5 @@ # ------------------------------------------------------------------------------ -# Copyright Christopher Kormanyos 2022. +# Copyright Christopher Kormanyos 2022 - 2024. # Distributed under the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt # or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -36,12 +36,29 @@ C_INCLUDES :=$(addprefix -I,$(C_INCLUDES)) TIDY_CHECKS = "*, \ - -altera-struct-pack-align, \ - -altera-unroll-loops, \ - -fuchsia-*, \ - -llvmlibc-*" + -cert-dcl58-cpp, \ + -cppcoreguidelines-rvalue-reference-param-not-moved, \ + -cppcoreguidelines-avoid-do-while, \ + -llvm-header-guard, \ + -cppcoreguidelines-macro-usage, \ + -hicpp-named-parameter, \ + -modernize-type-traits, \ + -modernize-use-constraints, \ + -modernize-use-trailing-return-type, \ + -misc-header-include-cycle, \ + -misc-include-cleaner, \ + -misc-const-correctness, \ + -performance-avoid-endl, \ + -readability-avoid-const-params-in-decls, \ + -readability-identifier-length, \ + -readability-identifier-naming, \ + -readability-named-parameter, \ + -readability-redundant-casting, \ + -altera-struct-pack-align, \ + -altera-unroll-loops, \ + -fuchsia-*, \ + -llvmlibc-*" TIDY_FLAGS = --extra-arg-before=--driver-mode=g++ \ - --header-filter=decwide_t \ -warnings-as-errors=* \ -checks=$(TIDY_CHECKS) diff --git a/code_snippets/chapter07/chapter07_01-001_register_address.c b/code_snippets/chapter07/chapter07_01-001_register_address.c index 91c84eae3..1fecbbf87 100644 --- a/code_snippets/chapter07/chapter07_01-001_register_address.c +++ b/code_snippets/chapter07/chapter07_01-001_register_address.c @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2019. +// Copyright Christopher Kormanyos 2019 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -15,16 +15,19 @@ static uint8_t simulated_register_portb; // The simulated address of portb. #define REG_PORTB ((uintptr_t) &simulated_register_portb) -void do_something() +void do_something(void); + +void do_something(void) { // Set portb to 0. *((volatile uint8_t*) REG_PORTB) = UINT8_C(0); } -int main() +int main(void); + +int main(void) { do_something(); - printf("simulated_register_portb: %d\n", - (unsigned) simulated_register_portb); + printf("simulated_register_portb: %d\n", (unsigned) simulated_register_portb); } diff --git a/ref_app/src/app/benchmark/app_benchmark.h b/ref_app/src/app/benchmark/app_benchmark.h index fcafcf013..345041b4b 100644 --- a/ref_app/src/app/benchmark/app_benchmark.h +++ b/ref_app/src/app/benchmark/app_benchmark.h @@ -110,6 +110,7 @@ #error APP_BENCHMARK_TYPE is undefined. #endif - } } // namespace app:::benchmark + } // namespace benchmark + } // namespace app #endif // APP_BENCHMARK_2018_10_02_H diff --git a/ref_app/src/app/benchmark/app_benchmark_detail.h b/ref_app/src/app/benchmark/app_benchmark_detail.h index fbd30f474..c1dd3e636 100644 --- a/ref_app/src/app/benchmark/app_benchmark_detail.h +++ b/ref_app/src/app/benchmark/app_benchmark_detail.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2022. +// Copyright Christopher Kormanyos 2007 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -14,8 +14,8 @@ namespace app { namespace benchmark { namespace detail { template - auto is_close_fraction(const NumericType a, - const NumericType b, + auto is_close_fraction(const NumericType a, // NOLINT(bugprone-easily-swappable-parameters) + const NumericType b, // NOLINT(bugprone-easily-swappable-parameters) const NumericType tol = NumericType(std::numeric_limits::epsilon() * NumericType(100))) -> bool { using std::fabs; @@ -27,6 +27,8 @@ return (closeness < tol); } - } } } // namespace app::benchmark::detail + } // namespace detail + } // namespace benchmark + } // namespace app #endif // APP_BENCHMARK_DETAIL_2018_10_02_H diff --git a/ref_app/src/app/benchmark/app_benchmark_trapezoid_integral.cpp b/ref_app/src/app/benchmark/app_benchmark_trapezoid_integral.cpp index c31ca7cb1..21437bdaa 100644 --- a/ref_app/src/app/benchmark/app_benchmark_trapezoid_integral.cpp +++ b/ref_app/src/app/benchmark/app_benchmark_trapezoid_integral.cpp @@ -17,45 +17,41 @@ #if defined(_MSC_VER) #include -namespace app { namespace benchmark { - -using my_float_type = double; - -} // namespace benchmark -} // namespace app #elif (defined(__has_include) && (__has_include())) #include -namespace app { namespace benchmark { +#else -#if (defined(__STDCPP_FLOAT64_T__) && (__STDCPP_FLOAT64_T__ == 1)) +#include -using my_float_type = std::float64_t; +#endif -#else +#if (defined(STDFLOAT_FLOAT64_NATIVE_TYPE) || (defined(__STDCPP_FLOAT64_T__) && (__STDCPP_FLOAT64_T__ == 1))) -using my_float_type = float; +using local_float_type = std::float64_t; +static_assert((std::numeric_limits::digits >= 53), "Error: Incorrect my_float_type type definition"); -#endif +#elif (defined(STDFLOAT_FLOAT32_NATIVE_TYPE) || (defined(__STDCPP_FLOAT32_T__) && (__STDCPP_FLOAT32_T__ == 1))) -} // namespace benchmark -} // namespace app +using local_float_type = std::float32_t; +static_assert((std::numeric_limits::digits >= 24), "Error: Incorrect my_float_type type definition"); #else -#include +using local_float_type = double; +static_assert((std::numeric_limits::digits >= 53), "Error: Incorrect my_float_type type definition"); + +#endif namespace app { namespace benchmark { -using my_float_type = std::floatmax_t; +using my_float_type = ::local_float_type; } // namespace benchmark } // namespace app -#endif - #include #include #include @@ -95,17 +91,10 @@ namespace auto app::benchmark::run_trapezoid_integral() -> bool { - #if (defined(__GNUC__) && defined(__AVR__) && (__GNUC__ < 12)) - static_assert((std::numeric_limits::digits >= 24), "Error: Incorrect my_float_type type definition"); - #else - static_assert((std::numeric_limits::digits >= 53), "Error: Incorrect my_float_type type definition"); - #endif - constexpr auto app_benchmark_tolerance = static_cast ( - std::numeric_limits::epsilon() - * static_cast(100.0L) + std::numeric_limits::epsilon() * static_cast(100.0L) ); // Compute y = cyl_bessel_j(2, 1.23) = 0.16636938378681407351267852431513159437103348245333 diff --git a/ref_app/src/app/benchmark/app_benchmark_wide_integer.cpp b/ref_app/src/app/benchmark/app_benchmark_wide_integer.cpp index 79e1ffcfd..008035cc6 100644 --- a/ref_app/src/app/benchmark/app_benchmark_wide_integer.cpp +++ b/ref_app/src/app/benchmark/app_benchmark_wide_integer.cpp @@ -74,7 +74,7 @@ namespace #if (defined(APP_BENCHMARK_WIDE_INTEGER_CONSTEXPR_IS_COMPILE_TIME_CONSTANT) \ && (APP_BENCHMARK_WIDE_INTEGER_CONSTEXPR_IS_COMPILE_TIME_CONSTANT == 1)) - static_assert(result_of_mul_is_ok == true, "Error: result_of_mul_is_ok not OK!"); + static_assert(result_of_mul_is_ok, "Error: result_of_mul_is_ok not OK!"); #endif return result_of_mul_is_ok; @@ -88,7 +88,7 @@ namespace #if (defined(APP_BENCHMARK_WIDE_INTEGER_CONSTEXPR_IS_COMPILE_TIME_CONSTANT) \ && (APP_BENCHMARK_WIDE_INTEGER_CONSTEXPR_IS_COMPILE_TIME_CONSTANT == 1)) - static_assert(result_of_div_is_ok == true, "Error: result_of_div_is_ok not OK!"); + static_assert(result_of_div_is_ok, "Error: result_of_div_is_ok not OK!"); #endif return result_of_div_is_ok; @@ -100,7 +100,7 @@ namespace #if (defined(APP_BENCHMARK_WIDE_INTEGER_CONSTEXPR_IS_COMPILE_TIME_CONSTANT) \ && (APP_BENCHMARK_WIDE_INTEGER_CONSTEXPR_IS_COMPILE_TIME_CONSTANT == 1)) - static_assert(result_of_mod_is_ok == true, "Error: result_of_div_is_ok not OK!"); + static_assert(result_of_mod_is_ok, "Error: result_of_div_is_ok not OK!"); #endif return result_of_mod_is_ok; diff --git a/ref_app/src/math/extended_complex/extended_complex.h b/ref_app/src/math/extended_complex/extended_complex.h index dff6edbed..0b8eef2d9 100644 --- a/ref_app/src/math/extended_complex/extended_complex.h +++ b/ref_app/src/math/extended_complex/extended_complex.h @@ -1000,10 +1000,10 @@ // and the +- sign is the same as the sign of zi. const bool real_part_is_neg(my_z.real() < T(static_cast(UINT8_C(0)))); - const T real_part_fabs ((real_part_is_neg == false) ? my_z.real() : -my_z.real()); + const T real_part_fabs ((!real_part_is_neg) ? my_z.real() : -my_z.real()); const T s_part (sqrt((real_part_fabs + abs(my_z)) / static_cast(UINT8_C(2)))); - if(real_part_is_neg == false) + if(!real_part_is_neg) { return complex(s_part, my_z.imag() / (s_part * static_cast(UINT8_C(2)))); @@ -1011,10 +1011,10 @@ else { const bool imag_part_is_neg(my_z.imag() < T(static_cast(UINT8_C(0)))); - const T imag_part_fabs ((imag_part_is_neg == false) ? my_z.imag() : -my_z.imag()); + const T imag_part_fabs ((!imag_part_is_neg) ? my_z.imag() : -my_z.imag()); - return complex( imag_part_fabs / (s_part * static_cast(UINT8_C(2))), - ((imag_part_is_neg == false) ? s_part : -s_part)); + return complex( imag_part_fabs / (s_part * static_cast(UINT8_C(2))), + ((!imag_part_is_neg) ? s_part : -s_part)); } } diff --git a/ref_app/src/math/fixed_point/fixed_point.h b/ref_app/src/math/fixed_point/fixed_point.h index 25e690e49..9f8ade580 100644 --- a/ref_app/src/math/fixed_point/fixed_point.h +++ b/ref_app/src/math/fixed_point/fixed_point.h @@ -51,7 +51,7 @@ static const unsigned_short_type decimal_split_mask = unsigned_value_type(decimal_split_value) - 1U; // Ensure that the underlying integer type of the fixed_point class is signed. - static_assert(std::numeric_limits::is_signed == true, + static_assert(std::numeric_limits::is_signed, "the fixed point signed_value_type must be signed"); // Another template kind of this class itself is a friend. diff --git a/ref_app/src/math/functions/math_functions_hypergeometric.h b/ref_app/src/math/functions/math_functions_hypergeometric.h index 4470df035..8c937f802 100644 --- a/ref_app/src/math/functions/math_functions_hypergeometric.h +++ b/ref_app/src/math/functions/math_functions_hypergeometric.h @@ -26,7 +26,7 @@ { template auto hypergeometric_0f1(T b, - T x, + T x, T tolerance = std::numeric_limits::epsilon() * T(10)) -> T { // Compute the Taylor series representation of hypergeometric_0f1. @@ -71,9 +71,9 @@ template auto hypergeometric_2f1(T a, - T b, - T c, - T x, + T b, + T c, + T x, T tolerance = std::numeric_limits::epsilon() * T(10)) -> T { // Compute the Taylor series representation of hypergeometric_2f1. @@ -126,10 +126,10 @@ typename iterator_a_type, typename iterator_b_type> auto hypergeometric_pfq(iterator_a_type coefficients_a_begin, - iterator_a_type coefficients_a_end, - iterator_b_type coefficients_b_begin, - iterator_b_type coefficients_b_end, - T x, + iterator_a_type coefficients_a_end, + iterator_b_type coefficients_b_begin, + iterator_b_type coefficients_b_end, + T x, T tolerance = std::numeric_limits::epsilon() * T(10)) -> T { const std::ptrdiff_t count_of_a_terms = std::distance(coefficients_a_begin, coefficients_a_end); @@ -202,7 +202,7 @@ x_pow_n_div_n_fact *= x; x_pow_n_div_n_fact = static_cast(x_pow_n_div_n_fact / static_cast(n)); - if(count_of_a_terms_is_zero == false) + if(!count_of_a_terms_is_zero) { // Increment each of the pochhammer elements in {an}. std::for_each(an.begin(), an.end(), [](T& a) { ++a; }); @@ -213,7 +213,7 @@ pochhammer_sequence_a *= std::accumulate(an.begin(), an.end(), my_one, std::multiplies()); } - if(count_of_b_terms_is_zero == false) + if(!count_of_b_terms_is_zero) { // Increment each of the pochhammer elements in {bm}. std::for_each(bm.begin(), bm.end(), [](T& b) { ++b; }); diff --git a/ref_app/src/math/wide_decimal/decwide_t.h b/ref_app/src/math/wide_decimal/decwide_t.h index 898b2e738..62ca3abed 100644 --- a/ref_app/src/math/wide_decimal/decwide_t.h +++ b/ref_app/src/math/wide_decimal/decwide_t.h @@ -709,7 +709,7 @@ // Constructors from built-in floating-point types. template::value == true>::type const* = nullptr> + typename std::enable_if::value>::type const* = nullptr> decwide_t(const FloatingPointType f) : my_data (), // NOLINT(google-explicit-constructor,hicpp-explicit-conversions) my_exp (static_cast(INT8_C(0))), my_neg (false), diff --git a/ref_app/src/mcal/am335x/mcal_gpt.cpp b/ref_app/src/mcal/am335x/mcal_gpt.cpp index b747ba286..544b0c98f 100644 --- a/ref_app/src/mcal/am335x/mcal_gpt.cpp +++ b/ref_app/src/mcal/am335x/mcal_gpt.cpp @@ -63,7 +63,7 @@ void __vector_timer7() void mcal::gpt::init(const config_type*) { - if(gpt_is_initialized() == false) + if(!gpt_is_initialized()) { mcal::reg::reg_access_static::bit_get() == true); + UINT8_C(1)>::bit_get()); } } diff --git a/ref_app/src/mcal/atmega2560/mcal_gpt.cpp b/ref_app/src/mcal/atmega2560/mcal_gpt.cpp index cc661c688..e55f76b9c 100644 --- a/ref_app/src/mcal/atmega2560/mcal_gpt.cpp +++ b/ref_app/src/mcal/atmega2560/mcal_gpt.cpp @@ -34,7 +34,7 @@ void __vector_23() void mcal::gpt::init(const config_type*) { - if(gpt_is_initialized() == false) + if(!gpt_is_initialized()) { // Clear the timer0 overflow flag. mcal::reg::reg_access_static::reg_set(); diff --git a/ref_app/src/mcal/atmega4809/mcal_gpt.cpp b/ref_app/src/mcal/atmega4809/mcal_gpt.cpp index f0554dff2..f0a12cc5d 100644 --- a/ref_app/src/mcal/atmega4809/mcal_gpt.cpp +++ b/ref_app/src/mcal/atmega4809/mcal_gpt.cpp @@ -47,7 +47,7 @@ void __vector_3() void mcal::gpt::init(const config_type*) { - if(gpt_is_initialized() == false) + if(!gpt_is_initialized()) { // The system tick for the multitasking scheduler is derived // from the real-time counter. The numerics of setting up diff --git a/ref_app/src/mcal/avr/mcal_eep.cpp b/ref_app/src/mcal/avr/mcal_eep.cpp index 780ca0e26..1a36498c9 100644 --- a/ref_app/src/mcal/avr/mcal_eep.cpp +++ b/ref_app/src/mcal/avr/mcal_eep.cpp @@ -18,7 +18,7 @@ namespace local return (mcal::reg::reg_access_static::bit_get() == true); + UINT8_C(1)>::bit_get()); } } // namespace local diff --git a/ref_app/src/mcal/bcm2835_raspi_b/mcal_gpt.cpp b/ref_app/src/mcal/bcm2835_raspi_b/mcal_gpt.cpp index 8c52cf5be..8ccf82648 100644 --- a/ref_app/src/mcal/bcm2835_raspi_b/mcal_gpt.cpp +++ b/ref_app/src/mcal/bcm2835_raspi_b/mcal_gpt.cpp @@ -82,7 +82,7 @@ namespace void mcal::gpt::init(const config_type*) { - if(gpt_is_initialized() == false) + if(!gpt_is_initialized()) { gpt_is_initialized() = true; diff --git a/ref_app/src/mcal/host/mcal_benchmark.h b/ref_app/src/mcal/host/mcal_benchmark.h index a37a2372c..4795ccb6d 100644 --- a/ref_app/src/mcal/host/mcal_benchmark.h +++ b/ref_app/src/mcal/host/mcal_benchmark.h @@ -15,7 +15,7 @@ namespace benchmark { using benchmark_port_type = mcal::port::port_pin; - } - } + } // namespace benchmark + } // namespace mcal #endif // MCAL_BENCHMARK_2014_04_16_H diff --git a/ref_app/src/mcal/host/mcal_cpu.h b/ref_app/src/mcal/host/mcal_cpu.h index 9b180093b..e5ea780c6 100644 --- a/ref_app/src/mcal/host/mcal_cpu.h +++ b/ref_app/src/mcal/host/mcal_cpu.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2023. +// Copyright Christopher Kormanyos 2007 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -13,14 +13,18 @@ #include #include - namespace mcal { namespace cpu { + namespace mcal + { + namespace cpu + { - auto init() -> void; + auto init() -> void; - inline auto post_init() -> void { } + inline auto post_init() -> void { } - inline auto nop() -> void { } + inline auto nop() -> void { } - } } // namespace mcal::cpu + } // namespace cpu + } // namespace mcal #endif // MCAL_CPU_2009_02_14_H diff --git a/ref_app/src/mcal/host/mcal_eep.h b/ref_app/src/mcal/host/mcal_eep.h index 9a70d5e8d..3e7d03690 100644 --- a/ref_app/src/mcal/host/mcal_eep.h +++ b/ref_app/src/mcal/host/mcal_eep.h @@ -21,7 +21,7 @@ auto write(const address_type addr, const std::uint8_t data) -> void; auto read (const address_type addr) -> std::uint8_t; - } - } + } // namespace eep + } // namespace mcal #endif // MCAL_EEP_2018_12_15_H diff --git a/ref_app/src/mcal/host/mcal_gpt.h b/ref_app/src/mcal/host/mcal_gpt.h index 676143e52..a11bed209 100644 --- a/ref_app/src/mcal/host/mcal_gpt.h +++ b/ref_app/src/mcal/host/mcal_gpt.h @@ -18,7 +18,7 @@ { template class timer; - } + } // namespace util namespace mcal { @@ -38,7 +38,7 @@ template friend class util::timer; }; - } - } + } // namespace gpt + } // namespace mcal #endif // MCAL_GPT_2011_10_20_H diff --git a/ref_app/src/mcal/host/mcal_irq.h b/ref_app/src/mcal/host/mcal_irq.h index ba9ca8fd9..5764d543b 100644 --- a/ref_app/src/mcal/host/mcal_irq.h +++ b/ref_app/src/mcal/host/mcal_irq.h @@ -18,7 +18,7 @@ inline auto enable_all () -> void { } inline auto disable_all() -> void { } - } - } + } // namespace irq + } // namespace mcal #endif // MCAL_IRQ_2010_04_10_H diff --git a/ref_app/src/mcal/host/mcal_led.h b/ref_app/src/mcal/host/mcal_led.h index eb3311015..1897eb522 100644 --- a/ref_app/src/mcal/host/mcal_led.h +++ b/ref_app/src/mcal/host/mcal_led.h @@ -15,7 +15,7 @@ namespace led { auto led0() -> led_base&; - } - } + } // namespace led + } // namespace mcal #endif // MCAL_LED_2010_09_14_H diff --git a/ref_app/src/mcal/host/mcal_osc.h b/ref_app/src/mcal/host/mcal_osc.h index 9565ea78d..603503bab 100644 --- a/ref_app/src/mcal/host/mcal_osc.h +++ b/ref_app/src/mcal/host/mcal_osc.h @@ -15,7 +15,7 @@ using config_type = void; auto init(const config_type*) -> void; - } - } + } // namespace osc + } // namespace mcal #endif // MCAL_OSC_2011_10_20_H diff --git a/ref_app/src/mcal/host/mcal_port.h b/ref_app/src/mcal/host/mcal_port.h index 7fcb3e967..85a2d865c 100644 --- a/ref_app/src/mcal/host/mcal_port.h +++ b/ref_app/src/mcal/host/mcal_port.h @@ -26,7 +26,7 @@ static constexpr auto read_input_value () noexcept -> bool { return false; } static constexpr auto toggle_pin () noexcept -> void { } }; - } - } + } // namespace port + } // namespace mcal #endif // MCAL_PORT_2012_06_27_H diff --git a/ref_app/src/mcal/host/mcal_pwm.h b/ref_app/src/mcal/host/mcal_pwm.h index c3650eebe..55e35aa0b 100644 --- a/ref_app/src/mcal/host/mcal_pwm.h +++ b/ref_app/src/mcal/host/mcal_pwm.h @@ -19,7 +19,7 @@ inline auto init(const config_type*) -> void { } auto pwm0() noexcept -> mcal::pwm::pwm_base&; - } - } + } // namespace pwm + } // namespace mcal #endif // MCAL_PWM_2010_09_14_H diff --git a/ref_app/src/mcal/host/mcal_ser.h b/ref_app/src/mcal/host/mcal_ser.h index 63c65efa9..599e71bd5 100644 --- a/ref_app/src/mcal/host/mcal_ser.h +++ b/ref_app/src/mcal/host/mcal_ser.h @@ -15,7 +15,7 @@ using config_type = void; inline auto init(const config_type*) -> void { } - } - } + } // namespace ser + } // namespace mcal #endif // MCAL_SER_2011_10_20_H diff --git a/ref_app/src/mcal/host/mcal_spi.h b/ref_app/src/mcal/host/mcal_spi.h index 4f77f6419..c0f26e71b 100644 --- a/ref_app/src/mcal/host/mcal_spi.h +++ b/ref_app/src/mcal/host/mcal_spi.h @@ -10,14 +10,18 @@ #include - namespace mcal { namespace spi { + namespace mcal + { + namespace spi + { - using config_type = void; + using config_type = void; - auto init(const config_type*) -> void; + auto init(const config_type*) -> void; - auto spi0() -> util::communication_base&; + auto spi0() -> util::communication_base&; - } } + } // namespace spi + } // namespace mcal #endif // MCAL_SPI_2012_05_24_H diff --git a/ref_app/src/mcal/host/mcal_wdg.h b/ref_app/src/mcal/host/mcal_wdg.h index f0810a9a4..c016b718e 100644 --- a/ref_app/src/mcal/host/mcal_wdg.h +++ b/ref_app/src/mcal/host/mcal_wdg.h @@ -13,9 +13,15 @@ { template class timer; - } + } // namespace util - namespace sys { namespace idle { void task_func(); } } + namespace sys + { + namespace idle + { + void task_func(); + } // namespace idle + } // namespace sys namespace mcal { @@ -34,7 +40,7 @@ template friend class util::timer; }; - } - } + } // namespace wdg + } // namespace mcal #endif // MCAL_WDG_2010_04_10_H diff --git a/ref_app/src/mcal/host/mcal_wdg_watchdog.h b/ref_app/src/mcal/host/mcal_wdg_watchdog.h index 5e5d34767..dd9238a1b 100644 --- a/ref_app/src/mcal/host/mcal_wdg_watchdog.h +++ b/ref_app/src/mcal/host/mcal_wdg_watchdog.h @@ -8,15 +8,16 @@ #ifndef MCAL_WDG_WATCHDOG_2013_12_11_H #define MCAL_WDG_WATCHDOG_2013_12_11_H + #include + + #include + #include + #include #include #include #include - #include - #include - #include - #if defined(_MSC_VER) #define MCAL_WDG_NORETURN #else @@ -90,7 +91,7 @@ MCAL_WDG_NORETURN static auto thread_function() -> void { - std::this_thread::sleep_for(std::chrono::milliseconds(10U)); + std::this_thread::sleep_for(std::chrono::milliseconds(static_cast(UINT8_C(10)))); bool timeout_has_occurred = false; @@ -100,7 +101,7 @@ { print_timeout_message(); - std::this_thread::sleep_for(std::chrono::milliseconds(500U)); + std::this_thread::sleep_for(std::chrono::milliseconds(static_cast(UINT16_C(500)))); } else { @@ -109,7 +110,7 @@ timeout_has_occurred = true; } - std::this_thread::sleep_for(std::chrono::milliseconds(20U)); + std::this_thread::sleep_for(std::chrono::milliseconds(static_cast(UINT8_C(20)))); } } } @@ -118,11 +119,11 @@ }; template - watchdog watchdog::my_watchdog(thread_function); + watchdog watchdog::my_watchdog(thread_function); // NOLINT(cert-err58-cpp) template std::atomic_flag watchdog::my_lock = ATOMIC_FLAG_INIT; - } - } + } // namespace wdg + } // namespace mcal #endif // MCAL_WDG_WATCHDOG_2013_12_11_H diff --git a/ref_app/src/mcal/lpc11c24/mcal_gpt.cpp b/ref_app/src/mcal/lpc11c24/mcal_gpt.cpp index 977e4df99..56a85885d 100644 --- a/ref_app/src/mcal/lpc11c24/mcal_gpt.cpp +++ b/ref_app/src/mcal/lpc11c24/mcal_gpt.cpp @@ -40,7 +40,7 @@ extern "C" void __sys_tick_handler(void) void mcal::gpt::init(const config_type*) { - if(gpt_is_initialized() == false) + if(!gpt_is_initialized()) { const std::uint32_t systick_load_val = std::uint32_t(mcal::osc::get_sys_clk_rate() / mcal::config::systick_hz) & UINT32_C(0x00FFFFFF); diff --git a/ref_app/src/mcal/lpc11c24/mcal_osc.cpp b/ref_app/src/mcal/lpc11c24/mcal_osc.cpp index e41e8e70d..f507fa697 100644 --- a/ref_app/src/mcal/lpc11c24/mcal_osc.cpp +++ b/ref_app/src/mcal/lpc11c24/mcal_osc.cpp @@ -74,10 +74,10 @@ void mcal::osc::init(const config_type*) mcal::reg::syscon_pdruncfg_syspll_pd_bpos>::bit_clr(); // Wait for the PLL to lock. - while(mcal::reg::reg_access_static::bit_get() == false) { mcal::cpu::nop(); } + while(!mcal::reg::reg_access_static::bit_get()) { mcal::cpu::nop(); } // Set the AHB clock divider. mcal::reg::reg_access_static #include @@ -19,14 +19,17 @@ #include #include - static_assert( (std::numeric_limits::digits >= 64) - && (std::numeric_limits::is_integer == true) - && (std::numeric_limits::is_signed == false), + #include + #include + + static_assert( (std::numeric_limits::digits >= static_cast(INT8_C(64))) + && std::numeric_limits::is_integer + && (!std::numeric_limits::is_signed), "The gpt value type must be an unsigned integer type having at least 64 bits."); namespace mcal { auto init() -> void; - } + } // namespace mcal -#endif // MCAL_2011_10_20_H_ +#endif // MCAL_2011_10_20_H diff --git a/ref_app/src/mcal/mcal_helper.h b/ref_app/src/mcal/mcal_helper.h index 808fa0af0..44b4b9d50 100644 --- a/ref_app/src/mcal/mcal_helper.h +++ b/ref_app/src/mcal/mcal_helper.h @@ -46,25 +46,25 @@ template auto disable_all_interrupts(const bool = has_disable_enable_interrupts, - const typename std::enable_if<(has_disable_enable_interrupts == true)>::type* = nullptr) noexcept -> void + const typename std::enable_if::type* = nullptr) noexcept -> void { mcal::irq::disable_all(); } template auto enable_all_interrupts(const bool = has_disable_enable_interrupts, - const typename std::enable_if<(has_disable_enable_interrupts == true)>::type* = nullptr) noexcept -> void + const typename std::enable_if::type* = nullptr) noexcept -> void { mcal::irq::enable_all(); } template auto disable_all_interrupts(const bool = has_disable_enable_interrupts, - const typename std::enable_if<(has_disable_enable_interrupts == false)>::type* = nullptr) noexcept -> void { } + const typename std::enable_if<(!has_disable_enable_interrupts)>::type* = nullptr) noexcept -> void { } template auto enable_all_interrupts(const bool = has_disable_enable_interrupts, - const typename std::enable_if<(has_disable_enable_interrupts == false)>::type* = nullptr) noexcept -> void { } + const typename std::enable_if<(!has_disable_enable_interrupts)>::type* = nullptr) noexcept -> void { } } } // namespace mcal::helper diff --git a/ref_app/src/mcal/rl78/mcal_gpt.cpp b/ref_app/src/mcal/rl78/mcal_gpt.cpp index 0cceab51f..2fa1b8edb 100644 --- a/ref_app/src/mcal/rl78/mcal_gpt.cpp +++ b/ref_app/src/mcal/rl78/mcal_gpt.cpp @@ -33,7 +33,7 @@ void __inttm02_vect() void mcal::gpt::init(const config_type*) { - if(gpt_is_initialized() == false) + if(!gpt_is_initialized()) { // set TAU0EN to enable input clock supply. mcal::reg::reg_access_static::reg_or(); // Wait until the hse is ready. - while(mcal::reg::reg_access_static::bit_get() == false) + while(!mcal::reg::reg_access_static::bit_get()) { mcal::cpu::nop(); } @@ -78,10 +78,10 @@ namespace UINT32_C(0x01000000)>::reg_or(); // Wait until the pll is locked. - while(mcal::reg::reg_access_static::bit_get() == false) + while(!mcal::reg::reg_access_static::bit_get()) { mcal::cpu::nop(); } diff --git a/ref_app/src/mcal/stm32f429/mcal_osc.cpp b/ref_app/src/mcal/stm32f429/mcal_osc.cpp index bf51fe775..933b68712 100644 --- a/ref_app/src/mcal/stm32f429/mcal_osc.cpp +++ b/ref_app/src/mcal/stm32f429/mcal_osc.cpp @@ -30,10 +30,10 @@ namespace UINT32_C(0x00010000)>::reg_or(); // Wait until the hse is ready. - while(mcal::reg::reg_access_static::bit_get() == false) + while(!mcal::reg::reg_access_static::bit_get()) { mcal::cpu::nop(); } @@ -79,10 +79,10 @@ namespace UINT32_C(0x01000000)>::reg_or(); // Wait until the pll is locked. - while(mcal::reg::reg_access_static::bit_get() == false) + while(!mcal::reg::reg_access_static::bit_get()) { mcal::cpu::nop(); } diff --git a/ref_app/src/mcal/stm32l100c/mcal_cpu.cpp b/ref_app/src/mcal/stm32l100c/mcal_cpu.cpp index 75274855f..f34639afc 100644 --- a/ref_app/src/mcal/stm32l100c/mcal_cpu.cpp +++ b/ref_app/src/mcal/stm32l100c/mcal_cpu.cpp @@ -26,7 +26,7 @@ void mcal::cpu::init() mcal::reg::flash_acr, 2U>::bit_get(); - if(acc64_is_ok == false) + if(!acc64_is_ok) { for(;;) { @@ -47,7 +47,7 @@ void mcal::cpu::init() mcal::reg::flash_acr, 0U>::bit_get(); - if(latency_is_ok == false) + if(!latency_is_ok) { for(;;) { diff --git a/ref_app/src/mcal/stm32l100c/mcal_osc.cpp b/ref_app/src/mcal/stm32l100c/mcal_osc.cpp index c4d513412..f6bcff61e 100644 --- a/ref_app/src/mcal/stm32l100c/mcal_osc.cpp +++ b/ref_app/src/mcal/stm32l100c/mcal_osc.cpp @@ -26,7 +26,7 @@ void mcal::osc::init(const config_type*) while(mcal::reg::reg_access_static::bit_get() == true) + UINT32_C(25)>::bit_get()) { mcal::cpu::nop(); } @@ -51,10 +51,10 @@ void mcal::osc::init(const config_type*) // Wait until the HSI is ready. // Read the HSIRDY bit. - while(mcal::reg::reg_access_static::bit_get() == false) + while(!mcal::reg::reg_access_static::bit_get()) { mcal::cpu::nop(); } diff --git a/ref_app/src/mcal/stm32l152/mcal_cpu.cpp b/ref_app/src/mcal/stm32l152/mcal_cpu.cpp index 75274855f..f34639afc 100644 --- a/ref_app/src/mcal/stm32l152/mcal_cpu.cpp +++ b/ref_app/src/mcal/stm32l152/mcal_cpu.cpp @@ -26,7 +26,7 @@ void mcal::cpu::init() mcal::reg::flash_acr, 2U>::bit_get(); - if(acc64_is_ok == false) + if(!acc64_is_ok) { for(;;) { @@ -47,7 +47,7 @@ void mcal::cpu::init() mcal::reg::flash_acr, 0U>::bit_get(); - if(latency_is_ok == false) + if(!latency_is_ok) { for(;;) { diff --git a/ref_app/src/mcal/stm32l152/mcal_gpt.cpp b/ref_app/src/mcal/stm32l152/mcal_gpt.cpp index 404d7261b..14cd22160 100644 --- a/ref_app/src/mcal/stm32l152/mcal_gpt.cpp +++ b/ref_app/src/mcal/stm32l152/mcal_gpt.cpp @@ -41,7 +41,7 @@ extern "C" void __vector_timer4(void) void mcal::gpt::init(const config_type*) { - if(gpt_is_initialized() == false) + if(!gpt_is_initialized()) { // Set up an interrupt on timer4 for a system tick based // on the free-running 16-bit timer4 with a frequency of 1MHz. diff --git a/ref_app/src/mcal/stm32l152/mcal_osc.cpp b/ref_app/src/mcal/stm32l152/mcal_osc.cpp index c4d513412..f6bcff61e 100644 --- a/ref_app/src/mcal/stm32l152/mcal_osc.cpp +++ b/ref_app/src/mcal/stm32l152/mcal_osc.cpp @@ -26,7 +26,7 @@ void mcal::osc::init(const config_type*) while(mcal::reg::reg_access_static::bit_get() == true) + UINT32_C(25)>::bit_get()) { mcal::cpu::nop(); } @@ -51,10 +51,10 @@ void mcal::osc::init(const config_type*) // Wait until the HSI is ready. // Read the HSIRDY bit. - while(mcal::reg::reg_access_static::bit_get() == false) + while(!mcal::reg::reg_access_static::bit_get()) { mcal::cpu::nop(); } diff --git a/ref_app/src/mcal/v850es_fx2/mcal_gpt.cpp b/ref_app/src/mcal/v850es_fx2/mcal_gpt.cpp index c9b692fe4..1fd710997 100644 --- a/ref_app/src/mcal/v850es_fx2/mcal_gpt.cpp +++ b/ref_app/src/mcal/v850es_fx2/mcal_gpt.cpp @@ -45,7 +45,7 @@ extern "C" void mcal_gpt_increment_tick(void) void mcal::gpt::init(const config_type*) { - if(gpt_is_initialized() == false) + if(!gpt_is_initialized()) { gpt_is_initialized() = true; diff --git a/ref_app/src/mcal/xtensa32/mcal_gpt.cpp b/ref_app/src/mcal/xtensa32/mcal_gpt.cpp index 6c93a3812..d75f9175d 100644 --- a/ref_app/src/mcal/xtensa32/mcal_gpt.cpp +++ b/ref_app/src/mcal/xtensa32/mcal_gpt.cpp @@ -68,7 +68,7 @@ namespace void mcal::gpt::init(const config_type*) { - if(gpt_is_initialized() == false) + if(!gpt_is_initialized()) { gpt_is_initialized() = true; diff --git a/ref_app/src/mcal_led/mcal_led_base.h b/ref_app/src/mcal_led/mcal_led_base.h index 77cd309cb..08e6712a2 100644 --- a/ref_app/src/mcal_led/mcal_led_base.h +++ b/ref_app/src/mcal_led/mcal_led_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2023. +// Copyright Christopher Kormanyos 2013 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -12,7 +12,7 @@ namespace mcal { namespace led { - class led_base : private util::noncopyable + class led_base : private util::noncopyable // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { public: virtual ~led_base() = default; diff --git a/ref_app/src/mcal_led/mcal_led_boolean_state_base.h b/ref_app/src/mcal_led/mcal_led_boolean_state_base.h index 6552f26da..d97b83116 100644 --- a/ref_app/src/mcal_led/mcal_led_boolean_state_base.h +++ b/ref_app/src/mcal_led/mcal_led_boolean_state_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2020 - 2023. +// Copyright Christopher Kormanyos 2020 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -12,13 +12,14 @@ namespace mcal { namespace led { - class led_boolean_state_base : public mcal::led::led_base + class led_boolean_state_base : public mcal::led::led_base // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { + public: + ~led_boolean_state_base() override = default; + protected: constexpr led_boolean_state_base() = default; - ~led_boolean_state_base() override = default; - auto toggle() -> void override { // Toggle the LED state. @@ -31,6 +32,7 @@ bool is_on { }; }; - } } // namespace mcal::led + } // namespace led + } // namespace mcal #endif // MCAL_LED_BOOLEAN_STATE_BASE_2020_08_07_H diff --git a/ref_app/src/mcal_led/mcal_led_console.h b/ref_app/src/mcal_led/mcal_led_console.h index 92516cd2e..5aee4d640 100644 --- a/ref_app/src/mcal_led/mcal_led_console.h +++ b/ref_app/src/mcal_led/mcal_led_console.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2023. +// Copyright Christopher Kormanyos 2013 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -15,12 +15,14 @@ namespace mcal { namespace led { - class led_console final : public mcal::led::led_boolean_state_base + class led_console final : public mcal::led::led_boolean_state_base // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { public: explicit constexpr led_console(const std::uint_fast8_t i) : my_index(i) { } + ~led_console() override = default; + auto toggle() -> void override { using base_class_type = mcal::led::led_boolean_state_base; @@ -39,6 +41,7 @@ const std::uint_fast8_t my_index; }; - } } // namespace mcal::led + } // namespace led + } // namespace mcal #endif // MCAL_LED_CONSOLE_2020_04_23_H diff --git a/ref_app/src/mcal_led/mcal_led_port.h b/ref_app/src/mcal_led/mcal_led_port.h index f0d383ef7..d7446e685 100644 --- a/ref_app/src/mcal_led/mcal_led_port.h +++ b/ref_app/src/mcal_led/mcal_led_port.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2023. +// Copyright Christopher Kormanyos 2013 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -23,6 +23,8 @@ port_type::set_direction_output(); } + ~led_port() override = default; + auto toggle() -> void override { using base_class_type = led_boolean_state_base; diff --git a/ref_app/src/mcal_led/mcal_led_port_inverted.h b/ref_app/src/mcal_led/mcal_led_port_inverted.h index 847661fad..47ede3cab 100644 --- a/ref_app/src/mcal_led/mcal_led_port_inverted.h +++ b/ref_app/src/mcal_led/mcal_led_port_inverted.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2020 - 2023. +// Copyright Christopher Kormanyos 2020 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -23,6 +23,8 @@ port_type::set_direction_output(); } + ~led_port_inverted() override = default; + auto toggle() -> void override { using base_class_type = led_boolean_state_base; diff --git a/ref_app/src/mcal_led/mcal_led_pwm.h b/ref_app/src/mcal_led/mcal_led_pwm.h index d65c84527..1778302db 100644 --- a/ref_app/src/mcal_led/mcal_led_pwm.h +++ b/ref_app/src/mcal_led/mcal_led_pwm.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2023. +// Copyright Christopher Kormanyos 2013 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -21,6 +21,8 @@ my_pwm.set_duty(static_cast(UINT8_C(0))); } + ~led_pwm() override = default; + auto state_is_on() const -> bool override { return (my_pwm.get_duty() > static_cast(UINT8_C(0))); } auto toggle() -> void override @@ -40,6 +42,7 @@ mcal::pwm::pwm_base& my_pwm; }; - } } // namespace mcal::led + } // namespace led + } // namespace mcal #endif // MCAL_LED_PWM_2020_04_23_H diff --git a/ref_app/src/mcal_led/mcal_led_rgb_base.h b/ref_app/src/mcal_led/mcal_led_rgb_base.h index 6277b28b8..98e26d2b5 100644 --- a/ref_app/src/mcal_led/mcal_led_rgb_base.h +++ b/ref_app/src/mcal_led/mcal_led_rgb_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2017 - 2023. +// Copyright Christopher Kormanyos 2017 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -17,6 +17,8 @@ class led_rgb_base : public mcal::led::led_boolean_state_base { public: + ~led_rgb_base() override = default; + auto toggle() -> void override { using base_class_type = mcal::led::led_boolean_state_base; @@ -94,6 +96,7 @@ } }; - } } // namespace mcal::led + } // namespace led + } // namespace mcal #endif // MCAL_LED_RGB_BASE_2023_07_12_H diff --git a/ref_app/src/mcal_memory/mcal_memory_progmem_array.h b/ref_app/src/mcal_memory/mcal_memory_progmem_array.h index be302e2d9..5ee392ad4 100644 --- a/ref_app/src/mcal_memory/mcal_memory_progmem_array.h +++ b/ref_app/src/mcal_memory/mcal_memory_progmem_array.h @@ -103,7 +103,7 @@ template bool operator!=(const array& left, const array& right) { - return ((left == right) == false); + return (!(left == right)); } template @@ -115,13 +115,13 @@ template bool operator>=(const array& left, const array& right) { - return ((left < right) == false); + return (!(left < right)); } template bool operator<=(const array& left, const array& right) { - return ((right < left) == false); + return (!(right < left)); } template diff --git a/ref_app/src/mcal_memory/mcal_memory_sram_array.h b/ref_app/src/mcal_memory/mcal_memory_sram_array.h index beb12767c..7936b6ce4 100644 --- a/ref_app/src/mcal_memory/mcal_memory_sram_array.h +++ b/ref_app/src/mcal_memory/mcal_memory_sram_array.h @@ -177,7 +177,7 @@ const mcal_sram_uintptr_t Address> bool operator!=(const array& left, const array& right) { - return ((left == right) == false); + return (!(left == right)); } template bool operator>=(const array& left, const array& right) { - return ((left < right) == false); + return (!(left < right)); } template bool operator<=(const array& left, const array& right) { - return ((right < left) == false); + return (!(right < left)); } template diff --git a/ref_app/src/mcal_pwm/mcal_pwm_base.h b/ref_app/src/mcal_pwm/mcal_pwm_base.h index 5bae70e7f..e386dd1e3 100644 --- a/ref_app/src/mcal_pwm/mcal_pwm_base.h +++ b/ref_app/src/mcal_pwm/mcal_pwm_base.h @@ -14,7 +14,7 @@ namespace mcal { namespace pwm { - class pwm_base : private util::noncopyable + class pwm_base : private util::noncopyable // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { public: using duty_type = std::uint16_t; @@ -32,7 +32,7 @@ : my_duty_cycle(initial_duty) { } private: - duty_type my_duty_cycle { }; + duty_type my_duty_cycle { }; // NOLINT(readability-identifier-naming) }; } // namespace pwm diff --git a/ref_app/src/mcal_pwm/mcal_pwm_console.h b/ref_app/src/mcal_pwm/mcal_pwm_console.h index 3d49352d4..7d53aa31f 100644 --- a/ref_app/src/mcal_pwm/mcal_pwm_console.h +++ b/ref_app/src/mcal_pwm/mcal_pwm_console.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2020 - 2022. +// Copyright Christopher Kormanyos 2020 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -16,7 +16,7 @@ namespace mcal { namespace pwm { - class pwm_console : public mcal::pwm::pwm_base + class pwm_console : public mcal::pwm::pwm_base // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { private: using base_class_type = mcal::pwm::pwm_base; @@ -50,6 +50,7 @@ ~pwm_console() override = default; }; - } } + } // namespace pwm + } // namespace mcal #endif // MCAL_PWM_CONSOLE_2020_04_12_H_ diff --git a/ref_app/src/mcal_spi/mcal_spi_software_dummy.h b/ref_app/src/mcal_spi/mcal_spi_software_dummy.h index f458fdecb..2deb3e08d 100644 --- a/ref_app/src/mcal_spi/mcal_spi_software_dummy.h +++ b/ref_app/src/mcal_spi/mcal_spi_software_dummy.h @@ -12,7 +12,7 @@ namespace mcal { namespace spi { - class spi_software_dummy : public util::communication_buffer_depth_one_byte + class spi_software_dummy : public util::communication_buffer_depth_one_byte // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { private: using base_class_type = util::communication_buffer_depth_one_byte; diff --git a/ref_app/src/os/os.h b/ref_app/src/os/os.h index 5a471d7b6..e252e00a4 100644 --- a/ref_app/src/os/os.h +++ b/ref_app/src/os/os.h @@ -5,8 +5,8 @@ // or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef OS_2011_10_20_H_ - #define OS_2011_10_20_H_ +#ifndef OS_2011_10_20_H + #define OS_2011_10_20_H #include #include @@ -26,6 +26,6 @@ auto set_event (const task_id_type task_id, const event_type& event_to_set) -> bool; auto get_event (event_type& event_to_get) -> void; auto clear_event(const event_type& event_to_clear) -> void; - } + } // namespace os -#endif // OS_2011_10_20_H_ +#endif // OS_2011_10_20_H diff --git a/ref_app/src/os/os_cfg.h b/ref_app/src/os/os_cfg.h index 984f4f6a3..42d845af7 100644 --- a/ref_app/src/os/os_cfg.h +++ b/ref_app/src/os/os_cfg.h @@ -8,29 +8,52 @@ #ifndef OS_CFG_2011_10_20_H #define OS_CFG_2011_10_20_H + #include + #include #include #include - #include - // Declare the task initialization and the task function of the idle process. - namespace sys { namespace idle { auto task_init() noexcept -> void; auto task_func() -> void; } } + namespace sys { namespace idle { + + auto task_init() noexcept -> void; auto task_func() -> void; + + } // namespace idle + } // namespace sys // Define symbols for the task initialization and the task function of the idle process. #define OS_IDLE_TASK_INIT() sys::idle::task_init() #define OS_IDLE_TASK_FUNC() sys::idle::task_func() // Declare all of the task initializations and the task functions. - namespace app { namespace led { auto task_init() -> void; auto task_func() -> void; } } - namespace app { namespace benchmark { auto task_init() -> void; auto task_func() -> void; } } - namespace sys { namespace mon { auto task_init() -> void; auto task_func() -> void; } } + namespace app { namespace led { + + auto task_init() -> void; auto task_func() -> void; + + } // namespace led + } // namespace app + + namespace app { namespace benchmark { + + auto task_init() -> void; auto task_func() -> void; + + } // namespace benchmark + } // namespace app + + namespace sys { namespace mon { + + auto task_init() -> void; auto task_func() -> void; + + } // namespace mon + } // namespace sys namespace os { // Enumerate the task IDs. Note that the order in this list must // be identical with the order of the tasks in the task list below. - enum class task_id_type + + enum class task_id_type // NOLINT(performance-enum-size) { task_id_app_led, task_id_app_benchmark, @@ -45,12 +68,12 @@ using tick_type = timer_type::tick_type; using event_type = std::uint_fast16_t; - static_assert(std::numeric_limits::digits >= 32, + static_assert(std::numeric_limits::digits >= static_cast(INT8_C(32)), "The operating system timer_type must be at least 32-bits wide."); - static_assert(std::numeric_limits::digits >= 16, + static_assert(std::numeric_limits::digits >= static_cast(INT8_C(16)), "The operating system event_type must be at least 16-bits wide."); - } + } // namespace os // Configure the operating system tasks. diff --git a/ref_app/src/os/os_task_control_block.h b/ref_app/src/os/os_task_control_block.h index 92ad02185..f8d46645f 100644 --- a/ref_app/src/os/os_task_control_block.h +++ b/ref_app/src/os/os_task_control_block.h @@ -19,10 +19,10 @@ class task_control_block final { public: - task_control_block(const function_type init, - const function_type func, - const tick_type cycle, - const tick_type offset) + task_control_block(const function_type init, // NOLINT(bugprone-easily-swappable-parameters) + const function_type func, // NOLINT(bugprone-easily-swappable-parameters) + const tick_type cycle, // NOLINT(bugprone-easily-swappable-parameters) + const tick_type offset) // NOLINT(bugprone-easily-swappable-parameters) : my_init { init }, my_func { func }, my_cycle { cycle }, @@ -40,9 +40,9 @@ auto operator=(task_control_block&&) noexcept -> task_control_block& = delete; private: - const function_type my_init; - const function_type my_func; - const tick_type my_cycle; + const function_type my_init; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members) + const function_type my_func; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members) + const tick_type my_cycle; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members) timer_type my_timer; event_type my_event { }; @@ -80,6 +80,6 @@ friend auto get_event (event_type&) -> void; friend auto clear_event(const event_type&) -> void; }; - } + } // namespace os #endif // OS_TASK_CONTROL_BLOCK_2013_07_30_H diff --git a/ref_app/src/sys/start/coverity.c b/ref_app/src/sys/start/coverity.c index ba75044d3..27d5e0c95 100644 --- a/ref_app/src/sys/start/coverity.c +++ b/ref_app/src/sys/start/coverity.c @@ -1,7 +1,9 @@ /* Coverity Scan model */ /* cd /mnt/c/Users/ckorm/Documents/Ks/uC_Software/Boards/real-time-cpp/ref_app */ -/* target/build/build.sh x86_64-w64-mingw32 rebuild */ +/* PATH=/home/chris/coverity/cov-analysis-linux64-2023.12.2/bin:$PATH */ +/* cov-build --dir cov-int target/build/build.sh x86_64-w64-mingw32 rebuild */ +/* tar caf real-time-cpp.bz2 cov-int */ void dummy(void); diff --git a/ref_app/src/util/STL/algorithm b/ref_app/src/util/STL/algorithm index 1542a21e3..6660186ee 100644 --- a/ref_app/src/util/STL/algorithm +++ b/ref_app/src/util/STL/algorithm @@ -293,7 +293,7 @@ { for( ; first != last; ++first) { - using forward_value_type = typename std::iterator_traits::value_type; + using forward_value_type = typename std::iterator_traits::value_type; *first = forward_value_type(value); } @@ -321,7 +321,7 @@ { while(first != last) { - using forward_value_type = typename std::iterator_traits::value_type; + using forward_value_type = typename std::iterator_traits::value_type; *first = forward_value_type(generator()); @@ -338,7 +338,7 @@ { for(size_type i = size_type(0); i < count; ++i) { - using output_value_type = typename std::iterator_traits::value_type; + using output_value_type = typename std::iterator_traits::value_type; *first = output_value_type(generator()); @@ -367,7 +367,7 @@ { for( ; first != last; ++first, ++result) { - using output_value_type = typename std::iterator_traits::value_type; + using output_value_type = typename std::iterator_traits::value_type; *result = output_value_type(unary_function(*first)); } @@ -387,7 +387,7 @@ { for( ; first1 != last1; ++first1, ++first2, ++result) { - using output_value_type = typename std::iterator_traits::value_type; + using output_value_type = typename std::iterator_traits::value_type; *result = output_value_type(binary_function(*first1, *first2)); } @@ -425,7 +425,7 @@ { while(first1 != last1) { - if(binary_function(*first1, *first2) == false) + if(!binary_function(*first1, *first2)) { break; } @@ -457,7 +457,7 @@ iterator_type last, unary_function_type unary_function) { - while((first != last) && (unary_function(*first) == false)) + while((first != last) && (!unary_function(*first))) { ++first; } @@ -471,7 +471,7 @@ iterator_type last, unary_function_type unary_function) { - while((first != last) && (unary_function(*first) == false)) + while((first != last) && (!unary_function(*first))) { ++first; } @@ -838,7 +838,7 @@ { for( ; ; ++first) { - for( ; (first != last) && (unary_function(*first) == true); ++first) + for( ; (first != last) && unary_function(*first); ++first) { ; } @@ -848,7 +848,7 @@ break; } - for( ; (first != --last) && (unary_function(*last) == false); ) + for( ; (first != --last) && (!unary_function(*last)); ) { ; } diff --git a/ref_app/src/util/STL/array b/ref_app/src/util/STL/array index 41f36b38a..bd6aa9aff 100644 --- a/ref_app/src/util/STL/array +++ b/ref_app/src/util/STL/array @@ -123,7 +123,7 @@ template STL_LOCAL_CONSTEXPR_ALGORITHMS bool operator!=(const array& left, const array& right) { - return ((left == right) == false); + return (!(left == right)); } template @@ -135,13 +135,13 @@ template STL_LOCAL_CONSTEXPR_ALGORITHMS bool operator>=(const array& left, const array& right) { - return ((left < right) == false); + return (!(left < right)); } template STL_LOCAL_CONSTEXPR_ALGORITHMS bool operator<=(const array& left, const array& right) { - return ((right < left) == false); + return (!(right < left)); } template diff --git a/ref_app/src/util/STL/complex b/ref_app/src/util/STL/complex index 88c7c6726..bad945cb7 100644 --- a/ref_app/src/util/STL/complex +++ b/ref_app/src/util/STL/complex @@ -1230,10 +1230,10 @@ const bool __my_real_part_is_neg(__my_z.real() < 0U); - const T __my_real_part_fabs((__my_real_part_is_neg == false) ? __my_z.real() : -__my_z.real()); + const T __my_real_part_fabs((!__my_real_part_is_neg) ? __my_z.real() : -__my_z.real()); const T __my_sqrt_part (sqrt((__my_real_part_fabs + abs(__my_z)) / 2U)); - if(__my_real_part_is_neg == false) + if(!__my_real_part_is_neg) { return complex(__my_sqrt_part, __my_z.imag() / (__my_sqrt_part * 2U)); @@ -1242,10 +1242,10 @@ { const bool __my_imag_part_is_neg(__my_z.imag() < 0U); - const T __my_imag_part_fabs((__my_imag_part_is_neg == false) ? __my_z.imag() : -__my_z.imag()); + const T __my_imag_part_fabs((!__my_imag_part_is_neg) ? __my_z.imag() : -__my_z.imag()); return complex( __my_imag_part_fabs / (__my_sqrt_part * 2U), - ((__my_imag_part_is_neg == false) ? __my_sqrt_part : -__my_sqrt_part)); + ((!__my_imag_part_is_neg) ? __my_sqrt_part : -__my_sqrt_part)); } } diff --git a/ref_app/src/util/STL/functional b/ref_app/src/util/STL/functional index a2ecd2c8f..4c12fec21 100644 --- a/ref_app/src/util/STL/functional +++ b/ref_app/src/util/STL/functional @@ -38,7 +38,7 @@ template(std::declval()), - std::enable_if_t<(std::is_same>::value == false)>())> + std::enable_if_t<(!std::is_same>::value)>())> constexpr reference_wrapper(U&& u) noexcept(noexcept(xfunctional_impl::func_ref_or_moveref(std::forward(u)))) : my_ptr(std::addressof(xfunctional_impl::func_ref_or_moveref(std::forward(u)))) { } diff --git a/ref_app/src/util/STL/impl/cmath_impl_gamma.cpp b/ref_app/src/util/STL/impl/cmath_impl_gamma.cpp index a7b67938b..83b21f86b 100644 --- a/ref_app/src/util/STL/impl/cmath_impl_gamma.cpp +++ b/ref_app/src/util/STL/impl/cmath_impl_gamma.cpp @@ -92,7 +92,7 @@ float tgammaf(float x) } // Check if the argument is very close to +1 or +2? - if(b_neg == false) + if(!b_neg) { using xcmath_impl::near_integer; @@ -125,7 +125,7 @@ float tgammaf(float x) } // Return (and possibly reflect) the result. - if(false == b_neg) + if(!b_neg) { return gamma_value; } diff --git a/ref_app/src/util/STL/stdfloat b/ref_app/src/util/STL/stdfloat index 9f58dcd9f..bfd5f4c65 100644 --- a/ref_app/src/util/STL/stdfloat +++ b/ref_app/src/util/STL/stdfloat @@ -15,14 +15,21 @@ namespace std { using float32_t = float; - #if defined(__AVR__) + #define __STDCPP_FLOAT32_T__ 1 + + #if (defined(__GNUC__) && defined(__AVR__)) + + #if(__GNUC__ >= 12) using float64_t = long double; + #define __STDCPP_FLOAT64_T__ 1 + #endif + #else + using float64_t = double; + #define __STDCPP_FLOAT64_T__ 1 + #endif } - #define __STDCPP_FLOAT32_T__ 1 - #define __STDCPP_FLOAT64_T__ 1 - #endif // STDFLOAT_2024_07_12 diff --git a/ref_app/src/util/STL/utility b/ref_app/src/util/STL/utility index 032979c08..b7f000937 100644 --- a/ref_app/src/util/STL/utility +++ b/ref_app/src/util/STL/utility @@ -193,13 +193,13 @@ template bool operator<=(const std::pair& left, const std::pair& right) { - return ((right < left) == false); + return (!(right < left)); } template bool operator>=(const std::pair& left, const std::pair& right) { - return ((left < right) == false); + return (!(left < right)); } template diff --git a/ref_app/src/util/STL_C++XX_stdfloat/cstdfloat b/ref_app/src/util/STL_C++XX_stdfloat/cstdfloat index 9a4164105..c060f0845 100644 --- a/ref_app/src/util/STL_C++XX_stdfloat/cstdfloat +++ b/ref_app/src/util/STL_C++XX_stdfloat/cstdfloat @@ -30,7 +30,7 @@ using ::float_fast16_t; using ::float_least16_t; - static_assert( (std::numeric_limits::is_iec559 == true) + static_assert( std::numeric_limits::is_iec559 && (std::numeric_limits::radix == 2) && (std::numeric_limits::digits == 11) && (std::numeric_limits::max_exponent == 16), @@ -42,7 +42,7 @@ using ::float_fast32_t; using ::float_least32_t; - static_assert( (std::numeric_limits::is_iec559 == true) + static_assert( std::numeric_limits::is_iec559 && (std::numeric_limits::radix == 2) && (std::numeric_limits::digits == 24) && (std::numeric_limits::max_exponent == 128), @@ -54,7 +54,7 @@ using ::float_fast64_t; using ::float_least64_t; - static_assert( (std::numeric_limits::is_iec559 == true) + static_assert( std::numeric_limits::is_iec559 && (std::numeric_limits::radix == 2) && (std::numeric_limits::digits == 53) && (std::numeric_limits::max_exponent == 1024), @@ -66,7 +66,7 @@ using ::float_fast80_t; using ::float_least80_t; - static_assert( (std::numeric_limits::is_iec559 == true) + static_assert( std::numeric_limits::is_iec559 && (std::numeric_limits::radix == 2) && (std::numeric_limits::digits == 64) && (std::numeric_limits::max_exponent == 16384), @@ -78,7 +78,7 @@ using ::float_fast128_t; using ::float_least128_t; - static_assert( (std::numeric_limits::is_iec559 == true) + static_assert( std::numeric_limits::is_iec559 && (std::numeric_limits::radix == 2) && (std::numeric_limits::digits == 113) && (std::numeric_limits::max_exponent == 16384), diff --git a/ref_app/src/util/utility/util_bit_mask.h b/ref_app/src/util/utility/util_bit_mask.h index a7334235a..0e411292e 100644 --- a/ref_app/src/util/utility/util_bit_mask.h +++ b/ref_app/src/util/utility/util_bit_mask.h @@ -24,11 +24,11 @@ static constexpr unsigned bit_cnt = BitCnt; // Ensure that the data_type is an integer type. - static_assert(std::numeric_limits::is_integer == true, + static_assert(std::numeric_limits::is_integer, "the data_type of the bit_mask template must be an integer type"); // Ensure that the data_type is unsigned. - static_assert(std::numeric_limits::is_signed == false, + static_assert((!std::numeric_limits::is_signed), "the data_type of the bit_mask template must be unsigned"); // Ensure that the requested bit mask is in range. @@ -56,11 +56,11 @@ static constexpr unsigned bit_pos = BitPos; // Ensure that the data_type is an integer type. - static_assert(std::numeric_limits::is_integer == true, + static_assert(std::numeric_limits::is_integer, "the data_type of the bit_mask template must be an integer type"); // Ensure that the data_type is unsigned. - static_assert(std::numeric_limits::is_signed == false, + static_assert((!std::numeric_limits::is_signed), "the data_type of the bit_mask template must be unsigned"); // Ensure that the requested bit mask is in range. @@ -81,11 +81,11 @@ static constexpr unsigned bit_pos = BitPos; // Ensure that the data_type is an integer type. - static_assert(std::numeric_limits::is_integer == true, + static_assert(std::numeric_limits::is_integer, "the data_type of the bit_mask template must be an integer type"); // Ensure that the data_type is unsigned. - static_assert(std::numeric_limits::is_signed == false, + static_assert((!std::numeric_limits::is_signed), "the data_type of the bit_mask template must be unsigned"); // Ensure that the requested bit mask is in range. diff --git a/ref_app/src/util/utility/util_communication.h b/ref_app/src/util/utility/util_communication.h index 5ee9788e1..6b15f3df3 100644 --- a/ref_app/src/util/utility/util_communication.h +++ b/ref_app/src/util/utility/util_communication.h @@ -17,7 +17,7 @@ namespace util { - class communication_base : private util::noncopyable + class communication_base : private util::noncopyable // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { public: virtual ~communication_base() = default; @@ -34,7 +34,7 @@ { auto send_result = true; - while((first != last) && send_result) + while((first != last) && send_result) // NOLINT(altera-id-dependent-backward-branch) { using send_value_type = typename std::iterator_traits::value_type; @@ -50,11 +50,11 @@ communication_base() = default; private: - template + template friend class communication_multi_channel; }; - class communication_buffer_depth_one_byte : public communication_base + class communication_buffer_depth_one_byte : public communication_base // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { public: using buffer_type = std::uint8_t; @@ -62,7 +62,7 @@ ~communication_buffer_depth_one_byte() override = default; protected: - buffer_type recv_buffer { }; + buffer_type recv_buffer { }; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes) communication_buffer_depth_one_byte() = default; @@ -75,13 +75,18 @@ } }; - template - class communication_multi_channel : public communication_base + template + class communication_multi_channel : public communication_base // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { + private: + static constexpr std::size_t channel_count = ChannelCount; + public: + communication_multi_channel() = delete; + explicit communication_multi_channel(communication_base** p_com_channels) { - std::copy(p_com_channels, p_com_channels + channel_count, my_com_channels.begin()); + std::copy(p_com_channels, p_com_channels + channel_count, my_com_channels.begin()); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } ~communication_multi_channel() override = default; @@ -112,13 +117,11 @@ } private: - std::array my_com_channels { }; - std::size_t my_index { }; - - communication_multi_channel() = delete; + std::array my_com_channels { }; // NOLINT(readability-identifier-naming) + std::size_t my_index { }; // NOLINT(readability-identifier-naming) static_assert(channel_count > 0U, "Error channel_count must be greater than zero."); }; - } + } // namespace util #endif // UTIL_COMMUNICATION_2012_05_31_H diff --git a/ref_app/src/util/utility/util_point.h b/ref_app/src/util/utility/util_point.h index 5e881298c..041a55b3a 100644 --- a/ref_app/src/util/utility/util_point.h +++ b/ref_app/src/util/utility/util_point.h @@ -81,7 +81,7 @@ template constexpr auto operator<=(const point& left, const point& right) -> bool { - return ((right < left) == false); + return (!(right < left)); } template @@ -93,8 +93,8 @@ template constexpr auto operator>=(const point& left, const point& right) -> bool { - return ((left < right) == false); + return (!(left < right)); } - } + } // namespace util #endif // UTIL_POINT_2008_11_22_H diff --git a/ref_app/src/util/utility/util_time.h b/ref_app/src/util/utility/util_time.h index bb6fa34b0..4fd8c27f5 100644 --- a/ref_app/src/util/utility/util_time.h +++ b/ref_app/src/util/utility/util_time.h @@ -23,23 +23,23 @@ static constexpr auto timer_mask = static_cast ( - (UINTMAX_C(1) << (std::numeric_limits::digits - 1)) - UINTMAX_C(1) + (UINTMAX_C(1) << static_cast(std::numeric_limits::digits - 1)) - UINTMAX_C(1) ); public: using tick_type = unsigned_tick_type; template static constexpr auto microseconds(other_tick_type value_microseconds) noexcept -> tick_type { return static_cast(value_microseconds); } - template static constexpr auto milliseconds(other_tick_type value_milliseconds) noexcept -> tick_type { return static_cast(1000UL) * microseconds(value_milliseconds); } - template static constexpr auto seconds (other_tick_type value_seconds) noexcept -> tick_type { return static_cast(1000UL) * milliseconds(value_seconds ); } - template static constexpr auto minutes (other_tick_type value_minutes) noexcept -> tick_type { return static_cast( 60UL) * seconds (value_minutes ); } - template static constexpr auto hours (other_tick_type value_hours) noexcept -> tick_type { return static_cast( 60UL) * minutes (value_hours ); } - template static constexpr auto days (other_tick_type value_days) noexcept -> tick_type { return static_cast( 24UL) * hours (value_days ); } - template static constexpr auto weeks (other_tick_type value_weeks) noexcept -> tick_type { return static_cast( 7UL) * days (value_weeks ); } + template static constexpr auto milliseconds(other_tick_type value_milliseconds) noexcept -> tick_type { return static_cast(UINT16_C(1000)) * microseconds(value_milliseconds); } + template static constexpr auto seconds (other_tick_type value_seconds) noexcept -> tick_type { return static_cast(UINT16_C(1000)) * milliseconds(value_seconds ); } + template static constexpr auto minutes (other_tick_type value_minutes) noexcept -> tick_type { return static_cast(UINT16_C( 60)) * seconds (value_minutes ); } + template static constexpr auto hours (other_tick_type value_hours) noexcept -> tick_type { return static_cast(UINT16_C( 60)) * minutes (value_hours ); } + template static constexpr auto days (other_tick_type value_days) noexcept -> tick_type { return static_cast(UINT16_C( 24)) * hours (value_days ); } + template static constexpr auto weeks (other_tick_type value_weeks) noexcept -> tick_type { return static_cast(UINT16_C( 7)) * days (value_weeks ); } constexpr timer() = default; - constexpr timer(tick_type tick_value) : my_tick(my_now() + tick_value) { } + explicit constexpr timer(tick_type tick_value) : my_tick(my_now() + tick_value) { } constexpr timer(const timer& other) = default; @@ -90,7 +90,7 @@ { const timer t_delay(delay); - while(false == t_delay.timeout()) + while(!t_delay.timeout()) // NOLINT(altera-id-dependent-backward-branch) { mcal::wdg::secure::trigger(); } @@ -104,12 +104,12 @@ return static_cast(mcal::gpt::secure::get_time_elapsed()); } - static_assert(std::numeric_limits::is_signed == false, + static_assert((!std::numeric_limits::is_signed), "the timer tick_type must be unsigned"); static_assert(std::numeric_limits::digits <= std::numeric_limits::digits, "The width of the timer tick_type can not exceed the width of mcal::gpt::value_type"); }; - } + } // namespace util #endif // UTIL_TIME_2010_04_10_H diff --git a/ref_app/src/util/utility/util_two_part_data_manipulation.h b/ref_app/src/util/utility/util_two_part_data_manipulation.h index fcedbda15..1e9bf5045 100644 --- a/ref_app/src/util/utility/util_two_part_data_manipulation.h +++ b/ref_app/src/util/utility/util_two_part_data_manipulation.h @@ -19,11 +19,11 @@ inline constexpr auto make_long(unsigned_short_type lo, unsigned_short_type hi) -> unsigned_long_type { // Ensure that the unsigned_short_type is an integer type. - static_assert(std::numeric_limits::is_integer == true, + static_assert(std::numeric_limits::is_integer, "the unsigned_short_type of the make_long template must be an integer type"); // Ensure that the unsigned_long_type is an integer type. - static_assert(std::numeric_limits::is_integer == true, + static_assert(std::numeric_limits::is_integer, "the unsigned_long_type of the make_long template must be an integer type."); // Ensure that the unsigned_long_type has exactly twice the digits as the unsigned_short_type. @@ -31,11 +31,11 @@ "the unsigned_long_type of the make_long template must be twice as wide as the unsigned_short_type"); // Ensure that the unsigned_short_type is unsigned. - static_assert(std::numeric_limits::is_signed == false, + static_assert((!std::numeric_limits::is_signed), "the unsigned_short_type of the make_long template must be unsigned"); // Ensure that the unsigned_long_type is unsigned. - static_assert(std::numeric_limits::is_signed == false, + static_assert((!std::numeric_limits::is_signed), "the unsigned_long_type of the make_long template must be unsigned."); return static_cast(static_cast(static_cast(hi) << std::numeric_limits::digits) | lo); @@ -46,11 +46,11 @@ inline constexpr auto lo_part(unsigned_long_type val) -> unsigned_short_type { // Ensure that the unsigned_short_type is an integer type. - static_assert(std::numeric_limits::is_integer == true, + static_assert(std::numeric_limits::is_integer, "the unsigned_short_type of the make_long template must be an integer type"); // Ensure that the unsigned_long_type is an integer type. - static_assert(std::numeric_limits::is_integer == true, + static_assert(std::numeric_limits::is_integer, "the unsigned_long_type of the make_long template must be an integer type."); // Ensure that the unsigned_long_type has exactly twice the digits as the unsigned_short_type. @@ -58,11 +58,11 @@ "the unsigned_long_type of the lo_part template must be twice as wide as the unsigned_short_type"); // Ensure that the unsigned_short_type is unsigned. - static_assert(std::numeric_limits::is_signed == false, + static_assert((!std::numeric_limits::is_signed), "the unsigned_short_type of the lo_part template must be unsigned"); // Ensure that the unsigned_long_type is unsigned. - static_assert(std::numeric_limits::is_signed == false, + static_assert((!std::numeric_limits::is_signed), "the long type of the lo_part template must be unsigned"); return static_cast(val); @@ -73,11 +73,11 @@ inline constexpr auto hi_part(unsigned_long_type val) -> unsigned_short_type { // Ensure that the unsigned_short_type is an integer type. - static_assert(std::numeric_limits::is_integer == true, + static_assert(std::numeric_limits::is_integer, "the unsigned_short_type of the make_long template must be an integer type"); // Ensure that the unsigned_long_type is an integer type. - static_assert(std::numeric_limits::is_integer == true, + static_assert(std::numeric_limits::is_integer, "the unsigned_long_type of the make_long template must be an integer type."); // Ensure that the unsigned_long_type has exactly twice the digits as the unsigned_short_type. @@ -85,11 +85,11 @@ "the unsigned_long_type of the hi_part template must be twice as wide as the unsigned_short_type"); // Ensure that the unsigned_short_type is unsigned. - static_assert(std::numeric_limits::is_signed == false, + static_assert((!std::numeric_limits::is_signed), "the unsigned_short_type of the hi_part template must be unsigned"); // Ensure that the unsigned_long_type is unsigned. - static_assert(std::numeric_limits::is_signed == false, + static_assert((!std::numeric_limits::is_signed), "the unsigned_long_type of the hi_part template must be unsigned"); return static_cast(val >> std::numeric_limits::digits); diff --git a/ref_app/target/micros/stm32f429/make/stm32f429_flags.gmk b/ref_app/target/micros/stm32f429/make/stm32f429_flags.gmk index 3468b5590..c366b0cf5 100644 --- a/ref_app/target/micros/stm32f429/make/stm32f429_flags.gmk +++ b/ref_app/target/micros/stm32f429/make/stm32f429_flags.gmk @@ -35,9 +35,7 @@ TGT_CXXFLAGS = -std=c++14 -Wno-psabi \ $(TGT_ALLFLAGS) -TGT_INCLUDES = -IC:/boost/modular_boost/libs/config/include \ - -IC:/boost/modular_boost/libs/math/include \ - -IC:/boost/modular_boost/libs/multiprecision/include +TGT_INCLUDES = -isystem $(PATH_APP)/util/STL TGT_AFLAGS = diff --git a/ref_app/target/micros/stm32f446/make/single/crt.cpp b/ref_app/target/micros/stm32f446/make/single/crt.cpp index 10dc266d5..f4738732a 100644 --- a/ref_app/target/micros/stm32f446/make/single/crt.cpp +++ b/ref_app/target/micros/stm32f446/make/single/crt.cpp @@ -1,10 +1,17 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2018 - 2019. +// Copyright Christopher Kormanyos 2018 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) // +#if (defined(__GNUC__) && !defined(__clang__)) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow=" +#endif + #include #include #include @@ -278,3 +285,8 @@ const volatile std::array __isr_vector = nullptr, // 0x01F8, dummy nullptr // 0x01FC, dummy }}; + +#if (defined(__GNUC__) && !defined(__clang__)) +#pragma GCC diagnostic pop +#pragma GCC diagnostic pop +#endif