Fix cpplint. (#4157)

* Add comment after #endif.
* Add missing headers.
This commit is contained in:
Jiaming Yuan
2019-02-18 00:16:29 +08:00
committed by GitHub
parent 71a604fae3
commit 2e618af743
46 changed files with 97 additions and 72 deletions

View File

@@ -16,7 +16,7 @@
*/
#ifndef XGBOOST_STRICT_R_MODE
#define XGBOOST_STRICT_R_MODE 0
#endif
#endif // XGBOOST_STRICT_R_MODE
/*!
* \brief Whether always log console message with time.
@@ -26,21 +26,21 @@
*/
#ifndef XGBOOST_LOG_WITH_TIME
#define XGBOOST_LOG_WITH_TIME 1
#endif
#endif // XGBOOST_LOG_WITH_TIME
/*!
* \brief Whether customize the logger outputs.
*/
#ifndef XGBOOST_CUSTOMIZE_LOGGER
#define XGBOOST_CUSTOMIZE_LOGGER XGBOOST_STRICT_R_MODE
#endif
#endif // XGBOOST_CUSTOMIZE_LOGGER
/*!
* \brief Whether to customize global PRNG.
*/
#ifndef XGBOOST_CUSTOMIZE_GLOBAL_PRNG
#define XGBOOST_CUSTOMIZE_GLOBAL_PRNG XGBOOST_STRICT_R_MODE
#endif
#endif // XGBOOST_CUSTOMIZE_GLOBAL_PRNG
/*!
* \brief Check if alignas(*) keyword is supported. (g++ 4.8 or higher)
@@ -49,7 +49,7 @@
#define XGBOOST_ALIGNAS(X) alignas(X)
#else
#define XGBOOST_ALIGNAS(X)
#endif
#endif // defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ > 4)
#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ > 4) && \
!defined(__CUDACC__)
@@ -64,7 +64,7 @@
#else
#define XGBOOST_PARALLEL_SORT(X, Y, Z) std::sort((X), (Y), (Z))
#define XGBOOST_PARALLEL_STABLE_SORT(X, Y, Z) std::stable_sort((X), (Y), (Z))
#endif
#endif // GLIBC VERSION
/*!
* \brief Tag function as usable by device
@@ -73,7 +73,7 @@
#define XGBOOST_DEVICE __host__ __device__
#else
#define XGBOOST_DEVICE
#endif
#endif // defined (__CUDA__) || defined(__NVCC__)
/*! \brief namespace of xgboost*/
namespace xgboost {
@@ -215,8 +215,8 @@ using bst_omp_uint = dmlc::omp_uint; // NOLINT
#if __GNUC__ == 4 && __GNUC_MINOR__ < 8
#define override
#define final
#endif
#endif
#endif // __GNUC__ == 4 && __GNUC_MINOR__ < 8
#endif // DMLC_USE_CXX11 && defined(__GNUC__) && !defined(__clang_version__)
} // namespace xgboost
/* Always keep this #include at the bottom of xgboost/base.h */

View File

@@ -13,6 +13,6 @@
#elif defined(__GNUC__)
// Enable __builtin_prefetch for GCC
#define XGBOOST_BUILTIN_PREFETCH_PRESENT
#endif
#endif // GUARDS
#endif // XGBOOST_BUILD_CONFIG_H_

View File

@@ -10,11 +10,12 @@
#ifdef __cplusplus
#define XGB_EXTERN_C extern "C"
#include <cstdio>
#include <cstdint>
#else
#define XGB_EXTERN_C
#include <stdio.h>
#include <stdint.h>
#endif
#endif // __cplusplus
// XGBoost C API will include APIs in Rabit C API
#include <rabit/c_api.h>
@@ -23,7 +24,7 @@
#define XGB_DLL XGB_EXTERN_C __declspec(dllexport)
#else
#define XGB_DLL XGB_EXTERN_C
#endif
#endif // defined(_MSC_VER) || defined(_WIN32)
// manually define unsigned long
typedef uint64_t bst_ulong; // NOLINT(*)
@@ -49,7 +50,7 @@ typedef struct { // NOLINT(*)
long* offset; // NOLINT(*)
#else
int64_t* offset; // NOLINT(*)
#endif
#endif // __APPLE__
/*! \brief labels of each instance */
float* label;
/*! \brief weight of each instance, can be NULL */
@@ -562,7 +563,7 @@ XGB_DLL int XGBoosterGetAttr(BoosterHandle handle,
*
* \param handle handle
* \param key The key of the attribute.
* \param value The value to be saved.
* \param value The value to be saved.
* If nullptr, the attribute would be deleted.
* \return 0 when success, -1 when failure happens
*/

View File

@@ -11,6 +11,7 @@
#include <rabit/rabit.h>
#include <utility>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "./base.h"

View File

@@ -25,7 +25,7 @@ class BaseLogger {
BaseLogger() {
#if XGBOOST_LOG_WITH_TIME
log_stream_ << "[" << dmlc::DateLogger().HumanDate() << "] ";
#endif
#endif // XGBOOST_LOG_WITH_TIME
}
std::ostream& stream() { return log_stream_; } // NOLINT
@@ -116,14 +116,14 @@ class LogCallbackRegistry {
return nullptr;
}
};
#endif
#endif // !defined(XGBOOST_STRICT_R_MODE) || XGBOOST_STRICT_R_MODE == 0
using LogCallbackRegistryStore = dmlc::ThreadLocalStore<LogCallbackRegistry>;
// Redefines LOG_WARNING for controling verbosity
#if defined(LOG_WARNING)
#undef LOG_WARNING
#endif
#endif // defined(LOG_WARNING)
#define LOG_WARNING \
if (::xgboost::ConsoleLogger::ShouldLog( \
::xgboost::ConsoleLogger::LV::kWarning)) \
@@ -133,7 +133,7 @@ using LogCallbackRegistryStore = dmlc::ThreadLocalStore<LogCallbackRegistry>;
// Redefines LOG_INFO for controling verbosity
#if defined(LOG_INFO)
#undef LOG_INFO
#endif
#endif // defined(LOG_INFO)
#define LOG_INFO \
if (::xgboost::ConsoleLogger::ShouldLog( \
::xgboost::ConsoleLogger::LV::kInfo)) \
@@ -142,7 +142,7 @@ using LogCallbackRegistryStore = dmlc::ThreadLocalStore<LogCallbackRegistry>;
#if defined(LOG_DEBUG)
#undef LOG_DEBUG
#endif
#endif // defined(LOG_DEBUG)
#define LOG_DEBUG \
if (::xgboost::ConsoleLogger::ShouldLog( \
::xgboost::ConsoleLogger::LV::kDebug)) \
@@ -152,7 +152,7 @@ using LogCallbackRegistryStore = dmlc::ThreadLocalStore<LogCallbackRegistry>;
// redefines the logging macro if not existed
#ifndef LOG
#define LOG(severity) LOG_##severity.stream()
#endif
#endif // LOG
// Enable LOG(CONSOLE) for print messages to console.
#define LOG_CONSOLE ::xgboost::ConsoleLogger( \

View File

@@ -7,11 +7,14 @@
#pragma once
#include <xgboost/base.h>
#include <xgboost/data.h>
#include <functional>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "../../src/gbm/gbtree_model.h"
#include "../../src/common/host_device_vector.h"