forked from boostorg/config
Merge branch 'z_OS_support' of https://github.com/pgroke-dt/config into develop
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
This commit is contained in:
1 parent
7a78d997d0
commit
ed79ada80e
12 files changed
+343
-29
No files matched your search
+49
-10
@@ -1,4 +1,5 @@
|
||||
// (C) Copyright John Maddock 2012.
|
||||
// (C) Copyright Dynatrace 2017.
|
||||
// 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)
|
||||
@@ -10,21 +11,59 @@
|
||||
// DESCRIPTION: The platform supports __int128.
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
namespace boost_has_int128{
|
||||
|
||||
#ifdef __GNUC__
|
||||
__extension__ typedef __int128 my_int128_t;
|
||||
__extension__ typedef unsigned __int128 my_uint128_t;
|
||||
#else
|
||||
typedef __int128 my_int128_t;
|
||||
typedef unsigned __int128 my_uint128_t;
|
||||
#endif
|
||||
|
||||
my_uint128_t volatile g_ui128 = 0;
|
||||
unsigned long volatile g_ul = 0;
|
||||
|
||||
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;
|
||||
my_int128_t si128 = 0;
|
||||
(void)&si128;
|
||||
|
||||
// Some compilers have seriously broken __int128 implementations, so we need to do a little more than simply check if we can declare variables with __int128...
|
||||
// #1: check __int128 size
|
||||
if (sizeof(my_uint128_t) < (128 / CHAR_BIT))
|
||||
{
|
||||
fputs("Type too small.", stderr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// #2: check result of computation with __int128
|
||||
my_uint128_t p1 = 1;
|
||||
my_uint128_t p2 = 1;
|
||||
unsigned int i = 0;
|
||||
for (; i < 180; i++)
|
||||
{
|
||||
g_ui128 = p1 + p2;
|
||||
if (g_ui128 < p1)
|
||||
{
|
||||
fputs("Unexpected overflow.", stderr);
|
||||
return 1;
|
||||
}
|
||||
p2 = p1;
|
||||
p1 = g_ui128;
|
||||
}
|
||||
|
||||
g_ul = static_cast<unsigned long>((g_ui128 >> 92) & 0xFFFFFFFFUL);
|
||||
g_ul -= 1216382273UL;
|
||||
if (g_ul != 0)
|
||||
{
|
||||
fputs("Incorrect computation result.", stderr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Copyright (C) 2009 Andrey Semashev
|
||||
// Copyright (C) 2017 Dynatrace
|
||||
// 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)
|
||||
@@ -11,13 +12,13 @@
|
||||
|
||||
namespace boost_no_cxx11_auto_declarations {
|
||||
|
||||
void check_f(int&)
|
||||
void check_f(short&)
|
||||
{
|
||||
}
|
||||
|
||||
int test()
|
||||
{
|
||||
auto x = 10;
|
||||
auto x = static_cast<short>(10);
|
||||
check_f(x);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Copyright (C) 2009 Andrey Semashev
|
||||
// Copyright (C) 2017 Dynatrace
|
||||
// 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)
|
||||
@@ -11,13 +12,13 @@
|
||||
|
||||
namespace boost_no_cxx11_auto_multideclarations {
|
||||
|
||||
void check_f(int&, int*&)
|
||||
void check_f(short&, short*&)
|
||||
{
|
||||
}
|
||||
|
||||
int test()
|
||||
{
|
||||
auto x = 10, *y = &x;
|
||||
auto x = static_cast<short>(10), *y = &x;
|
||||
check_f(x, y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user