Skip to content

Commit

Permalink
iox-#1755 Fix gcc builds
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Oct 15, 2023
1 parent 7f54194 commit dc1e337
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
12 changes: 6 additions & 6 deletions iceoryx_hoofs/reporting/include/iox/detail/log/logstream.inl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace log
{
template <typename T>
template <typename>
constexpr LogHex<T>::LogHex(const T value) noexcept
inline constexpr LogHex<T>::LogHex(const T value) noexcept
: m_value(value)
{
}
Expand All @@ -51,7 +51,7 @@ inline constexpr LogHex<const void* const> hex(const void* const ptr) noexcept

template <typename T>
template <typename>
constexpr LogOct<T>::LogOct(const T value) noexcept
inline constexpr LogOct<T>::LogOct(const T value) noexcept
: m_value(value)
{
}
Expand All @@ -65,7 +65,7 @@ inline constexpr LogOct<T> oct(const T value) noexcept

template <typename T>
template <typename>
constexpr LogBin<T>::LogBin(const T value) noexcept
inline constexpr LogBin<T>::LogBin(const T value) noexcept
: m_value(value)
{
}
Expand All @@ -77,15 +77,15 @@ inline constexpr LogBin<T> bin(const T value) noexcept
return LogBin<T>(value);
}

constexpr LogRaw::LogRaw(const void* const data, uint64_t size) noexcept
inline constexpr LogRaw::LogRaw(const void* const data, uint64_t size) noexcept
: m_data(data)
, m_size(size)
{
}

// AXIVION Next Construct AutosarC++19_03-M17.0.3 : See at declaration in header
template <typename T, typename>
inline constexpr LogRaw raw(const T& object) noexcept
template <typename T>
inline constexpr typename std::enable_if<!std::is_pointer<T>::value, LogRaw>::type raw(const T& object) noexcept
{
return LogRaw(&object, sizeof(T));
}
Expand Down
22 changes: 12 additions & 10 deletions iceoryx_hoofs/reporting/include/iox/log/logstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class LogOct

private:
template <typename = std::enable_if_t<std::is_integral<T>::value>>
inline explicit constexpr LogOct(const T value) noexcept;
explicit constexpr LogOct(const T value) noexcept;

LogOct(LogOct&&) noexcept = default;

Expand All @@ -102,7 +102,7 @@ class LogOct
/// @return a helper struct which will be used by the LogStream
// AXIVION Next Construct AutosarC++19_03-M17.0.3 : The function is in the iox::log namespace which prevents easy misuse
template <typename T, typename = std::enable_if_t<std::is_integral<T>::value && !std::is_same<T, bool>::value>>
inline constexpr LogOct<T> oct(const T value) noexcept;
constexpr LogOct<T> oct(const T value) noexcept;

/// @brief Helper struct to log in binary format
template <typename T>
Expand All @@ -122,7 +122,7 @@ class LogBin

private:
template <typename = std::enable_if_t<std::is_integral<T>::value>>
inline explicit constexpr LogBin(const T value) noexcept;
explicit constexpr LogBin(const T value) noexcept;

LogBin(LogBin&&) noexcept = default;

Expand All @@ -135,16 +135,18 @@ class LogBin
/// @return a helper struct which will be used by the LogStream
// AXIVION Next Construct AutosarC++19_03-M17.0.3 : The function is in the iox::log namespace which prevents easy misuse
template <typename T, typename = std::enable_if_t<std::is_integral<T>::value && !std::is_same<T, bool>::value>>
inline constexpr LogBin<T> bin(const T value) noexcept;
constexpr LogBin<T> bin(const T value) noexcept;

/// @brief Helper struct to log in raw bytes
class LogRaw
{
public:
friend class LogStream;

template <typename T, typename>
friend constexpr LogRaw raw(const T&) noexcept;
// for some reasons the default template argument SFINEA results in the error
// 'redeclaration of friend ... may not have default template arguments' on GCC but return type SFINEA seams to work
template <typename T>
friend constexpr typename std::enable_if<!std::is_pointer<T>::value, LogRaw>::type raw(const T&) noexcept;
friend constexpr LogRaw raw(const void* const, const uint64_t) noexcept;

~LogRaw() = default;
Expand All @@ -154,7 +156,7 @@ class LogRaw
LogRaw& operator=(LogRaw&&) noexcept = delete;

private:
inline explicit constexpr LogRaw(const void* const data, uint64_t size) noexcept;
explicit constexpr LogRaw(const void* const data, uint64_t size) noexcept;

LogRaw(LogRaw&&) noexcept = default;

Expand All @@ -167,15 +169,15 @@ class LogRaw
/// @param[in] object to be logged
/// @return a helper struct which will be used by the LogStream
// AXIVION Next Construct AutosarC++19_03-M17.0.3 : The function is in the iox::log namespace which prevents easy misuse
template <typename T, typename = std::enable_if_t<!std::is_pointer<T>::value>>
inline constexpr LogRaw raw(const T& object) noexcept;
template <typename T>
constexpr typename std::enable_if<!std::is_pointer<T>::value, LogRaw>::type raw(const T& object) noexcept;

/// @brief Log data in raw bytes
/// @param[in] data pointer to the data to be logged
/// @param[in] size of the data to be logged
/// @return a helper struct which will be used by the LogStream
// AXIVION Next Construct AutosarC++19_03-M17.0.3 : The function is in the iox::log namespace which prevents easy misuse
inline constexpr LogRaw raw(const void* const data, const uint64_t size) noexcept;
constexpr LogRaw raw(const void* const data, const uint64_t size) noexcept;

/// @brief This class provides the public interface to the logger and is used with the 'IOX_LOG' macro. In order to add
/// support for custom data types 'operator<<' needs to be implement for the custom type.
Expand Down

0 comments on commit dc1e337

Please sign in to comment.