Add initial support for __int128 to Config and TypeTraits

[SVN r81064]
This commit is contained in:
John Maddock
2012-10-25 12:21:19 +00:00
parent 3fd02775bb
commit bdfa0e0600
8 changed files with 2099 additions and 1956 deletions

View File

@ -146,6 +146,12 @@
# endif
#endif
//
// Recent GCC versions have __int128 when in 64-bit mode:
//
#if defined(__SIZEOF_INT128__)
# define BOOST_HAS_INT128
#endif
// C++0x features in 4.3.n and later
//

View File

@ -489,6 +489,18 @@ namespace boost{
# endif
}
#endif
// same again for __int128:
#if defined(BOOST_HAS_INT128) && defined(__cplusplus)
namespace boost{
# ifdef __GNUC__
__extension__ typedef __int128 int128_type;
__extension__ typedef unsigned __int128 uint128_type;
# else
typedef __int128 int128_type;
typedef unsigned __int128 uint128_type;
# endif
}
#endif
// BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------//
//

File diff suppressed because it is too large Load Diff

36
test/boost_has_int128.ipp Normal file
View File

@ -0,0 +1,36 @@
// (C) Copyright John Maddock 2012.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_INT128
// TITLE: __int128
// DESCRIPTION: The platform supports __int128.
#include <cstdlib>
namespace boost_has_int128{
int test()
{
#ifdef __GNUC__
__extension__ __int128 lli = 0;
__extension__ unsigned __int128 ulli = 0u;
#else
__int128 lli = 0;
unsigned __int128 ulli = 0u;
#endif
(void)&lli;
(void)&ulli;
return 0;
}
}

View File

@ -936,6 +936,7 @@ void print_boost_macros()
PRINT_MACRO(BOOST_HAS_GETSYSTEMTIMEASFILETIME);
PRINT_MACRO(BOOST_HAS_GETTIMEOFDAY);
PRINT_MACRO(BOOST_HAS_HASH);
PRINT_MACRO(BOOST_HAS_INT128);
PRINT_MACRO(BOOST_HAS_LOG1P);
PRINT_MACRO(BOOST_HAS_LONG_LONG);
PRINT_MACRO(BOOST_HAS_MACRO_USE_FACET);
@ -1026,6 +1027,7 @@ void print_boost_macros()
PRINT_MACRO(BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS);
PRINT_MACRO(BOOST_NO_CXX11_NOEXCEPT);
PRINT_MACRO(BOOST_NO_CXX11_NULLPTR);
PRINT_MACRO(BOOST_NO_CXX11_NUMERIC_LIMITS);
PRINT_MACRO(BOOST_NO_CXX11_RANGE_BASED_FOR);
PRINT_MACRO(BOOST_NO_CXX11_RAW_LITERALS);
PRINT_MACRO(BOOST_NO_CXX11_RVALUE_REFERENCES);
@ -1061,7 +1063,6 @@ void print_boost_macros()
PRINT_MACRO(BOOST_NO_MEMBER_TEMPLATE_KEYWORD);
PRINT_MACRO(BOOST_NO_MS_INT64_NUMERIC_LIMITS);
PRINT_MACRO(BOOST_NO_NESTED_FRIENDSHIP);
PRINT_MACRO(BOOST_NO_CXX11_NUMERIC_LIMITS);
PRINT_MACRO(BOOST_NO_OPERATORS_IN_NAMESPACE);
PRINT_MACRO(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS);
PRINT_MACRO(BOOST_NO_POINTER_TO_MEMBER_CONST);
@ -1116,6 +1117,7 @@ void print_boost_macros()
// END GENERATED BLOCK

File diff suppressed because it is too large Load Diff

37
test/has_int128_fail.cpp Normal file
View File

@ -0,0 +1,37 @@
// This file was automatically generated on Thu Oct 25 10:14:36 2012
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.//
// Revision $Id$
//
// Test file for macro BOOST_HAS_INT128
// This file should not compile, if it does then
// BOOST_HAS_INT128 should be defined.
// See file boost_has_int128.ipp for details
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include "test.hpp"
#ifndef BOOST_HAS_INT128
#include "boost_has_int128.ipp"
#else
#error "this file should not compile"
#endif
int main( int, char *[] )
{
return boost_has_int128::test();
}

37
test/has_int128_pass.cpp Normal file
View File

@ -0,0 +1,37 @@
// This file was automatically generated on Thu Oct 25 10:14:36 2012
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.//
// Revision $Id$
//
// Test file for macro BOOST_HAS_INT128
// This file should compile, if it does not then
// BOOST_HAS_INT128 should not be defined.
// See file boost_has_int128.ipp for details
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include "test.hpp"
#ifdef BOOST_HAS_INT128
#include "boost_has_int128.ipp"
#else
namespace boost_has_int128 = empty_boost;
#endif
int main( int, char *[] )
{
return boost_has_int128::test();
}