Skip to content

Fix: compiler warnings - #2688

Open
hasan-htp wants to merge 4 commits into
eclipse-ecal:masterfrom
hasan-htp:fix/cmake-warnings
Open

Fix: compiler warnings#2688
hasan-htp wants to merge 4 commits into
eclipse-ecal:masterfrom
hasan-htp:fix/cmake-warnings

Conversation

@hasan-htp

Copy link
Copy Markdown

Description

I used eCAL in a project via CMake FetchContent. -Werror is enabled globally in my project, and I encountered several CMake warnings. This PR addresses those gcc warnings.

Related issues

@KerstinKeller

Copy link
Copy Markdown
Contributor

hi @hasan-htp, thanks for opening the PR.
Some of the changes that you made are ok, but the ones in hdf5 now ignore important error conditions, and the taken approach for the serializers is also questionable.

I will check this and see what we can do!

@hasan-htp

Copy link
Copy Markdown
Author

hi @hasan-htp, thanks for opening the PR. Some of the changes that you made are ok, but the ones in hdf5 now ignore important error conditions, and the taken approach for the serializers is also questionable.

I will check this and see what we can do!

hi @KerstinKeller
thanks for the reply and the feedback, the reason of that change is -Wtype-limits, because the size>=0 condition is always true for size_t type.

@hasan-htp hasan-htp changed the title Fix/cmake warnings Fix: compiler warnings Jul 25, 2026
template <typename T, typename Serializer>
class OMessageChannel
{
friend OMessageChannel CreateChannel(OMeasurement& meas_, const std::string& channel_name_);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this issue a warning? I think we need this friend declaration.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is declared in line 80 as a template function. but this friend declaration itself is not template, this is what giving the warning.
The reason of removing the friend declaration is that the function is only using the constractor of OMessageChannel, which is public.

or am I missing something?

static bool Serialize(const T& msg_, void* buffer_, size_t size_)
{
if (msg_.size() <= size_)
if (msg_.size() <= size_ && msg_.size() > 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the addtional check in omeasurement.h, this check should not be necessary, as this function will never be called with size_ == 0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes, thanks, I will remove it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@hasan-htp
hasan-htp force-pushed the fix/cmake-warnings branch from 7e26e60 to 48309b8 Compare August 3, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants