Skip to content

Commit 2392d20

Browse files
authored
Merge pull request #667 from elbeno/flatten-logs
⚡ Inline injected functions
2 parents 9702670 + 84969f0 commit 2392d20

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ include(cmake/string_catalog.cmake)
2525
add_versioned_package("gh:boostorg/mp11#boost-1.83.0")
2626
fmt_recipe(10.2.1)
2727
add_versioned_package("gh:intel/cpp-baremetal-concurrency#7c5b26c")
28-
add_versioned_package("gh:intel/cpp-std-extensions#2512bcf")
28+
add_versioned_package("gh:intel/cpp-std-extensions#4d57b2e")
2929
add_versioned_package("gh:intel/cpp-baremetal-senders-and-receivers#73d95bc")
3030

3131
add_library(cib_sc INTERFACE)

include/interrupt/hal.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <interrupt/fwd.hpp>
44
#include <interrupt/policies.hpp>
55

6+
#include <stdx/compiler.hpp>
67
#include <stdx/concepts.hpp>
78
#include <stdx/type_traits.hpp>
89

@@ -44,19 +45,20 @@ template <typename...> inline auto injected_hal = null_hal{};
4445
struct hal {
4546
template <typename... Ts>
4647
requires(sizeof...(Ts) == 0)
47-
static auto init() -> void {
48+
ALWAYS_INLINE static auto init() -> void {
4849
injected_hal<Ts...>.init();
4950
}
5051

5152
template <bool Enable, irq_num_t IrqNumber, int Priority, typename... Ts>
5253
requires(sizeof...(Ts) == 0)
53-
static auto irq_init() -> void {
54+
ALWAYS_INLINE static auto irq_init() -> void {
5455
injected_hal<Ts...>.template irq_init<Enable, IrqNumber, Priority>();
5556
}
5657

5758
template <status_policy P, typename... Ts>
5859
requires(sizeof...(Ts) == 0)
59-
static auto run(irq_num_t irq, stdx::invocable auto const &isr) -> void {
60+
ALWAYS_INLINE static auto run(irq_num_t irq,
61+
stdx::invocable auto const &isr) -> void {
6062
injected_hal<Ts...>.template run<P>(irq, isr);
6163
}
6264
};

include/log/log.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <sc/format.hpp>
55
#include <sc/fwd.hpp>
66

7+
#include <stdx/compiler.hpp>
78
#include <stdx/ct_string.hpp>
89
#include <stdx/panic.hpp>
910

@@ -35,7 +36,7 @@ template <typename...> inline auto config = null::config{};
3536
struct default_flavor_t;
3637

3738
template <typename Flavor, typename... Ts>
38-
constexpr static auto get_config() -> auto & {
39+
ALWAYS_INLINE constexpr static auto get_config() -> auto & {
3940
if constexpr (std::same_as<Flavor, default_flavor_t>) {
4041
return config<Ts...>;
4142
} else {
@@ -45,7 +46,7 @@ constexpr static auto get_config() -> auto & {
4546

4647
template <typename Flavor, level L, typename ModuleId, typename... Ts,
4748
typename... TArgs>
48-
static auto log(TArgs &&...args) -> void {
49+
ALWAYS_INLINE static auto log(TArgs &&...args) -> void {
4950
auto &cfg = get_config<Flavor, Ts...>();
5051
cfg.logger.template log<L, ModuleId>(std::forward<TArgs>(args)...);
5152
}
@@ -103,7 +104,8 @@ using cib_log_module_id_t = typename logging::module_id_t<"default">::type;
103104
((expr) ? void(0) : CIB_FATAL("Assertion failure: " #expr))
104105

105106
namespace logging {
106-
template <typename Flavor, typename... Ts> static auto log_version() -> void {
107+
template <typename Flavor, typename... Ts>
108+
ALWAYS_INLINE static auto log_version() -> void {
107109
auto &l_cfg = get_config<Flavor, Ts...>();
108110
auto &v_cfg = ::version::config<Ts...>;
109111
if constexpr (requires {

0 commit comments

Comments
 (0)