Skip to content

Commit

Permalink
Merge pull request #559 from ckormanyos/updated_runners
Browse files Browse the repository at this point in the history
Fix #558 on updated runners
  • Loading branch information
ckormanyos authored Oct 11, 2024
2 parents 159d1c8 + e8a0821 commit 5c19eb5
Show file tree
Hide file tree
Showing 77 changed files with 387 additions and 297 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Checks: >
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
User: john
CheckOptions:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/real-time-cpp-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
29 changes: 23 additions & 6 deletions .tidy/make/make_tidy_03_flags.gmk
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
13 changes: 8 additions & 5 deletions code_snippets/chapter07/chapter07_01-001_register_address.c
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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);
}
3 changes: 2 additions & 1 deletion ref_app/src/app/benchmark/app_benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions ref_app/src/app/benchmark/app_benchmark_detail.h
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -14,8 +14,8 @@
namespace app { namespace benchmark { namespace detail {

template<typename NumericType>
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<NumericType>::epsilon() * NumericType(100))) -> bool
{
using std::fabs;
Expand All @@ -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
41 changes: 15 additions & 26 deletions ref_app/src/app/benchmark/app_benchmark_trapezoid_integral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,41 @@
#if defined(_MSC_VER)

#include <util/STL_C++XX_stdfloat/cstdfloat>
namespace app { namespace benchmark {

using my_float_type = double;

} // namespace benchmark
} // namespace app

#elif (defined(__has_include) && (__has_include(<stdfloat>)))

#include <stdfloat>

namespace app { namespace benchmark {
#else

#if (defined(__STDCPP_FLOAT64_T__) && (__STDCPP_FLOAT64_T__ == 1))
#include <util/STL_C++XX_stdfloat/cstdfloat>

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<local_float_type>::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<local_float_type>::digits >= 24), "Error: Incorrect my_float_type type definition");

#else

#include <util/STL_C++XX_stdfloat/cstdfloat>
using local_float_type = double;
static_assert((std::numeric_limits<local_float_type>::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 <app/benchmark/app_benchmark_detail.h>
#include <math/calculus/integral.h>
#include <math/constants/constants.h>
Expand Down Expand Up @@ -95,17 +91,10 @@ namespace

auto app::benchmark::run_trapezoid_integral() -> bool
{
#if (defined(__GNUC__) && defined(__AVR__) && (__GNUC__ < 12))
static_assert((std::numeric_limits<my_float_type>::digits >= 24), "Error: Incorrect my_float_type type definition");
#else
static_assert((std::numeric_limits<my_float_type>::digits >= 53), "Error: Incorrect my_float_type type definition");
#endif

constexpr auto app_benchmark_tolerance =
static_cast<my_float_type>
(
std::numeric_limits<my_float_type>::epsilon()
* static_cast<my_float_type>(100.0L)
std::numeric_limits<my_float_type>::epsilon() * static_cast<my_float_type>(100.0L)
);

// Compute y = cyl_bessel_j(2, 1.23) = 0.16636938378681407351267852431513159437103348245333
Expand Down
6 changes: 3 additions & 3 deletions ref_app/src/app/benchmark/app_benchmark_wide_integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions ref_app/src/math/extended_complex/extended_complex.h
Original file line number Diff line number Diff line change
Expand Up @@ -1000,21 +1000,21 @@
// and the +- sign is the same as the sign of zi.

const bool real_part_is_neg(my_z.real() < T(static_cast<unsigned>(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<unsigned>(UINT8_C(2))));

if(real_part_is_neg == false)
if(!real_part_is_neg)
{
return complex<T, EnableType>(s_part,
my_z.imag() / (s_part * static_cast<unsigned>(UINT8_C(2))));
}
else
{
const bool imag_part_is_neg(my_z.imag() < T(static_cast<unsigned>(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<T, EnableType>( imag_part_fabs / (s_part * static_cast<unsigned>(UINT8_C(2))),
((imag_part_is_neg == false) ? s_part : -s_part));
return complex<T, EnableType>( imag_part_fabs / (s_part * static_cast<unsigned>(UINT8_C(2))),
((!imag_part_is_neg) ? s_part : -s_part));
}
}

Expand Down
2 changes: 1 addition & 1 deletion ref_app/src/math/fixed_point/fixed_point.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<signed_value_type>::is_signed == true,
static_assert(std::numeric_limits<signed_value_type>::is_signed,
"the fixed point signed_value_type must be signed");

// Another template kind of this class itself is a friend.
Expand Down
20 changes: 10 additions & 10 deletions ref_app/src/math/functions/math_functions_hypergeometric.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{
template<typename T>
auto hypergeometric_0f1(T b,
T x,
T x,
T tolerance = std::numeric_limits<T>::epsilon() * T(10)) -> T
{
// Compute the Taylor series representation of hypergeometric_0f1.
Expand Down Expand Up @@ -71,9 +71,9 @@

template<typename T>
auto hypergeometric_2f1(T a,
T b,
T c,
T x,
T b,
T c,
T x,
T tolerance = std::numeric_limits<T>::epsilon() * T(10)) -> T
{
// Compute the Taylor series representation of hypergeometric_2f1.
Expand Down Expand Up @@ -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<T>::epsilon() * T(10)) -> T
{
const std::ptrdiff_t count_of_a_terms = std::distance(coefficients_a_begin, coefficients_a_end);
Expand Down Expand Up @@ -202,7 +202,7 @@
x_pow_n_div_n_fact *= x;
x_pow_n_div_n_fact = static_cast<float>(x_pow_n_div_n_fact / static_cast<float>(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; });
Expand All @@ -213,7 +213,7 @@
pochhammer_sequence_a *= std::accumulate(an.begin(), an.end(), my_one, std::multiplies<T>());
}

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; });
Expand Down
2 changes: 1 addition & 1 deletion ref_app/src/math/wide_decimal/decwide_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@

// Constructors from built-in floating-point types.
template<typename FloatingPointType,
typename std::enable_if<std::is_floating_point<FloatingPointType>::value == true>::type const* = nullptr>
typename std::enable_if<std::is_floating_point<FloatingPointType>::value>::type const* = nullptr>
decwide_t(const FloatingPointType f) : my_data (), // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)
my_exp (static_cast<exponent_type>(INT8_C(0))),
my_neg (false),
Expand Down
2 changes: 1 addition & 1 deletion ref_app/src/mcal/am335x/mcal_gpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::uint32_t,
std::uint32_t,
Expand Down
2 changes: 1 addition & 1 deletion ref_app/src/mcal/atmega2560/mcal_eep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace
return (mcal::reg::reg_access_static<std::uint8_t,
std::uint8_t,
mcal::reg::eecr,
UINT8_C(1)>::bit_get() == true);
UINT8_C(1)>::bit_get());
}
}

Expand Down
2 changes: 1 addition & 1 deletion ref_app/src/mcal/atmega2560/mcal_gpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::uint8_t, std::uint8_t, mcal::reg::tifr0, 0x01U>::reg_set();
Expand Down
2 changes: 1 addition & 1 deletion ref_app/src/mcal/atmega4809/mcal_gpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ref_app/src/mcal/avr/mcal_eep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace local
return (mcal::reg::reg_access_static<std::uint8_t,
std::uint8_t,
mcal::reg::eecr,
UINT8_C(1)>::bit_get() == true);
UINT8_C(1)>::bit_get());
}
} // namespace local

Expand Down
2 changes: 1 addition & 1 deletion ref_app/src/mcal/bcm2835_raspi_b/mcal_gpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading

0 comments on commit 5c19eb5

Please sign in to comment.