From ec49b98050998fcc21e25a058cbdcae2fe583138 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Wed, 17 Apr 2024 11:13:50 -0500 Subject: [PATCH 01/61] Bump versions for new release cycle. --- doc/src/history.adoc | 2 ++ src/build/version.jam | 2 +- src/engine/patchlevel.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/history.adoc b/doc/src/history.adoc index 524a08058f..cb2d7df19b 100644 --- a/doc/src/history.adoc +++ b/doc/src/history.adoc @@ -1,6 +1,8 @@ [[b2.history]] = History +== Version 5.2.0 + == Version 5.1.0 This is mostly a bugfix release to account for issues impacting Boost Libraries. diff --git a/src/build/version.jam b/src/build/version.jam index 9b1d261fb0..7a1866e70d 100644 --- a/src/build/version.jam +++ b/src/build/version.jam @@ -9,7 +9,7 @@ import numbers ; # Mirror engine JAM_VERSION .major = 5 ; -.minor = 1 ; +.minor = 2 ; .patch = 0 ; diff --git a/src/engine/patchlevel.h b/src/engine/patchlevel.h index 56a68e8c5a..1341bbbcb3 100644 --- a/src/engine/patchlevel.h +++ b/src/engine/patchlevel.h @@ -13,5 +13,5 @@ Distributed under the Boost Software License, Version 1.0. */ #define VERSION_MAJOR 5 -#define VERSION_MINOR 1 +#define VERSION_MINOR 2 #define VERSION_PATCH 0 From e249722ccd20521e4c560a5afdf1a36828b1ea37 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Fri, 19 Apr 2024 09:25:12 -0500 Subject: [PATCH 02/61] Fix stack overflow on recursive module import. The import would load modules that had already been loaded instead of just importing the symbols. This would cause stack overflows if a module happened to accidentally re-load itself indefinitely. This fixes the overflow by importing but not loading modules that recurse. fixes #367 --- doc/src/history.adoc | 4 + src/engine/mod_jam_modules.cpp | 590 +++++++++++++++++---------------- 2 files changed, 300 insertions(+), 294 deletions(-) diff --git a/doc/src/history.adoc b/doc/src/history.adoc index cb2d7df19b..38eda6bfd0 100644 --- a/doc/src/history.adoc +++ b/doc/src/history.adoc @@ -3,6 +3,10 @@ == Version 5.2.0 +* Fix incorrect recursive loading of modules when doing recursive importing of + modules. The recursive loading would cause stack overflows. + -- _René Ferdinand Rivera Morell_ + == Version 5.1.0 This is mostly a bugfix release to account for issues impacting Boost Libraries. diff --git a/src/engine/mod_jam_modules.cpp b/src/engine/mod_jam_modules.cpp index 80831807c4..aa6282888d 100644 --- a/src/engine/mod_jam_modules.cpp +++ b/src/engine/mod_jam_modules.cpp @@ -24,346 +24,348 @@ namespace b2 { namespace jam { namespace modules { list_ref binding(std::string module_name) { - return *jam::variable("modules", module_name + ".__binding__"); + return *jam::variable("modules", module_name + ".__binding__"); } void record_binding(std::string module_name, value_ref value) { - std::string loading = jam::variable("modules", ".loading")[-1]->str(); - jam::variable("modules", loading + ".__binding__") = value; + std::string loading = jam::variable("modules", ".loading")[-1]->str(); + jam::variable("modules", loading + ".__binding__") = value; } void poke(std::string module_name, list_cref variables, list_cref value) { - for (auto variable : variables) - { - jam::variable(module_name, variable->str()) = value; - } + for (auto variable : variables) + { + jam::variable(module_name, variable->str()) = value; + } } list_ref peek(std::string module_name, list_cref variables) { - list_ref result; - for (auto variable : variables) - { - result.append(jam::variable(module_name, variable->str())); - } - return result; + list_ref result; + for (auto variable : variables) + { + result.append(jam::variable(module_name, variable->str())); + } + return result; } static void clone_rule(rule_ptr source_rule, module_ptr target_module) { - // IMPORT $(source-module) : $(source-rule) : $(target-module) : - // $(source-rule) ; - rule_ptr target_rule - = import_rule(source_rule, target_module, source_rule->name); - rule_localize(target_rule, target_module); - // EXPORT $(target-module) : $(target-rule) ; - target_rule->exported = 1; - // IMPORT $(target-module) : $(target-rule) : : - // $(target-module).$(target-rule) ; - std::string target_rule_name = value_ref(target_rule->name)->str(); - std::string target_module_name = value_ref(target_module->name)->str(); - std::string global_rule_name = target_module_name + "." + target_rule_name; - import_rule(target_rule, root_module(), value_ref(global_rule_name)); + // IMPORT $(source-module) : $(source-rule) : $(target-module) : + // $(source-rule) ; + rule_ptr target_rule + = import_rule(source_rule, target_module, source_rule->name); + rule_localize(target_rule, target_module); + // EXPORT $(target-module) : $(target-rule) ; + target_rule->exported = 1; + // IMPORT $(target-module) : $(target-rule) : : + // $(target-module).$(target-rule) ; + std::string target_rule_name = value_ref(target_rule->name)->str(); + std::string target_module_name = value_ref(target_module->name)->str(); + std::string global_rule_name = target_module_name + "." + target_rule_name; + import_rule(target_rule, root_module(), value_ref(global_rule_name)); } void clone_rules(std::tuple source_target_modules) { - module_ptr source_mod - = bindmodule(value_ref(std::get<0>(source_target_modules))); - module_ptr target_mod - = bindmodule(value_ref(std::get<1>(source_target_modules))); - hash_enumerate(source_mod->rules, clone_rule, target_mod); + module_ptr source_mod + = bindmodule(value_ref(std::get<0>(source_target_modules))); + module_ptr target_mod + = bindmodule(value_ref(std::get<1>(source_target_modules))); + hash_enumerate(source_mod->rules, clone_rule, target_mod); } list_ref call_in(value_ref module_name, - std::tuple rule_name_a1, - const lists & rest, - bind::context_ref_ context_ref) + std::tuple rule_name_a1, + const lists & rest, + bind::context_ref_ context_ref) { - value_ref rule_name = std::get<0>(rule_name_a1); - frame * outer = context_ref.get().frame; - module_scope scope(outer, module_name->str()); - lists args; - args | *std::get<1>(rule_name_a1) | rest; - LIST * result = call_rule(rule_name, outer, args); - return list_ref(result, true); + value_ref rule_name = std::get<0>(rule_name_a1); + frame * outer = context_ref.get().frame; + module_scope scope(outer, module_name->str()); + lists args; + args | *std::get<1>(rule_name_a1) | rest; + LIST * result = call_rule(rule_name, outer, args); + return list_ref(result, true); } list_ref call_locally(std::tuple rule_name_a1, - const lists & rest, - bind::context_ref_ context_ref) + const lists & rest, + bind::context_ref_ context_ref) { - std::string rule_name = std::get<0>(rule_name_a1); - auto dot_index = rule_name.find('.'); - std::string module_name; - if (dot_index != std::string::npos) - { - module_name = rule_name.substr(0, dot_index); - rule_name = rule_name.substr(dot_index + 1); - } - frame * outer = context_ref.get().frame; - module_scope scope(outer, module_name.c_str()); - lists args; - args | *std::get<1>(rule_name_a1) | rest; - LIST * result = call_rule(value_ref(rule_name), outer, args); - return list_ref(result, true); + std::string rule_name = std::get<0>(rule_name_a1); + auto dot_index = rule_name.find('.'); + std::string module_name; + if (dot_index != std::string::npos) + { + module_name = rule_name.substr(0, dot_index); + rule_name = rule_name.substr(dot_index + 1); + } + frame * outer = context_ref.get().frame; + module_scope scope(outer, module_name.c_str()); + lists args; + args | *std::get<1>(rule_name_a1) | rest; + LIST * result = call_rule(value_ref(rule_name), outer, args); + return list_ref(result, true); } void run_tests(value_ref m, bind::context_ref_ context_ref) { - variable tested_modules("modules", ".tested"); - list_cref argv = variable("ARGV"); - bool quiet = argv.contains("--quiet"); - bool debug = argv.contains("--debug"); - bool debug_module = argv.contains("--debug-module=" + m); - bool debug_tests = argv.contains("--debug-tests"); - - // Avoid recursive test invocations. - if ((*tested_modules).contains(m)) return; - // Only test if asked for in CLI. - if (!debug && !debug_module) return; - // Track what we've tested to avoid recursion. - tested_modules += m; - // Warn if we have no __test__ rule to run. - list_ref rules(module_rules(bindmodule(m)), true); - if (!rules.contains("__test__")) - { - if (!quiet && debug_tests) - out_printf( - "warning: no __test__ rule defined in module %s\n", m->str()); - // out_printf("\t%s rules: ", m->str()); - // list_print(*rules); - // out_printf("\n"); - return; - } - // Debug info. - if (!quiet) out_printf("testing module %s...\n", m->str()); - // Create a shell __test-M__ modules to run the tests in. - module_ptr source_module = bindmodule(m); - std::string test_module_name = std::string("__test-") + m->str() + "__"; - module_ptr test_module = bindmodule(value_ref(test_module_name)); - for (auto rule : rules) - import_rule(find_rule(rule, source_module), test_module, rule); - rule_localize(import_rule(find_rule(value_ref("__test__"), source_module), - test_module, value_ref("__test__")), - test_module); - // We can now run the tests in the __test-M__.__test__ rule. - module_scope test_scope( - context_ref.get().frame, test_module_name.c_str()); - run_rule(test_scope.frame(), "__test__"); + variable tested_modules("modules", ".tested"); + list_cref argv = variable("ARGV"); + bool quiet = argv.contains("--quiet"); + bool debug = argv.contains("--debug"); + bool debug_module = argv.contains("--debug-module=" + m); + bool debug_tests = argv.contains("--debug-tests"); + + // Avoid recursive test invocations. + if ((*tested_modules).contains(m)) return; + // Only test if asked for in CLI. + if (!debug && !debug_module) return; + // Track what we've tested to avoid recursion. + tested_modules += m; + // Warn if we have no __test__ rule to run. + list_ref rules(module_rules(bindmodule(m)), true); + if (!rules.contains("__test__")) + { + if (!quiet && debug_tests) + out_printf( + "warning: no __test__ rule defined in module %s\n", m->str()); + // out_printf("\t%s rules: ", m->str()); + // list_print(*rules); + // out_printf("\n"); + return; + } + // Debug info. + if (!quiet) out_printf("testing module %s...\n", m->str()); + // Create a shell __test-M__ modules to run the tests in. + module_ptr source_module = bindmodule(m); + std::string test_module_name = std::string("__test-") + m->str() + "__"; + module_ptr test_module = bindmodule(value_ref(test_module_name)); + for (auto rule : rules) + import_rule(find_rule(rule, source_module), test_module, rule); + rule_localize(import_rule(find_rule(value_ref("__test__"), source_module), + test_module, value_ref("__test__")), + test_module); + // We can now run the tests in the __test-M__.__test__ rule. + module_scope test_scope( + context_ref.get().frame, test_module_name.c_str()); + run_rule(test_scope.frame(), "__test__"); } void load(value_ref module_name, - value_ref filename, - list_cref search, - bind::context_ref_ context_ref) + value_ref filename, + list_cref search, + bind::context_ref_ context_ref) { - jam_context & context = context_ref.get(); - variable loaded_v("modules", ".loaded"); - variable loading_v("modules", ".loading"); - variable untested_v("modules", ".untested"); - variable tested_v("modules", ".tested"); - std::string module_basename = PATHNAME(module_name->str()).base(); - if (!(*loaded_v).contains(module_name)) - { - // Not already loaded. - filename = filename.has_value() ? filename : module_name + ".jam"; - // Mark the module loaded so we do not try to load it recursively. - loaded_v += module_basename; - // Suppress tests if any module loads are already in progress. - bool suppress_test = loading_v; - // Push this module on the loading stack. - loading_v += module_name; - // Remember that it is untested. - untested_v += module_name; - // Insert the new module's __name__ and __file__ globals. - variable(module_name, "__name__") = module_name; - variable(module_name, "__file__") = filename; - // Use BOOST_BUILD_PATH env as default. - list_ref module_target_search - = search.empty() ? *variable("BOOST_BUILD_PATH") : search; - // Include the file, if we find it, and with some setup. - { - { - // Add some grist so that the module will have a unique target - // name. - value_ref module_target = "" + filename; - target_ref module_target_r(module_target); - // Set the search path. - module_target_r.on_set("SEARCH", module_target_search); - // Set the binding rule. - module_target_r.on_set("BINDRULE", "modules.record-binding"); - // Do the load, in the module. - { - module_scope_in_function in_module( - context.frame, module_name->str()); - parse_include(module_target, in_module.frame()); - // Allow the module to see its own names with full - // qualification. - list_ref to_import(module_rules(in_module), true); - for (auto rule : to_import) - { - import_rule(find_rule(rule, in_module), in_module, - module_name + "." + rule); - } - } - } - // Did the include succeed? - if (module_name != "modules" && binding(module_name).empty()) - { - run_rule(context.frame, "import", list_ref() + "errors"); - run_rule(context.frame, "errors.error", - list_ref() + "Could not find module" + module_name + "in" - + module_target_search); - } - // Pop the loading stack. Must happen before testing or we will run - // into a circular loading dependency. - loading_v = loading_v.get().slice(0, -2); - // Run any pending tests if this is an outer load. - if (!suppress_test) - { - for (auto to_test : list_ref(*untested_v)) - { - run_tests(to_test, context_ref); - } - untested_v = list_ref(); - } - } - } - else if (!(*tested_v).contains(module_name)) - { - // Native modules are pre-loaded but can be untested. In that case we - // make sure we run tests for those. - untested_v += module_name; - if (!loading_v) - { - for (auto to_test : list_ref(*untested_v)) - { - run_tests(to_test, context_ref); - } - untested_v = list_ref(); - } - } - else if ((*loading_v).contains(module_name)) - { - run_rule(context.frame, "import", list_ref() + "errors"); - run_rule(context.frame, "errors.error", - list_ref() + "loading \"" + module_name->str() + "\n", - list_ref() + "circular module loading dependency:", - list_ref() + *loading_v + "==>" + module_name); - } + jam_context & context = context_ref.get(); + variable loaded_v("modules", ".loaded"); + variable loading_v("modules", ".loading"); + variable untested_v("modules", ".untested"); + variable tested_v("modules", ".tested"); + std::string module_basename = PATHNAME(module_name->str()).base(); + if (!(*loaded_v).contains(module_name)) + { + // Not already loaded. + filename = filename.has_value() ? filename : module_name + ".jam"; + // Mark the module loaded so we do not try to load it recursively. + loaded_v += module_basename; + // Suppress tests if any module loads are already in progress. + bool suppress_test = loading_v; + // Push this module on the loading stack. + loading_v += module_name; + // Remember that it is untested. + untested_v += module_name; + // Insert the new module's __name__ and __file__ globals. + variable(module_name, "__name__") = module_name; + variable(module_name, "__file__") = filename; + // Use BOOST_BUILD_PATH env as default. + list_ref module_target_search + = search.empty() ? *variable("BOOST_BUILD_PATH") : search; + // Include the file, if we find it, and with some setup. + { + { + // Add some grist so that the module will have a unique target + // name. + value_ref module_target = "" + filename; + target_ref module_target_r(module_target); + // Set the search path. + module_target_r.on_set("SEARCH", module_target_search); + // Set the binding rule. + module_target_r.on_set("BINDRULE", "modules.record-binding"); + // Do the load, in the module. + { + module_scope_in_function in_module( + context.frame, module_name->str()); + parse_include(module_target, in_module.frame()); + // Allow the module to see its own names with full + // qualification. + list_ref to_import(module_rules(in_module), true); + for (auto rule : to_import) + { + import_rule(find_rule(rule, in_module), in_module, + module_name + "." + rule); + } + } + } + // Did the include succeed? + if (module_name != "modules" && binding(module_name).empty()) + { + run_rule(context.frame, "import", list_ref() + "errors"); + run_rule(context.frame, "errors.error", + list_ref() + "Could not find module" + module_name + "in" + + module_target_search); + } + // Pop the loading stack. Must happen before testing or we will run + // into a circular loading dependency. + loading_v = loading_v.get().slice(0, -2); + // Run any pending tests if this is an outer load. + if (!suppress_test) + { + for (auto to_test : list_ref(*untested_v)) + { + run_tests(to_test, context_ref); + } + untested_v = list_ref(); + } + } + } + else if (!(*tested_v).contains(module_name)) + { + // Native modules are pre-loaded but can be untested. In that case we + // make sure we run tests for those. + untested_v += module_name; + if (!loading_v) + { + for (auto to_test : list_ref(*untested_v)) + { + run_tests(to_test, context_ref); + } + untested_v = list_ref(); + } + } + else if ((*loading_v).contains(module_name)) + { + run_rule(context.frame, "import", list_ref() + "errors"); + run_rule(context.frame, "errors.error", + list_ref() + "loading \"" + module_name->str() + "\n", + list_ref() + "circular module loading dependency:", + list_ref() + *loading_v + "==>" + module_name); + } } namespace detail { value_ref caller_module(FRAME * frame, int levels = 0) { - for (; levels >= 0; --levels) frame = frame->prev ? frame->prev : frame; - return frame->module == root_module() ? nullptr : frame->module->name; + for (; levels >= 0; --levels) frame = frame->prev ? frame->prev : frame; + return frame->module == root_module() ? nullptr : frame->module->name; } } // namespace detail void import(list_cref module_names, - list_cref rules_opt, - list_cref rename_opt, - bind::context_ref_ context_ref) + list_cref rules_opt, + list_cref rename_opt, + bind::context_ref_ context_ref) { - jam_context & context = context_ref.get(); - variable loaded_v("modules", ".loaded"); - value_ref cwd = variable("modules", ".cwd")[0]; - variable tested_v("modules", ".tested"); - variable untested_v("modules", ".untested"); - bool wildcard_rules_opt = rules_opt == (list_ref() + "*"); - if ((wildcard_rules_opt || rules_opt.empty()) && !rename_opt.empty()) - { - run_rule(context.frame, "import", list_ref() + "errors"); - run_rule(context.frame, "errors.error", - list_ref() - + "Rule aliasing is only available for explicit imports."); - } - if (module_names.length() >= 2 - && (!rules_opt.empty() || !rename_opt.empty())) - { - run_rule(context.frame, "import", list_ref() + "errors"); - run_rule(context.frame, "errors.error", - list_ref() - + "When loading multiple modules, no specific rules or renaming is allowed."); - } - - value_ref caller_module = detail::caller_module(context.frame); - - // Import each specified module - for (value_ref m : module_names) - { - PATHNAME module_pathname(m->str()); - std::string module_basename = module_pathname.base(); - - // If the importing module is not already in the BOOST_BUILD_PATH, - // prepend it to the path. We do not want to invert the search - // order of modules that are already there. - std::string caller_location; - if (caller_module.has_value()) - { - list_ref caller_binding(binding(caller_module->str())); - if (!caller_binding.empty()) - { - caller_location = paths::normalize( - PATHNAME(caller_binding[0]->str()).dir()); - caller_location = paths::normalize( - paths::rooted(caller_location, cwd->str())); - } - } - - list_ref search; - for (auto p : *variable("BOOST_BUILD_PATH")) - search.push_back(paths::rooted(value_ref(p), cwd)); - - if (!caller_location.empty() && !search.contains(caller_location)) - search = std::move(list_ref(caller_location).append(search)); - - if (!module_pathname.dir().empty()) - { - list_ref xsearch; - xsearch.push_back(caller_location + "/" + module_pathname.dir()); - for (value_ref s : search) - xsearch.push_back(std::string(s) + "/" + module_pathname.dir()); - xsearch.append(search); - search = std::move(xsearch); - } - - if (!(*loaded_v).contains(module_basename)) - { - load(module_basename, value_ref(), list_cref(*search), context_ref); - // run_rule(context.frame, "modules.load", - // list_ref(module_basename)); - } - else if (!(*tested_v).contains(m)) - { - // Native modules are pre-loaded but can be untested. In that case - // we make sure we run tests for those. The load takes care of doing - // the testing. - untested_v += m; - load(module_basename, value_ref(), list_cref(*search), context_ref); - } - - import_module(*list_ref(module_basename), - caller_module.has_value() ? bindmodule(caller_module) - : root_module()); - - if (!rules_opt.empty()) - { - list_ref source_names; - if (wildcard_rules_opt) - source_names.reset(module_rules(bindmodule(m))); - else - source_names.append(rules_opt); - list_cref target_names( - rename_opt.empty() ? *source_names : *rename_opt); - run_rule(context.frame, "IMPORT", list_ref(module_basename), - source_names, list_ref() + caller_module, target_names); - } - } + jam_context & context = context_ref.get(); + variable loaded_v("modules", ".loaded"); + variable loading_v("modules", ".loading"); + value_ref cwd = variable("modules", ".cwd")[0]; + variable tested_v("modules", ".tested"); + variable untested_v("modules", ".untested"); + bool wildcard_rules_opt = rules_opt == (list_ref() + "*"); + if ((wildcard_rules_opt || rules_opt.empty()) && !rename_opt.empty()) + { + run_rule(context.frame, "import", list_ref() + "errors"); + run_rule(context.frame, "errors.error", + list_ref() + + "Rule aliasing is only available for explicit imports."); + } + if (module_names.length() >= 2 + && (!rules_opt.empty() || !rename_opt.empty())) + { + run_rule(context.frame, "import", list_ref() + "errors"); + run_rule(context.frame, "errors.error", + list_ref() + + "When loading multiple modules, no specific rules or renaming is allowed."); + } + + value_ref caller_module = detail::caller_module(context.frame); + + // Import each specified module + for (value_ref m : module_names) + { + PATHNAME module_pathname(m->str()); + std::string module_basename = module_pathname.base(); + + // If the importing module is not already in the BOOST_BUILD_PATH, + // prepend it to the path. We do not want to invert the search + // order of modules that are already there. + std::string caller_location; + if (caller_module.has_value()) + { + list_ref caller_binding(binding(caller_module->str())); + if (!caller_binding.empty()) + { + caller_location = paths::normalize( + PATHNAME(caller_binding[0]->str()).dir()); + caller_location = paths::normalize( + paths::rooted(caller_location, cwd->str())); + } + } + + list_ref search; + for (auto p : *variable("BOOST_BUILD_PATH")) + search.push_back(paths::rooted(value_ref(p), cwd)); + + if (!caller_location.empty() && !search.contains(caller_location)) + search = std::move(list_ref(caller_location).append(search)); + + if (!module_pathname.dir().empty()) + { + list_ref xsearch; + xsearch.push_back(caller_location + "/" + module_pathname.dir()); + for (value_ref s : search) + xsearch.push_back(std::string(s) + "/" + module_pathname.dir()); + xsearch.append(search); + search = std::move(xsearch); + } + + if (!(*loading_v).contains(module_basename)) + { + if (!(*loaded_v).contains(module_basename)) + { + load(module_basename, value_ref(), list_cref(*search), context_ref); + } + else if (!(*tested_v).contains(m)) + { + // Native modules are pre-loaded but can be untested. In that case + // we make sure we run tests for those. The load takes care of doing + // the testing. + untested_v += m; + load(module_basename, value_ref(), list_cref(*search), context_ref); + } + } + + import_module(*list_ref(module_basename), + caller_module.has_value() ? bindmodule(caller_module) + : root_module()); + + if (!rules_opt.empty()) + { + list_ref source_names; + if (wildcard_rules_opt) + source_names.reset(module_rules(bindmodule(m))); + else + source_names.append(rules_opt); + list_cref target_names( + rename_opt.empty() ? *source_names : *rename_opt); + run_rule(context.frame, "IMPORT", list_ref(module_basename), + source_names, list_ref() + caller_module, target_names); + } + } } /* From dee079980e539e2295b1791e38dfa0d8ca8c9b42 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sat, 20 Apr 2024 11:13:49 -0500 Subject: [PATCH 03/61] Add latest Boost releases for CI testing. --- azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7664d0f8f9..b67384e021 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -393,6 +393,8 @@ stages: displayName: 'Release Linux' strategy: matrix: + 1.85.0 .. GCC ${{variables.gcc_latest}}: {BOOST_VERSION: 1.85.0, BOOST_VERSION_U: 1_85_0, TOOLSET: gcc, CXX: "g++-${{variables.gcc_latest}}", PACKAGES: "g++-${{variables.gcc_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"} + 1.84.0 .. GCC ${{variables.gcc_latest}}: {BOOST_VERSION: 1.84.0, BOOST_VERSION_U: 1_84_0, TOOLSET: gcc, CXX: "g++-${{variables.gcc_latest}}", PACKAGES: "g++-${{variables.gcc_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"} 1.83.0 .. GCC ${{variables.gcc_latest}}: {BOOST_VERSION: 1.83.0, BOOST_VERSION_U: 1_83_0, TOOLSET: gcc, CXX: "g++-${{variables.gcc_latest}}", PACKAGES: "g++-${{variables.gcc_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"} 1.82.0 .. GCC ${{variables.gcc_latest}}: {BOOST_VERSION: 1.82.0, BOOST_VERSION_U: 1_82_0, TOOLSET: gcc, CXX: "g++-${{variables.gcc_latest}}", PACKAGES: "g++-${{variables.gcc_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"} 1.81.0 .. GCC ${{variables.gcc_latest}}: {BOOST_VERSION: 1.81.0, BOOST_VERSION_U: 1_81_0, TOOLSET: gcc, CXX: "g++-${{variables.gcc_latest}}", PACKAGES: "g++-${{variables.gcc_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"} @@ -442,6 +444,8 @@ stages: vmImage: "${{variables.macos_latest_vm}}" strategy: matrix: + 1.85.0 .. Xcode ${{variables.xc_latest}}: {BOOST_VERSION: 1.85.0, BOOST_VERSION_U: 1_85_0, TOOLSET: clang, CXX: clang++, XCODE_APP: "/Applications/Xcode_${{variables.xc_latest}}.app"} + 1.84.0 .. Xcode ${{variables.xc_latest}}: {BOOST_VERSION: 1.84.0, BOOST_VERSION_U: 1_84_0, TOOLSET: clang, CXX: clang++, XCODE_APP: "/Applications/Xcode_${{variables.xc_latest}}.app"} 1.83.0 .. Xcode ${{variables.xc_latest}}: {BOOST_VERSION: 1.83.0, BOOST_VERSION_U: 1_83_0, TOOLSET: clang, CXX: clang++, XCODE_APP: "/Applications/Xcode_${{variables.xc_latest}}.app"} 1.82.0 .. Xcode ${{variables.xc_latest}}: {BOOST_VERSION: 1.82.0, BOOST_VERSION_U: 1_82_0, TOOLSET: clang, CXX: clang++, XCODE_APP: "/Applications/Xcode_${{variables.xc_latest}}.app"} 1.81.0 .. Xcode ${{variables.xc_latest}}: {BOOST_VERSION: 1.81.0, BOOST_VERSION_U: 1_81_0, TOOLSET: clang, CXX: clang++, XCODE_APP: "/Applications/Xcode_${{variables.xc_latest}}.app"} @@ -490,6 +494,8 @@ stages: vmImage: "${{variables.windows_latest_vm}}" strategy: matrix: + 1.85.0 .. VS ${{variables.vs_latest}}: {BOOST_VERSION: 1.85.0, BOOST_VERSION_U: 1_85_0, TOOLSET: "${{variables.vc_latest}}"} + 1.84.0 .. VS ${{variables.vs_latest}}: {BOOST_VERSION: 1.84.0, BOOST_VERSION_U: 1_84_0, TOOLSET: "${{variables.vc_latest}}"} 1.83.0 .. VS ${{variables.vs_latest}}: {BOOST_VERSION: 1.83.0, BOOST_VERSION_U: 1_83_0, TOOLSET: "${{variables.vc_latest}}"} 1.82.0 .. VS ${{variables.vs_latest}}: {BOOST_VERSION: 1.82.0, BOOST_VERSION_U: 1_82_0, TOOLSET: "${{variables.vc_latest}}"} 1.81.0 .. VS ${{variables.vs_latest}}: {BOOST_VERSION: 1.81.0, BOOST_VERSION_U: 1_81_0, TOOLSET: "${{variables.vc_latest}}"} From b75a965c50a47b0fb01749e40952de2e8d090a04 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sat, 20 Apr 2024 11:15:07 -0500 Subject: [PATCH 04/61] Add backward compatibility for immediate recursive module import (with a warning). --- src/engine/mod_jam_modules.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/engine/mod_jam_modules.cpp b/src/engine/mod_jam_modules.cpp index aa6282888d..33a0e21c43 100644 --- a/src/engine/mod_jam_modules.cpp +++ b/src/engine/mod_jam_modules.cpp @@ -16,6 +16,7 @@ Distributed under the Boost Software License, Version 1.0. #include "startup.h" #include "variable.h" +#include "mod_jam_errors.h" #include "mod_path.h" #include @@ -270,8 +271,6 @@ void import(list_cref module_names, bind::context_ref_ context_ref) { jam_context & context = context_ref.get(); - variable loaded_v("modules", ".loaded"); - variable loading_v("modules", ".loading"); value_ref cwd = variable("modules", ".cwd")[0]; variable tested_v("modules", ".tested"); variable untested_v("modules", ".untested"); @@ -333,21 +332,36 @@ void import(list_cref module_names, search = std::move(xsearch); } - if (!(*loading_v).contains(module_basename)) + list_cref loading_r = *variable("modules", ".loading"); + list_cref loaded_r = *variable("modules", ".loaded"); + if (!loading_r.contains(module_basename)) { - if (!(*loaded_v).contains(module_basename)) + if (!loaded_r.contains(module_basename)) { - load(module_basename, value_ref(), list_cref(*search), context_ref); + load(module_basename, value_ref(), list_cref(*search), + context_ref); } else if (!(*tested_v).contains(m)) { - // Native modules are pre-loaded but can be untested. In that case - // we make sure we run tests for those. The load takes care of doing - // the testing. + // Native modules are pre-loaded but can be untested. In that + // case we make sure we run tests for those. The load takes care + // of doing the testing. untested_v += m; - load(module_basename, value_ref(), list_cref(*search), context_ref); + load(module_basename, value_ref(), list_cref(*search), + context_ref); } } + else if (!loaded_r.contains(module_basename) && !loading_r.empty() + && loading_r[loading_r.length() - 1]->str() == module_basename) + { + // Special case for back-compat. + b2::jam::errors::warning(lists() + | *(list_ref() + "loading" + module_basename) + | list_ref("circular module loading dependency:") + | *(list_ref() + loading_r + "==>" + module_basename), + context_ref); + load(module_basename, value_ref(), list_cref(*search), context_ref); + } import_module(*list_ref(module_basename), caller_module.has_value() ? bindmodule(caller_module) From be168aca851e70f07f1007dba70ed2beb07354f3 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Sat, 20 Apr 2024 23:35:34 +0300 Subject: [PATCH 05/61] Default to Clang on FreeBSD and OpenBSD (#369) * FreeBSD since 2012: https://lists.freebsd.org/pipermail/freebsd-current/2012-September/036480.html * OpenBSD since 2017-2020: https://marc.info/?l=openbsd-cvs&m=150109829003860 --- src/build-system.jam | 2 +- test/BoostBuild.py | 2 +- test/default_toolset.py | 16 ++++++++++------ test/test_all.py | 3 +-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/build-system.jam b/src/build-system.jam index bc8fea9faf..1f6c72b1e4 100644 --- a/src/build-system.jam +++ b/src/build-system.jam @@ -642,7 +642,7 @@ local rule should-clean-project ( project ) { default-toolset = vmsdecc ; } - else if [ os.name ] = MACOSX + else if [ os.name ] = MACOSX || [ os.name ] = FREEBSD || [ os.name ] = OPENBSD { default-toolset = clang ; } diff --git a/test/BoostBuild.py b/test/BoostBuild.py index 3942c00567..2c0e79e28d 100644 --- a/test/BoostBuild.py +++ b/test/BoostBuild.py @@ -105,7 +105,7 @@ def get_toolset(): if sys.platform == "win32": return "msvc" - if sys.platform == "darwin" or sys.platform.startswith("freebsd"): + if sys.platform == "darwin" or sys.platform.startswith("freebsd") or sys.platform.startswith("openbsd"): return "clang" return "gcc" diff --git a/test/default_toolset.py b/test/default_toolset.py index 791dad0c41..b7863dfe4e 100755 --- a/test/default_toolset.py +++ b/test/default_toolset.py @@ -36,7 +36,7 @@ def test_conditions_on_default_toolset(): be used by Boost Build. """ - t = BoostBuild.Tester("--user-config= --ignore-site-config", + t = BoostBuild.Tester(["--user-config=", "--ignore-site-config"], pass_toolset=False, use_test_config=False) toolset_name = "myCustomTestToolset" @@ -120,7 +120,7 @@ def test_default_toolset_on_os( os, expected_toolset ): important internal Boost Build state. """ - t = BoostBuild.Tester("--user-config= --ignore-site-config", + t = BoostBuild.Tester(["--user-config=", "--ignore-site-config"], pass_toolset=False, use_test_config=False) t.write("jamroot.jam", "modules.poke os : .name : %s ;" % os) @@ -128,7 +128,7 @@ def test_default_toolset_on_os( os, expected_toolset ): # We need to tell the test system to ignore stderr output as attempting to # load missing toolsets might cause random failures with which we are not # concerned in this test. - t.run_build_system(stderr=None) + t.run_build_system(status=None, stderr=None) t.expect_output_lines(configuring_default_toolset_message % expected_toolset) @@ -146,7 +146,7 @@ def test_default_toolset_requirements(): """Test that default toolset's requirements get applied correctly. """ - t = BoostBuild.Tester("--user-config= --ignore-site-config", + t = BoostBuild.Tester(["--user-config=", "--ignore-site-config"], pass_toolset=False, use_test_config=False, ignore_toolset_requirements=False) @@ -210,6 +210,10 @@ def test_default_toolset_requirements(): test_default_toolset_on_os("NT" , "msvc") test_default_toolset_on_os("LINUX" , "gcc" ) test_default_toolset_on_os("CYGWIN" , "gcc" ) +test_default_toolset_on_os("MACOSX" , "clang" ) +test_default_toolset_on_os("FREEBSD" , "clang" ) +test_default_toolset_on_os("OPENBSD" , "clang" ) test_default_toolset_on_os("SomeOtherOS", "gcc" ) -test_default_toolset_requirements() -test_conditions_on_default_toolset() +#test_default_toolset_requirements() +# FIXME: Failure of this test seems to indicate subfeatures matching issue +#test_conditions_on_default_toolset() diff --git a/test/test_all.py b/test/test_all.py index c33e2f231f..24b234f91e 100755 --- a/test/test_all.py +++ b/test/test_all.py @@ -285,8 +285,7 @@ def reorder_tests(tests, first_test): # "debugger-mi", "default_build", "default_features", -# This test is known to be broken itself. -# "default_toolset", + "default_toolset", "dependency_property", "dependency_test", "disambiguation", From 2e8f6cd6151f6abd6c04e673b1aff1e5dea3b170 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sat, 20 Apr 2024 15:41:55 -0500 Subject: [PATCH 06/61] Add note for PR #369. --- doc/src/history.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/history.adoc b/doc/src/history.adoc index 38eda6bfd0..de87c36a52 100644 --- a/doc/src/history.adoc +++ b/doc/src/history.adoc @@ -6,6 +6,8 @@ * Fix incorrect recursive loading of modules when doing recursive importing of modules. The recursive loading would cause stack overflows. -- _René Ferdinand Rivera Morell_ +* Default to building with Clang on FreeBSD and OpenBSD. + -- _Nikita Kniazev_ == Version 5.1.0 From d5a432a6d0e070f12dd9095c4147d8fe96e4a897 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sat, 20 Apr 2024 16:01:43 -0500 Subject: [PATCH 07/61] Abandon FreeBSD clang10 testing as it's unavailable. --- .cirrus.yml | 2 +- README.adoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index d338e45add..92e174a548 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -20,7 +20,7 @@ freebsd_task: - { name: 'FreeBSD, Clang 13', env: { TOOLSET: clang, TEST_TOOLSET: clang, CXX: 'clang++13', PACKAGE: 'devel/llvm13' }, freebsd_instance: { image_family: 'freebsd-14-0' } } - { name: 'FreeBSD, Clang 12', env: { TOOLSET: clang, TEST_TOOLSET: clang, CXX: 'clang++12', PACKAGE: 'devel/llvm12' }, freebsd_instance: { image_family: 'freebsd-14-0' } } - { name: 'FreeBSD, Clang 11', env: { TOOLSET: clang, TEST_TOOLSET: clang, CXX: 'clang++11', PACKAGE: 'devel/llvm11' }, freebsd_instance: { image_family: 'freebsd-14-0' } } - - { name: 'FreeBSD, Clang 10', env: { TOOLSET: clang, TEST_TOOLSET: clang, CXX: 'clang++10', PACKAGE: 'devel/llvm10' }, freebsd_instance: { image_family: 'freebsd-14-0' } } + # - { name: 'FreeBSD, Clang 10', env: { TOOLSET: clang, TEST_TOOLSET: clang, CXX: 'clang++10', PACKAGE: 'devel/llvm10' }, freebsd_instance: { image_family: 'freebsd-14-0' } } # To install with ports we need to initialize the package manager. To avoid # confirmation prompts we need to set an env var. install_script: [ diff --git a/README.adoc b/README.adoc index 78a7b291aa..e058e95f82 100644 --- a/README.adoc +++ b/README.adoc @@ -14,7 +14,7 @@ file LICENSE.txt or copy at https://www.bfgroup.xyz/b2/LICENSE.txt) Continuously tested on: -* FreeBSD Clang 10, 11, 12, 13, 14, 15, 16, 17 +* FreeBSD Clang 11, 12, 13, 14, 15, 16, 17 * FreeBSD GCC 9, 10, 11, 12, 13 * Linux Clang 3.6, 3.7, 3.8, 3.9, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 * Linux GCC 4.7, 4.8, 4.9, 5, 6, 7, 8, 9, 10, 11, 12, 13 From 74311faeff0ae6f6e9726409ec8164c79fc91d02 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Sun, 21 Apr 2024 05:27:51 +0300 Subject: [PATCH 08/61] Fix Solaris/SunOS detection (#370) GCC doesn't define `sun`. Tested on 'SunOS solaris 5.11 11.4.0.15.0 i86pc i386 i86pc' --- src/engine/jam.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/engine/jam.h b/src/engine/jam.h index 4e8ffa6420..83580b9de3 100644 --- a/src/engine/jam.h +++ b/src/engine/jam.h @@ -300,14 +300,12 @@ #define OSMINOR "OS=SINIX" #define OS_SINIX #endif -#ifdef sun - #if defined(__svr4__) || defined(__SVR4) - #define OSMINOR "OS=SOLARIS" - #define OS_SOLARIS - #else - #define OSMINOR "OS=SUNOS" - #define OS_SUNOS - #endif +#if defined(__svr4__) || defined(__SVR4) + #define OSMINOR "OS=SOLARIS" + #define OS_SOLARIS +#elif defined(__sun__) || defined(__sun) || defined(sun) + #define OSMINOR "OS=SUNOS" + #define OS_SUNOS #endif #ifdef ultrix #define OSMINOR "OS=ULTRIX" From 0513ee6681b7079e540b1dec0c6cf817b9f01c6d Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sat, 20 Apr 2024 22:30:39 -0500 Subject: [PATCH 09/61] Add history note for PR #370. --- doc/src/history.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/history.adoc b/doc/src/history.adoc index de87c36a52..3c4fbc1fc8 100644 --- a/doc/src/history.adoc +++ b/doc/src/history.adoc @@ -8,6 +8,8 @@ -- _René Ferdinand Rivera Morell_ * Default to building with Clang on FreeBSD and OpenBSD. -- _Nikita Kniazev_ +* Fix Solaris/SunOS detection in engine for `OS=SUNOS` and `OS=SOLARIS`. + -- _Nikita Kniazev_ == Version 5.1.0 From 56d0293f1cffdcc8cc6abdb3919e6dd0cc27953e Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Sun, 21 Apr 2024 16:21:51 +0300 Subject: [PATCH 10/61] Fix build.bat/bootstrap.bat exit code (#371) 1. cmd.exe quirk 1: `exit /b 1` sets error code `0` for **the process**, even though it sets `errorlevel` to `1`. 2. `bootstrap.bat` needs to check that `build.bat` succeded (cmd.exe quirk 2: `echo off` doesn't change `errorlevel`). 3. `build.bat` overrides exit code with call to `dir *.exe`. 4. `setlocal` will rollback `pushd` on exit (that also helps with Ctrl+C). --- bootstrap.bat | 16 +++++++--------- src/engine/build.bat | 3 ++- src/engine/config_toolset.bat | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/bootstrap.bat b/bootstrap.bat index 25acc0a1c9..53d4f447cb 100644 --- a/bootstrap.bat +++ b/bootstrap.bat @@ -9,13 +9,15 @@ REM (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.t :b2_build ECHO Building the B2 engine.. +setlocal pushd src\engine call .\build.bat %* @ECHO OFF -popd -if exist ".\src\engine\b2.exe" ( +if not errorlevel 1 ( +if exist b2.exe ( + popd copy .\src\engine\b2.exe . > nul - goto :b2_built) + goto :b2_built)) goto :b2_failure @@ -25,15 +27,11 @@ ECHO Building is done. To install, run: ECHO. ECHO .\b2 --prefix=DIR install ECHO. -goto :end +exit /b 0 :b2_failure ECHO. ECHO Failed to build the B2 engine. ECHO. -goto :end - - -:end -exit /b %ERRORLEVEL% +cmd /c exit 1 diff --git a/src/engine/build.bat b/src/engine/build.bat index 37ff324d3b..22453847d5 100644 --- a/src/engine/build.bat +++ b/src/engine/build.bat @@ -196,7 +196,8 @@ set B2_CXXFLAGS=%B2_CXXFLAGS% -DNDEBUG @echo ON %B2_CXX% %CXXFLAGS% %B2_CXXFLAGS% %B2_SOURCES% %B2_CXX_LINK% +@if errorlevel 1 goto :Finish dir *.exe :Finish -@exit /b %ERRORLEVEL% +@cmd /c exit %ERRORLEVEL% diff --git a/src/engine/config_toolset.bat b/src/engine/config_toolset.bat index 4ba577cacd..8b5e3091a1 100644 --- a/src/engine/config_toolset.bat +++ b/src/engine/config_toolset.bat @@ -260,6 +260,6 @@ goto :eof :Embed_Minafest_Via_Windres if not defined B2_DONT_EMBED_MANIFEST ( where windres >NUL 2>NUL - if %ERRORLEVEL% NEQ 0 ( call; ) else ( set "B2_CXX=windres --input res.rc --output res.o && %B2_CXX% -Wl,res.o" ) + if errorlevel 1 ( call; ) else ( set "B2_CXX=windres --input res.rc --output res.o && %B2_CXX% -Wl,res.o" ) ) goto :eof From fb743b7dbea676dabfd9b679a4da588d63a93876 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 23 Apr 2024 05:39:51 +0300 Subject: [PATCH 11/61] make repeated 'using X ;' a no-op (#374) This change allows putting `using X ;` into build scripts (as opposed to user configs) without creating a conflicting or wrong setup for module X. This is so that build scripts could rely on toolset modules having been configured (at least with default values). The commit only updates toolset modules which allow `using` without arguments in the first place. It also does not change toolset modules for C++ compilers, as nobody does e.g. `using gcc ;` in their build scripts anyway. --- src/tools/asciidoctor.jam | 7 +++++++ src/tools/fop.jam | 12 ++++++++++++ src/tools/gettext.jam | 10 ++++++++-- src/tools/pkg-config.jam | 10 +++++++++- src/tools/python.jam | 12 ++++++++++++ src/tools/sass.jam | 7 +++++++ src/tools/saxonhe.jam | 12 ++++++++++++ 7 files changed, 67 insertions(+), 3 deletions(-) diff --git a/src/tools/asciidoctor.jam b/src/tools/asciidoctor.jam index 173782bfad..2ceaa3726c 100644 --- a/src/tools/asciidoctor.jam +++ b/src/tools/asciidoctor.jam @@ -130,6 +130,13 @@ rule init ( command * ) # TODO: Design and implement a mechanism to resolve generator conflicts. generators.override asciidoctor.convert : boostbook.docbook-to-onehtml ; } + else + { + if ! $(command) + { + return ; + } + } # The command.. Default is bare asciidoctor. command ?= asciidoctor ; diff --git a/src/tools/fop.jam b/src/tools/fop.jam index 8ce748273a..697cbe9656 100644 --- a/src/tools/fop.jam +++ b/src/tools/fop.jam @@ -17,6 +17,18 @@ generators.register-standard fop.render.ps : FO : PS ; # rule init ( fop-command ? : java-home ? : java ? ) { + if ! $(.initialized) + { + .initialized = true ; + } + else + { + if ! ( $(1) && $(2) && $(3) ) + { + return ; + } + } + local has-command = $(.has-command) ; if $(fop-command) diff --git a/src/tools/gettext.jam b/src/tools/gettext.jam index 71900b74f2..b228d9f7ce 100644 --- a/src/tools/gettext.jam +++ b/src/tools/gettext.jam @@ -62,11 +62,17 @@ rule init ( path ? # Path where all tools are located. If not specified, # they should be in PATH. ) { - if $(.initialized) && $(.path) != $(path) + if $(.initialized) && ! $(path) { - errors.error "Attempt to reconfigure with different path" ; + return ; } + .initialized = true ; + if $(.path) != $(path) + { + errors.error "Attempt to reconfigure with different path" ; + } + if $(path) { .path = $(path)/ ; diff --git a/src/tools/pkg-config.jam b/src/tools/pkg-config.jam index 9565f8fed2..9d7fe2c34a 100644 --- a/src/tools/pkg-config.jam +++ b/src/tools/pkg-config.jam @@ -154,7 +154,15 @@ using pkg-config : [config] : [command] ... : [ options ] ... ; rule init ( config ? : command * : options * ) { - config ?= [ default-config ] ; + if ! $(config) + { + config = [ default-config ] ; + if ( $(config) in [ $(.configs).all ] ) + && ! ( $(command) && $(options) ) + { + return ; + } + } local tool = [ os.environ PKG_CONFIG ] ; tool ?= pkg-config ; diff --git a/src/tools/python.jam b/src/tools/python.jam index 0dfc750a22..bac00b33e7 100644 --- a/src/tools/python.jam +++ b/src/tools/python.jam @@ -104,6 +104,18 @@ py3-version = ; rule init ( version ? : cmd-or-prefix ? : includes * : libraries ? : condition * : extension-suffix ? ) { + if ! $(.initialized) + { + .initialized = true ; + } + else + { + if ! ( $(1) && $(2) && $(3) && $(4) && $(5) && $(6) ) + { + return ; + } + } + project.push-current $(.project) ; debug-message Configuring python... ; diff --git a/src/tools/sass.jam b/src/tools/sass.jam index ef3b931ab8..46947a1572 100644 --- a/src/tools/sass.jam +++ b/src/tools/sass.jam @@ -96,6 +96,13 @@ rule init ( command * ) # Register generators generators.register [ new sass-generator sass.convert : SASS : CSS ] ; } + else + { + if ! $(command) + { + return ; + } + } # Setting up command if ! $(command) diff --git a/src/tools/saxonhe.jam b/src/tools/saxonhe.jam index 69ad16df21..fc4203cab6 100644 --- a/src/tools/saxonhe.jam +++ b/src/tools/saxonhe.jam @@ -11,6 +11,18 @@ import os ; rule init ( saxonhe_jar ? : java_exe ? ) { + if ! $(.initialized) + { + .initialized = true ; + } + else + { + if ! ( $(1) && $(2) ) + { + return ; + } + } + .java_exe = [ common.get-invocation-command saxonhe : java : $(java_exe) : ] ; if $(saxonhe_jar) { From 6f383e26fda523f7b6a1c049a172a5b05a332044 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 22 Apr 2024 22:03:25 -0500 Subject: [PATCH 12/61] Add history note for PR #374. --- doc/src/history.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/src/history.adoc b/doc/src/history.adoc index 3c4fbc1fc8..cceb59efd3 100644 --- a/doc/src/history.adoc +++ b/doc/src/history.adoc @@ -10,6 +10,10 @@ -- _Nikita Kniazev_ * Fix Solaris/SunOS detection in engine for `OS=SUNOS` and `OS=SOLARIS`. -- _Nikita Kniazev_ +* Allow some tools to be default initialized with `using` multiple times. The + tools are `asciidoctor`, `fop`, `gettext`, `pkg-config`, `python`, `sass`, + and `saxonhe`. + -- _Dmitry Arkhipov_ == Version 5.1.0 From 33de6961820107b69e403c8fbf977646a8845985 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 24 Apr 2024 01:41:48 +0300 Subject: [PATCH 13/61] fix usage of configure.get-relevant-features (#375) The rule was misnamed, as it returned relevant properties, not features. The misnomer seems to had been the source of misuse: ac module did not consider any feature other than to be relevant when checking for library existance. That could result in incorrect config checks. The change renames the rule to get-relevant-properties, and adds back get-relevant-features that returns features. In addition, it fixes the usage of get-relevant-features in ac module (it called the rule without arguments), and removes another usage where its invocation could not result in anything meaningful. --- src/build/ac.jam | 7 ++++--- src/build/configure.jam | 12 +++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/build/ac.jam b/src/build/ac.jam index 53412ab89c..551cb7d5a1 100644 --- a/src/build/ac.jam +++ b/src/build/ac.jam @@ -226,7 +226,9 @@ class ac-library : basic-target library-path ?= [ os.environ $(name:U)_LIBPATH ] ; } - local relevant = [ property.select [ configure.get-relevant-features ] : + local relevant = [ configure.get-relevant-features + [ $(property-set).raw ] ] ; + relevant = [ property.select $(relevant) : [ $(property-set).raw ] ] ; local min = [ property.as-path [ SORT [ feature.minimize $(relevant) ] ] ] ; @@ -321,6 +323,5 @@ rule check-library ( target : true-properties * : false-properties * ) $(true-properties) : $(false-properties) ] ; return @$(instance).check [ property.evaluate-conditional-relevance - $(true-properties) $(false-properties) - : [ configure.get-relevant-features ] ] ; + $(true-properties) $(false-properties) : ] ; } diff --git a/src/build/configure.jam b/src/build/configure.jam index 5f47a1b2cc..89bf8ba1e5 100644 --- a/src/build/configure.jam +++ b/src/build/configure.jam @@ -428,7 +428,7 @@ rule find-builds-raw ( project : ps : what : * ) } } -rule get-relevant-features ( properties * ) +rule get-relevant-properties ( properties * ) { local ps-full = [ property-set.create $(properties) ] ; local ps-base = [ property-set.create [ $(ps-full).base ] ] ; @@ -439,9 +439,15 @@ rule get-relevant-features ( properties * ) return [ $(ps-relevant).raw ] ; } +rule get-relevant-features ( properties * ) +{ + local props = [ get-relevant-properties $(properties) ] ; + return $(props:G) ; +} + rule builds ( metatarget-reference : properties * : what ? : retry ? ) { - local relevant = [ get-relevant-features $(properties) ] ; + local relevant = [ get-relevant-properties $(properties) ] ; local ps = [ property-set.create $(relevant) ] ; local t = [ targets.current ] ; local p = [ $(t).project ] ; @@ -459,7 +465,7 @@ rule builds ( metatarget-reference : properties * : what ? : retry ? ) rule find-builds ( what : properties * : * ) { - local relevant = [ get-relevant-features $(properties) ] ; + local relevant = [ get-relevant-properties $(properties) ] ; local ps = [ property-set.create $(relevant) ] ; local t = [ targets.current ] ; local p = [ $(t).project ] ; From f7df545f128ebe1a2f459f4e06cbc8b3c1e6f89f Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 23 Apr 2024 19:06:08 -0500 Subject: [PATCH 14/61] Add history note for PR #375. --- doc/src/history.adoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/src/history.adoc b/doc/src/history.adoc index cceb59efd3..bdc09c7a3e 100644 --- a/doc/src/history.adoc +++ b/doc/src/history.adoc @@ -14,6 +14,9 @@ tools are `asciidoctor`, `fop`, `gettext`, `pkg-config`, `python`, `sass`, and `saxonhe`. -- _Dmitry Arkhipov_ +* Fix using relevant features in ac module that would cause incorrect configure + checks. + -- _Dmitry Arkhipov_ == Version 5.1.0 From 0db639cba6221b9e5614eb2b96dc616598bae075 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Wed, 24 Apr 2024 09:01:00 -0500 Subject: [PATCH 15/61] Update most of the GH CI action versions. --- .github/workflows/backport.yml | 2 +- .github/workflows/core_tests.yml | 4 ++-- .github/workflows/installer_windows.yml | 8 ++++---- .github/workflows/qemu_multiarch_linux.yml | 2 +- .github/workflows/release_archives.yml | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 4a4db17d05..31a9d10d48 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -31,6 +31,6 @@ jobs: ) steps: - name: "Checkout" - uses: actions/checkout@master + uses: actions/checkout@main - name: "Backport PR" uses: korthout/backport-action@main diff --git a/.github/workflows/core_tests.yml b/.github/workflows/core_tests.yml index ca53249c88..f422e0b281 100644 --- a/.github/workflows/core_tests.yml +++ b/.github/workflows/core_tests.yml @@ -52,10 +52,10 @@ jobs: shell: msys2 {0} steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@main - name: Install Toolset - uses: msys2/setup-msys2@v2 + uses: msys2/setup-msys2@main with: msystem: ${{matrix.msys}} pacboy: python:p ${{matrix.toolset}}:p diff --git a/.github/workflows/installer_windows.yml b/.github/workflows/installer_windows.yml index 194b99a2c4..f8ab137592 100644 --- a/.github/workflows/installer_windows.yml +++ b/.github/workflows/installer_windows.yml @@ -34,10 +34,10 @@ jobs: runs-on: "windows-latest" steps: - name: "Checkout" - uses: actions/checkout@master + uses: actions/checkout@main with: { path: "b2" } - name: "Checkout" - uses: actions/checkout@master + uses: actions/checkout@main with: { repository: "bfgroup/b2-pkg", path: "b2-pkg" } - name: "Install" run: | @@ -52,12 +52,12 @@ jobs: cd "${{github.workspace}}/b2-pkg" b2 --debug-configuration --b2root="${{github.workspace}}/b2" -j1 -d+2 windows-wix - name: "Upload" - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@main with: name: installer path: "${{github.workspace}}\\b2-pkg\\stage\\*.msi*" - name: "Publish" - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@master if: ${{ github.event_name == 'release' && github.event.action == 'published' }} with: files: "${{github.workspace}}\\b2-pkg\\stage\\*.msi*" diff --git a/.github/workflows/qemu_multiarch_linux.yml b/.github/workflows/qemu_multiarch_linux.yml index 30a3527c2f..683597b66e 100644 --- a/.github/workflows/qemu_multiarch_linux.yml +++ b/.github/workflows/qemu_multiarch_linux.yml @@ -81,7 +81,7 @@ jobs: TOOLSET: ${{ matrix.toolset }} steps: - name: "Checkout" - uses: actions/checkout@master + uses: actions/checkout@main - name: "Install" run: | sudo apt-get -o Acquire::Retries=3 update diff --git a/.github/workflows/release_archives.yml b/.github/workflows/release_archives.yml index b4deaac6cc..d388ef85b6 100644 --- a/.github/workflows/release_archives.yml +++ b/.github/workflows/release_archives.yml @@ -41,7 +41,7 @@ jobs: name: ${{ matrix.name }} steps: - name: "Checkout" - uses: actions/checkout@master + uses: actions/checkout@main with: { path: "b2" } - name: "Snapshot" @@ -72,13 +72,13 @@ jobs: rm -rf "${{github.workspace}}/b2-${version}" - name: "Upload" - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@main with: name: archives-${{github.run_id}} path: "${{github.workspace}}/b2-*" - name: "Publish" - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@master if: ${{ github.event_name == 'release' && github.event.action == 'published' }} with: files: "${{github.workspace}}/b2-*" From bed068acd6002a09157bb4b9a10d4b0d789fc1ac Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Wed, 24 Apr 2024 09:13:02 -0500 Subject: [PATCH 16/61] The msys2/setup-msys2 only works for released tags. --- .github/workflows/core_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/core_tests.yml b/.github/workflows/core_tests.yml index f422e0b281..0557bfdff4 100644 --- a/.github/workflows/core_tests.yml +++ b/.github/workflows/core_tests.yml @@ -55,7 +55,7 @@ jobs: uses: actions/checkout@main - name: Install Toolset - uses: msys2/setup-msys2@main + uses: msys2/setup-msys2@v2 with: msystem: ${{matrix.msys}} pacboy: python:p ${{matrix.toolset}}:p From b159938246761143d7c2ea2f28c8100e33c48976 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 9 May 2024 14:37:04 +0300 Subject: [PATCH 17/61] fix broken multiple configurations for some toolset modules (#388) --- src/tools/fop.jam | 2 +- src/tools/pkg-config.jam | 2 +- src/tools/python.jam | 2 +- src/tools/saxonhe.jam | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/fop.jam b/src/tools/fop.jam index 697cbe9656..57f8d8afc0 100644 --- a/src/tools/fop.jam +++ b/src/tools/fop.jam @@ -23,7 +23,7 @@ rule init ( fop-command ? : java-home ? : java ? ) } else { - if ! ( $(1) && $(2) && $(3) ) + if ! ( $(1) || $(2) || $(3) ) { return ; } diff --git a/src/tools/pkg-config.jam b/src/tools/pkg-config.jam index 9d7fe2c34a..8ddb66d83b 100644 --- a/src/tools/pkg-config.jam +++ b/src/tools/pkg-config.jam @@ -158,7 +158,7 @@ rule init ( config ? : command * : options * ) { config = [ default-config ] ; if ( $(config) in [ $(.configs).all ] ) - && ! ( $(command) && $(options) ) + && ! ( $(command) || $(options) ) { return ; } diff --git a/src/tools/python.jam b/src/tools/python.jam index bac00b33e7..f8f63f40ff 100644 --- a/src/tools/python.jam +++ b/src/tools/python.jam @@ -110,7 +110,7 @@ rule init ( version ? : cmd-or-prefix ? : includes * : libraries ? } else { - if ! ( $(1) && $(2) && $(3) && $(4) && $(5) && $(6) ) + if ! ( $(1) || $(2) || $(3) || $(4) || $(5) || $(6) ) { return ; } diff --git a/src/tools/saxonhe.jam b/src/tools/saxonhe.jam index fc4203cab6..a8d40f33b5 100644 --- a/src/tools/saxonhe.jam +++ b/src/tools/saxonhe.jam @@ -17,7 +17,7 @@ rule init ( saxonhe_jar ? : java_exe ? ) } else { - if ! ( $(1) && $(2) ) + if ! ( $(1) || $(2) ) { return ; } From 4e2ad2c01f669a7a18f332d2ea59258b9ccc25da Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Thu, 9 May 2024 14:56:13 +0300 Subject: [PATCH 18/61] cpp is a preprocessor, don't try to compile with it (#383) It dpesn't support multiple input files, leading to an error: ` cpp: fatal error: too many input files Fixes bfgroup/b2/issues/323 Fixes boostorg/build/issues/613 Fixes boostorg/build/issues/614 --- src/engine/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/build.sh b/src/engine/build.sh index 912c9478d5..c2a6640af1 100755 --- a/src/engine/build.sh +++ b/src/engine/build.sh @@ -251,7 +251,7 @@ check_toolset () if test_toolset sunpro && test_compiler /opt/SUNWspro/bin/CC -std=c++11 ; then B2_TOOLSET=sunpro ; return ${TRUE} ; fi # Generic (cxx) if test_toolset cxx && test_compiler cxx ; then B2_TOOLSET=cxx ; return ${TRUE} ; fi - if test_toolset cxx && test_compiler cpp ; then B2_TOOLSET=cxx ; return ${TRUE} ; fi + if test_toolset cxx && test_compiler c++ ; then B2_TOOLSET=cxx ; return ${TRUE} ; fi if test_toolset cxx && test_compiler CC ; then B2_TOOLSET=cxx ; return ${TRUE} ; fi # Nothing found. From 006b1ec71da54216aed369b8d88239ad61259b1c Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Thu, 9 May 2024 21:00:27 +0300 Subject: [PATCH 19/61] gcc/clang: -m* flags when architecture is not explicitly set (#379) GCC is picky, -m32/-m64 flags are available only on a subset of targets. Clang supports -m32/-m64 universally. --- .ci/azp-linux-test.yml | 11 ++++++++--- .ci/azp-macos-test.yml | 11 ++++++++--- .ci/azp-windows-test.yml | 11 ++++++++--- azure-pipelines.yml | 9 +++++++-- src/tools/clang-linux.jam | 16 ++++++++++++++++ src/tools/gcc.jam | 21 ++++++++++++++++++++- 6 files changed, 67 insertions(+), 12 deletions(-) diff --git a/.ci/azp-linux-test.yml b/.ci/azp-linux-test.yml index 9736e215d7..393a01b46a 100644 --- a/.ci/azp-linux-test.yml +++ b/.ci/azp-linux-test.yml @@ -1,3 +1,8 @@ +parameters: +- name: b2_opts + type: string + default: '' + steps: - bash: | set -e @@ -26,16 +31,16 @@ steps: displayName: Test - bash: | set -e - ./src/engine/b2 b2 warnings-as-errors=on variant=debug,release address-model=32,64 toolset=${TOOLSET} + ./src/engine/b2 b2 warnings-as-errors=on variant=debug,release ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }} displayName: "No Warnings" - bash: | set -e ./bootstrap.sh ${TOOLSET} - ./b2 --prefix=$HOME/temp/.b2 install toolset=${TOOLSET} + ./b2 --prefix=$HOME/temp/.b2 install ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }} rm ./b2 export PATH=$HOME/temp/.b2/bin:$PATH cd $HOME touch build.jam b2 -v - b2 -n --debug-configuration toolset=${TOOLSET} + b2 -n --debug-configuration ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }} displayName: Bootstrap diff --git a/.ci/azp-macos-test.yml b/.ci/azp-macos-test.yml index 1e517948b4..b93ea97393 100644 --- a/.ci/azp-macos-test.yml +++ b/.ci/azp-macos-test.yml @@ -1,3 +1,8 @@ +parameters: +- name: b2_opts + type: string + default: '' + steps: - bash: | set -e @@ -20,16 +25,16 @@ steps: displayName: Test - bash: | set -e - ./src/engine/b2 b2 warnings-as-errors=on variant=debug,release address-model=32,64 ${TOOLSET:+toolset=$TOOLSET} + ./src/engine/b2 b2 warnings-as-errors=on variant=debug,release ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }} displayName: "No Warnings" - bash: | set -e ./bootstrap.sh ${TOOLSET} - ./b2 --prefix=$HOME/temp/.b2 install ${TOOLSET:+toolset=$TOOLSET} + ./b2 --prefix=$HOME/temp/.b2 install ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }} rm ./b2 export PATH=$HOME/temp/.b2/bin:$PATH cd $HOME touch build.jam b2 -v - b2 -n --debug-configuration ${TOOLSET:+toolset=$TOOLSET} + b2 -n --debug-configuration ${TOOLSET:+toolset=$TOOLSET} ${{ parameters.b2_opts }} displayName: Bootstrap diff --git a/.ci/azp-windows-test.yml b/.ci/azp-windows-test.yml index 037aeccdb4..0f1e68cafd 100644 --- a/.ci/azp-windows-test.yml +++ b/.ci/azp-windows-test.yml @@ -1,3 +1,8 @@ +parameters: +- name: b2_opts + type: string + default: '' + steps: - powershell: | Set-PSDebug -Trace 1 @@ -22,7 +27,7 @@ steps: $env:HOME = $env:HOMEDRIVE + $env:HOMEPATH $env:path += ';' + $env:CXX_PATH echo "using" $env:TEST_TOOLSET ":" ":" $env:CXX ";" > ${env:HOME}/user-config.jam - ./src/engine/b2.exe --debug-configuration b2 warnings-as-errors=on variant=debug,release toolset=$env:TEST_TOOLSET + ./src/engine/b2.exe --debug-configuration b2 warnings-as-errors=on variant=debug,release toolset=$env:TEST_TOOLSET ${{ parameters.b2_opts }} displayName: "No Warnings" - powershell: | Set-PSDebug -Trace 1 @@ -30,11 +35,11 @@ steps: $env:path += ';' + $env:CXX_PATH echo "using" $env:TEST_TOOLSET ":" ":" $env:CXX ";" > ${env:HOME}/user-config.jam ./bootstrap.bat $env:TOOLSET - ./b2.exe --debug-configuration --prefix=${env:HOME}/temp/.b2 install toolset=$env:TEST_TOOLSET + ./b2.exe --debug-configuration --prefix=${env:HOME}/temp/.b2 install toolset=$env:TEST_TOOLSET ${{ parameters.b2_opts }} Remove-Item ./b2.exe $env:path += $env:HOME + '/temp/.b2' + ';' + $env:PATH cd $env:HOME echo $null >> build.jam b2 -v - b2 -n --debug-configuration + b2 -n --debug-configuration toolset=$env:TEST_TOOLSET ${{ parameters.b2_opts }} displayName: Bootstrap diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b67384e021..5cafff3bae 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -35,6 +35,7 @@ variables: - { name: linux_latest_os, value: 'focal' } - { name: windows_latest_vm, value: 'windows-2022' } - { name: clang_latest, value: '17' } +- { name: clang_latest_libstdcxx, value: 9 } - { name: gcc_latest, value: '13' } - { name: vc_latest, value: 'vc143' } - { name: vs_latest, value: '2022' } @@ -91,12 +92,14 @@ stages: - job: 'Linux_Latest' strategy: matrix: - GCC ${{variables.gcc_latest}}: {TOOLSET: "gcc-${{variables.gcc_latest}}", PACKAGES: "g++-${{variables.gcc_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"} - Clang ${{variables.clang_latest}}: {TOOLSET: "clang-${{variables.clang_latest}}", PACKAGES: "clang-${{variables.clang_latest}}", LLVM_OS: "${{variables.linux_latest_os}}", LLVM_VER: "${{variables.clang_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"} + GCC ${{variables.gcc_latest}}: {TOOLSET: "gcc-${{variables.gcc_latest}}", PACKAGES: "g++-${{variables.gcc_latest}}-multilib", VM_IMAGE: "${{variables.linux_latest_vm}}"} + Clang ${{variables.clang_latest}}: {TOOLSET: "clang-${{variables.clang_latest}}", PACKAGES: "clang-${{variables.clang_latest}} libstdc++-${{variables.clang_latest_libstdcxx}}-dev-i386-cross", LLVM_OS: "${{variables.linux_latest_os}}", LLVM_VER: "${{variables.clang_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"} pool: vmImage: $(VM_IMAGE) steps: - template: .ci/azp-linux-test.yml + parameters: + b2_opts: address-model=32,64 - job: 'Windows_Latest' strategy: @@ -108,6 +111,8 @@ stages: continueOnError: 'true' steps: - template: .ci/azp-windows-test.yml + parameters: + b2_opts: address-model=32,64 - job: 'macOS' strategy: diff --git a/src/tools/clang-linux.jam b/src/tools/clang-linux.jam index 26891f4b60..82501f6a88 100644 --- a/src/tools/clang-linux.jam +++ b/src/tools/clang-linux.jam @@ -30,11 +30,18 @@ toolset.inherit-generators clang-linux clang linux : gcc : gcc.mingw.link gcc.mingw.link.dll gcc.cygwin.link gcc.cygwin.link.dll ; +local all-os = [ feature.values ] ; +local all-arch = [ feature.values ] ; + toolset.inherit-rules clang-linux : gcc ; toolset.inherit-flags clang-linux : gcc : full on/full on/fat + $(all-os)/32 + $(all-os)/64 + $(all-os)/$(all-arch)/32 + $(all-os)/$(all-arch)/64 : INCLUDE-GCH ; @@ -126,6 +133,12 @@ rule get-short-version ( command-string : single-digit-since ? ) return $(version[1]) ; } +local rule compile-link-flags ( * ) +{ + toolset.flags clang-linux.compile OPTIONS $(1) : $(2) ; + toolset.flags clang-linux.link OPTIONS $(1) : $(2) ; +} + ############################################################################### # Flags @@ -135,6 +148,9 @@ toolset.flags clang-linux.compile INCLUDE-PCH : -include-pch ; # For clang, 'on' and 'full' are identical. toolset.flags clang-linux.compile OPTIONS full : -Wno-inline ; +compile-link-flags 32 : -m32 ; +compile-link-flags 64 : -m64 ; + # LTO toolset.flags clang-linux.compile OPTIONS on/thin : -flto=thin ; toolset.flags clang-linux.link OPTIONS on/thin : -flto=thin ; diff --git a/src/tools/gcc.jam b/src/tools/gcc.jam index e5f8f53a46..61072358fb 100644 --- a/src/tools/gcc.jam +++ b/src/tools/gcc.jam @@ -184,11 +184,12 @@ rule init ( version ? : command * : options * : requirement * ) bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; root ?= $(bin:D) ; } + local machine ; local target-os ; # Autodetect the version and flavor if not given. if $(command) { - local machine = [ MATCH "^([^ ]+)" : + machine = [ MATCH "^([^ ]+)" : [ SHELL "$(command-string) -dumpmachine" ] ] ; if ! $(version) { # ?= operator does not short-circuit version ?= [ get-short-version $(command-string) ] ; @@ -203,6 +204,8 @@ rule init ( version ? : command * : options * : requirement * ) case *mingw* : target-os ?= windows ; case *cygwin* : target-os ?= cygwin ; case *linux* : target-os ?= linux ; + case *aix* : target-os ?= aix ; + case *hpux* : target-os ?= hpux ; # TODO: finish this list. } } @@ -276,6 +279,20 @@ rule init ( version ? : command * : options * : requirement * ) toolset.flags gcc VERSION $(condition) : [ regex.split $(version) "[.]" ] ; init-cxxstd-flags $(condition) : $(version) ; + + if ! $(target-os) in aix hpux + { + if [ MATCH "^(i.86|x86|powerpc|ppc|sparc)" : $(machine:L) ] + { + compile-link-flags $(condition)//32 : -m32 ; + compile-link-flags $(condition)//64 : -m64 ; + } + if [ MATCH "^(s390)" : $(machine:L) ] + { + compile-link-flags $(condition)//32 : -m31 ; + compile-link-flags $(condition)//64 : -m64 ; + } + } } if [ os.name ] = NT @@ -369,6 +386,8 @@ local rule compile-link-flags ( * ) compile-link-flags hpux/64 : -mlp64 ; local generic-os = [ set.difference $(all-os) : aix hpux ] ; + compile-link-flags $(generic-os)/s390x/32 : -m31 ; + compile-link-flags $(generic-os)/s390x/64 : -m64 ; local arch = power sparc x86 ; compile-link-flags $(generic-os)/$(arch)/32 : -m32 ; compile-link-flags $(generic-os)/$(arch)/64 : -m64 ; From fe69c243022bde208bccdf59370c3434401ca300 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 20 May 2024 22:41:02 -0500 Subject: [PATCH 20/61] Fix release and wix uploads. --- .github/workflows/installer_windows.yml | 4 ++-- .github/workflows/release_archives.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/installer_windows.yml b/.github/workflows/installer_windows.yml index f8ab137592..fe9f0f7dfc 100644 --- a/.github/workflows/installer_windows.yml +++ b/.github/workflows/installer_windows.yml @@ -55,9 +55,9 @@ jobs: uses: actions/upload-artifact@main with: name: installer - path: "${{github.workspace}}\\b2-pkg\\stage\\*.msi*" + path: "./b2-pkg/stage/*.msi*" - name: "Publish" uses: softprops/action-gh-release@master if: ${{ github.event_name == 'release' && github.event.action == 'published' }} with: - files: "${{github.workspace}}\\b2-pkg\\stage\\*.msi*" + files: "./b2-pkg/stage/*.msi*" diff --git a/.github/workflows/release_archives.yml b/.github/workflows/release_archives.yml index d388ef85b6..96cbf4fb76 100644 --- a/.github/workflows/release_archives.yml +++ b/.github/workflows/release_archives.yml @@ -74,7 +74,7 @@ jobs: - name: "Upload" uses: actions/upload-artifact@main with: - name: archives-${{github.run_id}} + name: B2-${{matrix.name}} path: "${{github.workspace}}/b2-*" - name: "Publish" From 0c9c98086bc674493410e37bb7520234d422ee31 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Tue, 21 May 2024 15:03:38 +0300 Subject: [PATCH 21/61] bootstrap: embed manifest only when targeting windows (#384) Fixes bfgroup/b2/issues/382 --- src/engine/build.sh | 13 ++++++++++--- src/engine/config_toolset.bat | 5 +++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/engine/build.sh b/src/engine/build.sh index c2a6640af1..9a1e0b1a05 100755 --- a/src/engine/build.sh +++ b/src/engine/build.sh @@ -506,9 +506,16 @@ mod_version.cpp \ if test_true ${B2_DEBUG_OPT} ; then B2_CXXFLAGS="${B2_CXXFLAGS_DEBUG}" else B2_CXXFLAGS="${B2_CXXFLAGS_RELEASE} -DNDEBUG" fi - if [ -z "$B2_DONT_EMBED_MANIFEST" ] && [ -x "$(command -v windres)" ] ; then - B2_CXXFLAGS="${B2_CXXFLAGS} -Wl,res.o" - ( B2_VERBOSE_OPT=${TRUE} echo_run windres --input res.rc --output res.o ) + if [ -z "$B2_DONT_EMBED_MANIFEST" ] ; then + case "$(${B2_CXX} ${B2_CXXFLAGS} -dumpmachine 2>/dev/null)" in + *-windows*|*-mingw*|*-msys*|*-cygnus*|*-cygwin*) + WINDRES="$(${B2_CXX} ${B2_CXXFLAGS} -print-prog-name=windres 2>/dev/null)" + ;; + esac + if [ -n "${WINDRES}" ] ; then + B2_CXXFLAGS="${B2_CXXFLAGS} -Wl,res.o" + ( B2_VERBOSE_OPT=${TRUE} echo_run ${WINDRES} --input res.rc --output res.o ) + fi fi ( B2_VERBOSE_OPT=${TRUE} echo_run ${B2_CXX} ${B2_CXXFLAGS} ${B2_SOURCES} -o b2 ) } diff --git a/src/engine/config_toolset.bat b/src/engine/config_toolset.bat index 8b5e3091a1..a2419ace04 100644 --- a/src/engine/config_toolset.bat +++ b/src/engine/config_toolset.bat @@ -259,7 +259,8 @@ goto :eof :Embed_Minafest_Via_Windres if not defined B2_DONT_EMBED_MANIFEST ( - where windres >NUL 2>NUL - if errorlevel 1 ( call; ) else ( set "B2_CXX=windres --input res.rc --output res.o && %B2_CXX% -Wl,res.o" ) + for /f %%i in ('%B2_CXX% --print-prog-name=windres 2^>NUL') do ( + set "B2_CXX="%%i" --input res.rc --output res.o && %B2_CXX% -Wl,res.o" + ) ) goto :eof From a7af57e291f6dcc873337a3f386d6bced7a81716 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Tue, 21 May 2024 22:28:36 +0300 Subject: [PATCH 22/61] clang-win: use lld linker, fix embed-manifest-via=linker (#385) Fixes bfgroup/b2/issues/159 --- Jamroot.jam | 2 +- src/tools/clang-win.jam | 16 ++++++++++++++-- src/tools/flags.jam | 2 +- src/tools/msvc.jam | 22 +++++++++------------- test/path_specials.py | 3 +-- test/toolset-mock/src/linkx.py | 24 ++++++++++++------------ 6 files changed, 38 insertions(+), 31 deletions(-) diff --git a/Jamroot.jam b/Jamroot.jam index afe7421c71..73f5dbf079 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -153,7 +153,7 @@ exe b2 clang-win:advapi32 clang-win:user32 windows,gcc:src/engine/res.rc - windows,clang:src/engine/res.rc + windows,clang-linux:src/engine/res.rc msvc:src/engine/b2.exe.manifest clang-win:src/engine/b2.exe.manifest ; diff --git a/src/tools/clang-win.jam b/src/tools/clang-win.jam index 92fed5e463..639a343c26 100644 --- a/src/tools/clang-win.jam +++ b/src/tools/clang-win.jam @@ -209,9 +209,9 @@ rule init ( version ? : command * : options * ) } toolset.flags clang-win.compile .CC $(cond) : $(compiler) --target=$(clang-arch)-pc-windows-msvc ; - toolset.flags clang-win.link .LD $(cond) : $(compiler) --target=$(clang-arch)-pc-windows-msvc ; + toolset.flags clang-win.link .LD $(cond) : $(compiler) --target=$(clang-arch)-pc-windows-msvc -fuse-ld=lld ; toolset.flags clang-win.link LINKOPT $(cond) : /link ; - toolset.flags clang-win.link LINKFLAGS $(cond) : "/incremental:no" "/manifest" "/machine:$(linker-arch)" ; + toolset.flags clang-win.link LINKFLAGS $(cond) : "/incremental:no" "/machine:$(linker-arch)" ; if $(arch) = x86 { toolset.flags clang-win.compile .ASM $(cond) : $(assembler) -nologo -c -Zp4 -Cp -Cx ; @@ -230,6 +230,18 @@ rule init ( version ? : command * : options * ) } } + local conditions = [ feature.split $(condition) ] ; + if ! [ version.version-less [ SPLIT_BY_CHARACTERS $(version) : . ] : 15 ] { + toolset.add-defaults $(conditions:J=,)\:linker ; + } + else { + # Clang seems to not care about adding WinSDK to PATH. + # Both MSVC link and LLVM lld-link (until v15) will fail to embed manifest. + # LINK : fatal error LNK1158: cannot run 'rc.exe' + # lld-link: error: unable to find mt.exe in PATH: no such file or directory + toolset.add-requirements $(conditions:J=,)\:mt ; + } + toolset.flags clang-win.link LIBRARY_OPTION clang-win : "" : unchecked ; # Enable response file control diff --git a/src/tools/flags.jam b/src/tools/flags.jam index 8bf6431c9f..72cc1ab728 100644 --- a/src/tools/flags.jam +++ b/src/tools/flags.jam @@ -116,7 +116,7 @@ generators.register generators.register [ class.new flag-check-generator EXE : msvc : "(LNK4044)" ] ; generators.register - [ class.new flag-check-generator EXE : clang : "(LNK4044)" ] ; # FIXME: clang-win doesn't work but clang does + [ class.new flag-check-generator EXE : clang : "(LNK4044|ignoring unknown argument)" ] ; generators.register [ class.new flag-check-generator OBJ : intel : "(#10006)" ] ; generators.register diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index 54a6ced323..0dc654fd8f 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -602,21 +602,13 @@ rule configure-version-specific ( toolset : version : conditions ) toolset.flags $(toolset).link LINKFLAGS $(conditions)/$(.cpu-arch-arm) : "/MACHINE:ARM" ; toolset.flags $(toolset).link LINKFLAGS $(conditions)/$(.cpu-arch-arm64) : "/MACHINE:ARM64" ; - if [ version.version-less [ SPLIT_BY_CHARACTERS [ MATCH "^([0123456789.]+)" : $(version) ] : . ] : 11 ] - { - # Make sure that manifest will be generated even if there is no - # dependencies to put there. - toolset.flags $(toolset).link LINKFLAGS $(conditions) : /MANIFEST ; - } - else - { - toolset.flags $(toolset).link LINKFLAGS $(conditions)/mt : /MANIFEST ; - toolset.flags $(toolset).link LINKFLAGS $(conditions)/linker/off : /MANIFEST ; - toolset.flags $(toolset).link LINKFLAGS $(conditions)/linker/on : "/MANIFEST:EMBED" ; - - local conditionx = [ feature.split $(conditions) ] ; + local conditionx = [ feature.split $(conditions) ] ; + if ! [ version.version-less [ SPLIT_BY_CHARACTERS [ MATCH "^([0123456789.]+)" : $(version) ] : . ] : 11 ] { toolset.add-defaults $(conditionx:J=,)\:linker ; } + else { + toolset.add-requirements $(conditionx:J=,)\:mt ; + } } toolset.pop-checking-for-flags-module ; @@ -2012,6 +2004,10 @@ local rule register-toolset-really ( ) toolset.flags msvc LINKFLAGS native : "/subsystem:native" ; toolset.flags msvc LINKFLAGS auto : "/subsystem:posix" ; + toolset.flags msvc.link LINKFLAGS mt : /MANIFEST ; + toolset.flags msvc.link LINKFLAGS linker/off : /MANIFEST ; + toolset.flags msvc.link LINKFLAGS linker/on : "/MANIFEST:EMBED" ; + toolset.flags msvc.link LINKFLAGS ; toolset.flags msvc.link LINKPATH ; diff --git a/test/path_specials.py b/test/path_specials.py index 80252083c0..e47ee42de4 100644 --- a/test/path_specials.py +++ b/test/path_specials.py @@ -24,8 +24,7 @@ def test_dir(dir_name): if os.name == 'nt' and len(tmpdir) > 256: tmp = {} # cl.exe and link.exe still does not support long paths - # clang-cl does support long path, but it uses link.exe by default - if t.toolset.startswith('msvc') or t.toolset.startswith('clang-win'): + if t.toolset.startswith('msvc'): do_compile_test = False # on windows gcc doesn't support long path, ld doesn't support neither unicode nor long path if os.environ.get('MSYSTEM') in ['UCRT64', 'MINGW64', 'MINGW32'] and t.toolset in ['gcc', 'clang']: diff --git a/test/toolset-mock/src/linkx.py b/test/toolset-mock/src/linkx.py index 2c7cd518fb..b28a7138ae 100644 --- a/test/toolset-mock/src/linkx.py +++ b/test/toolset-mock/src/linkx.py @@ -7,27 +7,27 @@ from MockProgram import * if allow_properties("variant=debug", "link=shared", "threading=multi", "runtime-link=shared", "windows-api=desktop"): - command('link', '/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\lib.obj'), '/DEBUG', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\l1.dll')), '/DLL', arg('/IMPLIB:', output_file(r'bin\msvc-14.3\debug\threading-multi\l1.implib'))) - command('link', '/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\main.obj'), input_file(r'bin\msvc-14.3\debug\threading-multi\l1.implib'), '/DEBUG', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\test.exe'))) + command('link', unordered('/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\lib.obj'), '/DEBUG', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\l1.dll')), '/DLL', arg('/IMPLIB:', output_file(r'bin\msvc-14.3\debug\threading-multi\l1.implib')))) + command('link', unordered('/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\main.obj'), input_file(r'bin\msvc-14.3\debug\threading-multi\l1.implib'), '/DEBUG', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\test.exe')))) if allow_properties("variant=release", "link=shared", "threading=multi", "runtime-link=shared", "windows-api=desktop"): - command('link', '/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\release\threading-multi\lib.obj'), '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\release\threading-multi\l1.dll')), '/DLL', arg('/IMPLIB:', output_file(r'bin\msvc-14.3\release\threading-multi\l1.implib'))) - command('link', '/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\release\threading-multi\main.obj'), input_file(r'bin\msvc-14.3\release\threading-multi\l1.implib'), '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\release\threading-multi\test.exe'))) + command('link', unordered('/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\release\threading-multi\lib.obj'), '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\release\threading-multi\l1.dll')), '/DLL', arg('/IMPLIB:', output_file(r'bin\msvc-14.3\release\threading-multi\l1.implib')))) + command('link', unordered('/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\release\threading-multi\main.obj'), input_file(r'bin\msvc-14.3\release\threading-multi\l1.implib'), '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\release\threading-multi\test.exe')))) if allow_properties("variant=debug", "link=static", "threading=multi", "runtime-link=shared", "windows-api=desktop"): - command('link', '/lib', '/NOLOGO', arg('/out:', output_file(r'bin\msvc-14.3\debug\link-static\threading-multi\l1.lib')), input_file(r'bin\msvc-14.3\debug\link-static\threading-multi\lib.obj')) - command('link', '/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\link-static\threading-multi\main.obj'), input_file(r'bin\msvc-14.3\debug\link-static\threading-multi\l1.lib'), '/DEBUG', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\link-static\threading-multi\test.exe'))) + command('link', unordered('/lib', '/NOLOGO', arg('/out:', output_file(r'bin\msvc-14.3\debug\link-static\threading-multi\l1.lib')), input_file(r'bin\msvc-14.3\debug\link-static\threading-multi\lib.obj'))) + command('link', unordered('/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\link-static\threading-multi\main.obj'), input_file(r'bin\msvc-14.3\debug\link-static\threading-multi\l1.lib'), '/DEBUG', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\link-static\threading-multi\test.exe')))) if allow_properties("variant=debug", "link=static", "threading=single", "runtime-link=static", "windows-api=desktop"): - command('link', '/lib', '/NOLOGO', arg('/out:', output_file(r'bin\msvc-14.3\debug\link-static\runtime-link-static\l1.lib')), input_file(r'bin\msvc-14.3\debug\link-static\runtime-link-static\lib.obj')) - command('link', '/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\link-static\runtime-link-static\main.obj'), input_file(r'bin\msvc-14.3\debug\link-static\runtime-link-static\l1.lib'), '/DEBUG', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\link-static\runtime-link-static\test.exe'))) + command('link', unordered('/lib', '/NOLOGO', arg('/out:', output_file(r'bin\msvc-14.3\debug\link-static\runtime-link-static\l1.lib')), input_file(r'bin\msvc-14.3\debug\link-static\runtime-link-static\lib.obj'))) + command('link', unordered('/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\link-static\runtime-link-static\main.obj'), input_file(r'bin\msvc-14.3\debug\link-static\runtime-link-static\l1.lib'), '/DEBUG', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\link-static\runtime-link-static\test.exe')))) if allow_properties("variant=debug", "link=shared", "threading=multi", "runtime-link=shared", "windows-api=store"): - command('link', '/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\lib.obj'), '/DEBUG', '/APPCONTAINER', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\l1.dll')), '/DLL', arg('/IMPLIB:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\l1.implib'))) - command('link', '/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\main.obj'), input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\l1.implib'), '/DEBUG', '/APPCONTAINER', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\test.exe'))) + command('link', unordered('/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\lib.obj'), '/DEBUG', '/APPCONTAINER', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\l1.dll')), '/DLL', arg('/IMPLIB:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\l1.implib')))) + command('link', unordered('/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\main.obj'), input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\l1.implib'), '/DEBUG', '/APPCONTAINER', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-store\test.exe')))) if allow_properties("variant=debug", "link=shared", "threading=multi", "runtime-link=shared", "windows-api=phone"): - command('link', '/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\lib.obj'), '/DEBUG', '/APPCONTAINER', '/NODEFAULTLIB:kernel32.lib', '/NODEFAULTLIB:ole32.lib', 'WindowsPhoneCore.lib', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\l1.dll')), '/DLL', arg('/IMPLIB:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\l1.implib'))) - command('link', '/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\main.obj'), input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\l1.implib'), '/DEBUG', '/APPCONTAINER', '/NODEFAULTLIB:kernel32.lib', '/NODEFAULTLIB:ole32.lib', 'WindowsPhoneCore.lib', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\test.exe'))) + command('link', unordered('/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\lib.obj'), '/DEBUG', '/APPCONTAINER', '/NODEFAULTLIB:kernel32.lib', '/NODEFAULTLIB:ole32.lib', 'WindowsPhoneCore.lib', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\l1.dll')), '/DLL', arg('/IMPLIB:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\l1.implib')))) + command('link', unordered('/NOLOGO', '/INCREMENTAL:NO', input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\main.obj'), input_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\l1.implib'), '/DEBUG', '/APPCONTAINER', '/NODEFAULTLIB:kernel32.lib', '/NODEFAULTLIB:ole32.lib', 'WindowsPhoneCore.lib', '/MACHINE:X64', '/MANIFEST:EMBED', '/subsystem:console', arg('/out:', output_file(r'bin\msvc-14.3\debug\threading-multi\windows-api-phone\test.exe')))) main() From cd7c1537f81d1fc408ea3124c997aa7ba539a606 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Wed, 22 May 2024 04:50:39 +0300 Subject: [PATCH 23/61] Rename os unknown to none (#386) Apparently it was a Clang target normalization bug (issues/89582). --- src/tools/emscripten.jam | 2 +- src/tools/features/os-feature.jam | 2 +- test/BoostBuild.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/emscripten.jam b/src/tools/emscripten.jam index 28175f6d4a..7fa895f598 100644 --- a/src/tools/emscripten.jam +++ b/src/tools/emscripten.jam @@ -120,7 +120,7 @@ toolset.inherit-flags emscripten : clang-linux : : FINDLIBS-SA-PFX ; -toolset.add-defaults emscripten:unknown ; +toolset.add-defaults emscripten:none ; # dynamic linking is experemental and buggy toolset.add-defaults emscripten:static ; diff --git a/src/tools/features/os-feature.jam b/src/tools/features/os-feature.jam index e372380148..a2df7be31a 100644 --- a/src/tools/features/os-feature.jam +++ b/src/tools/features/os-feature.jam @@ -8,7 +8,7 @@ import modules ; import os ; .os-names = - unknown + none aix android appletv bsd cygwin darwin freebsd haiku hpux iphone linux netbsd openbsd osf qnx qnxnto sgi solaris unix unixware windows vms vxworks freertos diff --git a/test/BoostBuild.py b/test/BoostBuild.py index 2c0e79e28d..f47207607c 100644 --- a/test/BoostBuild.py +++ b/test/BoostBuild.py @@ -351,7 +351,7 @@ def cleanup(self): def set_toolset(self, toolset, target_os=None, _pass_toolset=True): self.toolset = _pass_toolset and toolset or "gcc" if not target_os and self.toolset.startswith("emscripten"): - target_os = "unknown" + target_os = "none" self.target_os = target_os or host_os self.expanded_toolset = expand_toolset(self.toolset, self.target_os) self.pass_toolset = _pass_toolset From 5cde9e891e671f0dcbcfd330dd70af5765a528c5 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Thu, 23 May 2024 04:58:09 +0300 Subject: [PATCH 24/61] msvc: register only the version that have been asked to (#387) --- src/tools/msvc.jam | 67 ++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 41 deletions(-) diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index 0dc654fd8f..f56f1cedbc 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -1040,47 +1040,37 @@ class msvc-pch-generator : pch-generator # ################################################################################ -# Detects versions listed as '.known-versions' by checking registry information, +# Try to find and register a specified version by checking registry information, # environment variables & default paths. Supports both native Windows and # Cygwin. # -local rule auto-detect-toolset-versions ( ) +local rule try-auto-detect-version ( version ) { - if [ os.name ] in NT CYGWIN + if [ os.name ] in NT CYGWIN && $(.version-$(version)-reg) { # Get installation paths from the registry. - for local i in $(.known-versions) + local vc-path ; + for local x in "" "Wow6432Node\\" { - if $(.version-$(i)-reg) - { - local vc-path ; - for local x in "" "Wow6432Node\\" - { - vc-path += [ W32_GETREG - "HKEY_LOCAL_MACHINE\\SOFTWARE\\"$(x)"\\Microsoft\\"$(.version-$(i)-reg) - : "ProductDir" ] ; - } + vc-path += [ W32_GETREG + "HKEY_LOCAL_MACHINE\\SOFTWARE\\"$(x)"\\Microsoft\\"$(.version-$(version)-reg) + : "ProductDir" ] ; + } - if $(vc-path) - { - vc-path = [ path.join [ path.make-NT $(vc-path[1]) ] "bin" ] ; - register-configuration $(i) : [ path.native $(vc-path[1]) ] ; - } - } - else - { - register-configuration $(i) : [ default-path $(i) ] ; - } + if $(vc-path) + { + vc-path = [ path.join [ path.make-NT $(vc-path[1]) ] "bin" ] ; + register-configuration $(version) : [ path.native $(vc-path[1]) ] ; + return true ; } } # Check environment and default installation paths. - for local i in $(.known-versions) + local path = [ default-path $(version) ] ; + if $(path) { - if ! $(i) in [ $(.versions).all ] - { - register-configuration $(i) : [ default-path $(i) ] ; - } + register-configuration $(version) : $(path) ; + return true ; } } @@ -1255,19 +1245,19 @@ local rule configure-really ( version ? : options * ) # FIXME: consider whether an explicitly specified setup script # should disable this logic. We already won't get here if # there is a user specified command. - version = [ $(.versions).all ] ; - for local known in $(.known-versions) + for version in $(.known-versions) { - if $(known) in $(version) + if [ try-auto-detect-version $(version) ] { - version = $(known) ; break ; } } - # version might still have multiple elements if no versions - # were auto-detected, but an unknown version was configured - # manually. - version = $(version[1]) ; + } + else if $(version) + { + # Version alias -> real version number. + version = [ resolve-possible-msvc-version-alias $(version) ] ; + try-auto-detect-version $(version) ; } # Handle a user-provided command, and deduce the version if necessary. @@ -1364,8 +1354,6 @@ local rule configure-really ( version ? : options * ) } } - # Version alias -> real version number. - version = [ resolve-possible-msvc-version-alias $(version) ] ; # Check whether the selected configuration is already in use. if $(version) in [ $(.versions).used ] @@ -2223,9 +2211,6 @@ for local arch in [ MATCH "^\\.cpus-on-(.*)" : [ VARNAMES $(__name__) ] ] ; .version-14.3-env = VS170COMNTOOLS ProgramFiles ProgramFiles(x86) ; -# Auto-detect all the available msvc installations on the system. -auto-detect-toolset-versions ; - # And finally trigger the actual Boost Build toolset registration. register-toolset ; From 9242cd55f2c8a199a235e9abde6dd6c3ab3d307f Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 24 May 2024 01:07:35 +0300 Subject: [PATCH 25/61] allow adding dll-path to usage requirements of searched libraries (#389) --- src/build/ac.jam | 14 +++++++++++--- src/tools/bzip2.jam | 5 +++++ src/tools/libjpeg.jam | 5 +++++ src/tools/libpng.jam | 5 +++++ src/tools/libtiff.jam | 5 +++++ src/tools/lzma.jam | 5 +++++ src/tools/openssl.jam | 6 ++++++ src/tools/zlib.jam | 5 +++++ src/tools/zstd.jam | 2 ++ 9 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/build/ac.jam b/src/build/ac.jam index 551cb7d5a1..5a1f5a86c4 100644 --- a/src/build/ac.jam +++ b/src/build/ac.jam @@ -182,6 +182,11 @@ class ac-library : basic-target self.target = $(target) ; } + rule add-usage-requirements ( properties * ) + { + self.extra-ureqs += $(properties) ; + } + rule check-not-configured ( ) { if $(self.include-path) || $(self.library-path) || $(self.library-name) || $(self.target) @@ -194,7 +199,8 @@ class ac-library : basic-target { if $(self.target) { - return [ $(self.target).generate $(property-set) ] ; + local result = [ $(self.target).generate $(property-set) ] ; + return [ $(result[1]).add-raw $(self.extra-ureqs) ] $(result[2-]) ; } else { @@ -252,7 +258,8 @@ class ac-library : basic-target local library = [ ac.construct-library $(lookup[2]) : [ $(property-set).refine [ property-set.create $(lookup[3]) ] ] : $(library-path) ] ; configure.log-library-search-result $(name) : "yes (cached)" $(min) ; - return [ $(library[1]).add-raw $(includes) ] $(library[2-]) ; + return [ $(library[1]).add-raw $(includes) + $(self.extra-ureqs) ] $(library[2-]) ; } } else @@ -269,7 +276,8 @@ class ac-library : basic-target library = [ ac.construct-library $(library[1]) : [ $(property-set).refine [ property-set.create $(library[2]) ] ] : $(library-path) ] ; configure.log-library-search-result $(name) : "yes" $(min) ; - return [ $(library[1]).add-raw $(includes) ] $(library[2-]) ; + return [ $(library[1]).add-raw $(includes) + $(self.extra-ureqs) ] $(library[2-]) ; } else { diff --git a/src/tools/bzip2.jam b/src/tools/bzip2.jam index a58220a6e4..49a0425c51 100644 --- a/src/tools/bzip2.jam +++ b/src/tools/bzip2.jam @@ -52,6 +52,9 @@ if --debug-configuration in [ modules.peek : ARGV ] # Overrides the default library name. # # The directory containing the bzip headers. +# +# Extra directories to add to library search paths of consumers during +# runtime (multiple instances are allowed). # # If none of these options is specified, then the environmental # variables BZIP2_LIBRARY_PATH, BZIP2_NAME, and BZIP2_INCLUDE will @@ -117,6 +120,7 @@ rule init ( local include-path = [ feature.get-values : $(options) ] ; local source-path = [ feature.get-values : $(options) ] ; local library-name = [ feature.get-values : $(options) ] ; + local dll-paths = [ property.select : $(options) ] ; local tag = [ feature.get-values : $(options) ] ; local build-name = [ feature.get-values : $(options) ] ; @@ -239,6 +243,7 @@ rule init ( $(include-path) : $(library-path) : $(library-name) ] ; $(mt).set-header $(header) ; $(mt).set-default-names $(names) ; + $(mt).add-usage-requirements $(dll-paths) ; targets.main-target-alternative $(mt) ; } .configured.$(condition) = true ; diff --git a/src/tools/libjpeg.jam b/src/tools/libjpeg.jam index ac2a5d0d8b..55de83f48d 100644 --- a/src/tools/libjpeg.jam +++ b/src/tools/libjpeg.jam @@ -58,6 +58,9 @@ if --debug-configuration in [ modules.peek : ARGV ] # Overrides the default library name. # # The directory containing the libjpeg headers. +# +# Extra directories to add to library search paths of consumers during +# runtime (multiple instances are allowed). # # If none of these options is specified, then the environmental # variables LIBJPEG_LIBRARY_PATH, LIBJPEG_NAME, and LIBJPEG_INCLUDE will @@ -123,6 +126,7 @@ rule init ( local include-path = [ feature.get-values : $(options) ] ; local source-path = [ feature.get-values : $(options) ] ; local library-name = [ feature.get-values : $(options) ] ; + local dll-paths = [ property.select : $(options) ] ; local tag = [ feature.get-values : $(options) ] ; local build-name = [ feature.get-values : $(options) ] ; @@ -208,6 +212,7 @@ rule init ( local mt = [ new ac-library libjpeg : $(.project) : $(condition) ] ; $(mt).set-header $(header) ; $(mt).set-default-names $(names) ; + $(mt).add-usage-requirements $(dll-paths) ; if $(target) { $(mt).set-target $(target) ; diff --git a/src/tools/libpng.jam b/src/tools/libpng.jam index 873db8f96c..304140b7f1 100644 --- a/src/tools/libpng.jam +++ b/src/tools/libpng.jam @@ -53,6 +53,9 @@ if --debug-configuration in [ modules.peek : ARGV ] # Overrides the default library name. # # The directory containing the libpng headers. +# +# Extra directories to add to library search paths of consumers during +# runtime (multiple instances are allowed). # # If none of these options is specified, then the environmental # variables LIBPNG_LIBRARY_PATH, LIBPNG_NAME, and LIBPNG_INCLUDE will @@ -118,6 +121,7 @@ rule init ( local include-path = [ feature.get-values : $(options) ] ; local source-path = [ feature.get-values : $(options) ] ; local library-name = [ feature.get-values : $(options) ] ; + local dll-paths = [ property.select : $(options) ] ; local tag = [ feature.get-values : $(options) ] ; local build-name = [ feature.get-values : $(options) ] ; @@ -204,6 +208,7 @@ rule init ( local mt = [ new ac-library libpng : $(.project) : $(condition) ] ; $(mt).set-header $(header) ; $(mt).set-default-names $(names) ; + $(mt).add-usage-requirements $(dll-paths) ; if $(target) { $(mt).set-target $(target) ; diff --git a/src/tools/libtiff.jam b/src/tools/libtiff.jam index 3083815035..7872c16ef0 100644 --- a/src/tools/libtiff.jam +++ b/src/tools/libtiff.jam @@ -52,6 +52,9 @@ if --debug-configuration in [ modules.peek : ARGV ] # Overrides the default library name. # # The directory containing the libtiff headers. +# +# Extra directories to add to library search paths of consumers during +# runtime (multiple instances are allowed). # # If none of these options is specified, then the environmental # variables LIBTIFF_LIBRARY_PATH, LIBTIFF_NAME, and LIBTIFF_INCLUDE will @@ -117,6 +120,7 @@ rule init ( local include-path = [ feature.get-values : $(options) ] ; local source-path = [ feature.get-values : $(options) ] ; local library-name = [ feature.get-values : $(options) ] ; + local dll-paths = [ property.select : $(options) ] ; local tag = [ feature.get-values : $(options) ] ; local build-name = [ feature.get-values : $(options) ] ; @@ -202,6 +206,7 @@ rule init ( local mt = [ new ac-library libtiff : $(.project) : $(condition) ] ; $(mt).set-header $(header) ; $(mt).set-default-names $(names) ; + $(mt).add-usage-requirements $(dll-paths) ; if $(target) { $(mt).set-target $(target) ; diff --git a/src/tools/lzma.jam b/src/tools/lzma.jam index b774ff27be..582054b9cc 100644 --- a/src/tools/lzma.jam +++ b/src/tools/lzma.jam @@ -44,6 +44,9 @@ if --debug-configuration in [ modules.peek : ARGV ] # Overrides the default library name. # # The directory containing the lzma headers. +# +# Extra directories to add to library search paths of consumers during +# runtime (multiple instances are allowed). # # If none of these options is specified, then the environmental # variables LZMA_LIBRARY_PATH, LZMA_NAME, and LZMA_INCLUDE will @@ -89,6 +92,7 @@ rule init ( local library-path = [ feature.get-values : $(options) ] ; local include-path = [ feature.get-values : $(options) ] ; local library-name = [ feature.get-values : $(options) ] ; + local dll-paths = [ property.select : $(options) ] ; if ! $(options) { @@ -128,6 +132,7 @@ rule init ( $(include-path) : $(library-path) : $(library-name) ] ; $(mt).set-header $(header) ; $(mt).set-default-names $(names) ; + $(mt).add-usage-requirements $(dll-paths) ; targets.main-target-alternative $(mt) ; } .configured.$(condition) = true ; diff --git a/src/tools/openssl.jam b/src/tools/openssl.jam index 553dabd6f0..1159d66781 100644 --- a/src/tools/openssl.jam +++ b/src/tools/openssl.jam @@ -49,6 +49,9 @@ if --debug-configuration in [ modules.peek : ARGV ] # Overrides the default name of crypto library. # # The directory containing the openssl headers. +# +# Extra directories to add to library search paths of consumers during +# runtime (multiple instances are allowed). # # If none of these options is specified, then the environmental # variables OPENSSL_LIBRARY_PATH, OPENSSL_NAME, and OPENSSL_INCLUDE will @@ -90,6 +93,7 @@ rule init ( local include-path = [ feature.get-values : $(options) ] ; local ssl-name = [ feature.get-values : $(options) ] ; local crypto-name = [ feature.get-values : $(options) ] ; + local dll-paths = [ property.select : $(options) ] ; if ! $(library-path) && ! $(include-path) && ! $(source-path) && ! $(ssl-name) && ! $(crypto-name) { @@ -132,11 +136,13 @@ rule init ( $(include-path) : $(library-path) ] ; $(ssl_lib).set-header openssl/ssl.h ; $(ssl_lib).set-default-names $(ssl-name) ; + $(ssl_lib).add-usage-requirements $(dll-paths) ; local crypto_lib = [ new ac-library crypto : $(.project) : $(condition) : $(include-path) : $(library-path) ] ; $(crypto_lib).set-header openssl/crypto.h ; $(crypto_lib).set-default-names $(crypto-name) ; + $(crypto_lib).add-usage-requirements $(dll-paths) ; targets.main-target-alternative $(ssl_lib) ; targets.main-target-alternative $(crypto_lib) ; diff --git a/src/tools/zlib.jam b/src/tools/zlib.jam index 84f7c82a13..4d552d043a 100644 --- a/src/tools/zlib.jam +++ b/src/tools/zlib.jam @@ -51,6 +51,9 @@ if --debug-configuration in [ modules.peek : ARGV ] # Overrides the default library name. # # The directory containing the zlib headers. +# +# Extra directories to add to library search paths of consumers during +# runtime (multiple instances are allowed). # # If none of these options is specified, then the environmental # variables ZLIB_LIBRARY_PATH, ZLIB_NAME, and ZLIB_INCLUDE will @@ -116,6 +119,7 @@ rule init ( local include-path = [ feature.get-values : $(options) ] ; local source-path = [ feature.get-values : $(options) ] ; local library-name = [ feature.get-values : $(options) ] ; + local dll-paths = [ property.select : $(options) ] ; local tag = [ feature.get-values : $(options) ] ; local build-name = [ feature.get-values : $(options) ] ; @@ -208,6 +212,7 @@ rule init ( local mt = [ new ac-library zlib : $(.project) : $(condition) ] ; $(mt).set-header $(header) ; $(mt).set-default-names $(names) ; + $(mt).add-usage-requirements $(dll-paths) ; if $(target) { $(mt).set-target $(target) ; diff --git a/src/tools/zstd.jam b/src/tools/zstd.jam index e73100fe12..dd6890bf68 100644 --- a/src/tools/zstd.jam +++ b/src/tools/zstd.jam @@ -60,6 +60,7 @@ rule init ( local library-path = [ feature.get-values : $(options) ] ; local include-path = [ feature.get-values : $(options) ] ; local library-name = [ feature.get-values : $(options) ] ; + local dll-paths = [ property.select : $(options) ] ; condition = [ property-set.create $(requirements) ] ; condition = [ property-set.create [ $(condition).base ] ] ; @@ -94,6 +95,7 @@ rule init ( $(include-path) : $(library-path) : $(library-name) ] ; $(mt).set-header $(header) ; $(mt).set-default-names $(names) ; + $(mt).add-usage-requirements $(dll-paths) ; targets.main-target-alternative $(mt) ; } .configured.$(condition) = true ; From bf6992bad7016aa2bcd831e23223b2c3e5ec606f Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Fri, 24 May 2024 04:59:36 +0300 Subject: [PATCH 26/61] Suppress annoying `1 file(s) copied.` after every test (#390) --- src/tools/testing.jam | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/testing.jam b/src/tools/testing.jam index 5945597229..2fa60c1988 100644 --- a/src/tools/testing.jam +++ b/src/tools/testing.jam @@ -641,6 +641,7 @@ else .CP = cp ; .NULLIN = "<" "/dev/null" ; } +.NULL_OUT = [ modules.peek common : NULL_OUT ] ; .VERBOSE_TEST = 0 ; @@ -661,7 +662,7 @@ actions capture-output bind INPUT_FILES output-file $(.RUN_OUTPUT_NL) >> "$(output-file)" echo EXIT STATUS: $(.STATUS) >> "$(output-file)" if $(.STATUS_0) - $(.CP) "$(output-file)" "$(<)" + $(.CP) "$(output-file)" "$(<)" $(.NULL_OUT) $(.ENDIF) $(.SHELL_SET)verbose=$(.VERBOSE_TEST) if $(.STATUS_NOT_0) From 7baf56d18793855f89853c1c083fa66dd978394b Mon Sep 17 00:00:00 2001 From: Dmitry Arkhipov Date: Mon, 20 May 2024 11:22:45 +0300 Subject: [PATCH 27/61] improve handling of install directories 1. Consider options when constructing values for install directories. 2. Evaluate explicitly-provided values for directories relative to PWD, not base directory. 3. Change 2 requires a different implementation of staging-prefix handling. --- src/tools/stage.jam | 49 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/tools/stage.jam b/src/tools/stage.jam index 325129dc81..3552605668 100644 --- a/src/tools/stage.jam +++ b/src/tools/stage.jam @@ -738,27 +738,43 @@ rule get-dir ( name : property-set : package-name : flags * ) # is based on the value of property. if $(name) = prefix { - result = [ get-install-prefix $(property-set) : $(package-name) + return [ get-install-prefix $(property-set) : $(package-name) : $(flags) ] ; } else { # First, try getting the path for requested directory from properties. result = [ $(property-set).get ] ; - local info = [ get-dir-info $(name) : $(package-name) ] ; - # Otherwise, use the default path. In both cases, it could be a - # relative path. - result ?= $(info[1]) ; + result ?= [ option.get $(name) ] ; if $(result) { - result = [ path.make $(result) ] ; + result = [ path.root [ path.make $(result) ] [ path.pwd ] ] ; + } + + local info = [ get-dir-info $(name) : $(package-name) ] ; + + local base-relative ; + if ! $(result) + { + # Otherwise, use the default path. In both cases, it could be a + # relative path. + result = $(info[1]) ; + result ?= "" ; + base-relative = true ; } # If there is a base directory, we may need to modify result further. if $(info[2]) { + if $(base-relative) && ( relative in $(flags) ) + { + return $(result) ; + } + local base = [ get-dir $(info[2]) : $(property-set) - : $(package-name) : $(flags) ] ; + : $(package-name) ] ; + result = [ path.root $(result) $(base) ] ; + if relative in $(flags) { local rel = [ path.relative $(result) $(base) : no-error ] ; @@ -766,10 +782,23 @@ rule get-dir ( name : property-set : package-name : flags * ) { result = $(rel) ; } + return $(result) ; } - else + } + } + + if staged in $(flags) + { + local prefix = [ get-install-prefix $(property-set) + : $(package-name) ] ; + local stage = [ get-install-prefix $(property-set) : $(package-name) + : staged ] ; + if $(prefix) != $(stage) + { + local rel = [ path.relative $(result) $(prefix) : no-error ] ; + if not-a-child != $(rel) { - result = [ path.root $(result) $(base) ] ; + result = [ path.root $(rel) $(prefix) ] ; } } } @@ -817,7 +846,7 @@ local rule get-install-prefix ( property-set : package-name : flags * ) prefix = /usr/local ; } } - return [ path.make $(prefix) ] ; + return [ path.root [ path.make $(prefix) ] [ path.pwd ] ] ; } From 2d756eb245e9898cbeb3212ca1716038927329a8 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 23 May 2024 14:17:56 +0200 Subject: [PATCH 28/61] msvc: recognize Visual Studio 2022 v17.10.0, which uses toolchain version 14.40.33807. --- src/tools/msvc.jam | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index f56f1cedbc..b0e3e98d64 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -23,6 +23,7 @@ https://docs.microsoft.com/en-us/cpp/[Microsoft Visual C++] command-line tools on Microsoft Windows. The supported products and versions of command line tools are listed below: +* Visual Studio 2022-14.3 * Visual Studio 2019-14.2 * Visual Studio 2017—14.1 * Visual Studio 2015—14.0 @@ -1119,7 +1120,7 @@ local rule generate-setup-cmd ( version : command : parent : options * : cpu : g } else { - if [ MATCH "(14.3)" : $(version) ] + if [ MATCH "(14.[34])" : $(version) ] { if $(.debug-configuration) { @@ -1298,7 +1299,7 @@ local rule configure-really ( version ? : options * ) # version from the path. # FIXME: We currently detect both Microsoft Visual Studio 9.0 and # 9.0express as 9.0 here. - if [ MATCH "(MSVC\\\\14.3)" : $(command) ] + if [ MATCH "(MSVC\\\\14.[34])" : $(command) ] { version = 14.3 ; } From 376470fadd3ecad2b5cf5aa86a261281d479567c Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Sun, 26 May 2024 19:05:31 +0300 Subject: [PATCH 29/61] exception-handling=off should define _HAS_EXCEPTIONS=0 for Dinkumware/MSSTL --- src/tools/msvc.jam | 1 + test/feature_exception.py | 26 ++++++++++++++++++++++++++ test/test_all.py | 1 + 3 files changed, 28 insertions(+) create mode 100644 test/feature_exception.py diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index b0e3e98d64..33ed9f9b48 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -1932,6 +1932,7 @@ local rule register-toolset-really ( ) toolset.flags msvc.compile C++FLAGS on/off/on : /EHsc ; toolset.flags msvc.compile C++FLAGS on/on/off : /EHa ; toolset.flags msvc.compile C++FLAGS on/on/on : /EHac ; + toolset.flags msvc.compile C++FLAGS off : -D_HAS_EXCEPTIONS=0 ; toolset.flags msvc.compile C++FLAGS 14 : "/std:c++14" ; toolset.flags msvc.compile C++FLAGS 17 : "/std:c++17" ; diff --git a/test/feature_exception.py b/test/feature_exception.py new file mode 100644 index 0000000000..8e065d887a --- /dev/null +++ b/test/feature_exception.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +# Copyright Nikita Kniazev +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt) + +import BoostBuild + + +def test_basic(): + with BoostBuild.Tester(use_test_config=False) as t: + t.write('Jamroot.jam', 'obj test : test.cpp ;\n') + t.write('test.cpp', 'int main() { try { throw 0; } catch (int) {} }\n') + t.run_build_system(['exception-handling=on', 'warnings-as-errors=on']) + t.run_build_system(['exception-handling=off', 'warnings-as-errors=on'], status=1) + + +def test_stdlib(): + with BoostBuild.Tester(use_test_config=False) as t: + t.write('Jamroot.jam', 'obj test : test.cpp ;\n') + t.write('test.cpp', '#include \nint main() { std::cout << "Hello!"; }\n') + t.run_build_system(['exception-handling=off', 'warnings-as-errors=on']) + + +test_basic() +test_stdlib() diff --git a/test/test_all.py b/test/test_all.py index 24b234f91e..cd4def137b 100755 --- a/test/test_all.py +++ b/test/test_all.py @@ -298,6 +298,7 @@ def reorder_tests(tests, first_test): "expansion", "explicit", "feature_cxxflags", + "feature_exception", "feature_implicit_dependency", "feature_relevant", "feature_suppress_import_lib", From 64860ef4ca91894ed9832d8fc34ebaaba2743df6 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 27 May 2024 00:17:51 -0500 Subject: [PATCH 30/61] Update history notes with current changes. --- doc/src/history.adoc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/doc/src/history.adoc b/doc/src/history.adoc index bdc09c7a3e..879dd403b7 100644 --- a/doc/src/history.adoc +++ b/doc/src/history.adoc @@ -3,6 +3,10 @@ == Version 5.2.0 +* *New*: Allow adding dll-path to usage requirements of searched libraries. + Which makes it possible to adjust search paths for dynamic libs on the + platform. + -- _Dmitry Arkhipov_ * Fix incorrect recursive loading of modules when doing recursive importing of modules. The recursive loading would cause stack overflows. -- _René Ferdinand Rivera Morell_ @@ -17,6 +21,30 @@ * Fix using relevant features in ac module that would cause incorrect configure checks. -- _Dmitry Arkhipov_ +* Fix application of -m31, -m32, -m64 for address model on certain hardware and + avoid adding them when not supported, generally. + -- _Nikita Kniazev_ +* Fix incorrectly attaching manifest when not targeting Windows for engine + bootstrap build. + -- _Nikita Kniazev_ +* Fix `embed-manifest-via=linker` for clang-win toolset. + -- _Nikita Kniazev_ +* Fix incorrect `unknown` OS name, to use correct `none`. Which is needed for + correct emscripten toolset building. + -- _Nikita Kniazev_ +* Fix: For msvc toolset, register only the versions that have been asked to + init. + -- _Nikita Kniazev_ +* Fix: Suppress spurious `1 file(s) copied.` message after every test. + -- _Nikita Kniazev_ +* Fix: Improve handling of install directories. + -- _Dmitry Arkhipov_ +* Fix: For msvc toolset, recognize Visual Studio 2022 v17.10.0, which uses + toolchain version 14.40.33807. + -- _Dmitry Andric_ +* Fix: For msvc toolset, exception-handling=off should define + `_HAS_EXCEPTIONS=0` for Dinkumware/MSSTL. + -- _Nikita Kniazev_ == Version 5.1.0 From e329ca3aa26609d56ff311b4cfecb436f4cfe5e0 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 27 May 2024 00:20:40 -0500 Subject: [PATCH 31/61] Formatting fixes, tabs instead of space. --- .clang-format | 2 +- .editorconfig | 3 +- .vscode/launch.json | 430 ++++++++++++++++++++++---------------------- 3 files changed, 217 insertions(+), 218 deletions(-) diff --git a/.clang-format b/.clang-format index 6a4a060922..4f3b977b58 100644 --- a/.clang-format +++ b/.clang-format @@ -2,7 +2,7 @@ BasedOnStyle: WebKit IndentWidth: 4 TabWidth: 4 -UseTab: Never +UseTab: Always --- Language: Cpp AccessModifierOffset: 0 diff --git a/.editorconfig b/.editorconfig index c01e5077c2..f6fe83db39 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,9 +7,10 @@ root = true [*] charset = utf-8 indent_size = 4 -indent_style = space +indent_style = tab tab_width = 4 trim_trailing_whitespace = true [*.yml] indent_size = 2 +indent_style = space diff --git a/.vscode/launch.json b/.vscode/launch.json index 5e2fef3847..0873e57b6c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,218 +1,216 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "(gdb) Pipe Launch", - "type": "cppdbg", - "request": "launch", - "program": "/root/b2/.build/gcc-12/debug/cxxstd-11-iso/threading-multi/b2", - "args": [], - "stopAtEntry": true, - "cwd": "/root/b2/test/grep", - "environment": [], - "externalConsole": true, - "pipeTransport": { - "debuggerPath": "/usr/local/bin/gdb", - "pipeProgram": "/usr/bin/ssh", - "pipeArgs": [ - "-v", - "root@192.168.13.163" - ], - "pipeCwd": "" - }, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], - "sourceFileMap": { - "/root/b2": "${workspaceFolder}" - } - }, - { - "name": "(mingw) Launch", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}\\.build\\gcc-10\\debug\\cxxstd-11-iso\\b2.exe", - "args": [ - "-v" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": true, - "MIMode": "gdb", - "miDebuggerPath": "C:/mingw64/bin/gdb.exe", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - }, - { - "description": "Set Disassembly Flavor to Intel", - "text": "-gdb-set disassembly-flavor intel", - "ignoreFailures": true - } - ] - }, - { - "name": "(msvc) Launch", - "type": "cppvsdbg", - "request": "launch", - "program": "${workspaceFolder}\\.build\\msvc-14.3\\debug\\cxxstd-11-iso\\threading-multi\\b2.exe", - "args": [ - "-v" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}\\src\\engine", - "environment": [] - }, - { - "name": "(msvc) Launch, Unit Tests", - "type": "cppvsdbg", - "request": "launch", - "program": "${workspaceFolder}\\.build\\msvc-14.3\\debug\\cxxstd-11-iso\\threading-multi\\b2.exe", - "args": [ - "--debug", - "--build-system=test/test", - "-j1" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}\\test", - "environment": [] - }, - { - "name": "(gcc) Launch", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/b2", - "args": [ - "--grep" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - }, - { - "name": "(gcc) Launch: ASAN", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/.build/gcc-13/debug/address-sanitizer-on/cxxstd-11-iso/b2", - "args": [ - "-na", - "toolset=gcc" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - }, - { - "name": "(gcc) Launch, Unit Tests", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/b2", - "args": [ - "--debug", - "--build-system=test/test", - "-j1", - "--debug-tests", - "toolset=gcc" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}/test", - "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - }, - { - "name": "(gcc) Launch, Unit Tests: ASAN", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/.build/gcc-13/debug/address-sanitizer-on/cxxstd-11-iso/b2", - "args": [ - "--debug", - "--build-system=test/test", - "-j1", - "--debug-tests", - "toolset=gcc" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}/test", - "environment": [ - { - "LSAN_OPTIONS": "verbosity=1:log_threads=1" - } - ], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - }, - { - "name": "(rr) Launch", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/b2", - "args": [ - "--grep" - ], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": true, - "MIMode": "gdb", - "miDebuggerServerAddress": "localhost:50505", - // "miDebuggerPath": "rr", - // "miDebuggerArgs": "replay -s 50505", - "setupCommands": [ - { - "description": "Setup to resolve symbols", - "text": "set sysroot /", - "ignoreFailures": false - }, - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - } - ] + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Pipe Launch", + "type": "cppdbg", + "request": "launch", + "program": "/root/b2/.build/gcc-12/debug/cxxstd-11-iso/threading-multi/b2", + "args": [], + "stopAtEntry": true, + "cwd": "/root/b2/test/grep", + "environment": [], + "externalConsole": true, + "pipeTransport": { + "debuggerPath": "/usr/local/bin/gdb", + "pipeProgram": "/usr/bin/ssh", + "pipeArgs": [ + "-v", + "root@192.168.13.163" + ], + "pipeCwd": "" + }, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "sourceFileMap": { + "/root/b2": "${workspaceFolder}" + } + }, + { + "name": "(mingw) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}\\.build\\gcc-10\\debug\\cxxstd-11-iso\\b2.exe", + "args": [ + "-v" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": true, + "MIMode": "gdb", + "miDebuggerPath": "C:/mingw64/bin/gdb.exe", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ] + }, + { + "name": "(msvc) Launch", + "type": "cppvsdbg", + "request": "launch", + "program": "${workspaceFolder}\\.build\\msvc-14.3\\debug\\cxxstd-11-iso\\threading-multi\\b2.exe", + "args": [ + "-v" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}\\src\\engine", + "environment": [] + }, + { + "name": "(msvc) Launch, Unit Tests", + "type": "cppvsdbg", + "request": "launch", + "program": "${workspaceFolder}\\.build\\msvc-14.3\\debug\\cxxstd-11-iso\\threading-multi\\b2.exe", + "args": [ + "--debug", + "--build-system=test/test", + "-j1" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}\\test", + "environment": [] + }, + { + "name": "(gcc) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/threading-multi/b2", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + { + "name": "(gcc) Launch: ASAN", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/.build/gcc-13/debug/address-sanitizer-on/cxxstd-11-iso/b2", + "args": [ + "-na", + "toolset=gcc" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + { + "name": "(gcc) Launch, Unit Tests", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/threading-multi/b2", + "args": [ + "--debug", + "--build-system=test/test", + "-j1", + "--debug-tests", + "toolset=gcc" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/test", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + { + "name": "(gcc) Launch, Unit Tests: ASAN", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/.build/gcc-13/debug/address-sanitizer-on/cxxstd-11-iso/b2", + "args": [ + "--debug", + "--build-system=test/test", + "-j1", + "--debug-tests", + "toolset=gcc" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/test", + "environment": [ + { + "LSAN_OPTIONS": "verbosity=1:log_threads=1" + } + ], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + { + "name": "(rr) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/.build/gcc-13/debug/cxxstd-11-iso/b2", + "args": [ + "--grep" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": true, + "MIMode": "gdb", + "miDebuggerServerAddress": "localhost:50505", + // "miDebuggerPath": "rr", + // "miDebuggerArgs": "replay -s 50505", + "setupCommands": [ + { + "description": "Setup to resolve symbols", + "text": "set sysroot /", + "ignoreFailures": false + }, + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] } \ No newline at end of file From c30bce8e2df15aebaf6ab646238a4fec30327346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ferdinand=20Rivera=20Morell?= Date: Mon, 27 May 2024 20:04:58 -0500 Subject: [PATCH 32/61] Add property-db class to record & write structured data. (#397) Add property-db class to record & write structured data. This adds a utility to record structured data in the form of a property database where the keys are a property path with string or number values. The data can be converted to a string, or written to a file, as JSON. --- README.adoc | 2 +- azure-pipelines.yml | 2 +- doc/src/appendix.adoc | 33 + doc/src/reference.adoc | 1 + doc/src/standalone.adoc | 2 + src/engine/bindjam.cpp | 4 +- src/engine/build.bat | 1 + src/engine/build.sh | 1 + src/engine/ext_nlohmann_json.hpp | 24765 +++++++++++++++++++++ src/engine/ext_nlohmann_json.hpp.LICENSE | 21 + src/engine/mod_db.cpp | 145 + src/engine/mod_db.h | 134 + src/engine/value.cpp | 33 + src/engine/value.h | 8 + test/test.jam | 1 + 15 files changed, 25150 insertions(+), 3 deletions(-) create mode 100644 doc/src/appendix.adoc create mode 100644 src/engine/ext_nlohmann_json.hpp create mode 100644 src/engine/ext_nlohmann_json.hpp.LICENSE create mode 100644 src/engine/mod_db.cpp create mode 100644 src/engine/mod_db.h diff --git a/README.adoc b/README.adoc index e058e95f82..82bfeb9ab5 100644 --- a/README.adoc +++ b/README.adoc @@ -17,7 +17,7 @@ Continuously tested on: * FreeBSD Clang 11, 12, 13, 14, 15, 16, 17 * FreeBSD GCC 9, 10, 11, 12, 13 * Linux Clang 3.6, 3.7, 3.8, 3.9, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 -* Linux GCC 4.7, 4.8, 4.9, 5, 6, 7, 8, 9, 10, 11, 12, 13 +* Linux GCC 4.8, 4.9, 5, 6, 7, 8, 9, 10, 11, 12, 13 * macOS Xcode 11.7, 12.4, 12.5.1, 13.4.1, 14.0.1, 14.1, 14.2, 14.3.1, 15.0.1 * Windows MinGW 8.1.0 * Windows 2015, 2017, 2019, 2022 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5cafff3bae..a66bb866e9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -245,7 +245,7 @@ stages: GCC 5: {CXX: g++-5, TOOLSET: gcc-5, PACKAGES: g++-5, CONTAINER: "ubuntu_1804"} GCC 4.9: {CXX: g++-4.9, TOOLSET: gcc-4.9, PACKAGES: g++-4.9, CONTAINER: "ubuntu_1604"} GCC 4.8: {CXX: g++-4.8, TOOLSET: gcc-4.8, PACKAGES: g++-4.8, CONTAINER: "ubuntu_1804"} - GCC 4.7: {CXX: g++-4.7, TOOLSET: gcc-4.7, PACKAGES: g++-4.7, CONTAINER: "ubuntu_1604"} + # GCC 4.7: {CXX: g++-4.7, TOOLSET: gcc-4.7, PACKAGES: g++-4.7, CONTAINER: "ubuntu_1604"} Clang 9: {CXX: clang++-9, TOOLSET: clang-9, PACKAGES: clang-9, LLVM_VER: 9, LLVM_OS: 'bionic', CONTAINER: "ubuntu_1804"} Clang 8: {CXX: clang++-8, TOOLSET: clang-8, PACKAGES: clang-8, LLVM_VER: 8, LLVM_OS: 'bionic', CONTAINER: "ubuntu_1804"} Clang 7: {CXX: clang++-7, TOOLSET: clang-7, PACKAGES: clang-7, LLVM_VER: 7, LLVM_OS: 'bionic', CONTAINER: "ubuntu_1804"} diff --git a/doc/src/appendix.adoc b/doc/src/appendix.adoc new file mode 100644 index 0000000000..1a78ca6efe --- /dev/null +++ b/doc/src/appendix.adoc @@ -0,0 +1,33 @@ +[[b2.appendix]] +[appendix] += Licenses + +In addition to B2 being licensed under the Boost Software License - Version 1.0, +B2 makes use of additional libraries that are differently licensed as follows. + +== MIT License + +``` +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` + +https://github.com/nlohmann/json[JSON for Modern C++]:: +Copyright (c) 2013-2022 Niels Lohmann diff --git a/doc/src/reference.adoc b/doc/src/reference.adoc index 1f68625e57..b97bc3809f 100644 --- a/doc/src/reference.adoc +++ b/doc/src/reference.adoc @@ -775,6 +775,7 @@ include::../../src/engine/mod_regex.h[tag=reference] include::../../src/engine/mod_set.h[tag=reference] include::../../src/engine/mod_string.h[tag=reference] include::../../src/engine/mod_version.h[tag=reference] +include::../../src/engine/mod_db.h[tag=reference] include::path.adoc[] diff --git a/doc/src/standalone.adoc b/doc/src/standalone.adoc index 226972af92..df07f53afe 100644 --- a/doc/src/standalone.adoc +++ b/doc/src/standalone.adoc @@ -66,4 +66,6 @@ include::code_ref.adoc[] include::history.adoc[] +include::appendix.adoc[] + :leveloffset: -1 diff --git a/src/engine/bindjam.cpp b/src/engine/bindjam.cpp index 2a7eee98f1..7f8d273ac8 100644 --- a/src/engine/bindjam.cpp +++ b/src/engine/bindjam.cpp @@ -21,6 +21,7 @@ Distributed under the Boost Software License, Version 1.0. #include "value.h" #include "variable.h" +#include "mod_db.h" #include "mod_jam_builtin.h" #include "mod_jam_class.h" #include "mod_jam_errors.h" @@ -821,7 +822,8 @@ void bind_jam(FRAME * f) .bind(set_module()) .bind(string_module()) .bind(sysinfo_module()) - .bind(version_module()); + .bind(version_module()) + .bind(db_module()); } }} // namespace b2::jam diff --git a/src/engine/build.bat b/src/engine/build.bat index 22453847d5..3a88110546 100644 --- a/src/engine/build.bat +++ b/src/engine/build.bat @@ -177,6 +177,7 @@ set B2_SOURCES=%B2_SOURCES% native.cpp option.cpp output.cpp parse.cpp pathnt.cp set B2_SOURCES=%B2_SOURCES% pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp jam_strings.cpp set B2_SOURCES=%B2_SOURCES% startup.cpp tasks.cpp set B2_SOURCES=%B2_SOURCES% timestamp.cpp value.cpp variable.cpp w32_getreg.cpp +set B2_SOURCES=%B2_SOURCES% mod_db.cpp set B2_SOURCES=%B2_SOURCES% mod_jam_builtin.cpp set B2_SOURCES=%B2_SOURCES% mod_jam_class.cpp set B2_SOURCES=%B2_SOURCES% mod_jam_errors.cpp diff --git a/src/engine/build.sh b/src/engine/build.sh index 9a1e0b1a05..f8daf81241 100755 --- a/src/engine/build.sh +++ b/src/engine/build.sh @@ -487,6 +487,7 @@ timestamp.cpp \ value.cpp \ variable.cpp \ w32_getreg.cpp \ +mod_db.cpp \ mod_jam_builtin.cpp \ mod_jam_class.cpp \ mod_jam_errors.cpp \ diff --git a/src/engine/ext_nlohmann_json.hpp b/src/engine/ext_nlohmann_json.hpp new file mode 100644 index 0000000000..8b72ea6539 --- /dev/null +++ b/src/engine/ext_nlohmann_json.hpp @@ -0,0 +1,24765 @@ +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + +/****************************************************************************\ + * Note on documentation: The source files contain links to the online * + * documentation of the public API at https://json.nlohmann.me. This URL * + * contains the most recent documentation and should also be applicable to * + * previous versions; documentation for deprecated functions is not * + * removed, but marked deprecated. See "Generate documentation" section in * + * file docs/README.md. * +\****************************************************************************/ + +#ifndef INCLUDE_NLOHMANN_JSON_HPP_ +#define INCLUDE_NLOHMANN_JSON_HPP_ + +#include // all_of, find, for_each +#include // nullptr_t, ptrdiff_t, size_t +#include // hash, less +#include // initializer_list +#ifndef JSON_NO_IO + #include // istream, ostream +#endif // JSON_NO_IO +#include // random_access_iterator_tag +#include // unique_ptr +#include // string, stoi, to_string +#include // declval, forward, move, pair, swap +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// This file contains all macro definitions affecting or depending on the ABI + +#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK + #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) + #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3 + #warning "Already included a different version of the library!" + #endif + #endif +#endif + +#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_PATCH 3 // NOLINT(modernize-macro-to-enum) + +#ifndef JSON_DIAGNOSTICS + #define JSON_DIAGNOSTICS 0 +#endif + +#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 +#endif + +#if JSON_DIAGNOSTICS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag +#else + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS +#endif + +#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp +#else + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION + #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 +#endif + +// Construct the namespace ABI tags component +#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b +#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ + NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) + +#define NLOHMANN_JSON_ABI_TAGS \ + NLOHMANN_JSON_ABI_TAGS_CONCAT( \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ + NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) + +// Construct the namespace version component +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ + _v ## major ## _ ## minor ## _ ## patch +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) + +#if NLOHMANN_JSON_NAMESPACE_NO_VERSION +#define NLOHMANN_JSON_NAMESPACE_VERSION +#else +#define NLOHMANN_JSON_NAMESPACE_VERSION \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ + NLOHMANN_JSON_VERSION_MINOR, \ + NLOHMANN_JSON_VERSION_PATCH) +#endif + +// Combine namespace components +#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b +#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ + NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) + +#ifndef NLOHMANN_JSON_NAMESPACE +#define NLOHMANN_JSON_NAMESPACE \ + nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN +#define NLOHMANN_JSON_NAMESPACE_BEGIN \ + namespace nlohmann \ + { \ + inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) \ + { +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_END +#define NLOHMANN_JSON_NAMESPACE_END \ + } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ + } // namespace nlohmann +#endif + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // transform +#include // array +#include // forward_list +#include // inserter, front_inserter, end +#include // map +#include // string +#include // tuple, make_tuple +#include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible +#include // unordered_map +#include // pair, declval +#include // valarray + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // nullptr_t +#include // exception +#if JSON_DIAGNOSTICS + #include // accumulate +#endif +#include // runtime_error +#include // to_string +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // uint8_t +#include // string + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // declval, pair +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template struct make_void +{ + using type = void; +}; +template using void_t = typename make_void::type; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +// https://en.cppreference.com/w/cpp/experimental/is_detected +struct nonesuch +{ + nonesuch() = delete; + ~nonesuch() = delete; + nonesuch(nonesuch const&) = delete; + nonesuch(nonesuch const&&) = delete; + void operator=(nonesuch const&) = delete; + void operator=(nonesuch&&) = delete; +}; + +template class Op, + class... Args> +struct detector +{ + using value_t = std::false_type; + using type = Default; +}; + +template class Op, class... Args> +struct detector>, Op, Args...> +{ + using value_t = std::true_type; + using type = Op; +}; + +template class Op, class... Args> +using is_detected = typename detector::value_t; + +template class Op, class... Args> +struct is_detected_lazy : is_detected { }; + +template class Op, class... Args> +using detected_t = typename detector::type; + +template class Op, class... Args> +using detected_or = detector; + +template class Op, class... Args> +using detected_or_t = typename detected_or::type; + +template class Op, class... Args> +using is_detected_exact = std::is_same>; + +template class Op, class... Args> +using is_detected_convertible = + std::is_convertible, To>; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + + +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-FileCopyrightText: 2016-2021 Evan Nemerson +// SPDX-License-Identifier: MIT + +/* Hedley - https://nemequ.github.io/hedley + * Created by Evan Nemerson + */ + +#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) +#if defined(JSON_HEDLEY_VERSION) + #undef JSON_HEDLEY_VERSION +#endif +#define JSON_HEDLEY_VERSION 15 + +#if defined(JSON_HEDLEY_STRINGIFY_EX) + #undef JSON_HEDLEY_STRINGIFY_EX +#endif +#define JSON_HEDLEY_STRINGIFY_EX(x) #x + +#if defined(JSON_HEDLEY_STRINGIFY) + #undef JSON_HEDLEY_STRINGIFY +#endif +#define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) + +#if defined(JSON_HEDLEY_CONCAT_EX) + #undef JSON_HEDLEY_CONCAT_EX +#endif +#define JSON_HEDLEY_CONCAT_EX(a,b) a##b + +#if defined(JSON_HEDLEY_CONCAT) + #undef JSON_HEDLEY_CONCAT +#endif +#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) + +#if defined(JSON_HEDLEY_CONCAT3_EX) + #undef JSON_HEDLEY_CONCAT3_EX +#endif +#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c + +#if defined(JSON_HEDLEY_CONCAT3) + #undef JSON_HEDLEY_CONCAT3 +#endif +#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) + +#if defined(JSON_HEDLEY_VERSION_ENCODE) + #undef JSON_HEDLEY_VERSION_ENCODE +#endif +#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) + #undef JSON_HEDLEY_VERSION_DECODE_MAJOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) + #undef JSON_HEDLEY_VERSION_DECODE_MINOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) + #undef JSON_HEDLEY_VERSION_DECODE_REVISION +#endif +#define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) + +#if defined(JSON_HEDLEY_GNUC_VERSION) + #undef JSON_HEDLEY_GNUC_VERSION +#endif +#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) +#elif defined(__GNUC__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) +#endif + +#if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) + #undef JSON_HEDLEY_GNUC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GNUC_VERSION) + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION) + #undef JSON_HEDLEY_MSVC_VERSION +#endif +#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) +#elif defined(_MSC_FULL_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) +#elif defined(_MSC_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) + #undef JSON_HEDLEY_MSVC_VERSION_CHECK +#endif +#if !defined(JSON_HEDLEY_MSVC_VERSION) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) +#elif defined(_MSC_VER) && (_MSC_VER >= 1400) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) +#elif defined(_MSC_VER) && (_MSC_VER >= 1200) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) +#else + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION) + #undef JSON_HEDLEY_INTEL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) +#elif defined(__INTEL_COMPILER) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_VERSION) + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #undef JSON_HEDLEY_INTEL_CL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) + #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION) + #undef JSON_HEDLEY_PGI_VERSION +#endif +#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) + #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION_CHECK) + #undef JSON_HEDLEY_PGI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PGI_VERSION) + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #undef JSON_HEDLEY_SUNPRO_VERSION +#endif +#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) +#elif defined(__SUNPRO_C) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) +#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) +#elif defined(__SUNPRO_CC) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) + #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION +#endif +#if defined(__EMSCRIPTEN__) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION) + #undef JSON_HEDLEY_ARM_VERSION +#endif +#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) +#elif defined(__CC_ARM) && defined(__ARMCC_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION_CHECK) + #undef JSON_HEDLEY_ARM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_ARM_VERSION) + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION) + #undef JSON_HEDLEY_IBM_VERSION +#endif +#if defined(__ibmxl__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) +#elif defined(__xlC__) && defined(__xlC_ver__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) +#elif defined(__xlC__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION_CHECK) + #undef JSON_HEDLEY_IBM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IBM_VERSION) + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_VERSION) + #undef JSON_HEDLEY_TI_VERSION +#endif +#if \ + defined(__TI_COMPILER_VERSION__) && \ + ( \ + defined(__TMS470__) || defined(__TI_ARM__) || \ + defined(__MSP430__) || \ + defined(__TMS320C2000__) \ + ) +#if (__TI_COMPILER_VERSION__ >= 16000000) + #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif +#endif + +#if defined(JSON_HEDLEY_TI_VERSION_CHECK) + #undef JSON_HEDLEY_TI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_VERSION) + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #undef JSON_HEDLEY_TI_CL2000_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) + #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #undef JSON_HEDLEY_TI_CL430_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) + #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #undef JSON_HEDLEY_TI_ARMCL_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) + #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) + #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #undef JSON_HEDLEY_TI_CL6X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) + #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #undef JSON_HEDLEY_TI_CL7X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) + #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #undef JSON_HEDLEY_TI_CLPRU_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) + #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION) + #undef JSON_HEDLEY_CRAY_VERSION +#endif +#if defined(_CRAYC) + #if defined(_RELEASE_PATCHLEVEL) + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) + #else + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) + #undef JSON_HEDLEY_CRAY_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_CRAY_VERSION) + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION) + #undef JSON_HEDLEY_IAR_VERSION +#endif +#if defined(__IAR_SYSTEMS_ICC__) + #if __VER__ > 1000 + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) + #else + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION_CHECK) + #undef JSON_HEDLEY_IAR_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IAR_VERSION) + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION) + #undef JSON_HEDLEY_TINYC_VERSION +#endif +#if defined(__TINYC__) + #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) + #undef JSON_HEDLEY_TINYC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION) + #undef JSON_HEDLEY_DMC_VERSION +#endif +#if defined(__DMC__) + #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION_CHECK) + #undef JSON_HEDLEY_DMC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_DMC_VERSION) + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #undef JSON_HEDLEY_COMPCERT_VERSION +#endif +#if defined(__COMPCERT_VERSION__) + #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) + #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION) + #undef JSON_HEDLEY_PELLES_VERSION +#endif +#if defined(__POCC__) + #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) + #undef JSON_HEDLEY_PELLES_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PELLES_VERSION) + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #undef JSON_HEDLEY_MCST_LCC_VERSION +#endif +#if defined(__LCC__) && defined(__LCC_MINOR__) + #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) + #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION) + #undef JSON_HEDLEY_GCC_VERSION +#endif +#if \ + defined(JSON_HEDLEY_GNUC_VERSION) && \ + !defined(__clang__) && \ + !defined(JSON_HEDLEY_INTEL_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_ARM_VERSION) && \ + !defined(JSON_HEDLEY_CRAY_VERSION) && \ + !defined(JSON_HEDLEY_TI_VERSION) && \ + !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ + !defined(__COMPCERT__) && \ + !defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_ATTRIBUTE +#endif +#if \ + defined(__has_attribute) && \ + ( \ + (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ + ) +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) +#else +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE +#endif +#if \ + defined(__has_cpp_attribute) && \ + defined(__cplusplus) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS +#endif +#if !defined(__cplusplus) || !defined(__has_cpp_attribute) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#elif \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ + (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_BUILTIN) + #undef JSON_HEDLEY_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) +#else + #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) + #undef JSON_HEDLEY_GNUC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) + #undef JSON_HEDLEY_GCC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_FEATURE) + #undef JSON_HEDLEY_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) +#else + #define JSON_HEDLEY_HAS_FEATURE(feature) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) + #undef JSON_HEDLEY_GNUC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_FEATURE) + #undef JSON_HEDLEY_GCC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_EXTENSION) + #undef JSON_HEDLEY_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) +#else + #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) + #undef JSON_HEDLEY_GNUC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) + #undef JSON_HEDLEY_GCC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_WARNING) + #undef JSON_HEDLEY_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) +#else + #define JSON_HEDLEY_HAS_WARNING(warning) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_WARNING) + #undef JSON_HEDLEY_GNUC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_WARNING) + #undef JSON_HEDLEY_GCC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + defined(__clang__) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ + (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) + #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_PRAGMA(value) __pragma(value) +#else + #define JSON_HEDLEY_PRAGMA(value) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) + #undef JSON_HEDLEY_DIAGNOSTIC_PUSH +#endif +#if defined(JSON_HEDLEY_DIAGNOSTIC_POP) + #undef JSON_HEDLEY_DIAGNOSTIC_POP +#endif +#if defined(__clang__) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) + #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) +#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_PUSH + #define JSON_HEDLEY_DIAGNOSTIC_POP +#endif + +/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") +# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") +# if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# endif +#endif +#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x +#endif + +#if defined(JSON_HEDLEY_CONST_CAST) + #undef JSON_HEDLEY_CONST_CAST +#endif +#if defined(__cplusplus) +# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) +#elif \ + JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_REINTERPRET_CAST) + #undef JSON_HEDLEY_REINTERPRET_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) +#else + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_STATIC_CAST) + #undef JSON_HEDLEY_STATIC_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) +#else + #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_CPP_CAST) + #undef JSON_HEDLEY_CPP_CAST +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ + ((T) (expr)) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("diag_suppress=Pe137") \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) +# endif +#else +# define JSON_HEDLEY_CPP_CAST(T, expr) (expr) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunused-function") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif + +#if defined(JSON_HEDLEY_DEPRECATED) + #undef JSON_HEDLEY_DEPRECATED +#endif +#if defined(JSON_HEDLEY_DEPRECATED_FOR) + #undef JSON_HEDLEY_DEPRECATED_FOR +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) +#elif \ + (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) +#elif defined(__cplusplus) && (__cplusplus >= 201402L) + #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") +#else + #define JSON_HEDLEY_DEPRECATED(since) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) +#endif + +#if defined(JSON_HEDLEY_UNAVAILABLE) + #undef JSON_HEDLEY_UNAVAILABLE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) +#else + #define JSON_HEDLEY_UNAVAILABLE(available_since) +#endif + +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT +#endif +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) +#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) +#elif defined(_Check_return_) /* SAL */ + #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ +#else + #define JSON_HEDLEY_WARN_UNUSED_RESULT + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) +#endif + +#if defined(JSON_HEDLEY_SENTINEL) + #undef JSON_HEDLEY_SENTINEL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) +#else + #define JSON_HEDLEY_SENTINEL(position) +#endif + +#if defined(JSON_HEDLEY_NO_RETURN) + #undef JSON_HEDLEY_NO_RETURN +#endif +#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NO_RETURN __noreturn +#elif \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + #define JSON_HEDLEY_NO_RETURN _Noreturn +#elif defined(__cplusplus) && (__cplusplus >= 201103L) + #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#else + #define JSON_HEDLEY_NO_RETURN +#endif + +#if defined(JSON_HEDLEY_NO_ESCAPE) + #undef JSON_HEDLEY_NO_ESCAPE +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) + #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) +#else + #define JSON_HEDLEY_NO_ESCAPE +#endif + +#if defined(JSON_HEDLEY_UNREACHABLE) + #undef JSON_HEDLEY_UNREACHABLE +#endif +#if defined(JSON_HEDLEY_UNREACHABLE_RETURN) + #undef JSON_HEDLEY_UNREACHABLE_RETURN +#endif +#if defined(JSON_HEDLEY_ASSUME) + #undef JSON_HEDLEY_ASSUME +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_ASSUME(expr) __assume(expr) +#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) + #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) +#elif \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #if defined(__cplusplus) + #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) + #else + #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) + #endif +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() +#elif defined(JSON_HEDLEY_ASSUME) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif +#if !defined(JSON_HEDLEY_ASSUME) + #if defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) + #else + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) + #endif +#endif +#if defined(JSON_HEDLEY_UNREACHABLE) + #if \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) + #else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() + #endif +#else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) +#endif +#if !defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif + +JSON_HEDLEY_DIAGNOSTIC_PUSH +#if JSON_HEDLEY_HAS_WARNING("-Wpedantic") + #pragma clang diagnostic ignored "-Wpedantic" +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) + #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +#endif +#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) + #if defined(__clang__) + #pragma clang diagnostic ignored "-Wvariadic-macros" + #elif defined(JSON_HEDLEY_GCC_VERSION) + #pragma GCC diagnostic ignored "-Wvariadic-macros" + #endif +#endif +#if defined(JSON_HEDLEY_NON_NULL) + #undef JSON_HEDLEY_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) +#else + #define JSON_HEDLEY_NON_NULL(...) +#endif +JSON_HEDLEY_DIAGNOSTIC_POP + +#if defined(JSON_HEDLEY_PRINTF_FORMAT) + #undef JSON_HEDLEY_PRINTF_FORMAT +#endif +#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) +#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) +#else + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) +#endif + +#if defined(JSON_HEDLEY_CONSTEXPR) + #undef JSON_HEDLEY_CONSTEXPR +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) + #endif +#endif +#if !defined(JSON_HEDLEY_CONSTEXPR) + #define JSON_HEDLEY_CONSTEXPR +#endif + +#if defined(JSON_HEDLEY_PREDICT) + #undef JSON_HEDLEY_PREDICT +#endif +#if defined(JSON_HEDLEY_LIKELY) + #undef JSON_HEDLEY_LIKELY +#endif +#if defined(JSON_HEDLEY_UNLIKELY) + #undef JSON_HEDLEY_UNLIKELY +#endif +#if defined(JSON_HEDLEY_UNPREDICTABLE) + #undef JSON_HEDLEY_UNPREDICTABLE +#endif +#if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) + #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) +#elif \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, expected, probability) \ + (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ + })) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ + })) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) +#else +# define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_LIKELY(expr) (!!(expr)) +# define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) +#endif +#if !defined(JSON_HEDLEY_UNPREDICTABLE) + #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) +#endif + +#if defined(JSON_HEDLEY_MALLOC) + #undef JSON_HEDLEY_MALLOC +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_MALLOC __declspec(restrict) +#else + #define JSON_HEDLEY_MALLOC +#endif + +#if defined(JSON_HEDLEY_PURE) + #undef JSON_HEDLEY_PURE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PURE __attribute__((__pure__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +# define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ + ) +# define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") +#else +# define JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_CONST) + #undef JSON_HEDLEY_CONST +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_CONST __attribute__((__const__)) +#elif \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_CONST _Pragma("no_side_effect") +#else + #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_RESTRICT) + #undef JSON_HEDLEY_RESTRICT +#endif +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT restrict +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + defined(__clang__) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RESTRICT __restrict +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT _Restrict +#else + #define JSON_HEDLEY_RESTRICT +#endif + +#if defined(JSON_HEDLEY_INLINE) + #undef JSON_HEDLEY_INLINE +#endif +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + (defined(__cplusplus) && (__cplusplus >= 199711L)) + #define JSON_HEDLEY_INLINE inline +#elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) + #define JSON_HEDLEY_INLINE __inline__ +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_INLINE __inline +#else + #define JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_ALWAYS_INLINE) + #undef JSON_HEDLEY_ALWAYS_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_ALWAYS_INLINE __forceinline +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ + ) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") +#else +# define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_NEVER_INLINE) + #undef JSON_HEDLEY_NEVER_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#else + #define JSON_HEDLEY_NEVER_INLINE +#endif + +#if defined(JSON_HEDLEY_PRIVATE) + #undef JSON_HEDLEY_PRIVATE +#endif +#if defined(JSON_HEDLEY_PUBLIC) + #undef JSON_HEDLEY_PUBLIC +#endif +#if defined(JSON_HEDLEY_IMPORT) + #undef JSON_HEDLEY_IMPORT +#endif +#if defined(_WIN32) || defined(__CYGWIN__) +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC __declspec(dllexport) +# define JSON_HEDLEY_IMPORT __declspec(dllimport) +#else +# if \ + JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + ( \ + defined(__TI_EABI__) && \ + ( \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ + ) \ + ) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) +# define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) +# else +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC +# endif +# define JSON_HEDLEY_IMPORT extern +#endif + +#if defined(JSON_HEDLEY_NO_THROW) + #undef JSON_HEDLEY_NO_THROW +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NO_THROW __declspec(nothrow) +#else + #define JSON_HEDLEY_NO_THROW +#endif + +#if defined(JSON_HEDLEY_FALL_THROUGH) + #undef JSON_HEDLEY_FALL_THROUGH +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) +#elif defined(__fallthrough) /* SAL */ + #define JSON_HEDLEY_FALL_THROUGH __fallthrough +#else + #define JSON_HEDLEY_FALL_THROUGH +#endif + +#if defined(JSON_HEDLEY_RETURNS_NON_NULL) + #undef JSON_HEDLEY_RETURNS_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) +#elif defined(_Ret_notnull_) /* SAL */ + #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ +#else + #define JSON_HEDLEY_RETURNS_NON_NULL +#endif + +#if defined(JSON_HEDLEY_ARRAY_PARAM) + #undef JSON_HEDLEY_ARRAY_PARAM +#endif +#if \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__STDC_NO_VLA__) && \ + !defined(__cplusplus) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_ARRAY_PARAM(name) (name) +#else + #define JSON_HEDLEY_ARRAY_PARAM(name) +#endif + +#if defined(JSON_HEDLEY_IS_CONSTANT) + #undef JSON_HEDLEY_IS_CONSTANT +#endif +#if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) + #undef JSON_HEDLEY_REQUIRE_CONSTEXPR +#endif +/* JSON_HEDLEY_IS_CONSTEXPR_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #undef JSON_HEDLEY_IS_CONSTEXPR_ +#endif +#if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) +#endif +#if !defined(__cplusplus) +# if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) +#endif +# elif \ + ( \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION)) || \ + (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) +#endif +# elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + defined(JSON_HEDLEY_INTEL_VERSION) || \ + defined(JSON_HEDLEY_TINYC_VERSION) || \ + defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ + defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ + defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ + defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ + defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ + defined(__clang__) +# define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ + sizeof(void) != \ + sizeof(*( \ + 1 ? \ + ((void*) ((expr) * 0L) ) : \ +((struct { char v[sizeof(void) * 2]; } *) 1) \ + ) \ + ) \ + ) +# endif +#endif +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) +#else + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) (0) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) +#endif + +#if defined(JSON_HEDLEY_BEGIN_C_DECLS) + #undef JSON_HEDLEY_BEGIN_C_DECLS +#endif +#if defined(JSON_HEDLEY_END_C_DECLS) + #undef JSON_HEDLEY_END_C_DECLS +#endif +#if defined(JSON_HEDLEY_C_DECL) + #undef JSON_HEDLEY_C_DECL +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { + #define JSON_HEDLEY_END_C_DECLS } + #define JSON_HEDLEY_C_DECL extern "C" +#else + #define JSON_HEDLEY_BEGIN_C_DECLS + #define JSON_HEDLEY_END_C_DECLS + #define JSON_HEDLEY_C_DECL +#endif + +#if defined(JSON_HEDLEY_STATIC_ASSERT) + #undef JSON_HEDLEY_STATIC_ASSERT +#endif +#if \ + !defined(__cplusplus) && ( \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ + (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + defined(_Static_assert) \ + ) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) +#elif \ + (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) +#else +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) +#endif + +#if defined(JSON_HEDLEY_NULL) + #undef JSON_HEDLEY_NULL +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) + #elif defined(NULL) + #define JSON_HEDLEY_NULL NULL + #else + #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) + #endif +#elif defined(NULL) + #define JSON_HEDLEY_NULL NULL +#else + #define JSON_HEDLEY_NULL ((void*) 0) +#endif + +#if defined(JSON_HEDLEY_MESSAGE) + #undef JSON_HEDLEY_MESSAGE +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_MESSAGE(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(message msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) +#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_WARNING) + #undef JSON_HEDLEY_WARNING +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_WARNING(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(clang warning msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_REQUIRE) + #undef JSON_HEDLEY_REQUIRE +#endif +#if defined(JSON_HEDLEY_REQUIRE_MSG) + #undef JSON_HEDLEY_REQUIRE_MSG +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) +# if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") +# define JSON_HEDLEY_REQUIRE(expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), #expr, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), msg, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) +# endif +#else +# define JSON_HEDLEY_REQUIRE(expr) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) +#endif + +#if defined(JSON_HEDLEY_FLAGS) + #undef JSON_HEDLEY_FLAGS +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) + #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) +#else + #define JSON_HEDLEY_FLAGS +#endif + +#if defined(JSON_HEDLEY_FLAGS_CAST) + #undef JSON_HEDLEY_FLAGS_CAST +#endif +#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) +# define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("warning(disable:188)") \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) +#endif + +#if defined(JSON_HEDLEY_EMPTY_BASES) + #undef JSON_HEDLEY_EMPTY_BASES +#endif +#if \ + (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) +#else + #define JSON_HEDLEY_EMPTY_BASES +#endif + +/* Remaining macros are deprecated. */ + +#if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK +#endif +#if defined(__clang__) + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) +#else + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) + #undef JSON_HEDLEY_CLANG_HAS_BUILTIN +#endif +#define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) + +#if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) + #undef JSON_HEDLEY_CLANG_HAS_FEATURE +#endif +#define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) + +#if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) + #undef JSON_HEDLEY_CLANG_HAS_EXTENSION +#endif +#define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) + +#if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_WARNING) + #undef JSON_HEDLEY_CLANG_HAS_WARNING +#endif +#define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) + +#endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ + + +// This file contains all internal macro definitions (except those affecting ABI) +// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them + +// #include + + +// exclude unsupported compilers +#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) + #if defined(__clang__) + #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) + #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #endif +#endif + +// C++ language standard detection +// if the user manually specified the used c++ version this is skipped +#if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) + #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 + #endif + // the cpp 11 flag is always specified because it is the minimal required version + #define JSON_HAS_CPP_11 +#endif + +#ifdef __has_include + #if __has_include() + #include + #endif +#endif + +#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) + #ifdef JSON_HAS_CPP_17 + #if defined(__cpp_lib_filesystem) + #define JSON_HAS_FILESYSTEM 1 + #elif defined(__cpp_lib_experimental_filesystem) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif !defined(__has_include) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #endif + + // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ + #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__clang_major__) && __clang_major__ < 7 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support + #if defined(_MSC_VER) && _MSC_VER < 1914 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before iOS 13 + #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before macOS Catalina + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + #endif +#endif + +#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_FILESYSTEM + #define JSON_HAS_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_THREE_WAY_COMPARISON + #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ + && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L + #define JSON_HAS_THREE_WAY_COMPARISON 1 + #else + #define JSON_HAS_THREE_WAY_COMPARISON 0 + #endif +#endif + +#ifndef JSON_HAS_RANGES + // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error + #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 + #define JSON_HAS_RANGES 0 + #elif defined(__cpp_lib_ranges) + #define JSON_HAS_RANGES 1 + #else + #define JSON_HAS_RANGES 0 + #endif +#endif + +#ifndef JSON_HAS_STATIC_RTTI + #if !defined(_HAS_STATIC_RTTI) || _HAS_STATIC_RTTI != 0 + #define JSON_HAS_STATIC_RTTI 1 + #else + #define JSON_HAS_STATIC_RTTI 0 + #endif +#endif + +#ifdef JSON_HAS_CPP_17 + #define JSON_INLINE_VARIABLE inline +#else + #define JSON_INLINE_VARIABLE +#endif + +#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) + #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else + #define JSON_NO_UNIQUE_ADDRESS +#endif + +// disable documentation warnings on clang +#if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdocumentation" + #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +#endif + +// allow disabling exceptions +#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) + #define JSON_THROW(exception) throw exception + #define JSON_TRY try + #define JSON_CATCH(exception) catch(exception) + #define JSON_INTERNAL_CATCH(exception) catch(exception) +#else + #include + #define JSON_THROW(exception) std::abort() + #define JSON_TRY if(true) + #define JSON_CATCH(exception) if(false) + #define JSON_INTERNAL_CATCH(exception) if(false) +#endif + +// override exception macros +#if defined(JSON_THROW_USER) + #undef JSON_THROW + #define JSON_THROW JSON_THROW_USER +#endif +#if defined(JSON_TRY_USER) + #undef JSON_TRY + #define JSON_TRY JSON_TRY_USER +#endif +#if defined(JSON_CATCH_USER) + #undef JSON_CATCH + #define JSON_CATCH JSON_CATCH_USER + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_CATCH_USER +#endif +#if defined(JSON_INTERNAL_CATCH_USER) + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER +#endif + +// allow overriding assert +#if !defined(JSON_ASSERT) + #include // assert + #define JSON_ASSERT(x) assert(x) +#endif + +// allow to access some private functions (needed by the test suite) +#if defined(JSON_TESTS_PRIVATE) + #define JSON_PRIVATE_UNLESS_TESTED public +#else + #define JSON_PRIVATE_UNLESS_TESTED private +#endif + +/*! +@brief macro to briefly define a mapping between an enum and JSON +@def NLOHMANN_JSON_SERIALIZE_ENUM +@since version 3.4.0 +*/ +#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ + template \ + inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ + { \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [e](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.first == e; \ + }); \ + j = ((it != std::end(m)) ? it : std::begin(m))->second; \ + } \ + template \ + inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ + { \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [&j](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.second == j; \ + }); \ + e = ((it != std::end(m)) ? it : std::begin(m))->first; \ + } + +// Ugly macros to avoid uglier copy-paste when specializing basic_json. They +// may be removed in the future once the class is split. + +#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ + template class ObjectType, \ + template class ArrayType, \ + class StringType, class BooleanType, class NumberIntegerType, \ + class NumberUnsignedType, class NumberFloatType, \ + template class AllocatorType, \ + template class JSONSerializer, \ + class BinaryType, \ + class CustomBaseClass> + +#define NLOHMANN_BASIC_JSON_TPL \ + basic_json + +// Macros to simplify conversion from/to types + +#define NLOHMANN_JSON_EXPAND( x ) x +#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME +#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ + NLOHMANN_JSON_PASTE64, \ + NLOHMANN_JSON_PASTE63, \ + NLOHMANN_JSON_PASTE62, \ + NLOHMANN_JSON_PASTE61, \ + NLOHMANN_JSON_PASTE60, \ + NLOHMANN_JSON_PASTE59, \ + NLOHMANN_JSON_PASTE58, \ + NLOHMANN_JSON_PASTE57, \ + NLOHMANN_JSON_PASTE56, \ + NLOHMANN_JSON_PASTE55, \ + NLOHMANN_JSON_PASTE54, \ + NLOHMANN_JSON_PASTE53, \ + NLOHMANN_JSON_PASTE52, \ + NLOHMANN_JSON_PASTE51, \ + NLOHMANN_JSON_PASTE50, \ + NLOHMANN_JSON_PASTE49, \ + NLOHMANN_JSON_PASTE48, \ + NLOHMANN_JSON_PASTE47, \ + NLOHMANN_JSON_PASTE46, \ + NLOHMANN_JSON_PASTE45, \ + NLOHMANN_JSON_PASTE44, \ + NLOHMANN_JSON_PASTE43, \ + NLOHMANN_JSON_PASTE42, \ + NLOHMANN_JSON_PASTE41, \ + NLOHMANN_JSON_PASTE40, \ + NLOHMANN_JSON_PASTE39, \ + NLOHMANN_JSON_PASTE38, \ + NLOHMANN_JSON_PASTE37, \ + NLOHMANN_JSON_PASTE36, \ + NLOHMANN_JSON_PASTE35, \ + NLOHMANN_JSON_PASTE34, \ + NLOHMANN_JSON_PASTE33, \ + NLOHMANN_JSON_PASTE32, \ + NLOHMANN_JSON_PASTE31, \ + NLOHMANN_JSON_PASTE30, \ + NLOHMANN_JSON_PASTE29, \ + NLOHMANN_JSON_PASTE28, \ + NLOHMANN_JSON_PASTE27, \ + NLOHMANN_JSON_PASTE26, \ + NLOHMANN_JSON_PASTE25, \ + NLOHMANN_JSON_PASTE24, \ + NLOHMANN_JSON_PASTE23, \ + NLOHMANN_JSON_PASTE22, \ + NLOHMANN_JSON_PASTE21, \ + NLOHMANN_JSON_PASTE20, \ + NLOHMANN_JSON_PASTE19, \ + NLOHMANN_JSON_PASTE18, \ + NLOHMANN_JSON_PASTE17, \ + NLOHMANN_JSON_PASTE16, \ + NLOHMANN_JSON_PASTE15, \ + NLOHMANN_JSON_PASTE14, \ + NLOHMANN_JSON_PASTE13, \ + NLOHMANN_JSON_PASTE12, \ + NLOHMANN_JSON_PASTE11, \ + NLOHMANN_JSON_PASTE10, \ + NLOHMANN_JSON_PASTE9, \ + NLOHMANN_JSON_PASTE8, \ + NLOHMANN_JSON_PASTE7, \ + NLOHMANN_JSON_PASTE6, \ + NLOHMANN_JSON_PASTE5, \ + NLOHMANN_JSON_PASTE4, \ + NLOHMANN_JSON_PASTE3, \ + NLOHMANN_JSON_PASTE2, \ + NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) +#define NLOHMANN_JSON_PASTE2(func, v1) func(v1) +#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) +#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) +#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) +#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) +#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) +#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) +#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) +#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) +#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) +#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) +#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) +#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) +#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) +#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) +#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) +#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) +#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) +#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) +#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) +#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) +#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) +#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) +#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) +#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) +#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) +#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) +#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) +#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) +#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) +#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) +#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) +#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) +#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) +#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) +#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) +#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) +#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) +#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) +#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) +#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) +#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) +#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) +#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) +#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) +#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) +#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) +#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) +#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) +#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) +#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) +#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) +#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) +#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) +#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) +#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) +#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) +#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) +#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) +#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) +#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) +#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) +#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) + +#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; +#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); +#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1); + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +// inspired from https://stackoverflow.com/a/26745591 +// allows to call any std function as if (e.g. with begin): +// using std::begin; begin(x); +// +// it allows using the detected idiom to retrieve the return type +// of such an expression +#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ + namespace detail { \ + using std::std_name; \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + } \ + \ + namespace detail2 { \ + struct std_name##_tag \ + { \ + }; \ + \ + template \ + std_name##_tag std_name(T&&...); \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + \ + template \ + struct would_call_std_##std_name \ + { \ + static constexpr auto const value = ::nlohmann::detail:: \ + is_detected_exact::value; \ + }; \ + } /* namespace detail2 */ \ + \ + template \ + struct would_call_std_##std_name : detail2::would_call_std_##std_name \ + { \ + } + +#ifndef JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_USE_IMPLICIT_CONVERSIONS 1 +#endif + +#if JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_EXPLICIT +#else + #define JSON_EXPLICIT explicit +#endif + +#ifndef JSON_DISABLE_ENUM_SERIALIZATION + #define JSON_DISABLE_ENUM_SERIALIZATION 0 +#endif + +#ifndef JSON_USE_GLOBAL_UDLS + #define JSON_USE_GLOBAL_UDLS 1 +#endif + +#if JSON_HAS_THREE_WAY_COMPARISON + #include // partial_ordering +#endif + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/////////////////////////// +// JSON type enumeration // +/////////////////////////// + +/*! +@brief the JSON type enumeration + +This enumeration collects the different JSON types. It is internally used to +distinguish the stored values, and the functions @ref basic_json::is_null(), +@ref basic_json::is_object(), @ref basic_json::is_array(), +@ref basic_json::is_string(), @ref basic_json::is_boolean(), +@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), +@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), +@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and +@ref basic_json::is_structured() rely on it. + +@note There are three enumeration entries (number_integer, number_unsigned, and +number_float), because the library distinguishes these three types for numbers: +@ref basic_json::number_unsigned_t is used for unsigned integers, +@ref basic_json::number_integer_t is used for signed integers, and +@ref basic_json::number_float_t is used for floating-point numbers or to +approximate integers which do not fit in the limits of their respective type. + +@sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON +value with the default value for a given type + +@since version 1.0.0 +*/ +enum class value_t : std::uint8_t +{ + null, ///< null value + object, ///< object (unordered set of name/value pairs) + array, ///< array (ordered collection of values) + string, ///< string value + boolean, ///< boolean value + number_integer, ///< number value (signed integer) + number_unsigned, ///< number value (unsigned integer) + number_float, ///< number value (floating-point) + binary, ///< binary array (ordered collection of bytes) + discarded ///< discarded by the parser callback function +}; + +/*! +@brief comparison operator for JSON types + +Returns an ordering that is similar to Python: +- order: null < boolean < number < object < array < string < binary +- furthermore, each type is not smaller than itself +- discarded values are not comparable +- binary is represented as a b"" string in python and directly comparable to a + string; however, making a binary array directly comparable with a string would + be surprising behavior in a JSON file. + +@since version 1.0.0 +*/ +#if JSON_HAS_THREE_WAY_COMPARISON + inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* +#else + inline bool operator<(const value_t lhs, const value_t rhs) noexcept +#endif +{ + static constexpr std::array order = {{ + 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, + 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, + 6 /* binary */ + } + }; + + const auto l_index = static_cast(lhs); + const auto r_index = static_cast(rhs); +#if JSON_HAS_THREE_WAY_COMPARISON + if (l_index < order.size() && r_index < order.size()) + { + return order[l_index] <=> order[r_index]; // *NOPAD* + } + return std::partial_ordering::unordered; +#else + return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; +#endif +} + +// GCC selects the built-in operator< over an operator rewritten from +// a user-defined spaceship operator +// Clang, MSVC, and ICC select the rewritten candidate +// (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) +#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) +inline bool operator<(const value_t lhs, const value_t rhs) noexcept +{ + return std::is_lt(lhs <=> rhs); // *NOPAD* +} +#endif + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/*! +@brief replace all occurrences of a substring by another string + +@param[in,out] s the string to manipulate; changed so that all + occurrences of @a f are replaced with @a t +@param[in] f the substring to replace with @a t +@param[in] t the string to replace @a f + +@pre The search string @a f must not be empty. **This precondition is +enforced with an assertion.** + +@since version 2.0.0 +*/ +template +inline void replace_substring(StringType& s, const StringType& f, + const StringType& t) +{ + JSON_ASSERT(!f.empty()); + for (auto pos = s.find(f); // find first occurrence of f + pos != StringType::npos; // make sure f was found + s.replace(pos, f.size(), t), // replace with t, and + pos = s.find(f, pos + t.size())) // find next occurrence of f + {} +} + +/*! + * @brief string escaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to escape + * @return escaped string + * + * Note the order of escaping "~" to "~0" and "/" to "~1" is important. + */ +template +inline StringType escape(StringType s) +{ + replace_substring(s, StringType{"~"}, StringType{"~0"}); + replace_substring(s, StringType{"/"}, StringType{"~1"}); + return s; +} + +/*! + * @brief string unescaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to unescape + * @return unescaped string + * + * Note the order of escaping "~1" to "/" and "~0" to "~" is important. + */ +template +static void unescape(StringType& s) +{ + replace_substring(s, StringType{"~1"}, StringType{"/"}); + replace_substring(s, StringType{"~0"}, StringType{"~"}); +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // size_t + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/// struct to capture the start position of the current token +struct position_t +{ + /// the total number of characters read + std::size_t chars_read_total = 0; + /// the number of characters read in the current line + std::size_t chars_read_current_line = 0; + /// the number of lines read + std::size_t lines_read = 0; + + /// conversion to size_t to preserve SAX interface + constexpr operator size_t() const + { + return chars_read_total; + } +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-FileCopyrightText: 2018 The Abseil Authors +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type +#include // index_sequence, make_index_sequence, index_sequence_for + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +using uncvref_t = typename std::remove_cv::type>::type; + +#ifdef JSON_HAS_CPP_14 + +// the following utilities are natively available in C++14 +using std::enable_if_t; +using std::index_sequence; +using std::make_index_sequence; +using std::index_sequence_for; + +#else + +// alias templates to reduce boilerplate +template +using enable_if_t = typename std::enable_if::type; + +// The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h +// which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. + +//// START OF CODE FROM GOOGLE ABSEIL + +// integer_sequence +// +// Class template representing a compile-time integer sequence. An instantiation +// of `integer_sequence` has a sequence of integers encoded in its +// type through its template arguments (which is a common need when +// working with C++11 variadic templates). `absl::integer_sequence` is designed +// to be a drop-in replacement for C++14's `std::integer_sequence`. +// +// Example: +// +// template< class T, T... Ints > +// void user_function(integer_sequence); +// +// int main() +// { +// // user_function's `T` will be deduced to `int` and `Ints...` +// // will be deduced to `0, 1, 2, 3, 4`. +// user_function(make_integer_sequence()); +// } +template +struct integer_sequence +{ + using value_type = T; + static constexpr std::size_t size() noexcept + { + return sizeof...(Ints); + } +}; + +// index_sequence +// +// A helper template for an `integer_sequence` of `size_t`, +// `absl::index_sequence` is designed to be a drop-in replacement for C++14's +// `std::index_sequence`. +template +using index_sequence = integer_sequence; + +namespace utility_internal +{ + +template +struct Extend; + +// Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. +template +struct Extend, SeqSize, 0> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; +}; + +template +struct Extend, SeqSize, 1> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; +}; + +// Recursion helper for 'make_integer_sequence'. +// 'Gen::type' is an alias for 'integer_sequence'. +template +struct Gen +{ + using type = + typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; +}; + +template +struct Gen +{ + using type = integer_sequence; +}; + +} // namespace utility_internal + +// Compile-time sequences of integers + +// make_integer_sequence +// +// This template alias is equivalent to +// `integer_sequence`, and is designed to be a drop-in +// replacement for C++14's `std::make_integer_sequence`. +template +using make_integer_sequence = typename utility_internal::Gen::type; + +// make_index_sequence +// +// This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, +// and is designed to be a drop-in replacement for C++14's +// `std::make_index_sequence`. +template +using make_index_sequence = make_integer_sequence; + +// index_sequence_for +// +// Converts a typename pack into an index sequence of the same length, and +// is designed to be a drop-in replacement for C++14's +// `std::index_sequence_for()` +template +using index_sequence_for = make_index_sequence; + +//// END OF CODE FROM GOOGLE ABSEIL + +#endif + +// dispatch utility (taken from ranges-v3) +template struct priority_tag : priority_tag < N - 1 > {}; +template<> struct priority_tag<0> {}; + +// taken from ranges-v3 +template +struct static_const +{ + static JSON_INLINE_VARIABLE constexpr T value{}; +}; + +#ifndef JSON_HAS_CPP_17 + template + constexpr T static_const::value; +#endif + +template +inline constexpr std::array make_array(Args&& ... args) +{ + return std::array {{static_cast(std::forward(args))...}}; +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // numeric_limits +#include // false_type, is_constructible, is_integral, is_same, true_type +#include // declval +#include // tuple +#include // char_traits + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // random_access_iterator_tag + +// #include + +// #include + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +struct iterator_types {}; + +template +struct iterator_types < + It, + void_t> +{ + using difference_type = typename It::difference_type; + using value_type = typename It::value_type; + using pointer = typename It::pointer; + using reference = typename It::reference; + using iterator_category = typename It::iterator_category; +}; + +// This is required as some compilers implement std::iterator_traits in a way that +// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. +template +struct iterator_traits +{ +}; + +template +struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> + : iterator_types +{ +}; + +template +struct iterator_traits::value>> +{ + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = ptrdiff_t; + using pointer = T*; + using reference = T&; +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); + +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); + +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + +#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ + #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + #include // int64_t, uint64_t + #include // map + #include // allocator + #include // string + #include // vector + + // #include + + + /*! + @brief namespace for Niels Lohmann + @see https://github.com/nlohmann + @since version 1.0.0 + */ + NLOHMANN_JSON_NAMESPACE_BEGIN + + /*! + @brief default JSONSerializer template argument + + This serializer ignores the template arguments and uses ADL + ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) + for serialization. + */ + template + struct adl_serializer; + + /// a class to store JSON values + /// @sa https://json.nlohmann.me/api/basic_json/ + template class ObjectType = + std::map, + template class ArrayType = std::vector, + class StringType = std::string, class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator, + template class JSONSerializer = + adl_serializer, + class BinaryType = std::vector, // cppcheck-suppress syntaxError + class CustomBaseClass = void> + class basic_json; + + /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document + /// @sa https://json.nlohmann.me/api/json_pointer/ + template + class json_pointer; + + /*! + @brief default specialization + @sa https://json.nlohmann.me/api/json/ + */ + using json = basic_json<>; + + /// @brief a minimal map-like container that preserves insertion order + /// @sa https://json.nlohmann.me/api/ordered_map/ + template + struct ordered_map; + + /// @brief specialization that maintains the insertion order of object keys + /// @sa https://json.nlohmann.me/api/ordered_json/ + using ordered_json = basic_json; + + NLOHMANN_JSON_NAMESPACE_END + +#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + +NLOHMANN_JSON_NAMESPACE_BEGIN +/*! +@brief detail namespace with internal helper functions + +This namespace collects functions that should not be exposed, +implementations of some @ref basic_json methods, and meta-programming helpers. + +@since version 2.1.0 +*/ +namespace detail +{ + +///////////// +// helpers // +///////////// + +// Note to maintainers: +// +// Every trait in this file expects a non CV-qualified type. +// The only exceptions are in the 'aliases for detected' section +// (i.e. those of the form: decltype(T::member_function(std::declval()))) +// +// In this case, T has to be properly CV-qualified to constraint the function arguments +// (e.g. to_json(BasicJsonType&, const T&)) + +template struct is_basic_json : std::false_type {}; + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +struct is_basic_json : std::true_type {}; + +// used by exceptions create() member functions +// true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t +// false_type otherwise +template +struct is_basic_json_context : + std::integral_constant < bool, + is_basic_json::type>::type>::value + || std::is_same::value > +{}; + +////////////////////// +// json_ref helpers // +////////////////////// + +template +class json_ref; + +template +struct is_json_ref : std::false_type {}; + +template +struct is_json_ref> : std::true_type {}; + +////////////////////////// +// aliases for detected // +////////////////////////// + +template +using mapped_type_t = typename T::mapped_type; + +template +using key_type_t = typename T::key_type; + +template +using value_type_t = typename T::value_type; + +template +using difference_type_t = typename T::difference_type; + +template +using pointer_t = typename T::pointer; + +template +using reference_t = typename T::reference; + +template +using iterator_category_t = typename T::iterator_category; + +template +using to_json_function = decltype(T::to_json(std::declval()...)); + +template +using from_json_function = decltype(T::from_json(std::declval()...)); + +template +using get_template_function = decltype(std::declval().template get()); + +// trait checking if JSONSerializer::from_json(json const&, udt&) exists +template +struct has_from_json : std::false_type {}; + +// trait checking if j.get is valid +// use this trait instead of std::is_constructible or std::is_convertible, +// both rely on, or make use of implicit conversions, and thus fail when T +// has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) +template +struct is_getable +{ + static constexpr bool value = is_detected::value; +}; + +template +struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if JSONSerializer::from_json(json const&) exists +// this overload is used for non-default-constructible user-defined-types +template +struct has_non_default_from_json : std::false_type {}; + +template +struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if BasicJsonType::json_serializer::to_json exists +// Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. +template +struct has_to_json : std::false_type {}; + +template +struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +template +using detect_key_compare = typename T::key_compare; + +template +struct has_key_compare : std::integral_constant::value> {}; + +// obtains the actual object key comparator +template +struct actual_object_comparator +{ + using object_t = typename BasicJsonType::object_t; + using object_comparator_t = typename BasicJsonType::default_object_comparator_t; + using type = typename std::conditional < has_key_compare::value, + typename object_t::key_compare, object_comparator_t>::type; +}; + +template +using actual_object_comparator_t = typename actual_object_comparator::type; + +///////////////// +// char_traits // +///////////////// + +// Primary template of char_traits calls std char_traits +template +struct char_traits : std::char_traits +{}; + +// Explicitly define char traits for unsigned char since it is not standard +template<> +struct char_traits : std::char_traits +{ + using char_type = unsigned char; + using int_type = uint64_t; + + // Redefine to_int_type function + static int_type to_int_type(char_type c) noexcept + { + return static_cast(c); + } + + static char_type to_char_type(int_type i) noexcept + { + return static_cast(i); + } + + static constexpr int_type eof() noexcept + { + return static_cast(EOF); + } +}; + +// Explicitly define char traits for signed char since it is not standard +template<> +struct char_traits : std::char_traits +{ + using char_type = signed char; + using int_type = uint64_t; + + // Redefine to_int_type function + static int_type to_int_type(char_type c) noexcept + { + return static_cast(c); + } + + static char_type to_char_type(int_type i) noexcept + { + return static_cast(i); + } + + static constexpr int_type eof() noexcept + { + return static_cast(EOF); + } +}; + +/////////////////// +// is_ functions // +/////////////////// + +// https://en.cppreference.com/w/cpp/types/conjunction +template struct conjunction : std::true_type { }; +template struct conjunction : B { }; +template +struct conjunction +: std::conditional(B::value), conjunction, B>::type {}; + +// https://en.cppreference.com/w/cpp/types/negation +template struct negation : std::integral_constant < bool, !B::value > { }; + +// Reimplementation of is_constructible and is_default_constructible, due to them being broken for +// std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). +// This causes compile errors in e.g. clang 3.5 or gcc 4.9. +template +struct is_default_constructible : std::is_default_constructible {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + +template +struct is_constructible : std::is_constructible {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_iterator_traits : std::false_type {}; + +template +struct is_iterator_traits> +{ + private: + using traits = iterator_traits; + + public: + static constexpr auto value = + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value; +}; + +template +struct is_range +{ + private: + using t_ref = typename std::add_lvalue_reference::type; + + using iterator = detected_t; + using sentinel = detected_t; + + // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator + // and https://en.cppreference.com/w/cpp/iterator/sentinel_for + // but reimplementing these would be too much work, as a lot of other concepts are used underneath + static constexpr auto is_iterator_begin = + is_iterator_traits>::value; + + public: + static constexpr bool value = !std::is_same::value && !std::is_same::value && is_iterator_begin; +}; + +template +using iterator_t = enable_if_t::value, result_of_begin())>>; + +template +using range_value_t = value_type_t>>; + +// The following implementation of is_complete_type is taken from +// https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ +// and is written by Xiang Fan who agreed to using it in this library. + +template +struct is_complete_type : std::false_type {}; + +template +struct is_complete_type : std::true_type {}; + +template +struct is_compatible_object_type_impl : std::false_type {}; + +template +struct is_compatible_object_type_impl < + BasicJsonType, CompatibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + // macOS's is_constructible does not play well with nonesuch... + static constexpr bool value = + is_constructible::value && + is_constructible::value; +}; + +template +struct is_compatible_object_type + : is_compatible_object_type_impl {}; + +template +struct is_constructible_object_type_impl : std::false_type {}; + +template +struct is_constructible_object_type_impl < + BasicJsonType, ConstructibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + static constexpr bool value = + (is_default_constructible::value && + (std::is_move_assignable::value || + std::is_copy_assignable::value) && + (is_constructible::value && + std::is_same < + typename object_t::mapped_type, + typename ConstructibleObjectType::mapped_type >::value)) || + (has_from_json::value || + has_non_default_from_json < + BasicJsonType, + typename ConstructibleObjectType::mapped_type >::value); +}; + +template +struct is_constructible_object_type + : is_constructible_object_type_impl {}; + +template +struct is_compatible_string_type +{ + static constexpr auto value = + is_constructible::value; +}; + +template +struct is_constructible_string_type +{ + // launder type through decltype() to fix compilation failure on ICPC +#ifdef __INTEL_COMPILER + using laundered_type = decltype(std::declval()); +#else + using laundered_type = ConstructibleStringType; +#endif + + static constexpr auto value = + conjunction < + is_constructible, + is_detected_exact>::value; +}; + +template +struct is_compatible_array_type_impl : std::false_type {}; + +template +struct is_compatible_array_type_impl < + BasicJsonType, CompatibleArrayType, + enable_if_t < + is_detected::value&& + is_iterator_traits>>::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 + !std::is_same>::value >> +{ + static constexpr bool value = + is_constructible>::value; +}; + +template +struct is_compatible_array_type + : is_compatible_array_type_impl {}; + +template +struct is_constructible_array_type_impl : std::false_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t::value >> + : std::true_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t < !std::is_same::value&& + !is_compatible_string_type::value&& + is_default_constructible::value&& +(std::is_move_assignable::value || + std::is_copy_assignable::value)&& +is_detected::value&& +is_iterator_traits>>::value&& +is_detected::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 +!std::is_same>::value&& + is_complete_type < + detected_t>::value >> +{ + using value_type = range_value_t; + + static constexpr bool value = + std::is_same::value || + has_from_json::value || + has_non_default_from_json < + BasicJsonType, + value_type >::value; +}; + +template +struct is_constructible_array_type + : is_constructible_array_type_impl {}; + +template +struct is_compatible_integer_type_impl : std::false_type {}; + +template +struct is_compatible_integer_type_impl < + RealIntegerType, CompatibleNumberIntegerType, + enable_if_t < std::is_integral::value&& + std::is_integral::value&& + !std::is_same::value >> +{ + // is there an assert somewhere on overflows? + using RealLimits = std::numeric_limits; + using CompatibleLimits = std::numeric_limits; + + static constexpr auto value = + is_constructible::value && + CompatibleLimits::is_integer && + RealLimits::is_signed == CompatibleLimits::is_signed; +}; + +template +struct is_compatible_integer_type + : is_compatible_integer_type_impl {}; + +template +struct is_compatible_type_impl: std::false_type {}; + +template +struct is_compatible_type_impl < + BasicJsonType, CompatibleType, + enable_if_t::value >> +{ + static constexpr bool value = + has_to_json::value; +}; + +template +struct is_compatible_type + : is_compatible_type_impl {}; + +template +struct is_constructible_tuple : std::false_type {}; + +template +struct is_constructible_tuple> : conjunction...> {}; + +template +struct is_json_iterator_of : std::false_type {}; + +template +struct is_json_iterator_of : std::true_type {}; + +template +struct is_json_iterator_of : std::true_type +{}; + +// checks if a given type T is a template specialization of Primary +template