From 6590cb3fc9902aa82ae69169389c3e484fc6891f Mon Sep 17 00:00:00 2001 From: xiaoyewww <641311428@qq.com> Date: Sun, 4 Feb 2024 15:30:56 +0000 Subject: [PATCH] feat(windows): add TEST_API for windows --- paddle/utils/flags_native.cc | 5 +++-- paddle/utils/flags_native.h | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/paddle/utils/flags_native.cc b/paddle/utils/flags_native.cc index 46a91a10c2ed15..982a7da39eb50a 100644 --- a/paddle/utils/flags_native.cc +++ b/paddle/utils/flags_native.cc @@ -509,8 +509,9 @@ T GetFromEnv(const std::string& name, const T& default_val) { } } -#define INSTANTIATE_GET_FROM_ENV(type) \ - template type GetFromEnv(const std::string& name, const type& default_val) +#define INSTANTIATE_GET_FROM_ENV(type) \ + template TEST_API type GetFromEnv(const std::string& name, \ + const type& default_val) INSTANTIATE_GET_FROM_ENV(bool); INSTANTIATE_GET_FROM_ENV(int32_t); diff --git a/paddle/utils/flags_native.h b/paddle/utils/flags_native.h index 979991fd21a80a..0a2558373df396 100644 --- a/paddle/utils/flags_native.h +++ b/paddle/utils/flags_native.h @@ -52,24 +52,25 @@ TEST_API void AllowUndefinedFlags(); * Otherwise, the errors above will be ignored, that is the same effect as using * commandline argument "--tryfromenv=var_name1,var_name2,...". */ -void SetFlagsFromEnv(const std::vector& flags, bool error_fatal); +TEST_API void SetFlagsFromEnv(const std::vector& flags, + bool error_fatal); /** * @brief Set Single flag value, return true if success. */ -bool SetFlagValue(const std::string& name, const std::string& value); +TEST_API bool SetFlagValue(const std::string& name, const std::string& value); /** * @brief Find flag by name, return true if found. */ -bool FindFlag(const std::string& name); +TEST_API bool FindFlag(const std::string& name); /** * @brief Print all registered flags' help message. If to_file is true, * write help message to file. */ -void PrintAllFlagHelp(bool to_file = false, - const std::string& file_name = "all_flags.txt"); +TEST_API void PrintAllFlagHelp(bool to_file = false, + const std::string& file_name = "all_flags.txt"); /** * @brief Get environment variable. If not found, return default value.