Unverified Commit c5c60c8f authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

[ci][c++] fixed `build/header_guard` errors from cpplint (#7055)

parent 32781bae
...@@ -27,8 +27,9 @@ repos: ...@@ -27,8 +27,9 @@ repos:
hooks: hooks:
- id: cpplint - id: cpplint
args: args:
- --root=.. # workaround to get correct header guard pattern
- --recursive - --recursive
- --filter=-build/include_subdir,-build/header_guard,-whitespace/line_length - --filter=-build/include_subdir,-whitespace/line_length
- repo: local - repo: local
hooks: hooks:
- id: check-omp-pragmas - id: check-omp-pragmas
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* Copyright (c) 2017 Microsoft Corporation. All rights reserved. * Copyright (c) 2017 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
*/ */
#ifndef LIGHTGBM_R_H_ #ifndef LIGHTGBM_R_PACKAGE_SRC_LIGHTGBM_R_H_
#define LIGHTGBM_R_H_ #define LIGHTGBM_R_PACKAGE_SRC_LIGHTGBM_R_H_
#include <LightGBM/c_api.h> #include <LightGBM/c_api.h>
...@@ -903,4 +903,4 @@ LIGHTGBM_C_EXPORT SEXP LGBM_SetMaxThreads_R( ...@@ -903,4 +903,4 @@ LIGHTGBM_C_EXPORT SEXP LGBM_SetMaxThreads_R(
SEXP num_threads SEXP num_threads
); );
#endif // LIGHTGBM_R_H_ #endif // LIGHTGBM_R_PACKAGE_SRC_LIGHTGBM_R_H_
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Copyright (c) 2016 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
*/ */
#ifndef LIGHTGBM_APPLICATION_H_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_APPLICATION_H_
#define LIGHTGBM_APPLICATION_H_ #define LIGHTGBM_INCLUDE_LIGHTGBM_APPLICATION_H_
#include <LightGBM/config.h> #include <LightGBM/config.h>
#include <LightGBM/meta.h> #include <LightGBM/meta.h>
...@@ -89,4 +89,4 @@ inline void Application::Run() { ...@@ -89,4 +89,4 @@ inline void Application::Run() {
} // namespace LightGBM } // namespace LightGBM
#endif // LightGBM_APPLICATION_H_ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_APPLICATION_H_
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
* Author: Oliver Borchert * Author: Oliver Borchert
*/ */
#ifndef LIGHTGBM_ARROW_H_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_ARROW_H_
#define LIGHTGBM_ARROW_H_ #define LIGHTGBM_INCLUDE_LIGHTGBM_ARROW_H_
#include <algorithm> #include <algorithm>
#include <cstdint> #include <cstdint>
...@@ -296,4 +296,4 @@ class ArrowTable { ...@@ -296,4 +296,4 @@ class ArrowTable {
#include "arrow.tpp" #include "arrow.tpp"
#endif /* LIGHTGBM_ARROW_H_ */ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_ARROW_H_
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Copyright (c) 2016 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
*/ */
#ifndef LIGHTGBM_BIN_H_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_BIN_H_
#define LIGHTGBM_BIN_H_ #define LIGHTGBM_INCLUDE_LIGHTGBM_BIN_H_
#include <LightGBM/meta.h> #include <LightGBM/meta.h>
#include <LightGBM/utils/common.h> #include <LightGBM/utils/common.h>
...@@ -651,4 +651,4 @@ inline uint32_t BinMapper::ValueToBin(double value) const { ...@@ -651,4 +651,4 @@ inline uint32_t BinMapper::ValueToBin(double value) const {
} // namespace LightGBM } // namespace LightGBM
#endif // LightGBM_BIN_H_ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_BIN_H_
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Copyright (c) 2016 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
*/ */
#ifndef LIGHTGBM_BOOSTING_H_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_BOOSTING_H_
#define LIGHTGBM_BOOSTING_H_ #define LIGHTGBM_INCLUDE_LIGHTGBM_BOOSTING_H_
#include <LightGBM/config.h> #include <LightGBM/config.h>
#include <LightGBM/meta.h> #include <LightGBM/meta.h>
...@@ -328,4 +328,4 @@ class GBDTBase : public Boosting { ...@@ -328,4 +328,4 @@ class GBDTBase : public Boosting {
} // namespace LightGBM } // namespace LightGBM
#endif // LightGBM_BOOSTING_H_ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_BOOSTING_H_
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
* . * .
* The reason is that they are called frequently, and the type conversion on them may be time-cost. * The reason is that they are called frequently, and the type conversion on them may be time-cost.
*/ */
#ifndef LIGHTGBM_C_API_H_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_C_API_H_
#define LIGHTGBM_C_API_H_ #define LIGHTGBM_INCLUDE_LIGHTGBM_C_API_H_
#include <LightGBM/arrow.h> #include <LightGBM/arrow.h>
#include <LightGBM/export.h> #include <LightGBM/export.h>
...@@ -1663,4 +1663,4 @@ INLINE_FUNCTION void LGBM_SetLastError(const char* msg) { ...@@ -1663,4 +1663,4 @@ INLINE_FUNCTION void LGBM_SetLastError(const char* msg) {
#endif #endif
} }
#endif /* LIGHTGBM_C_API_H_ */ #endif /* LIGHTGBM_INCLUDE_LIGHTGBM_C_API_H_ */
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
* - param is only used by the CLI (especially the "predict" and "convert_model" tasks) * - param is only used by the CLI (especially the "predict" and "convert_model" tasks)
* - param is related to LightGBM writing files (e.g. "output_model", "save_binary") * - param is related to LightGBM writing files (e.g. "output_model", "save_binary")
*/ */
#ifndef LIGHTGBM_CONFIG_H_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CONFIG_H_
#define LIGHTGBM_CONFIG_H_ #define LIGHTGBM_INCLUDE_LIGHTGBM_CONFIG_H_
#include <LightGBM/export.h> #include <LightGBM/export.h>
#include <LightGBM/meta.h> #include <LightGBM/meta.h>
...@@ -1320,4 +1320,4 @@ inline std::string ParseMetricAlias(const std::string& type) { ...@@ -1320,4 +1320,4 @@ inline std::string ParseMetricAlias(const std::string& type) {
} // namespace LightGBM } // namespace LightGBM
#endif // LightGBM_CONFIG_H_ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_CONFIG_H_
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved. * Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved.
*/ */
#ifndef LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_
#define LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_ #define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_
#ifdef USE_CUDA #ifdef USE_CUDA
...@@ -620,4 +620,4 @@ __device__ VAL_T PercentileDevice(const VAL_T* values, ...@@ -620,4 +620,4 @@ __device__ VAL_T PercentileDevice(const VAL_T* values,
} // namespace LightGBM } // namespace LightGBM
#endif // USE_CUDA #endif // USE_CUDA
#endif // LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ALGORITHMS_HPP_
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
*/ */
#ifdef USE_CUDA #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_
#define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_
#ifndef LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_ #ifdef USE_CUDA
#define LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_
#include <LightGBM/config.h> #include <LightGBM/config.h>
#include <LightGBM/cuda/cuda_utils.hu> #include <LightGBM/cuda/cuda_utils.hu>
...@@ -137,6 +137,6 @@ class CUDAColumnData { ...@@ -137,6 +137,6 @@ class CUDAColumnData {
} // namespace LightGBM } // namespace LightGBM
#endif // LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_
#endif // USE_CUDA #endif // USE_CUDA
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_COLUMN_DATA_HPP_
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
*/ */
#ifdef USE_CUDA #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_METADATA_HPP_
#define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_METADATA_HPP_
#ifndef LIGHTGBM_CUDA_CUDA_METADATA_HPP_ #ifdef USE_CUDA
#define LIGHTGBM_CUDA_CUDA_METADATA_HPP_
#include <LightGBM/cuda/cuda_utils.hu> #include <LightGBM/cuda/cuda_utils.hu>
#include <LightGBM/meta.h> #include <LightGBM/meta.h>
...@@ -53,6 +53,6 @@ class CUDAMetadata { ...@@ -53,6 +53,6 @@ class CUDAMetadata {
} // namespace LightGBM } // namespace LightGBM
#endif // LIGHTGBM_CUDA_CUDA_METADATA_HPP_
#endif // USE_CUDA #endif // USE_CUDA
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_METADATA_HPP_
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* license information. * license information.
*/ */
#ifndef LIGHTGBM_CUDA_CUDA_METRIC_HPP_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_METRIC_HPP_
#define LIGHTGBM_CUDA_CUDA_METRIC_HPP_ #define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_METRIC_HPP_
#ifdef USE_CUDA #ifdef USE_CUDA
...@@ -41,4 +41,4 @@ class CUDAMetricInterface: public HOST_METRIC { ...@@ -41,4 +41,4 @@ class CUDAMetricInterface: public HOST_METRIC {
#endif // USE_CUDA #endif // USE_CUDA
#endif // LIGHTGBM_CUDA_CUDA_METRIC_HPP_ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_METRIC_HPP_
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* license information. * license information.
*/ */
#ifndef LIGHTGBM_CUDA_CUDA_OBJECTIVE_FUNCTION_HPP_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_OBJECTIVE_FUNCTION_HPP_
#define LIGHTGBM_CUDA_CUDA_OBJECTIVE_FUNCTION_HPP_ #define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_OBJECTIVE_FUNCTION_HPP_
#ifdef USE_CUDA #ifdef USE_CUDA
...@@ -83,4 +83,4 @@ class CUDAObjectiveInterface: public HOST_OBJECTIVE { ...@@ -83,4 +83,4 @@ class CUDAObjectiveInterface: public HOST_OBJECTIVE {
#endif // USE_CUDA #endif // USE_CUDA
#endif // LIGHTGBM_CUDA_CUDA_OBJECTIVE_FUNCTION_HPP_ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_OBJECTIVE_FUNCTION_HPP_
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* Copyright (c) 2021 Microsoft Corporation. All rights reserved. * Copyright (c) 2021 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
*/ */
#ifndef LIGHTGBM_CUDA_CUDA_RANDOM_HPP_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_RANDOM_HPP_
#define LIGHTGBM_CUDA_CUDA_RANDOM_HPP_ #define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_RANDOM_HPP_
#ifdef USE_CUDA #ifdef USE_CUDA
...@@ -71,4 +71,4 @@ class CUDARandom { ...@@ -71,4 +71,4 @@ class CUDARandom {
#endif // USE_CUDA #endif // USE_CUDA
#endif // LIGHTGBM_CUDA_CUDA_RANDOM_HPP_ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_RANDOM_HPP_
/*! /*!
* Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved. * Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved.
*/ */
#ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ROCM_INTEROP_H_
#define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ROCM_INTEROP_H_
#ifdef USE_CUDA #ifdef USE_CUDA
#if defined(__HIP_PLATFORM_AMD__) || defined(__HIP__) #if defined(__HIP_PLATFORM_AMD__) || defined(__HIP__)
...@@ -15,6 +19,8 @@ ...@@ -15,6 +19,8 @@
#else #else
// CUDA warpSize is not a constexpr, but always 32 // CUDA warpSize is not a constexpr, but always 32
#define WARPSIZE 32 #define WARPSIZE 32
#endif #endif // defined(__HIP_PLATFORM_AMD__) || defined(__HIP__)
#endif // USE_CUDA
#endif #endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ROCM_INTEROP_H_
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
*/ */
#ifdef USE_CUDA #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ROW_DATA_HPP_
#define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ROW_DATA_HPP_
#ifndef LIGHTGBM_CUDA_CUDA_ROW_DATA_HPP_ #ifdef USE_CUDA
#define LIGHTGBM_CUDA_CUDA_ROW_DATA_HPP_
#include <LightGBM/bin.h> #include <LightGBM/bin.h>
#include <LightGBM/config.h> #include <LightGBM/config.h>
...@@ -175,6 +175,7 @@ class CUDARowData { ...@@ -175,6 +175,7 @@ class CUDARowData {
}; };
} // namespace LightGBM } // namespace LightGBM
#endif // LIGHTGBM_CUDA_CUDA_ROW_DATA_HPP_
#endif // USE_CUDA #endif // USE_CUDA
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_ROW_DATA_HPP_
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
* Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved. * Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved.
*/ */
#ifdef USE_CUDA #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_SPLIT_INFO_HPP_
#define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_SPLIT_INFO_HPP_
#ifndef LIGHTGBM_CUDA_CUDA_SPLIT_INFO_HPP_ #ifdef USE_CUDA
#define LIGHTGBM_CUDA_CUDA_SPLIT_INFO_HPP_
#include <LightGBM/meta.h> #include <LightGBM/meta.h>
...@@ -103,6 +103,6 @@ class CUDASplitInfo { ...@@ -103,6 +103,6 @@ class CUDASplitInfo {
} // namespace LightGBM } // namespace LightGBM
#endif // LIGHTGBM_CUDA_CUDA_SPLIT_INFO_HPP_
#endif // USE_CUDA #endif // USE_CUDA
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_SPLIT_INFO_HPP_
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
*/ */
#ifdef USE_CUDA #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_TREE_HPP_
#define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_TREE_HPP_
#ifndef LIGHTGBM_CUDA_CUDA_TREE_HPP_ #ifdef USE_CUDA
#define LIGHTGBM_CUDA_CUDA_TREE_HPP_
#include <LightGBM/cuda/cuda_column_data.hpp> #include <LightGBM/cuda/cuda_column_data.hpp>
#include <LightGBM/cuda/cuda_split_info.hpp> #include <LightGBM/cuda/cuda_split_info.hpp>
...@@ -168,6 +168,6 @@ class CUDATree : public Tree { ...@@ -168,6 +168,6 @@ class CUDATree : public Tree {
} // namespace LightGBM } // namespace LightGBM
#endif // LIGHTGBM_CUDA_CUDA_TREE_HPP_
#endif // USE_CUDA #endif // USE_CUDA
#endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_CUDA_TREE_HPP_
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
* Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved. * Modifications Copyright(C) 2023 Advanced Micro Devices, Inc. All rights reserved.
*/ */
#ifndef LIGHTGBM_CUDA_VECTOR_CUDAHOST_H_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_VECTOR_CUDAHOST_H_
#define LIGHTGBM_CUDA_VECTOR_CUDAHOST_H_ #define LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_VECTOR_CUDAHOST_H_
#include <LightGBM/utils/common.h> #include <LightGBM/utils/common.h>
...@@ -91,4 +91,4 @@ bool operator!=(const CHAllocator<T>&, const CHAllocator<U>&); ...@@ -91,4 +91,4 @@ bool operator!=(const CHAllocator<T>&, const CHAllocator<U>&);
} // namespace LightGBM } // namespace LightGBM
#endif // LIGHTGBM_CUDA_VECTOR_CUDAHOST_H_ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_CUDA_VECTOR_CUDAHOST_H_
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* Copyright (c) 2016 Microsoft Corporation. All rights reserved. * Copyright (c) 2016 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information. * Licensed under the MIT License. See LICENSE file in the project root for license information.
*/ */
#ifndef LIGHTGBM_DATASET_H_ #ifndef LIGHTGBM_INCLUDE_LIGHTGBM_DATASET_H_
#define LIGHTGBM_DATASET_H_ #define LIGHTGBM_INCLUDE_LIGHTGBM_DATASET_H_
#include <LightGBM/arrow.h> #include <LightGBM/arrow.h>
#include <LightGBM/config.h> #include <LightGBM/config.h>
...@@ -1071,4 +1071,4 @@ class Dataset { ...@@ -1071,4 +1071,4 @@ class Dataset {
} // namespace LightGBM } // namespace LightGBM
#endif // LightGBM_DATA_H_ #endif // LIGHTGBM_INCLUDE_LIGHTGBM_DATASET_H_
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment