From 9f78cceee4911dd56f4635dfd36d4482363db5aa Mon Sep 17 00:00:00 2001 From: maskedcoder1337 <136711291+maskedcoder1337@users.noreply.github.com> Date: Fri, 30 Jun 2023 15:30:13 +0200 Subject: [PATCH] move LightGBM-vendored json11 into a LightGBM-specific namespace (fixes #5944) (#5946) --- include/LightGBM/tree_learner.h | 2 +- include/LightGBM/utils/common.h | 2 +- include/LightGBM/utils/json11.h | 4 ++-- src/boosting/gbdt.h | 2 +- src/io/dataset_loader.cpp | 2 +- src/io/json11.cpp | 6 +++--- src/treelearner/gpu_tree_learner.h | 2 +- src/treelearner/serial_tree_learner.h | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/LightGBM/tree_learner.h b/include/LightGBM/tree_learner.h index 5e2ca48c304b..f6caebc21ef4 100644 --- a/include/LightGBM/tree_learner.h +++ b/include/LightGBM/tree_learner.h @@ -14,7 +14,7 @@ namespace LightGBM { -using json11::Json; +using json11_internal_lightgbm::Json; /*! \brief forward declaration */ class Tree; diff --git a/include/LightGBM/utils/common.h b/include/LightGBM/utils/common.h index 3125f6b9e9ca..4e82734858f3 100644 --- a/include/LightGBM/utils/common.h +++ b/include/LightGBM/utils/common.h @@ -58,7 +58,7 @@ namespace LightGBM { namespace Common { -using json11::Json; +using json11_internal_lightgbm::Json; /*! * Imbues the stream with the C locale. diff --git a/include/LightGBM/utils/json11.h b/include/LightGBM/utils/json11.h index eac70a3c91d0..67996055b898 100644 --- a/include/LightGBM/utils/json11.h +++ b/include/LightGBM/utils/json11.h @@ -60,7 +60,7 @@ #include #include -namespace json11 { +namespace json11_internal_lightgbm { enum JsonParse { STANDARD, COMMENTS }; @@ -223,4 +223,4 @@ class JsonValue { virtual ~JsonValue() {} }; -} // namespace json11 +} // namespace json11_internal_lightgbm diff --git a/src/boosting/gbdt.h b/src/boosting/gbdt.h index 288c345a4f1f..e38b26be3e14 100644 --- a/src/boosting/gbdt.h +++ b/src/boosting/gbdt.h @@ -29,7 +29,7 @@ namespace LightGBM { -using json11::Json; +using json11_internal_lightgbm::Json; /*! * \brief GBDT algorithm implementation. including Training, prediction, bagging. diff --git a/src/io/dataset_loader.cpp b/src/io/dataset_loader.cpp index c0aa5e9d4eaf..354936cfb01a 100644 --- a/src/io/dataset_loader.cpp +++ b/src/io/dataset_loader.cpp @@ -15,7 +15,7 @@ namespace LightGBM { -using json11::Json; +using json11_internal_lightgbm::Json; DatasetLoader::DatasetLoader(const Config& io_config, const PredictFunction& predict_fun, int num_class, const char* filename) :config_(io_config), random_(config_.data_random_seed), predict_fun_(predict_fun), num_class_(num_class) { diff --git a/src/io/json11.cpp b/src/io/json11.cpp index 2bd98eb4079f..32a9c9d718b7 100644 --- a/src/io/json11.cpp +++ b/src/io/json11.cpp @@ -27,7 +27,7 @@ #include #include -namespace json11 { +namespace json11_internal_lightgbm { static const int max_depth = 200; @@ -160,7 +160,7 @@ class Value : public JsonValue { } const T m_value; - void dump(string *out) const override { json11::dump(m_value, out); } + void dump(string *out) const override { json11_internal_lightgbm::dump(m_value, out); } }; class JsonDouble final : public Value { @@ -777,4 +777,4 @@ bool Json::has_shape(const shape &types, string *err) const { return true; } -} // namespace json11 +} // namespace json11_internal_lightgbm diff --git a/src/treelearner/gpu_tree_learner.h b/src/treelearner/gpu_tree_learner.h index 02dd4d1224c0..b266df3f60e8 100644 --- a/src/treelearner/gpu_tree_learner.h +++ b/src/treelearner/gpu_tree_learner.h @@ -36,7 +36,7 @@ namespace LightGBM { -using json11::Json; +using json11_internal_lightgbm::Json; /*! * \brief GPU-based parallel learning algorithm. diff --git a/src/treelearner/serial_tree_learner.h b/src/treelearner/serial_tree_learner.h index 1f8e3add0d8c..d815d265c0d2 100644 --- a/src/treelearner/serial_tree_learner.h +++ b/src/treelearner/serial_tree_learner.h @@ -37,7 +37,7 @@ namespace LightGBM { -using json11::Json; +using json11_internal_lightgbm::Json; /*! \brief forward declaration */ class CostEfficientGradientBoosting;