diff --git a/paddle/fluid/platform/port.h b/paddle/fluid/platform/port.h index 4ff07edc19567e27f29ac6614783909e7e55d331..347622f212f842ae5ab06b5bc376754befba8d50 100644 --- a/paddle/fluid/platform/port.h +++ b/paddle/fluid/platform/port.h @@ -24,42 +24,42 @@ #include "glog/logging.h" #if !defined(_WIN32) -#define UNUSED __attribute__((unused)) -#include // dladdr -#include // backtrace -#include -#include // std::accumulate + #define UNUSED __attribute__((unused)) + #include // dladdr + #include // backtrace + #include + #include // std::accumulate #else -#include -#include // _popen, _pclose -#include -#include // std::accumulate in msvc -// windows version of __attribute__((unused)) -#define UNUSED __pragma(warning(suppress : 4100)) - -#ifndef S_ISDIR // windows port for sys/stat.h -#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) -#endif // S_ISDIR - -static void *dlsym(void *handle, const char *symbol_name) { - FARPROC found_symbol; - found_symbol = GetProcAddress((HMODULE)handle, symbol_name); - - if (found_symbol == NULL) { - throw std::runtime_error(std::string(symbol_name) + " not found."); - } - return reinterpret_cast(found_symbol); -} + #include + #include // _popen, _pclose + #include + #include // std::accumulate in msvc + // windows version of __attribute__((unused)) + #define UNUSED __pragma(warning(suppress : 4100)) + + #ifndef S_ISDIR // windows port for sys/stat.h + #define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) + #endif // S_ISDIR + + static void *dlsym(void *handle, const char *symbol_name) { + FARPROC found_symbol; + found_symbol = GetProcAddress((HMODULE)handle, symbol_name); + + if (found_symbol == NULL) { + throw std::runtime_error(std::string(symbol_name) + " not found."); + } + return reinterpret_cast(found_symbol); + } -static void *dlopen(const char *filename, int flag) { - std::string file_name(filename); - file_name.replace(0, file_name.size() - 1, '/', '\\'); - HMODULE hModule = LoadLibrary(file_name.c_str()); - if (!hModule) { - throw std::runtime_error(file_name + " not found."); - } - return reinterpret_cast(hModule); -} + static void *dlopen(const char *filename, int flag) { + std::string file_name(filename); + file_name.replace(0, file_name.size() - 1, '/', '\\'); + HMODULE hModule = LoadLibrary(file_name.c_str()); + if (!hModule) { + throw std::runtime_error(file_name + " not found."); + } + return reinterpret_cast(hModule); + } #endif // !_WIN32