Skip to content

Commit c5c60c8

Browse files
authored
[ci][c++] fixed build/header_guard errors from cpplint (#7055)
1 parent 32781ba commit c5c60c8

File tree

100 files changed

+314
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+314
-308
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ repos:
2727
hooks:
2828
- id: cpplint
2929
args:
30+
- --root=.. # workaround to get correct header guard pattern
3031
- --recursive
31-
- --filter=-build/include_subdir,-build/header_guard,-whitespace/line_length
32+
- --filter=-build/include_subdir,-whitespace/line_length
3233
- repo: local
3334
hooks:
3435
- id: check-omp-pragmas

R-package/src/lightgbm_R.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Copyright (c) 2017 Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*/
5-
#ifndef LIGHTGBM_R_H_
6-
#define LIGHTGBM_R_H_
5+
#ifndef LIGHTGBM_R_PACKAGE_SRC_LIGHTGBM_R_H_
6+
#define LIGHTGBM_R_PACKAGE_SRC_LIGHTGBM_R_H_
77

88
#include <LightGBM/c_api.h>
99

@@ -903,4 +903,4 @@ LIGHTGBM_C_EXPORT SEXP LGBM_SetMaxThreads_R(
903903
SEXP num_threads
904904
);
905905

906-
#endif // LIGHTGBM_R_H_
906+
#endif // LIGHTGBM_R_PACKAGE_SRC_LIGHTGBM_R_H_

include/LightGBM/application.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Copyright (c) 2016 Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*/
5-
#ifndef LIGHTGBM_APPLICATION_H_
6-
#define LIGHTGBM_APPLICATION_H_
5+
#ifndef LIGHTGBM_INCLUDE_LIGHTGBM_APPLICATION_H_
6+
#define LIGHTGBM_INCLUDE_LIGHTGBM_APPLICATION_H_
77

88
#include <LightGBM/config.h>
99
#include <LightGBM/meta.h>
@@ -89,4 +89,4 @@ inline void Application::Run() {
8989

9090
} // namespace LightGBM
9191

92-
#endif // LightGBM_APPLICATION_H_
92+
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_APPLICATION_H_

include/LightGBM/arrow.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* Author: Oliver Borchert
66
*/
77

8-
#ifndef LIGHTGBM_ARROW_H_
9-
#define LIGHTGBM_ARROW_H_
8+
#ifndef LIGHTGBM_INCLUDE_LIGHTGBM_ARROW_H_
9+
#define LIGHTGBM_INCLUDE_LIGHTGBM_ARROW_H_
1010

1111
#include <algorithm>
1212
#include <cstdint>
@@ -296,4 +296,4 @@ class ArrowTable {
296296

297297
#include "arrow.tpp"
298298

299-
#endif /* LIGHTGBM_ARROW_H_ */
299+
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_ARROW_H_

include/LightGBM/bin.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Copyright (c) 2016 Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*/
5-
#ifndef LIGHTGBM_BIN_H_
6-
#define LIGHTGBM_BIN_H_
5+
#ifndef LIGHTGBM_INCLUDE_LIGHTGBM_BIN_H_
6+
#define LIGHTGBM_INCLUDE_LIGHTGBM_BIN_H_
77

88
#include <LightGBM/meta.h>
99
#include <LightGBM/utils/common.h>
@@ -651,4 +651,4 @@ inline uint32_t BinMapper::ValueToBin(double value) const {
651651

652652
} // namespace LightGBM
653653

654-
#endif // LightGBM_BIN_H_
654+
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_BIN_H_

include/LightGBM/boosting.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Copyright (c) 2016 Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*/
5-
#ifndef LIGHTGBM_BOOSTING_H_
6-
#define LIGHTGBM_BOOSTING_H_
5+
#ifndef LIGHTGBM_INCLUDE_LIGHTGBM_BOOSTING_H_
6+
#define LIGHTGBM_INCLUDE_LIGHTGBM_BOOSTING_H_
77

88
#include <LightGBM/config.h>
99
#include <LightGBM/meta.h>
@@ -328,4 +328,4 @@ class GBDTBase : public Boosting {
328328

329329
} // namespace LightGBM
330330

331-
#endif // LightGBM_BOOSTING_H_
331+
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_BOOSTING_H_

include/LightGBM/c_api.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* .
1111
* The reason is that they are called frequently, and the type conversion on them may be time-cost.
1212
*/
13-
#ifndef LIGHTGBM_C_API_H_
14-
#define LIGHTGBM_C_API_H_
13+
#ifndef LIGHTGBM_INCLUDE_LIGHTGBM_C_API_H_
14+
#define LIGHTGBM_INCLUDE_LIGHTGBM_C_API_H_
1515

1616
#include <LightGBM/arrow.h>
1717
#include <LightGBM/export.h>
@@ -1663,4 +1663,4 @@ INLINE_FUNCTION void LGBM_SetLastError(const char* msg) {
16631663
#endif
16641664
}
16651665

1666-
#endif /* LIGHTGBM_C_API_H_ */
1666+
#endif /* LIGHTGBM_INCLUDE_LIGHTGBM_C_API_H_ */

include/LightGBM/config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* - param is only used by the CLI (especially the "predict" and "convert_model" tasks)
1414
* - param is related to LightGBM writing files (e.g. "output_model", "save_binary")
1515
*/
16-
#ifndef LIGHTGBM_CONFIG_H_
17-
#define LIGHTGBM_CONFIG_H_
16+
#ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CONFIG_H_
17+
#define LIGHTGBM_INCLUDE_LIGHTGBM_CONFIG_H_
1818

1919
#include <LightGBM/export.h>
2020
#include <LightGBM/meta.h>
@@ -1320,4 +1320,4 @@ inline std::string ParseMetricAlias(const std::string& type) {
13201320

13211321
} // namespace LightGBM
13221322

1323-
#endif // LightGBM_CONFIG_H_
1323+
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_CONFIG_H_

include/LightGBM/cuda/cuda_algorithms.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved.
55
*/
66

7-
#ifndef LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_
8-
#define LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_
7+
#ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_
8+
#define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_
99

1010
#ifdef USE_CUDA
1111

@@ -620,4 +620,4 @@ __device__ VAL_T PercentileDevice(const VAL_T* values,
620620
} // namespace LightGBM
621621

622622
#endif // USE_CUDA
623-
#endif // LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_
623+
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_

include/LightGBM/cuda/cuda_column_data.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*/
55

6-
#ifdef USE_CUDA
6+
#ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_
7+
#define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_
78

8-
#ifndef LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_
9-
#define LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_
9+
#ifdef USE_CUDA
1010

1111
#include <LightGBM/config.h>
1212
#include <LightGBM/cuda/cuda_utils.hu>
@@ -137,6 +137,6 @@ class CUDAColumnData {
137137

138138
} // namespace LightGBM
139139

140-
#endif // LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_
141-
142140
#endif // USE_CUDA
141+
142+
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_

0 commit comments

Comments
 (0)