Skip to content

Commit

Permalink
It seems that include order is very sensitive using modules and some …
Browse files Browse the repository at this point in the history
…includes seem to be missing from asio
  • Loading branch information
omarhogni committed Oct 26, 2023
1 parent 1e14941 commit 02de446
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if(BUILD_TESTS)
endif()

# Clang format all files
file(GLOB_RECURSE ALL_SOURCE_FILES src/*.cpp include/**/*.hpp examples/*.cpp tests/*.cpp)
file(GLOB_RECURSE ALL_SOURCE_FILES src/*.cpp include/**/*.hpp examples/*.cpp tests/*.cpp src/*.cxx)
add_custom_target(
clangformat-fix
COMMAND clang-format
Expand Down
2 changes: 2 additions & 0 deletions examples/client_example.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
#include <iostream>
#include <thread>
#include <vector>
// clang-format off
#include <exception> // Missing include inside asio
#include <asio.hpp>
// clang-format on

import modbus;

Expand Down
2 changes: 2 additions & 0 deletions examples/server_example.cxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023, Skaginn3x (https://skaginn3x.com)

// clang-format off
#include <exception>
#include <asio.hpp>
#include <iostream>
// clang-format on

import modbus;

Expand Down
2 changes: 2 additions & 0 deletions src/client.cxx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright (c) 2023, Skaginn3x (https://Skaginn3x.com)
module;

// clang-format off
#include <expected>
#include <exception>
#include <asio.hpp>
// clang-format on

export module modbus:client;
import :packet;
Expand Down
2 changes: 2 additions & 0 deletions src/deserialize.cxx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module;
#include <system_error>
// clang-format off
#include <expected>
#include <exception>
#include <asio.hpp>
#include <span>
// clang-format on
export module modbus:deserialize;
import :function;
import :error;
Expand Down
2 changes: 2 additions & 0 deletions src/serialize.cxx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright (c) 2023, Skaginn3x (https://skaginn3x.com)
module;
// clang-format off
#include <utility>
#include <cstdint>
#include <exception>
#include <asio.hpp> // This include is only here for cross platform htons and ntohs
// clang-format on
export module modbus:serialize;
import :function;

Expand Down
2 changes: 2 additions & 0 deletions src/server.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ module;
#include <ranges>
#include <string>

// clang-format off
#include <exception>
#include <asio.hpp>
// clang-format on
#include <asio/experimental/awaitable_operators.hpp>
export module modbus:server;
import :tcp;
Expand Down
2 changes: 2 additions & 0 deletions src/tcp.cxx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module;
// clang-format off
#include <exception>
#include <asio.hpp>
#include <cstdint>
#include <span>
#include <utility>
// clang-format on

export module modbus:tcp;

Expand Down
2 changes: 2 additions & 0 deletions tests/deserialization.cxx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// clang-format off
#include <exception>
#include <array>
#include <iostream>
#include <span>
#include <boost/ut.hpp>
#include <expected>
// clang-format on

import modbus;

Expand Down
3 changes: 2 additions & 1 deletion tests/integration.cxx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

// clang-format off
#include <exception>
#include <asio.hpp>
#include <array>
#include <boost/ut.hpp>
// clang-format on

import modbus;

Expand Down

0 comments on commit 02de446

Please sign in to comment.