GCC Code Coverage Report


Directory: ./
File: Os/Posix/DefaultCountingSemaphore.cpp
Date: 2026-09-03 21:13:48
Exec Total Coverage
Lines: 4 4 100.0%
Functions: 1 1 100.0%
Branches: 1 3 33.3%

Line Branch Exec Source
1 // ======================================================================
2 // \title Os/Posix/DefaultCountingSemaphore.cpp
3 // \brief sets default Os::CountingSemaphore Posix implementation via linker
4 // ======================================================================
5 #include "Os/Delegate.hpp"
6 #include "Os/Posix/CountingSemaphore.hpp"
7
8 namespace Os {
9
10 2581 CountingSemaphoreInterface* CountingSemaphoreInterface::getDelegate(CountingSemaphoreHandleStorage& aligned_new_memory,
11 U32 initial_count) {
12 static_assert(std::is_base_of<CountingSemaphoreInterface, Os::Posix::Semaphore::PosixCountingSemaphore>::value,
13 "Implementation must derive from CountingSemaphoreInterface");
14 static_assert(sizeof(Os::Posix::Semaphore::PosixCountingSemaphore) <= sizeof(CountingSemaphoreHandleStorage),
15 "Handle size not large enough");
16 static_assert((FW_HANDLE_ALIGNMENT % alignof(Os::Posix::Semaphore::PosixCountingSemaphore)) == 0,
17 "Handle alignment invalid");
18
1/3
✓ Branch 3 taken 2581 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2581 auto* ptr = new (aligned_new_memory) Os::Posix::Semaphore::PosixCountingSemaphore(initial_count);
19 2581 FW_ASSERT(ptr != nullptr);
20 2581 return ptr;
21 }
22 } // namespace Os
23