Skip to content

Commit

Permalink
iox-#2284 Fix implicit conversion warning on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Apr 25, 2024
1 parent 661eee5 commit 814a265
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion iceoryx_dds/source/gateway/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ShutdownManager
static void scheduleShutdown(int num)
{
char reason;
psignal(num, &reason);
iox_psignal(num, &reason);
s_semaphore.post().or_else([](auto) {
std::cerr << "failed to call post on shutdown semaphore" << std::endl;
std::terminate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@

#include <signal.h>

inline void iox_psignal(int sig, const char* s)
{
psignal(sig, s);
}

#endif // IOX_HOOFS_LINUX_PLATFORM_SIGNAL_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,27 @@

#include <signal.h>

inline void psignal(int sig, const char* s)
namespace iox
{
psignal(static_cast<unsigned int>(sig), s);
namespace platform
{
namespace helper
{
inline void psignal_helper(void (*psignal_function)(int, const char*), int sig, const char* s)
{
psignal_function(sig, s);
}
inline void psignal_helper(void (*psignal_function)(unsigned int, const char*), int sig, const char* s)
{
psignal_function(static_cast<unsigned int>(sig), s);
}
} // namespace helper
} // namespace platform
} // namespace iox

inline void iox_psignal(int sig, const char* s)
{
iox::platform::helper::psignal_helper(psignal, sig, s);
}

#endif // IOX_HOOFS_MAC_PLATFORM_SIGNAL_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@

#include <signal.h>

inline void iox_psignal(int sig, const char* s)
{
psignal(sig, s);
}

#endif // IOX_HOOFS_QNX_PLATFORM_SIGNAL_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@

#include <signal.h>

inline void iox_psignal(int sig, const char* s)
{
psignal(sig, s);
}

#endif // IOX_HOOFS_UNIX_PLATFORM_SIGNAL_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,6 @@ int sigemptyset(sigset_t* set);
int sigaction(int signum, const struct sigaction* act, struct sigaction* oldact);
int kill(pid_t pid, int sig);

void iox_psignal(int sig, const char* s);

#endif // IOX_HOOFS_WIN_PLATFORM_SIGNAL_HPP
5 changes: 5 additions & 0 deletions iceoryx_hoofs/platform/win/source/signal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ int kill(pid_t pid, int sig)
{
return 0;
}

void iox_psignal(int sig, const char* s)
{
psignal(sig, s);
}

0 comments on commit 814a265

Please sign in to comment.