support for IBM z/OS XL C/C++ (configure script & compiler/platform/stdlib headers)

This commit is contained in:
Paul Groke
2017-02-21 22:03:15 +01:00
parent 5ff8f83739
commit a01d4996bf
12 changed files with 387 additions and 29 deletions

4
configure vendored
View File

@ -2614,7 +2614,7 @@ for file in $boost_base/libs/config/test/boost_no*.ipp; do
basename=`echo $file | $SED 's/.*boost_\(.*\)\.ipp/\1/'`
macroname=`cat $file | grep '^//[ ]*MACRO:' | $SED 's/.*MACRO:[ ]*\([_A-Z0-9]*\).*/\1/'`
title=`cat $file | grep '^//[ ]*TITLE:' | $SED 's/.*TITLE:[ ]*\([^ ].*\)/\1/'`
namespace=`echo $macroname | tr [A-Z] [a-z]`
namespace=`echo $macroname | tr $as_cr_LETTERS $as_cr_letters`
#echo file = $file
#echo basename = $basename
@ -2777,7 +2777,7 @@ for file in $boost_base/libs/config/test/boost_has*.ipp; do
basename=`echo $file | $SED 's/.*boost_\(.*\)\.ipp/\1/'`
macroname=`cat $file | grep '^//[ ]*MACRO:' | $SED 's/.*MACRO:[ ]*\([_A-Z0-9]*\).*/\1/'`
title=`cat $file | grep '^//[ ]*TITLE:' | $SED 's/.*TITLE:[ ]*\([^ ].*\)/\1/'`
namespace=`echo $macroname | tr [A-Z] [a-z]`
namespace=`echo $macroname | tr $as_cr_LETTERS $as_cr_letters`
# echo $file
# echo $basename

View File

@ -0,0 +1,200 @@
// Copyright (c) 2017 Dynatrace
//
// Distributed under 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 for most recent version.
// Compiler setup for IBM z/OS XL C/C++ compiler.
// Oldest compiler version currently supported is 2.1 (V2R1)
#if !defined(__IBMCPP__) || !defined(__COMPILER_VER__) || __COMPILER_VER__ < 0x42010000
# error "Compiler not supported or configured - please reconfigure"
#endif
#if __COMPILER_VER__ > 0x42010000
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# endif
#endif
#define BOOST_COMPILER "IBM z/OS XL C/C++ version " BOOST_STRINGIZE(__COMPILER_VER__)
#define BOOST_XLCPP_ZOS __COMPILER_VER__
// -------------------------------------
#include <features.h> // For __UU, __C99, __TR1, ...
#if !defined(BOOST_XLCPP_ZOS_DO_NOT_GUESS)
# if (defined(__C99_MIXED_STRING_CONCAT) \
&& defined(__C99_MAX_LINE_NUMBER) \
&& defined(__C99_EMPTY_MACRO_ARGUMENTS) \
&& defined(__C99_LLONG) \
&& defined(__IBMCPP_C99_PREPROCESSOR) \
&& defined(__IBMCPP_C99_LONG_LONG) \
&& defined(__IBM_CHAR32_T__) \
&& defined(__IBM_CHAR16_T__) \
&& defined(__IBMCPP_VARIADIC_TEMPLATES) \
&& defined(__IBMCPP_STATIC_ASSERT) \
&& defined(__IBMCPP_SCOPED_ENUM) \
&& defined(__IBMCPP_RVALUE_REFERENCES) \
&& defined(__IBMCPP_RIGHT_ANGLE_BRACKET) \
&& defined(__IBMCPP_REFERENCE_COLLAPSING) \
&& defined(__IBMCPP_INLINE_NAMESPACE) \
&& defined(__IBMCPP_EXTENDED_FRIEND) \
&& defined(__IBMCPP_EXPLICIT_CONVERSION_OPERATORS) \
&& defined(__IBMCPP_DELEGATING_CTORS) \
&& defined(__IBMCPP_DECLTYPE) \
&& defined(__IBMCPP_CONSTEXPR) \
&& defined(__IBMCPP_AUTO_TYPEDEDUCTION) \
)
// According to documentation, the "defaulted and deleted functions" feature should be testable via the predefined macro __IBMCPP_DEFAULTED_AND_DELETED_FUNCTIONS.
// Unfortunately this doesn't work, the macro is actually never defined (compiler version V2R1).
// Guess: defaulted and deleted functions feature is active if ALL other C++11 features supported by the compiler are active.
# if !defined(__IBMCPP_DEFAULTED_AND_DELETED_FUNCTIONS)
# define __IBMCPP_DEFAULTED_AND_DELETED_FUNCTIONS 1
# endif
# endif
#endif
#if !defined(__IBMCPP_DEFAULTED_AND_DELETED_FUNCTIONS)
# define BOOST_NO_CXX11_DELETED_FUNCTIONS
# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
# define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS
#endif
// -------------------------------------
#if defined(__UU) || defined(__C99) || defined(__TR1)
# define BOOST_HAS_LOG1P
# define BOOST_HAS_EXPM1
#endif
#if defined(__C99) || defined(__TR1)
# define BOOST_HAS_STDINT_H
#else
# define BOOST_NO_FENV_H
#endif
// -------------------------------------
#define BOOST_HAS_NRVO
#if !defined(__RTTI_ALL__)
# define BOOST_NO_RTTI
#endif
#if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
# define BOOST_NO_EXCEPTIONS
#endif
#if defined(_LONG_LONG) || defined(__IBMCPP_C99_LONG_LONG) || defined(__LL)
# define BOOST_HAS_LONG_LONG
#else
# define BOOST_NO_LONG_LONG
#endif
#if defined(_LONG_LONG) || defined(__IBMCPP_C99_LONG_LONG) || defined(__LL) || defined(_LP64)
# define BOOST_HAS_MS_INT64
#endif
#define BOOST_NO_SFINAE_EXPR
#if defined(__IBMCPP_VARIADIC_TEMPLATES)
# define BOOST_HAS_VARIADIC_TMPL
#else
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
#endif
#if defined(__IBMCPP_STATIC_ASSERT)
# define BOOST_HAS_STATIC_ASSERT
#else
# define BOOST_NO_CXX11_STATIC_ASSERT
#endif
#if defined(__IBMCPP_RVALUE_REFERENCES)
# define BOOST_HAS_RVALUE_REFS
#else
# define BOOST_NO_CXX11_RVALUE_REFERENCES
#endif
#if !defined(__IBMCPP_SCOPED_ENUM)
# define BOOST_NO_CXX11_SCOPED_ENUMS
#endif
#define BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
#if !defined(__IBMCPP_EXPLICIT_CONVERSION_OPERATORS)
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
#endif
#if !defined(__IBMCPP_DECLTYPE)
# define BOOST_NO_CXX11_DECLTYPE
#else
# define BOOST_HAS_DECLTYPE
#endif
#define BOOST_NO_CXX11_DECLTYPE_N3276
#if !defined(__IBMCPP_INLINE_NAMESPACE)
# define BOOST_NO_CXX11_INLINE_NAMESPACES
#endif
#if !defined(__IBMCPP_AUTO_TYPEDEDUCTION)
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
# define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
#endif
#if !defined(__IBM_CHAR32_T__)
# define BOOST_NO_CXX11_CHAR32_T
#endif
#if !defined(__IBM_CHAR16_T__)
# define BOOST_NO_CXX11_CHAR16_T
#endif
#if !defined(__IBMCPP_CONSTEXPR)
# define BOOST_NO_CXX11_CONSTEXPR
#endif
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
#define BOOST_NO_CXX11_UNICODE_LITERALS
#define BOOST_NO_CXX11_RAW_LITERALS
#define BOOST_NO_CXX11_RANGE_BASED_FOR
#define BOOST_NO_CXX11_NULLPTR
#define BOOST_NO_CXX11_NOEXCEPT
#define BOOST_NO_CXX11_LAMBDAS
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
#define BOOST_NO_CXX11_THREAD_LOCAL
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_FINAL
#define BOOST_NO_CXX11_ALIGNAS
#define BOOST_NO_CXX14_VARIABLE_TEMPLATES
#define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
#define BOOST_NO_CXX14_AGGREGATE_NSDMI
#define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
#define BOOST_NO_CXX14_GENERIC_LAMBDAS
#define BOOST_NO_CXX14_DIGIT_SEPARATORS
#define BOOST_NO_CXX14_DECLTYPE_AUTO
#define BOOST_NO_CXX14_CONSTEXPR
#define BOOST_NO_CXX14_BINARY_LITERALS
// -------------------------------------
#define BOOST_SP_NO_SYNC
// -------------------------------------
#if defined(__IBM_ATTRIBUTES)
# define BOOST_FORCEINLINE inline __attribute__ ((__always_inline__))
# define BOOST_NOINLINE __attribute__ ((__noinline__))
# define BOOST_ALIGNMENT(x) __attribute__ ((__aligned__(x)))
#endif
extern "builtin" long __builtin_expect(long, long);
#define BOOST_LIKELY(x) __builtin_expect((x) && true, 1)
#define BOOST_UNLIKELY(x) __builtin_expect((x) && true, 0)

View File

@ -0,0 +1,32 @@
// Copyright (c) 2017 Dynatrace
//
// Distributed under 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 for most recent version.
// Platform setup for IBM z/OS.
#define BOOST_PLATFORM "IBM z/OS"
#include <features.h> // For __UU, __C99, __TR1, ...
#if defined(__UU)
# define BOOST_HAS_GETTIMEOFDAY
#endif
#if defined(_OPEN_THREADS) || defined(__SUSV3_THR)
# define BOOST_HAS_PTHREADS
# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
# define BOOST_HAS_THREADS
#endif
#if defined(__SUSV3) || defined(__SUSV3_THR)
# define BOOST_HAS_SCHED_YIELD
#endif
#define BOOST_HAS_SIGACTION
#define BOOST_HAS_UNISTD_H
#define BOOST_HAS_DIRENT_H
#define BOOST_HAS_NL_TYPES_H

View File

@ -92,6 +92,10 @@
// MPW MrCpp or SCpp
# define BOOST_COMPILER_CONFIG "boost/config/compiler/mpw.hpp"
#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
// IBM z/OS XL C/C++
# define BOOST_COMPILER_CONFIG "boost/config/compiler/xlcpp_zos.hpp"
#elif defined(__ibmxl__)
// IBM XL C/C++ for Linux (Little Endian)
# define BOOST_COMPILER_CONFIG "boost/config/compiler/xlcpp.hpp"
@ -140,6 +144,8 @@
#include <boost/config/compiler/sunpro_cc.hpp>
#include <boost/config/compiler/hp_acc.hpp>
#include <boost/config/compiler/mpw.hpp>
#include <boost/config/compiler/xlcpp_zos.hpp>
#include <boost/config/compiler/xlcpp.hpp>
#include <boost/config/compiler/vacpp.hpp>
#include <boost/config/compiler/pgi.hpp>
#include <boost/config/compiler/visualc.hpp>

View File

@ -53,8 +53,12 @@
// MacOS
# define BOOST_PLATFORM_CONFIG "boost/config/platform/macos.hpp"
#elif defined(__TOS_MVS__)
// IBM z/OS
# define BOOST_PLATFORM_CONFIG "boost/config/platform/zos.hpp"
#elif defined(__IBMCPP__) || defined(_AIX)
// IBM
// IBM AIX
# define BOOST_PLATFORM_CONFIG "boost/config/platform/aix.hpp"
#elif defined(__amigaos__)
@ -122,6 +126,7 @@
# include "boost/config/platform/win32.hpp"
# include "boost/config/platform/beos.hpp"
# include "boost/config/platform/macos.hpp"
# include "boost/config/platform/zos.hpp"
# include "boost/config/platform/aix.hpp"
# include "boost/config/platform/amigaos.hpp"
# include "boost/config/platform/qnxnto.hpp"

View File

@ -66,6 +66,10 @@
// MSL standard lib:
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/msl.hpp"
#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
// IBM z/OS XL C/C++
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/xlcpp_zos.hpp"
#elif defined(__IBMCPP__)
// take the default VACPP std lib
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/vacpp.hpp"
@ -98,6 +102,7 @@
# include "boost/config/stdlib/libstdcpp3.hpp"
# include "boost/config/stdlib/sgi.hpp"
# include "boost/config/stdlib/msl.hpp"
# include "boost/config/stdlib/xlcpp_zos.hpp"
# include "boost/config/stdlib/vacpp.hpp"
# include "boost/config/stdlib/modena.hpp"
# include "boost/config/stdlib/dinkumware.hpp"

View File

@ -0,0 +1,67 @@
// Copyright (c) 2017 Dynatrace
//
// Distributed under 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 for most recent version.
// Standard library setup for IBM z/OS XL C/C++ compiler.
// Oldest library version currently supported is 2.1 (V2R1)
#if __TARGET_LIB__ < 0x42010000
# error "Library version not supported or configured - please reconfigure"
#endif
#if __TARGET_LIB__ > 0x42010000
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown library version - please run the configure tests and report the results"
# endif
#endif
#define BOOST_STDLIB "IBM z/OS XL C/C++ standard library"
#define BOOST_HAS_MACRO_USE_FACET
// Unfortunately the IBM z/OS XL C/C++ standard library has a bug when it comes to locales...
// The locale-enabled overloads of functions like std::isdigit or std::tolower in <locale> are defined in a nested namespace and pulled into "std" via "using namespace xyz;".
// The classic C versions of those functions are defined in the global namespace, and then pulled into "std" via "using ::functionname;" in <cctype>.
// This causes problems when including both <locale> and <cctype>, because the compiler will stop looking after it finds a function that was pulled in via "using ::functionname;"
// (which is correct behavior as far as the compiler is concerned).
// I.e. you cannot call a locale-enabled overload of one of those functions if both <locale> and <cctype> were included.
// To deal with this we have to define at least BOOST_DATE_TIME_NO_LOCALE (possibly others?), even though there - theoretically - *is* support for locales.
#define BOOST_DATE_TIME_NO_LOCALE
#define BOOST_NO_CXX11_HDR_TYPE_TRAITS
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#define BOOST_NO_CXX11_ADDRESSOF
#define BOOST_NO_CXX11_SMART_PTR
#define BOOST_NO_CXX11_ATOMIC_SMART_PTR
#define BOOST_NO_CXX11_NUMERIC_LIMITS
#define BOOST_NO_CXX11_ALLOCATOR
#define BOOST_NO_CXX11_HDR_FUNCTIONAL
#define BOOST_NO_CXX11_HDR_UNORDERED_SET
#define BOOST_NO_CXX11_HDR_UNORDERED_MAP
#define BOOST_NO_CXX11_HDR_TYPEINDEX
#define BOOST_NO_CXX11_HDR_TUPLE
#define BOOST_NO_CXX11_HDR_THREAD
#define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
#define BOOST_NO_CXX11_HDR_REGEX
#define BOOST_NO_CXX11_HDR_RATIO
#define BOOST_NO_CXX11_HDR_RANDOM
#define BOOST_NO_CXX11_HDR_MUTEX
#define BOOST_NO_CXX11_HDR_FUTURE
#define BOOST_NO_CXX11_HDR_FORWARD_LIST
#define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
#define BOOST_NO_CXX11_HDR_CODECVT
#define BOOST_NO_CXX11_HDR_CHRONO
#define BOOST_NO_CXX11_HDR_ATOMIC
#define BOOST_NO_CXX11_HDR_ARRAY
#define BOOST_NO_CXX11_STD_ALIGN
#define BOOST_NO_CXX14_STD_EXCHANGE
#define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#define BOOST_NO_CXX17_STD_INVOKE
#define BOOST_NO_CXX17_STD_APPLY

View File

@ -676,6 +676,7 @@ namespace std{ using ::type_info; }
// Type and data alignment specification
//
#if !defined(BOOST_ALIGNMENT)
# if !defined(BOOST_NO_CXX11_ALIGNAS)
# define BOOST_ALIGNMENT(x) alignas(x)
# elif defined(_MSC_VER)
@ -686,6 +687,7 @@ namespace std{ using ::type_info; }
# define BOOST_NO_ALIGNMENT
# define BOOST_ALIGNMENT(x)
# endif
#endif
// Lack of non-public defaulted functions is implied by the lack of any defaulted functions
#if !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS) && defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -166,7 +166,7 @@ for file in $boost_base/libs/config/test/boost_no*.ipp; do
basename=`echo $file | $SED 's/.*boost_\(.*\)\.ipp/\1/'`
macroname=`cat $file | grep '^//[[ ]]*MACRO:' | $SED 's/.*MACRO:[[ ]]*\([[_A-Z0-9]]*\).*/\1/'`
title=`cat $file | grep '^//[[ ]]*TITLE:' | $SED 's/.*TITLE:[[ ]]*\([[^ ]].*\)/\1/'`
namespace=`echo $macroname | tr [[A-Z]] [[a-z]]`
namespace=`echo $macroname | tr $as_cr_LETTERS $as_cr_letters`
#echo file = $file
#echo basename = $basename
@ -234,7 +234,7 @@ for file in $boost_base/libs/config/test/boost_has*.ipp; do
basename=`echo $file | $SED 's/.*boost_\(.*\)\.ipp/\1/'`
macroname=`cat $file | grep '^//[[ ]]*MACRO:' | $SED 's/.*MACRO:[[ ]]*\([[_A-Z0-9]]*\).*/\1/'`
title=`cat $file | grep '^//[[ ]]*TITLE:' | $SED 's/.*TITLE:[[ ]]*\([[^ ]].*\)/\1/'`
namespace=`echo $macroname | tr [[A-Z]] [[a-z]]`
namespace=`echo $macroname | tr $as_cr_LETTERS $as_cr_letters`
# echo $file
# echo $basename