Check for 'long long' without computing size
In KWSys IOStream we need to detect whether 'long long' exists but we do not need its size. We avoid using CHECK_TYPE_SIZE because it does not work for types whose size varies across architectuers in Mac OS X universal binaries. See issue #9913.
This commit is contained in:
parent
2a789187fc
commit
2d80c9e31a
|
@ -534,8 +534,9 @@ ENDIF(KWSYS_USE_FundamentalType)
|
|||
|
||||
IF(KWSYS_USE_IOStream)
|
||||
# Determine whether iostreams support long long.
|
||||
CHECK_TYPE_SIZE("long long" KWSYS_SIZEOF_LONG_LONG)
|
||||
IF(KWSYS_SIZEOF_LONG_LONG)
|
||||
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_LONG_LONG
|
||||
"Checking whether C++ compiler has 'long long'" DIRECT)
|
||||
IF(KWSYS_CXX_HAS_LONG_LONG)
|
||||
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
|
||||
-DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
|
||||
-DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD})
|
||||
|
@ -544,10 +545,10 @@ IF(KWSYS_USE_IOStream)
|
|||
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_OSTREAM_LONG_LONG
|
||||
"Checking if ostream supports long long" DIRECT)
|
||||
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
|
||||
ELSE(KWSYS_SIZEOF_LONG_LONG)
|
||||
ELSE()
|
||||
SET(KWSYS_IOS_HAS_ISTREAM_LONG_LONG 0)
|
||||
SET(KWSYS_IOS_HAS_OSTREAM_LONG_LONG 0)
|
||||
ENDIF(KWSYS_SIZEOF_LONG_LONG)
|
||||
ENDIF()
|
||||
ENDIF(KWSYS_USE_IOStream)
|
||||
|
||||
IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
|
||||
|
|
|
@ -113,6 +113,15 @@ void f(size_t) {}
|
|||
int main() { return 0; }
|
||||
#endif
|
||||
|
||||
#ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
|
||||
long long f(long long n) { return n; }
|
||||
int main()
|
||||
{
|
||||
long long n = 0;
|
||||
return static_cast<int>(f(n));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
|
||||
template <class T> class A;
|
||||
template <class T> int f(A<T>&);
|
||||
|
|
Loading…
Reference in New Issue