aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbuild2/algorithm.hxx6
-rw-r--r--libbuild2/cc/utility.hxx3
-rw-r--r--libbuild2/config/utility.hxx3
-rw-r--r--libbuild2/context.hxx21
-rw-r--r--libbuild2/diagnostics.hxx6
-rw-r--r--libbuild2/dump.hxx5
-rw-r--r--libbuild2/file.hxx5
-rw-r--r--libbuild2/forward.hxx73
-rw-r--r--libbuild2/function.hxx1
-rw-r--r--libbuild2/module.hxx4
-rw-r--r--libbuild2/operation.hxx14
-rw-r--r--libbuild2/parser.hxx6
-rw-r--r--libbuild2/prerequisite.hxx3
-rw-r--r--libbuild2/rule-map.hxx3
-rw-r--r--libbuild2/rule.hxx1
-rw-r--r--libbuild2/scope.hxx1
-rw-r--r--libbuild2/search.hxx5
-rw-r--r--libbuild2/spec.hxx3
-rw-r--r--libbuild2/target-key.hxx3
-rw-r--r--libbuild2/target-type.hxx7
-rw-r--r--libbuild2/target.hxx4
-rw-r--r--libbuild2/test/script/parser.hxx3
-rw-r--r--libbuild2/test/script/script.hxx3
-rw-r--r--libbuild2/utility.hxx8
-rw-r--r--libbuild2/variable.hxx7
25 files changed, 97 insertions, 101 deletions
diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx
index f105fbe..5000c47 100644
--- a/libbuild2/algorithm.hxx
+++ b/libbuild2/algorithm.hxx
@@ -6,6 +6,7 @@
#define LIBBUILD2_ALGORITHM_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/action.hxx>
@@ -15,11 +16,6 @@
namespace build2
{
- class scope;
- class context;
- class prerequisite;
- class prerequisite_key;
-
// The default prerequisite search implementation. It first calls the
// prerequisite-type-specific search function. If that doesn't yeld
// anything, it creates a new target.
diff --git a/libbuild2/cc/utility.hxx b/libbuild2/cc/utility.hxx
index 3ee07bd..2dd06a8 100644
--- a/libbuild2/cc/utility.hxx
+++ b/libbuild2/cc/utility.hxx
@@ -6,6 +6,7 @@
#define LIBBUILD2_CC_UTILITY_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/target.hxx>
@@ -15,8 +16,6 @@
namespace build2
{
- struct variable;
-
namespace cc
{
// To form the complete path do:
diff --git a/libbuild2/config/utility.hxx b/libbuild2/config/utility.hxx
index cfb7177..2a0909f 100644
--- a/libbuild2/config/utility.hxx
+++ b/libbuild2/config/utility.hxx
@@ -6,6 +6,7 @@
#define LIBBUILD2_CONFIG_UTILITY_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/scope.hxx>
@@ -16,8 +17,6 @@
namespace build2
{
- class scope;
-
namespace config
{
// Set, if necessary, a required config.* variable.
diff --git a/libbuild2/context.hxx b/libbuild2/context.hxx
index 75147ef..08b023e 100644
--- a/libbuild2/context.hxx
+++ b/libbuild2/context.hxx
@@ -6,6 +6,7 @@
#define LIBBUILD2_CONTEXT_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
// NOTE: this file is included by pretty much every other build state header
@@ -20,26 +21,6 @@
namespace build2
{
- class context;
-
- class scope;
- class scope_map;
- class target_set;
- class target_type_map;
-
- class value;
- using values = small_vector<value, 1>;
-
- struct variable;
- class variable_pool;
- struct variable_override;
- using variable_overrides = vector<variable_override>;
- class variable_override_cache;
-
- class function_map;
-
- struct opspec;
-
class loaded_modules_lock;
class LIBBUILD2_SYMEXPORT run_phase_mutex
diff --git a/libbuild2/diagnostics.hxx b/libbuild2/diagnostics.hxx
index 26f602a..6d06dec 100644
--- a/libbuild2/diagnostics.hxx
+++ b/libbuild2/diagnostics.hxx
@@ -8,6 +8,7 @@
#include <libbutl/diagnostics.mxx>
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/export.hxx>
@@ -441,11 +442,6 @@ namespace build2
//
// info << "while " << diag_doing (a, t);
//
- class scope;
- class target;
- class context;
- struct action;
-
struct diag_phrase
{
const action& a;
diff --git a/libbuild2/dump.hxx b/libbuild2/dump.hxx
index aead805..d3e3239 100644
--- a/libbuild2/dump.hxx
+++ b/libbuild2/dump.hxx
@@ -6,6 +6,7 @@
#define LIBBUILD2_DUMP_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/action.hxx>
@@ -14,10 +15,6 @@
namespace build2
{
- class scope;
- class target;
- class context;
-
// Dump the build state to diag_stream. If action is specified, then assume
// rules have been matched for this action and dump action-specific
// information (like rule-specific variables).
diff --git a/libbuild2/file.hxx b/libbuild2/file.hxx
index 009ba14..3d3c38b 100644
--- a/libbuild2/file.hxx
+++ b/libbuild2/file.hxx
@@ -8,6 +8,7 @@
#include <map>
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/scope.hxx>
@@ -17,10 +18,6 @@
namespace build2
{
- class target;
- class location;
- class prerequisite_key;
-
using subprojects = std::map<project_name, dir_path>;
LIBBUILD2_SYMEXPORT ostream&
diff --git a/libbuild2/forward.hxx b/libbuild2/forward.hxx
new file mode 100644
index 0000000..1c1eb77
--- /dev/null
+++ b/libbuild2/forward.hxx
@@ -0,0 +1,73 @@
+// file : libbuild2/forward.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef LIBBUILD2_FORWARD_HXX
+#define LIBBUILD2_FORWARD_HXX
+
+#include <libbuild2/types.hxx>
+
+namespace build2
+{
+ // Forward declarations for the build state.
+
+ // <libbuild2/action.hxx>
+ //
+ struct action;
+
+ // <libbuild2/spec.hxx>
+ //
+ struct opspec;
+
+ // <libbuild2/variable.hxx>
+ //
+ class value;
+ using values = small_vector<value, 1>;
+ struct lookup;
+
+ struct variable;
+ class variable_pool;
+ class variable_map;
+ struct variable_override;
+ using variable_overrides = vector<variable_override>;
+ class variable_override_cache;
+
+ // <libbuild2/function.hxx>
+ //
+ class function_map;
+
+ // <libbuild2/scope.hxx>
+ //
+ class scope;
+ class scope_map;
+
+ // <libbuild2/target-type.hxx>
+ //
+ class target_type_map;
+
+ // <libbuild2/target-key.hxx>
+ //
+ class target_key;
+
+ // <libbuild2/target.hxx>
+ //
+ class target;
+ class target_set;
+ class include_type;
+ struct prerequisite_member;
+
+ // <libbuild2/prerequisite.hxx>
+ //
+ class prerequisite;
+ class prerequisite_key;
+
+ // <libbuild2/rule.hxx>
+ //
+ class rule;
+
+ // <libbuild2/context.hxx>
+ //
+ class context;
+}
+
+#endif // LIBBUILD2_FORWARD_HXX
diff --git a/libbuild2/function.hxx b/libbuild2/function.hxx
index d1de4ac..dd31024 100644
--- a/libbuild2/function.hxx
+++ b/libbuild2/function.hxx
@@ -10,6 +10,7 @@
#include <type_traits> // aligned_storage
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/variable.hxx>
diff --git a/libbuild2/module.hxx b/libbuild2/module.hxx
index 50ca7da..34c7245 100644
--- a/libbuild2/module.hxx
+++ b/libbuild2/module.hxx
@@ -8,6 +8,7 @@
#include <map>
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/context.hxx>
@@ -24,9 +25,6 @@ namespace build2
// module is "bootstrapped" (or "booted" for short) and then "initialized"
// (or "inited").
- class scope;
- class location;
-
class module_base
{
public:
diff --git a/libbuild2/operation.hxx b/libbuild2/operation.hxx
index 125c692..7b6310f 100644
--- a/libbuild2/operation.hxx
+++ b/libbuild2/operation.hxx
@@ -8,6 +8,7 @@
#include <libbutl/string-table.mxx>
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/action.hxx>
@@ -17,19 +18,6 @@
namespace build2
{
- class location;
- class scope;
- class target;
- class target_key;
- class context;
- class include_type;
- struct prerequisite_member;
-
- class value;
- using values = small_vector<value, 1>;
-
- struct opspec;
-
// Meta-operation info.
//
diff --git a/libbuild2/parser.hxx b/libbuild2/parser.hxx
index d0e5b57..8b6179c 100644
--- a/libbuild2/parser.hxx
+++ b/libbuild2/parser.hxx
@@ -8,6 +8,7 @@
#include <stack>
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/spec.hxx>
@@ -20,11 +21,6 @@
namespace build2
{
- class scope;
- class target;
- class context;
- class prerequisite;
-
class LIBBUILD2_SYMEXPORT parser
{
public:
diff --git a/libbuild2/prerequisite.hxx b/libbuild2/prerequisite.hxx
index fe6d10a..c826e3b 100644
--- a/libbuild2/prerequisite.hxx
+++ b/libbuild2/prerequisite.hxx
@@ -6,6 +6,7 @@
#define LIBBUILD2_PREREQUISITE_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/scope.hxx>
@@ -18,8 +19,6 @@
namespace build2
{
- class target;
-
// Light-weight (by being shallow-pointing) prerequisite key, similar
// to (and based on) target key.
//
diff --git a/libbuild2/rule-map.hxx b/libbuild2/rule-map.hxx
index 26f80a8..7994583 100644
--- a/libbuild2/rule-map.hxx
+++ b/libbuild2/rule-map.hxx
@@ -10,14 +10,13 @@
#include <libbutl/prefix-map.mxx>
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/action.hxx>
namespace build2
{
- class rule;
-
using hint_rule_map =
butl::prefix_map<string, reference_wrapper<const rule>, '.'>;
diff --git a/libbuild2/rule.hxx b/libbuild2/rule.hxx
index abd754e..88c6c7d 100644
--- a/libbuild2/rule.hxx
+++ b/libbuild2/rule.hxx
@@ -6,6 +6,7 @@
#define LIBBUILD2_RULE_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/action.hxx>
diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx
index b29a981..2737958 100644
--- a/libbuild2/scope.hxx
+++ b/libbuild2/scope.hxx
@@ -9,6 +9,7 @@
#include <unordered_set>
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/module.hxx>
diff --git a/libbuild2/search.hxx b/libbuild2/search.hxx
index 63ea6b1..1b018c4 100644
--- a/libbuild2/search.hxx
+++ b/libbuild2/search.hxx
@@ -6,16 +6,13 @@
#define LIBBUILD2_SEARCH_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/export.hxx>
namespace build2
{
- class target;
- class context;
- class prerequisite_key;
-
// Search for an existing target in this prerequisite's scope. Scope can be
// NULL if directories are absolute.
//
diff --git a/libbuild2/spec.hxx b/libbuild2/spec.hxx
index b18f665..b8e65fe 100644
--- a/libbuild2/spec.hxx
+++ b/libbuild2/spec.hxx
@@ -6,6 +6,7 @@
#define LIBBUILD2_SPEC_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/variable.hxx>
@@ -14,8 +15,6 @@
namespace build2
{
- class scope;
-
struct targetspec
{
typedef build2::name name_type;
diff --git a/libbuild2/target-key.hxx b/libbuild2/target-key.hxx
index 4df2b1f..dd937c9 100644
--- a/libbuild2/target-key.hxx
+++ b/libbuild2/target-key.hxx
@@ -8,9 +8,8 @@
#include <map>
#include <cstring> // strcmp()
-#include <libbutl/utility.mxx> // compare_c_string
-
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/target-type.hxx>
diff --git a/libbuild2/target-type.hxx b/libbuild2/target-type.hxx
index 3325df1..120e6e0 100644
--- a/libbuild2/target-type.hxx
+++ b/libbuild2/target-type.hxx
@@ -8,18 +8,13 @@
#include <map>
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/export.hxx>
namespace build2
{
- class scope;
- class target;
- class context;
- class target_key;
- class prerequisite_key;
-
// Target type.
//
// Note that we assume there is always a single instance of this class for
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index e91c41a..258daef 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -12,6 +12,7 @@
#include <libbutl/multi-index.mxx> // map_iterator_adapter
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/scope.hxx>
@@ -27,9 +28,6 @@
namespace build2
{
- class rule;
- class target;
-
// From <libbuild2/algorithm.hxx>.
//
LIBBUILD2_SYMEXPORT const target&
diff --git a/libbuild2/test/script/parser.hxx b/libbuild2/test/script/parser.hxx
index 4d3fa49..c8a1408 100644
--- a/libbuild2/test/script/parser.hxx
+++ b/libbuild2/test/script/parser.hxx
@@ -6,6 +6,7 @@
#define LIBBUILD2_TEST_SCRIPT_PARSER_HXX
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/parser.hxx>
@@ -16,8 +17,6 @@
namespace build2
{
- class context;
-
namespace test
{
namespace script
diff --git a/libbuild2/test/script/script.hxx b/libbuild2/test/script/script.hxx
index 8b34be8..30bc6e8 100644
--- a/libbuild2/test/script/script.hxx
+++ b/libbuild2/test/script/script.hxx
@@ -8,6 +8,7 @@
#include <set>
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/variable.hxx>
@@ -18,8 +19,6 @@
namespace build2
{
- class target;
-
namespace test
{
namespace script
diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx
index 1d5c7bb..43b556e 100644
--- a/libbuild2/utility.hxx
+++ b/libbuild2/utility.hxx
@@ -21,6 +21,7 @@
#include <unordered_set>
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
// "Fake" version values used during bootstrap.
//
@@ -157,8 +158,6 @@ namespace build2
LIBBUILD2_SYMEXPORT extern optional<path> config_sub; // --config-sub
LIBBUILD2_SYMEXPORT extern optional<path> config_guess; // --config-guess
- class location;
-
LIBBUILD2_SYMEXPORT void
check_build_version (const standard_version_constraint&, const location&);
@@ -502,8 +501,6 @@ namespace build2
//
// If excl is not NULL, then filter this option out (note: case sensitive).
//
- struct variable;
-
template <typename T>
void
append_options (cstrings&, T&, const variable&, const char* excl = nullptr);
@@ -530,9 +527,6 @@ namespace build2
// As above but from the strings value directly.
//
- class value;
- struct lookup;
-
LIBBUILD2_SYMEXPORT void
append_options (cstrings&, const lookup&, const char* excl = nullptr);
diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx
index 51cdf49..6a2c681 100644
--- a/libbuild2/variable.hxx
+++ b/libbuild2/variable.hxx
@@ -14,6 +14,7 @@
#include <libbutl/multi-index.mxx> // map_key
#include <libbuild2/types.hxx>
+#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/context.hxx>
@@ -34,10 +35,6 @@ namespace build2
// during a phase other than load must make sure the variable has already
// been typified.
- class value;
- struct variable;
- struct lookup;
-
struct value_type
{
const char* name; // Type name for diagnostics.
@@ -481,8 +478,6 @@ namespace build2
// A variable can be undefined, NULL, or contain a (potentially empty)
// value.
//
- class variable_map;
-
struct lookup
{
using value_type = build2::value;