From 35d7a6bb691d7e0564cda324b3d724caf4901545 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Fri, 7 Jun 2024 11:17:39 +0200 Subject: Use a precompiled header to speed up the build --- src/Makefile | 2 +- src/_pch.cpp | 1 + src/_pch.h | 22 ++++++++++++++++++++++ src/cancel.cpp | 2 +- src/cancel.h | 2 -- src/compat.cpp | 1 + src/compat.h | 3 --- src/debugspew.h | 2 -- src/deep.cpp | 5 +---- src/deep.h | 3 --- src/intercopycontext.cpp | 2 +- src/intercopycontext.h | 2 -- src/keeper.cpp | 5 +---- src/keeper.h | 5 ----- src/lane.cpp | 2 +- src/lane.h | 7 ------- src/lanes.cpp | 3 +-- src/lanes.h | 2 -- src/linda.cpp | 4 +--- src/linda.h | 5 ----- src/lindafactory.cpp | 1 + src/luaerrors.h | 4 ---- src/macros_and_utils.h | 3 --- src/nameof.cpp | 1 + src/state.cpp | 3 +-- src/threading.cpp | 2 ++ src/threading.h | 2 -- src/tools.cpp | 1 + src/tracker.cpp | 2 ++ src/tracker.h | 2 -- src/uniquekey.h | 2 -- src/universe.cpp | 3 +-- src/universe.h | 3 --- 33 files changed, 41 insertions(+), 68 deletions(-) create mode 100644 src/_pch.cpp create mode 100644 src/_pch.h (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 0362b8b..4990a05 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,7 +7,7 @@ MODULE=lanes -SRC=cancel.cpp compat.cpp deep.cpp intercopycontext.cpp keeper.cpp lane.cpp lanes.cpp linda.cpp lindafactory.cpp nameof.cpp state.cpp threading.cpp tools.cpp tracker.cpp universe.cpp +SRC=_pch.cpp cancel.cpp compat.cpp deep.cpp intercopycontext.cpp keeper.cpp lane.cpp lanes.cpp linda.cpp lindafactory.cpp nameof.cpp state.cpp threading.cpp tools.cpp tracker.cpp universe.cpp OBJ=$(SRC:.cpp=.o) diff --git a/src/_pch.cpp b/src/_pch.cpp new file mode 100644 index 0000000..4082771 --- /dev/null +++ b/src/_pch.cpp @@ -0,0 +1 @@ +#include "_pch.h" \ No newline at end of file diff --git a/src/_pch.h b/src/_pch.h new file mode 100644 index 0000000..67fe4a7 --- /dev/null +++ b/src/_pch.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/cancel.cpp b/src/cancel.cpp index f53dc36..8845e9d 100644 --- a/src/cancel.cpp +++ b/src/cancel.cpp @@ -32,7 +32,7 @@ THE SOFTWARE. =============================================================================== ]]-- */ - +#include "_pch.h" #include "cancel.h" #include "debugspew.h" diff --git a/src/cancel.h b/src/cancel.h index d60903c..df3cfad 100644 --- a/src/cancel.h +++ b/src/cancel.h @@ -14,8 +14,6 @@ extern "C" #include "macros_and_utils.h" #include "uniquekey.h" -#include - // ################################################################################################# class Lane; // forward diff --git a/src/compat.cpp b/src/compat.cpp index 3b026b4..f0a3685 100644 --- a/src/compat.cpp +++ b/src/compat.cpp @@ -1,3 +1,4 @@ +#include "_pch.h" #include "compat.h" #include "macros_and_utils.h" diff --git a/src/compat.h b/src/compat.h index 0ae7759..24a105f 100644 --- a/src/compat.h +++ b/src/compat.h @@ -24,9 +24,6 @@ extern "C" #define LUA_JITLIBNAME "jit" #endif // LUA_JITLIBNAME -#include -#include - // code is now preferring Lua 5.4 API // ################################################################################################# diff --git a/src/debugspew.h b/src/debugspew.h index ccebc0a..051742e 100644 --- a/src/debugspew.h +++ b/src/debugspew.h @@ -3,8 +3,6 @@ #include "lanesconf.h" #include "universe.h" -#include - // ################################################################################################# #if USE_DEBUG_SPEW() diff --git a/src/deep.cpp b/src/deep.cpp index 9538fdf..0fdcb31 100644 --- a/src/deep.cpp +++ b/src/deep.cpp @@ -31,14 +31,11 @@ THE SOFTWARE. =============================================================================== */ - +#include "_pch.h" #include "deep.h" #include "tools.h" -#include -#include - /*-- Metatable copying --*/ /*---=== Deep userdata ===---*/ diff --git a/src/deep.h b/src/deep.h index b39a87f..6cb9bd6 100644 --- a/src/deep.h +++ b/src/deep.h @@ -17,9 +17,6 @@ extern "C" #include "lanesconf.h" #include "uniquekey.h" -#include -#include - // forwards enum class LookupMode; class DeepFactory; diff --git a/src/intercopycontext.cpp b/src/intercopycontext.cpp index 375a403..f00b268 100644 --- a/src/intercopycontext.cpp +++ b/src/intercopycontext.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. =============================================================================== */ - +#include "_pch.h" #include "intercopycontext.h" #include "debugspew.h" diff --git a/src/intercopycontext.h b/src/intercopycontext.h index 4f6ed89..ffa825f 100644 --- a/src/intercopycontext.h +++ b/src/intercopycontext.h @@ -2,8 +2,6 @@ #include "tools.h" -#include - // forwards class Universe; diff --git a/src/keeper.cpp b/src/keeper.cpp index b8f2bd0..87f5505 100644 --- a/src/keeper.cpp +++ b/src/keeper.cpp @@ -37,6 +37,7 @@ =============================================================================== ]]-- */ +#include "_pch.h" #include "keeper.h" #include "intercopycontext.h" @@ -44,10 +45,6 @@ #include "linda.h" #include "state.h" -#include -#include -#include - // There is a table at _R[kLindasRegKey] (aka LindasDB) // This table contains entries of the form [Linda*] = {KeysDB...} // Each KeysDB contains entries of the form [key] = KeyUD diff --git a/src/keeper.h b/src/keeper.h index 5cc7422..9c08c26 100644 --- a/src/keeper.h +++ b/src/keeper.h @@ -11,11 +11,6 @@ extern "C" #include "uniquekey.h" -#include -#include -#include -#include - // forwards class Linda; enum class LookupMode; diff --git a/src/lane.cpp b/src/lane.cpp index b55b611..ea3edb0 100644 --- a/src/lane.cpp +++ b/src/lane.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. =============================================================================== */ - +#include "_pch.h" #include "lane.h" #include "debugspew.h" diff --git a/src/lane.h b/src/lane.h index 4dcb99e..6146df8 100644 --- a/src/lane.h +++ b/src/lane.h @@ -4,13 +4,6 @@ #include "uniquekey.h" #include "universe.h" -#include -#include -#include -#include -#include -#include - // ################################################################################################# // xxh64 of string "kExtendedStackTraceRegKey" generated at https://www.pelock.com/products/hash-calculator diff --git a/src/lanes.cpp b/src/lanes.cpp index c3d0928..96d4ecd 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp @@ -79,6 +79,7 @@ THE SOFTWARE. =============================================================================== */ +#include "_pch.h" #include "lanes.h" #include "deep.h" @@ -100,8 +101,6 @@ THE SOFTWARE. #include #endif -#include - // ################################################################################################# // ########################################### Threads ############################################# // ################################################################################################# diff --git a/src/lanes.h b/src/lanes.h index 6fea869..e697406 100644 --- a/src/lanes.h +++ b/src/lanes.h @@ -11,8 +11,6 @@ extern "C" #include "lanesconf.h" -#include - #define LANES_VERSION_MAJOR 4 #define LANES_VERSION_MINOR 0 #define LANES_VERSION_PATCH 0 diff --git a/src/linda.cpp b/src/linda.cpp index a7d7ee9..031eea0 100644 --- a/src/linda.cpp +++ b/src/linda.cpp @@ -30,15 +30,13 @@ THE SOFTWARE. =============================================================================== */ +#include "_pch.h" #include "linda.h" #include "lane.h" #include "lindafactory.h" #include "tools.h" -#include -#include - // ################################################################################################# static void check_key_types(lua_State* const L_, int const start_, int const end_) diff --git a/src/linda.h b/src/linda.h index 809ade5..3098161 100644 --- a/src/linda.h +++ b/src/linda.h @@ -4,11 +4,6 @@ #include "deep.h" #include "universe.h" -#include -#include -#include -#include - struct Keeper; // ################################################################################################# diff --git a/src/lindafactory.cpp b/src/lindafactory.cpp index 9a75b4f..68cb471 100644 --- a/src/lindafactory.cpp +++ b/src/lindafactory.cpp @@ -30,6 +30,7 @@ THE SOFTWARE. =============================================================================== */ +#include "_pch.h" #include "lindafactory.h" #include "linda.h" diff --git a/src/luaerrors.h b/src/luaerrors.h index 9399427..ff72582 100644 --- a/src/luaerrors.h +++ b/src/luaerrors.h @@ -11,10 +11,6 @@ extern "C" } #endif // __cplusplus -#include -#include -#include - // ################################################################################################# // use this instead of Lua's lua_error diff --git a/src/macros_and_utils.h b/src/macros_and_utils.h index d540cdb..338e389 100644 --- a/src/macros_and_utils.h +++ b/src/macros_and_utils.h @@ -14,9 +14,6 @@ extern "C" #include "debug.h" #include "luaerrors.h" -#include -#include - using namespace std::chrono_literals; // ################################################################################################# diff --git a/src/nameof.cpp b/src/nameof.cpp index 8611239..8e79fda 100644 --- a/src/nameof.cpp +++ b/src/nameof.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. =============================================================================== */ +#include "_pch.h" #include "nameof.h" #include "tools.h" diff --git a/src/state.cpp b/src/state.cpp index af071e8..47e31c3 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -31,6 +31,7 @@ THE SOFTWARE. =============================================================================== */ +#include "_pch.h" #include "state.h" #include "intercopycontext.h" @@ -39,8 +40,6 @@ THE SOFTWARE. #include "tools.h" #include "universe.h" -#include - // ################################################################################################# static constexpr char const* kOnStateCreate{ "on_state_create" }; // update lanes.lua if the name changes! diff --git a/src/threading.cpp b/src/threading.cpp index 43bd107..ebac0da 100644 --- a/src/threading.cpp +++ b/src/threading.cpp @@ -34,6 +34,8 @@ THE SOFTWARE. =============================================================================== */ +#include "_pch.h" + #if defined(__linux__) #ifndef _GNU_SOURCE // definition by the makefile can cause a redefinition error diff --git a/src/threading.h b/src/threading.h index 521618b..f0d1592 100644 --- a/src/threading.h +++ b/src/threading.h @@ -2,8 +2,6 @@ #include "platform.h" -#include - #define THREADAPI_WINDOWS 1 #define THREADAPI_PTHREAD 2 diff --git a/src/tools.cpp b/src/tools.cpp index 302a0df..1afc2b8 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -31,6 +31,7 @@ THE SOFTWARE. =============================================================================== */ +#include "_pch.h" #include "tools.h" diff --git a/src/tracker.cpp b/src/tracker.cpp index 618dc37..24e8d01 100644 --- a/src/tracker.cpp +++ b/src/tracker.cpp @@ -23,7 +23,9 @@ THE SOFTWARE. =============================================================================== */ +#include "_pch.h" #include "tracker.h" + #include "lane.h" // ################################################################################################# diff --git a/src/tracker.h b/src/tracker.h index 14926ec..dcf3c6e 100644 --- a/src/tracker.h +++ b/src/tracker.h @@ -1,7 +1,5 @@ #pragma once -#include - class Lane; struct lua_State; diff --git a/src/uniquekey.h b/src/uniquekey.h index 5ccecc5..114d22e 100644 --- a/src/uniquekey.h +++ b/src/uniquekey.h @@ -3,8 +3,6 @@ #include "compat.h" #include "macros_and_utils.h" -#include - // ################################################################################################# class UniqueKey diff --git a/src/universe.cpp b/src/universe.cpp index b4d54b2..116c8e3 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -28,6 +28,7 @@ THE SOFTWARE. =============================================================================== */ +#include "_pch.h" #include "universe.h" #include "deep.h" @@ -36,8 +37,6 @@ THE SOFTWARE. #include "lane.h" #include "state.h" -#include - extern LUAG_FUNC(linda); // ################################################################################################# diff --git a/src/universe.h b/src/universe.h index 4239466..6f03ed3 100644 --- a/src/universe.h +++ b/src/universe.h @@ -14,9 +14,6 @@ extern "C" #include "tracker.h" #include "uniquekey.h" -#include -#include - // ################################################################################################# // forwards -- cgit v1.2.3-55-g6feb