Commit 6b288215 authored by Guolin Ke's avatar Guolin Ke
Browse files

fix keyword error in VS2013

parent 81f45947
...@@ -495,9 +495,12 @@ ColumnFunctionFromCSC(const void* col_ptr, int col_ptr_type, const int32_t* indi ...@@ -495,9 +495,12 @@ ColumnFunctionFromCSC(const void* col_ptr, int col_ptr_type, const int32_t* indi
std::vector<double> std::vector<double>
SampleFromOneColumn(const std::vector<std::pair<int, double>>& data, const std::vector<int>& indices); SampleFromOneColumn(const std::vector<std::pair<int, double>>& data, const std::vector<int>& indices);
#if defined(_MSC_VER)
// exception handle and error msg // exception handle and error msg
static char* LastErrorMsg() { static __declspec(thread) char err_msg[512] = "Everything is fine"; return err_msg; }
#else
static char* LastErrorMsg() { static thread_local char err_msg[512] = "Everything is fine"; return err_msg; } static char* LastErrorMsg() { static thread_local char err_msg[512] = "Everything is fine"; return err_msg; }
#endif
inline void LGBM_SetLastError(const char* msg) { inline void LGBM_SetLastError(const char* msg) {
std::strcpy(LastErrorMsg(), msg); std::strcpy(LastErrorMsg(), msg);
......
...@@ -89,7 +89,11 @@ private: ...@@ -89,7 +89,11 @@ private:
// a trick to use static variable in header file. // a trick to use static variable in header file.
// May be not good, but avoid to use an additional cpp file // May be not good, but avoid to use an additional cpp file
#if defined(_MSC_VER)
static LogLevel& GetLevel() { static __declspec(thread) LogLevel level = LogLevel::Info; return level; }
#else
static LogLevel& GetLevel() { static thread_local LogLevel level = LogLevel::Info; return level; } static LogLevel& GetLevel() { static thread_local LogLevel level = LogLevel::Info; return level; }
#endif
}; };
......
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