Skip to content

Commit

Permalink
reworked includes in source files (#2066)
Browse files Browse the repository at this point in the history
* added all necessary includes - fixed build/include_what_you_use error

* fixed the order of includes (build/include_order)
  • Loading branch information
StrikerRUS committed Apr 11, 2019
1 parent c56412a commit 50ce01b
Show file tree
Hide file tree
Showing 88 changed files with 341 additions and 330 deletions.
4 changes: 2 additions & 2 deletions include/LightGBM/application.h
@@ -1,11 +1,11 @@
#ifndef LIGHTGBM_APPLICATION_H_
#define LIGHTGBM_APPLICATION_H_

#include <LightGBM/meta.h>
#include <LightGBM/config.h>
#include <LightGBM/meta.h>

#include <vector>
#include <memory>
#include <vector>

namespace LightGBM {

Expand Down
8 changes: 4 additions & 4 deletions include/LightGBM/bin.h
Expand Up @@ -2,15 +2,15 @@
#define LIGHTGBM_BIN_H_

#include <LightGBM/meta.h>

#include <LightGBM/utils/common.h>
#include <LightGBM/utils/file_io.h>


#include <vector>
#include <limits>
#include <string>
#include <functional>
#include <unordered_map>
#include <sstream>
#include <unordered_map>
#include <vector>

namespace LightGBM {

Expand Down
5 changes: 3 additions & 2 deletions include/LightGBM/boosting.h
@@ -1,12 +1,13 @@
#ifndef LIGHTGBM_BOOSTING_H_
#define LIGHTGBM_BOOSTING_H_

#include <LightGBM/meta.h>
#include <LightGBM/config.h>
#include <LightGBM/meta.h>

#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>

namespace LightGBM {

Expand Down
4 changes: 2 additions & 2 deletions include/LightGBM/c_api.h
@@ -1,6 +1,8 @@
#ifndef LIGHTGBM_C_API_H_
#define LIGHTGBM_C_API_H_

#include <LightGBM/export.h>

#include <cstdint>
#include <cstring>

Expand All @@ -12,8 +14,6 @@
* The reason is because they are called frequently, the type-conversion on them maybe time cost.
*/

#include <LightGBM/export.h>

typedef void* DatasetHandle;
typedef void* BoosterHandle;

Expand Down
12 changes: 5 additions & 7 deletions include/LightGBM/config.h
@@ -1,20 +1,18 @@
/// desc and descl2 fields must be written in reStructuredText format

#ifndef LIGHTGBM_CONFIG_H_
#define LIGHTGBM_CONFIG_H_

#include <LightGBM/export.h>
#include <LightGBM/meta.h>
#include <LightGBM/utils/common.h>
#include <LightGBM/utils/log.h>

#include <LightGBM/meta.h>
#include <LightGBM/export.h>

#include <vector>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <memory>
#include <unordered_map>
#include <unordered_set>
#include <vector>

namespace LightGBM {

Expand Down
18 changes: 9 additions & 9 deletions include/LightGBM/dataset.h
@@ -1,20 +1,20 @@
#ifndef LIGHTGBM_DATASET_H_
#define LIGHTGBM_DATASET_H_

#include <LightGBM/utils/random.h>
#include <LightGBM/utils/text_reader.h>
#include <LightGBM/utils/openmp_wrapper.h>

#include <LightGBM/meta.h>
#include <LightGBM/config.h>
#include <LightGBM/feature_group.h>
#include <LightGBM/meta.h>
#include <LightGBM/utils/openmp_wrapper.h>
#include <LightGBM/utils/random.h>
#include <LightGBM/utils/text_reader.h>

#include <vector>
#include <utility>
#include <functional>
#include <string>
#include <unordered_set>
#include <functional>
#include <memory>
#include <mutex>
#include <unordered_set>
#include <utility>
#include <vector>

namespace LightGBM {

Expand Down
4 changes: 4 additions & 0 deletions include/LightGBM/dataset_loader.h
Expand Up @@ -3,6 +3,10 @@

#include <LightGBM/dataset.h>

#include <string>
#include <unordered_set>
#include <vector>

namespace LightGBM {

class DatasetLoader {
Expand Down
5 changes: 2 additions & 3 deletions include/LightGBM/feature_group.h
@@ -1,10 +1,9 @@
#ifndef LIGHTGBM_FEATURE_GROUP_H_
#define LIGHTGBM_FEATURE_GROUP_H_

#include <LightGBM/utils/random.h>

#include <LightGBM/meta.h>
#include <LightGBM/bin.h>
#include <LightGBM/meta.h>
#include <LightGBM/utils/random.h>

#include <cstdio>
#include <memory>
Expand Down
5 changes: 3 additions & 2 deletions include/LightGBM/json11.hpp
Expand Up @@ -51,10 +51,11 @@
#pragma once

#include <string>
#include <vector>
#include <initializer_list>
#include <map>
#include <memory>
#include <initializer_list>
#include <utility>
#include <vector>

#ifdef _MSC_VER
#if _MSC_VER <= 1800 // VS 2013
Expand Down
5 changes: 2 additions & 3 deletions include/LightGBM/lightgbm_R.h
@@ -1,11 +1,10 @@
#ifndef LIGHTGBM_R_H_
#define LIGHTGBM_R_H_

#include "R_object_helper.h"

#include <cstdint>
#include <LightGBM/c_api.h>
#include <LightGBM/R_object_helper.h>

#include <cstdint>

/*!
* \brief get string message of the last error
Expand Down
6 changes: 3 additions & 3 deletions include/LightGBM/meta.h
@@ -1,12 +1,12 @@
#ifndef LIGHTGBM_META_H_
#define LIGHTGBM_META_H_

#include <cstdint>

#include <limits>
#include <vector>
#include <cstdint>
#include <functional>
#include <memory>
#include <utility>
#include <vector>

namespace LightGBM {

Expand Down
8 changes: 4 additions & 4 deletions include/LightGBM/metric.h
@@ -1,14 +1,14 @@
#ifndef LIGHTGBM_METRIC_H_
#define LIGHTGBM_METRIC_H_

#include <LightGBM/utils/log.h>
#include <LightGBM/utils/common.h>

#include <LightGBM/meta.h>
#include <LightGBM/config.h>
#include <LightGBM/dataset.h>
#include <LightGBM/meta.h>
#include <LightGBM/objective_function.h>
#include <LightGBM/utils/log.h>
#include <LightGBM/utils/common.h>

#include <string>
#include <vector>

namespace LightGBM {
Expand Down
7 changes: 3 additions & 4 deletions include/LightGBM/network.h
@@ -1,14 +1,13 @@
#ifndef LIGHTGBM_NETWORK_H_
#define LIGHTGBM_NETWORK_H_

#include <LightGBM/utils/log.h>

#include <LightGBM/meta.h>
#include <LightGBM/config.h>
#include <LightGBM/meta.h>
#include <LightGBM/utils/log.h>

#include <functional>
#include <vector>
#include <memory>
#include <vector>

namespace LightGBM {

Expand Down
4 changes: 3 additions & 1 deletion include/LightGBM/objective_function.h
@@ -1,9 +1,11 @@
#ifndef LIGHTGBM_OBJECTIVE_FUNCTION_H_
#define LIGHTGBM_OBJECTIVE_FUNCTION_H_

#include <LightGBM/meta.h>
#include <LightGBM/config.h>
#include <LightGBM/dataset.h>
#include <LightGBM/meta.h>

#include <string>
#include <functional>

namespace LightGBM {
Expand Down
6 changes: 3 additions & 3 deletions include/LightGBM/prediction_early_stop.h
@@ -1,11 +1,11 @@
#ifndef LIGHTGBM_PREDICTION_EARLY_STOP_H_
#define LIGHTGBM_PREDICTION_EARLY_STOP_H_

#include <functional>
#include <string>

#include <LightGBM/export.h>

#include <string>
#include <functional>

namespace LightGBM {

struct PredictionEarlyStopInstance {
Expand Down
7 changes: 4 additions & 3 deletions include/LightGBM/tree.h
@@ -1,13 +1,14 @@
#ifndef LIGHTGBM_TREE_H_
#define LIGHTGBM_TREE_H_

#include <LightGBM/meta.h>
#include <LightGBM/dataset.h>
#include <LightGBM/meta.h>

#include <string>
#include <vector>
#include <memory>
#include <map>
#include <memory>
#include <unordered_map>
#include <vector>

namespace LightGBM {

Expand Down
7 changes: 4 additions & 3 deletions include/LightGBM/tree_learner.h
@@ -1,13 +1,14 @@
#ifndef LIGHTGBM_TREE_LEARNER_H_
#define LIGHTGBM_TREE_LEARNER_H_


#include <LightGBM/meta.h>
#include <LightGBM/config.h>
#include <LightGBM/json11.hpp>
#include <LightGBM/meta.h>

#include <string>
#include <vector>

#include <LightGBM/json11.hpp>

using namespace json11;

namespace LightGBM {
Expand Down
6 changes: 4 additions & 2 deletions include/LightGBM/utils/array_args.h
@@ -1,10 +1,12 @@
#ifndef LIGHTGBM_UTILS_ARRAY_AGRS_H_
#define LIGHTGBM_UTILS_ARRAY_AGRS_H_

#include <vector>
#include <algorithm>
#include <LightGBM/utils/openmp_wrapper.h>

#include <algorithm>
#include <utility>
#include <vector>

namespace LightGBM {

/*!
Expand Down
14 changes: 8 additions & 6 deletions include/LightGBM/utils/common.h
Expand Up @@ -4,18 +4,20 @@
#include <LightGBM/utils/log.h>
#include <LightGBM/utils/openmp_wrapper.h>

#include <cstdio>
#include <limits>
#include <string>
#include <vector>
#include <sstream>
#include <cstdint>
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <memory>
#include <iomanip>
#include <iterator>
#include <memory>
#include <sstream>
#include <type_traits>
#include <iomanip>
#include <utility>
#include <vector>

#ifdef _MSC_VER
#include "intrin.h"
Expand Down
5 changes: 3 additions & 2 deletions include/LightGBM/utils/file_io.h
@@ -1,11 +1,12 @@
#ifndef LIGHTGBM_UTILS_FILE_IO_H_
#define LIGHTGBM_UTILS_FILE_IO_H_

#include <memory>
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <memory>

namespace LightGBM {

Expand Down
5 changes: 3 additions & 2 deletions include/LightGBM/utils/log.h
@@ -1,12 +1,13 @@
#ifndef LIGHTGBM_UTILS_LOG_H_
#define LIGHTGBM_UTILS_LOG_H_

#include <iostream>
#include <string>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#include <cstring>
#include <exception>
#include <iostream>
#include <stdexcept>

namespace LightGBM {
Expand Down
7 changes: 4 additions & 3 deletions include/LightGBM/utils/openmp_wrapper.h
Expand Up @@ -3,12 +3,13 @@
#ifdef _OPENMP

#include <omp.h>
#include <LightGBM/utils/log.h>

#include <exception>
#include <stdexcept>
#include <memory>
#include <mutex>
#include <stdexcept>
#include <vector>
#include <memory>
#include "log.h"

class ThreadExceptionHelper {
public:
Expand Down

0 comments on commit 50ce01b

Please sign in to comment.