Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fixes with clang 11 #138

Draft
wants to merge 6 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions runtime/core/dnp3s/dnp3.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@
#include <utility>
#include <sstream>
#include <string>
#include <mutex>

#include "ini_util.h"

namespace asiodnp3 {
class OutstationStackConfig;
}
namespace std {
class mutex;
}

struct GlueVariable;
class GlueVariablesBinding;
Expand Down
2 changes: 1 addition & 1 deletion runtime/core/interactive_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int interactive_open_socket(uint16_t port) {
server_addr.sin_port = htons(port);

// Bind socket
if (bind(socket_fd, (struct sockaddr *)&server_addr,
if (::bind(socket_fd, (struct sockaddr *)&server_addr,
sizeof(server_addr)) < 0)
{
spdlog::error("Interactive Server: error binding socket => {}",
Expand Down
8 changes: 6 additions & 2 deletions runtime/core/lib/iec_std_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
#define DBG_TYPE(TYPENAME, name)
#endif

#ifdef __APPLE__
typedef long time_t;
#endif

/*
* Include type defs.
*/
Expand Down Expand Up @@ -379,7 +383,7 @@ static inline TIME __time_mul(TIME IN1, LREAL IN2){
time_t s = (time_t)s_f;
div_t ns = div((int)((LREAL)IN1.tv_nsec * IN2), 1000000000);
TIME res = {(long)s + ns.quot,
(long)ns.rem + (s_f - s) * 1000000000 };
(long)((long)ns.rem + (s_f - s) * 1000000000) };
__normalize_timespec(&res);
return res;
}
Expand Down Expand Up @@ -537,7 +541,7 @@ static inline LREAL __string_to_real(STRING IN) {
/* TO_TIME */
/***************/
static inline TIME __int_to_time(LINT IN) {return (TIME){IN, 0};}
static inline TIME __real_to_time(LREAL IN) {return (TIME){IN, (IN - (LINT)IN) * 1000000000};}
static inline TIME __real_to_time(LREAL IN) {return (TIME){(long)(IN), (long)((IN - (LINT)IN) * 1000000000)};}
static inline TIME __string_to_time(STRING IN){
__strlen_t l;
/* TODO :
Expand Down
6 changes: 6 additions & 0 deletions runtime/core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include <spdlog/spdlog.h>

#include <thread>

#include "iec_types.h"
#include "ini_util.h"
#include "ladder.h"
Expand Down Expand Up @@ -56,13 +58,17 @@ uint8_t run_openplc = 1; // Variable to control OpenPLC Runtime execution
/// \param delay in milliseconds
////////////////////////////////////////////////////////////////////////////////
void sleep_until(struct timespec *ts, int delay) {
#ifdef __linux__
ts->tv_nsec += delay;
if (ts->tv_nsec >= 1000*1000*1000)
{
ts->tv_nsec -= 1000*1000*1000;
ts->tv_sec++;
}
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts, NULL);
#else
std::this_thread::sleep_for(std::chrono::milliseconds(delay));
#endif
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion runtime/core/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int create_socket(uint16_t port)
server_addr.sin_port = htons(port);

//Bind socket
if (bind(socket_fd,(struct sockaddr *)&server_addr,sizeof(server_addr)) < 0)
if (::bind(socket_fd,(struct sockaddr *)&server_addr,sizeof(server_addr)) < 0)
{
spdlog::error("Server: error binding socket => {}", strerror(errno));
return -1;
Expand Down
4 changes: 2 additions & 2 deletions utils/dnp3_src/cpp/libs/src/asiodnp3/MasterStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ class MasterStack : public IMaster, public opendnp3::ILinkSession, public opendn
return this->tstack.link->OnLowerLayerDown();
}

virtual bool OnFrame(const opendnp3::LinkHeaderFields& header, const openpal::RSlice& userdata)
virtual bool OnFrame(const opendnp3::LinkHeaderFields& header, const openpal::RSlice& userdata) override
{
return this->tstack.link->OnFrame(header, userdata);
}

virtual void BeginTransmit(const openpal::RSlice& buffer, opendnp3::ILinkSession& context)
virtual void BeginTransmit(const openpal::RSlice& buffer, opendnp3::ILinkSession& context) override
{
this->iohandler->BeginTransmit(shared_from_this(), buffer);
}
Expand Down
4 changes: 2 additions & 2 deletions utils/dnp3_src/cpp/libs/src/asiodnp3/OutstationStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ class OutstationStack final : public IOutstation, public opendnp3::ILinkSession,
return this->tstack.link->OnLowerLayerDown();
}

virtual bool OnFrame(const opendnp3::LinkHeaderFields& header, const openpal::RSlice& userdata)
virtual bool OnFrame(const opendnp3::LinkHeaderFields& header, const openpal::RSlice& userdata) override
{
return this->tstack.link->OnFrame(header, userdata);
}

virtual void BeginTransmit(const openpal::RSlice& buffer, opendnp3::ILinkSession& context)
virtual void BeginTransmit(const openpal::RSlice& buffer, opendnp3::ILinkSession& context) override
{
this->iohandler->BeginTransmit(shared_from_this(), buffer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DatabaseBuffers : public IStaticSelector, public IResponseLoader, public I
virtual Range AssignClassToRange(AssignClassType type, PointClass clazz, const Range& range) override final;

//used to unselect selected points
void Unselect();
void Unselect() override;

// stores the most revent values and event information
StaticBuffers buffers;
Expand Down