Skip to content

Commit

Permalink
feat(windows): add TEST_API for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyewww committed Feb 4, 2024
1 parent 01d6d98 commit 6590cb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions paddle/utils/flags_native.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 6 additions & 5 deletions paddle/utils/flags_native.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>& flags, bool error_fatal);
TEST_API void SetFlagsFromEnv(const std::vector<std::string>& 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.
Expand Down

0 comments on commit 6590cb3

Please sign in to comment.