cmTarget: Use null_ptr code path on all platforms
This reduces conversions asked of the compiler. Also drop 'static' from the declaration of the local null_ptr helper.
This commit is contained in:
parent
3a20cef3d7
commit
32a191ce4b
|
@ -4798,11 +4798,7 @@ std::pair<bool, const char*> consistentNumberProperty(const char *lhs,
|
||||||
{
|
{
|
||||||
char *pEnd;
|
char *pEnd;
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
const char* const null_ptr = 0;
|
||||||
static const char* const null_ptr = 0;
|
|
||||||
#else
|
|
||||||
# define null_ptr 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
long lnum = strtol(lhs, &pEnd, 0);
|
long lnum = strtol(lhs, &pEnd, 0);
|
||||||
if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE)
|
if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE)
|
||||||
|
@ -4816,10 +4812,6 @@ std::pair<bool, const char*> consistentNumberProperty(const char *lhs,
|
||||||
return std::pair<bool, const char*>(false, null_ptr);
|
return std::pair<bool, const char*>(false, null_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(_MSC_VER)
|
|
||||||
#undef null_ptr
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (t == NumberMaxType)
|
if (t == NumberMaxType)
|
||||||
{
|
{
|
||||||
return std::make_pair(true, cmMaximum(lnum, rnum) == lnum ? lhs : rhs);
|
return std::make_pair(true, cmMaximum(lnum, rnum) == lnum ? lhs : rhs);
|
||||||
|
@ -4849,11 +4841,7 @@ std::pair<bool, const char*> consistentProperty(const char *lhs,
|
||||||
return std::make_pair(true, lhs);
|
return std::make_pair(true, lhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
const char* const null_ptr = 0;
|
||||||
static const char* const null_ptr = 0;
|
|
||||||
#else
|
|
||||||
# define null_ptr 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch(t)
|
switch(t)
|
||||||
{
|
{
|
||||||
|
@ -4868,11 +4856,6 @@ std::pair<bool, const char*> consistentProperty(const char *lhs,
|
||||||
}
|
}
|
||||||
assert(!"Unreachable!");
|
assert(!"Unreachable!");
|
||||||
return std::pair<bool, const char*>(false, null_ptr);
|
return std::pair<bool, const char*>(false, null_ptr);
|
||||||
|
|
||||||
#if !defined(_MSC_VER)
|
|
||||||
#undef null_ptr
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename PropertyType>
|
template<typename PropertyType>
|
||||||
|
|
Loading…
Reference in New Issue