Use selectany on msvc versions
This commit is contained in:
parent
2e3c6991d3
commit
b2b8cf2f50
@ -50,6 +50,13 @@ THE SOFTWARE.
|
|||||||
# define CXXOPTS_NO_REGEX true
|
# define CXXOPTS_NO_REGEX true
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define CXXOPTS_LINKONCE_CONST __declspec(selectany)
|
||||||
|
#define CXXOPTS_LINKONCE __declspec(selectany)
|
||||||
|
#else
|
||||||
|
#define CXXOPTS_LINKONCE_CONST const
|
||||||
|
#define CXXOPTS_LINKONCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CXXOPTS_NO_REGEX
|
#ifndef CXXOPTS_NO_REGEX
|
||||||
# include <regex>
|
# include <regex>
|
||||||
@ -325,11 +332,11 @@ namespace cxxopts {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
const std::string LQUOTE("\'");
|
CXXOPTS_LINKONCE_CONST std::string LQUOTE("\'");
|
||||||
const std::string RQUOTE("\'");
|
CXXOPTS_LINKONCE_CONST std::string RQUOTE("\'");
|
||||||
#else
|
#else
|
||||||
const std::string LQUOTE("‘");
|
CXXOPTS_LINKONCE_CONST std::string LQUOTE("‘");
|
||||||
const std::string RQUOTE("’");
|
CXXOPTS_LINKONCE_CONST std::string RQUOTE("’");
|
||||||
#endif
|
#endif
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@ -744,18 +751,22 @@ inline ArguDesc ParseArgument(const char *arg, bool &matched)
|
|||||||
#else // CXXOPTS_NO_REGEX
|
#else // CXXOPTS_NO_REGEX
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
CXXOPTS_LINKONCE
|
||||||
std::basic_regex<char> integer_pattern
|
std::basic_regex<char> integer_pattern
|
||||||
("(-)?(0x)?([0-9a-zA-Z]+)|((0x)?0)");
|
("(-)?(0x)?([0-9a-zA-Z]+)|((0x)?0)");
|
||||||
|
CXXOPTS_LINKONCE
|
||||||
std::basic_regex<char> truthy_pattern
|
std::basic_regex<char> truthy_pattern
|
||||||
("(t|T)(rue)?|1");
|
("(t|T)(rue)?|1");
|
||||||
|
CXXOPTS_LINKONCE
|
||||||
std::basic_regex<char> falsy_pattern
|
std::basic_regex<char> falsy_pattern
|
||||||
("(f|F)(alse)?|0");
|
("(f|F)(alse)?|0");
|
||||||
|
CXXOPTS_LINKONCE
|
||||||
std::basic_regex<char> option_matcher
|
std::basic_regex<char> option_matcher
|
||||||
("--([[:alnum:]][-_[:alnum:]\\.]+)(=(.*))?|-([[:alnum:]].*)");
|
("--([[:alnum:]][-_[:alnum:]\\.]+)(=(.*))?|-([[:alnum:]].*)");
|
||||||
|
CXXOPTS_LINKONCE
|
||||||
std::basic_regex<char> option_specifier
|
std::basic_regex<char> option_specifier
|
||||||
("([[:alnum:]][-_[:alnum:]\\.]*)(,[ ]*[[:alnum:]][-_[:alnum:]]*)*");
|
("([[:alnum:]][-_[:alnum:]\\.]*)(,[ ]*[[:alnum:]][-_[:alnum:]]*)*");
|
||||||
|
CXXOPTS_LINKONCE
|
||||||
std::basic_regex<char> option_specifier_separator(", *");
|
std::basic_regex<char> option_specifier_separator(", *");
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user