Fix: Resolve multiple definition linker error Added the `inline` keyword to `uefi::cper::convertToBcd` and `uefi::cper::createCperTimestamp` functions in `cper_encoder.hpp`. This resolves a linker error caused by multiple definitions of these functions when `cper_encoder.hpp` was included in multiple source files. Tested: Fixes build failures in https://gbmc-internal-review.git.corp.google.com/c/deepsea-power-cap/+/244408 Google-Bug-Id: 424199978 Change-Id: I8fd86b8204b4406e6492b61e96c5f8b293d13888 Signed-off-by: Gaurav Gandhi <gauravgandhi@google.com>
diff --git a/include/cper_encoder.hpp b/include/cper_encoder.hpp index 4258cf1..f80f781 100644 --- a/include/cper_encoder.hpp +++ b/include/cper_encoder.hpp
@@ -23,7 +23,7 @@ * * @returns a byte with the BCD val. */ -uint8_t convertToBcd(uint8_t val) +inline uint8_t convertToBcd(uint8_t val) { return (0x10 * (val / 10)) + (val % 10); } @@ -39,7 +39,7 @@ * * @param[out] A uefi cper timestamp as uint64_t. */ -uint64_t createCperTimestamp( +inline uint64_t createCperTimestamp( const std::chrono::time_point<std::chrono::system_clock> timeOfCollection, const bool isPrecise = true) {