From e5d4c47040e526f0302a53c75ccf1f8c3f5981a1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Oct 2019 14:17:30 +0200 Subject: Add forward declaration header for build state types --- libbuild2/algorithm.hxx | 6 +--- libbuild2/cc/utility.hxx | 3 +- libbuild2/config/utility.hxx | 3 +- libbuild2/context.hxx | 21 +----------- libbuild2/diagnostics.hxx | 6 +--- libbuild2/dump.hxx | 5 +-- libbuild2/file.hxx | 5 +-- libbuild2/forward.hxx | 73 ++++++++++++++++++++++++++++++++++++++++ libbuild2/function.hxx | 1 + libbuild2/module.hxx | 4 +-- libbuild2/operation.hxx | 14 +------- libbuild2/parser.hxx | 6 +--- libbuild2/prerequisite.hxx | 3 +- libbuild2/rule-map.hxx | 3 +- libbuild2/rule.hxx | 1 + libbuild2/scope.hxx | 1 + libbuild2/search.hxx | 5 +-- libbuild2/spec.hxx | 3 +- libbuild2/target-key.hxx | 3 +- libbuild2/target-type.hxx | 7 +--- libbuild2/target.hxx | 4 +-- libbuild2/test/script/parser.hxx | 3 +- libbuild2/test/script/script.hxx | 3 +- libbuild2/utility.hxx | 8 +---- libbuild2/variable.hxx | 7 +--- 25 files changed, 97 insertions(+), 101 deletions(-) create mode 100644 libbuild2/forward.hxx (limited to 'libbuild2') 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 +#include #include #include @@ -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 +#include #include #include @@ -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 +#include #include #include @@ -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 +#include #include // 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; - - struct variable; - class variable_pool; - struct variable_override; - using variable_overrides = vector; - 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 #include +#include #include #include @@ -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 +#include #include #include @@ -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 #include +#include #include #include @@ -17,10 +18,6 @@ namespace build2 { - class target; - class location; - class prerequisite_key; - using subprojects = std::map; 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 + +namespace build2 +{ + // Forward declarations for the build state. + + // + // + struct action; + + // + // + struct opspec; + + // + // + class value; + using values = small_vector; + struct lookup; + + struct variable; + class variable_pool; + class variable_map; + struct variable_override; + using variable_overrides = vector; + class variable_override_cache; + + // + // + class function_map; + + // + // + class scope; + class scope_map; + + // + // + class target_type_map; + + // + // + class target_key; + + // + // + class target; + class target_set; + class include_type; + struct prerequisite_member; + + // + // + class prerequisite; + class prerequisite_key; + + // + // + class rule; + + // + // + 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 // aligned_storage #include +#include #include #include 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 #include +#include #include #include @@ -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 #include +#include #include #include @@ -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; - - 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 #include +#include #include #include @@ -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 +#include #include #include @@ -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 #include +#include #include #include namespace build2 { - class rule; - using hint_rule_map = butl::prefix_map, '.'>; 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 +#include #include #include 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 #include +#include #include #include 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 +#include #include #include 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 +#include #include #include @@ -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 #include // strcmp() -#include // compare_c_string - #include +#include #include #include 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 #include +#include #include #include 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 // map_iterator_adapter #include +#include #include #include @@ -27,9 +28,6 @@ namespace build2 { - class rule; - class target; - // From . // 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 +#include #include #include @@ -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 #include +#include #include #include @@ -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 #include +#include // "Fake" version values used during bootstrap. // @@ -157,8 +158,6 @@ namespace build2 LIBBUILD2_SYMEXPORT extern optional config_sub; // --config-sub LIBBUILD2_SYMEXPORT extern optional 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 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 // map_key #include +#include #include #include @@ -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; -- cgit v1.1