Skip to content

Commit

Permalink
Everything working under clang
Browse files Browse the repository at this point in the history
  • Loading branch information
omarhogni committed Oct 26, 2023
1 parent fae1e9a commit aa17008
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/deserialize.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export module modbus:deserialize;
import :function;
import :error;

namespace modbus::impl {
export namespace modbus::impl {

/// Check if length is sufficient.
[[nodiscard]] inline auto check_length(std::size_t actual, std::size_t needed) -> std::error_code {
Expand Down
5 changes: 4 additions & 1 deletion src/modbus.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ export import :client;
export import :error;
export import :packet;
export import :deserialize;
export import :serialize;
export import :default_handler;
export import :server;
export import :server;
export import :tcp;
export import :function;
3 changes: 2 additions & 1 deletion src/packet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export module modbus:packet;
import :deserialize;
import :serialize;
import :function;
import :tcp;

namespace modbus {
export namespace modbus {
namespace request {
struct read_coils;
struct read_discrete_inputs;
Expand Down
2 changes: 1 addition & 1 deletion src/serialize.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module;
export module modbus:serialize;
import :function;

namespace modbus::impl {
export namespace modbus::impl {

/// Convert a boolean to a uint16 Modbus representation.
inline auto bool_to_uint16(bool value) -> std::uint16_t {
Expand Down
2 changes: 1 addition & 1 deletion src/tcp.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace modbus {

/// Modbus/TCP application protocol (MBAP) header.
#pragma pack(push, 1)
struct tcp_mbap {
export struct tcp_mbap {
std::uint16_t transaction;
std::uint16_t protocol = 0; // 0 for modbus.
std::uint16_t length;
Expand Down
1 change: 1 addition & 0 deletions tests/helpers/mbpoll_request_encoding_sniffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Used to generate test data from known working modbus clients
// fe mbpoll

#include <exception>
#include <asio.hpp>
#include <iostream>

Expand Down
3 changes: 3 additions & 0 deletions tests/serialization.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include <array>

#include <boost/ut.hpp>
#include <span>

import modbus;

void print_bytes(std::span<uint8_t> data) {
for (auto& k : data) {
Expand Down

0 comments on commit aa17008

Please sign in to comment.