mirror of
https://github.com/boostorg/config.git
synced 2025-07-30 04:17:16 +02:00
Make Boost.Config C language compatible.
[SVN r70953]
This commit is contained in:
@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
// if we don't have a std library config set, try and find one:
|
||||
#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG)
|
||||
#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) && defined(__cplusplus)
|
||||
# include <boost/config/select_stdlib_config.hpp>
|
||||
#endif
|
||||
// if we have a std library config, include it now:
|
||||
|
@ -56,6 +56,7 @@
|
||||
# define BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
# define BOOST_NO_DEDUCED_TYPENAME
|
||||
// workaround for missing WCHAR_MAX/WCHAR_MIN:
|
||||
#ifdef __cplusplus
|
||||
#include <climits>
|
||||
#include <cwchar>
|
||||
#ifndef WCHAR_MAX
|
||||
@ -65,9 +66,10 @@
|
||||
# define WCHAR_MIN 0
|
||||
#endif
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
// Borland C++ Builder 6 and below:
|
||||
#if (__BORLANDC__ <= 0x564)
|
||||
#if (__BORLANDC__ <= 0x564) && defined(__cplusplus)
|
||||
|
||||
# ifdef NDEBUG
|
||||
// fix broken <cstring> so that Boost.test works:
|
||||
|
@ -60,7 +60,7 @@
|
||||
// (Niels Dekker, LKEB, April 2010)
|
||||
# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
|
||||
# ifdef NDEBUG
|
||||
# if defined(NDEBUG) && defined(__cplusplus)
|
||||
// fix broken <cstring> so that Boost.test works:
|
||||
# include <cstring>
|
||||
# undef strcmp
|
||||
|
@ -44,7 +44,9 @@
|
||||
//
|
||||
// Is this really the best way to detect whether the std lib is in namespace std?
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#endif
|
||||
#if !defined(__STL_IMPORT_VENDOR_CSTD) && !defined(_STLP_IMPORT_VENDOR_CSTD)
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
#endif
|
||||
|
@ -121,6 +121,7 @@
|
||||
// in type_traits code among other things, getting this correct
|
||||
// for the Intel compiler is actually remarkably fragile and tricky:
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#if defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
#include <cwchar>
|
||||
template< typename T > struct assert_no_intrinsic_wchar_t;
|
||||
@ -134,6 +135,7 @@ template<> struct assert_intrinsic_wchar_t<wchar_t> {};
|
||||
// if you see an error here then define BOOST_NO_INTRINSIC_WCHAR_T on the command line:
|
||||
template<> struct assert_intrinsic_wchar_t<unsigned short> {};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER+0 >= 1000)
|
||||
# if _MSC_VER >= 1200
|
||||
|
@ -11,7 +11,11 @@
|
||||
#define BOOST_PLATFORM "linux"
|
||||
|
||||
// make sure we have __GLIBC_PREREQ if available at all
|
||||
#ifdef __cplusplus
|
||||
#include <cstdlib>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
// <stdint.h> added to glibc 2.1.1
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define BOOST_SYMBIAN 1
|
||||
|
||||
|
||||
#if defined(__S60_3X__)
|
||||
#if defined(__S60_3X__) && defined(__cplusplus)
|
||||
// Open C / C++ plugin was introdused in this SDK, earlier versions don't have CRT / STL
|
||||
# define BOOST_S60_3rd_EDITION_FP2_OR_LATER_SDK
|
||||
// make sure we have __GLIBC_PREREQ if available at all
|
||||
|
@ -14,7 +14,11 @@
|
||||
// First include <cstddef> to determine if some version of STLport is in use as the std lib
|
||||
// (do not rely on this header being included since users can short-circuit this header
|
||||
// if they know whose std lib they are using.)
|
||||
#include <cstddef>
|
||||
#ifdef __cplusplus
|
||||
# include <cstddef>
|
||||
#else
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
// STLPort library; this _must_ come first, otherwise since
|
||||
|
@ -86,10 +86,12 @@
|
||||
# define BOOST_NO_STD_LOCALE
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <typeinfo>
|
||||
#if !_HAS_EXCEPTIONS
|
||||
# define BOOST_NO_STD_TYPEINFO
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// C++0x headers implemented in 520 (as shipped by Microsoft)
|
||||
//
|
||||
|
@ -8,7 +8,7 @@
|
||||
// config for libc++
|
||||
// Might need more in here later.
|
||||
|
||||
#if !defined(_LIBCPP_VERSION)
|
||||
#if !defined(_LIBCPP_VERSION) && defined(__cplusplus)
|
||||
# include <ciso646>
|
||||
# if !defined(_LIBCPP_VERSION)
|
||||
# error "This is not libc++!"
|
||||
|
@ -26,7 +26,9 @@
|
||||
#endif
|
||||
|
||||
// check C lib version for <stdint.h>
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#endif
|
||||
|
||||
#if defined(__MSL__) && (__MSL__ >= 0x5000)
|
||||
# define BOOST_HAS_STDINT_H
|
||||
|
@ -91,7 +91,7 @@
|
||||
//
|
||||
// If this is GNU libstdc++2, then no <limits> and no std::wstring:
|
||||
//
|
||||
#if (defined(__GNUC__) && (__GNUC__ < 3))
|
||||
#if (defined(__GNUC__) && (__GNUC__ < 3) && defined(__cplusplus))
|
||||
# include <string>
|
||||
# if defined(__BASTRING__)
|
||||
# define BOOST_NO_LIMITS
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
// STLPort standard library config:
|
||||
|
||||
#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && defined(__cplusplus)
|
||||
# include <cstddef>
|
||||
# if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
# error "This is not STLPort!"
|
||||
@ -203,7 +203,7 @@ namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy;
|
||||
//
|
||||
// gcc-2.95.3/STLPort does not like the using declarations we use to get ADL with std::min/max
|
||||
//
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3)
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3) && defined(__cplusplus)
|
||||
# include <algorithm> // for std::min and std::max
|
||||
# define BOOST_USING_STD_MIN() ((void)0)
|
||||
# define BOOST_USING_STD_MAX() ((void)0)
|
||||
|
@ -379,7 +379,7 @@
|
||||
// works as expected with standard conforming compilers. The resulting
|
||||
// double inclusion of <cstddef> is harmless.
|
||||
|
||||
# ifdef BOOST_NO_STDC_NAMESPACE
|
||||
# if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus)
|
||||
# include <cstddef>
|
||||
namespace std { using ::ptrdiff_t; using ::size_t; }
|
||||
# endif
|
||||
@ -398,7 +398,7 @@
|
||||
|
||||
// BOOST_NO_STD_MIN_MAX workaround -----------------------------------------//
|
||||
|
||||
# ifdef BOOST_NO_STD_MIN_MAX
|
||||
# if defined(BOOST_NO_STD_MIN_MAX) && defined(__cplusplus)
|
||||
|
||||
namespace std {
|
||||
template <class _Tp>
|
||||
@ -509,7 +509,7 @@ namespace std {
|
||||
// but it's use may generate either warnings (with -ansi), or errors
|
||||
// (with -pedantic -ansi) unless it's use is prefixed by __extension__
|
||||
//
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
#if defined(BOOST_HAS_LONG_LONG) && defined(__cplusplus)
|
||||
namespace boost{
|
||||
# ifdef __GNUC__
|
||||
__extension__ typedef long long long_long_type;
|
||||
@ -563,7 +563,7 @@ namespace boost{
|
||||
//
|
||||
|
||||
|
||||
#if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
|
||||
#if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) && defined(__cplusplus)
|
||||
|
||||
# include "boost/type.hpp"
|
||||
# include "boost/non_type.hpp"
|
||||
@ -601,7 +601,7 @@ namespace boost{
|
||||
|
||||
// When BOOST_NO_STD_TYPEINFO is defined, we can just import
|
||||
// the global definition into std namespace:
|
||||
#ifdef BOOST_NO_STD_TYPEINFO
|
||||
#if defined(BOOST_NO_STD_TYPEINFO) && defined(__cplusplus)
|
||||
#include <typeinfo>
|
||||
namespace std{ using ::type_info; }
|
||||
#endif
|
||||
|
@ -24,7 +24,8 @@ if $(is_unix)
|
||||
}
|
||||
|
||||
test-suite config
|
||||
:
|
||||
:
|
||||
[ compile config_test_c.c ]
|
||||
[ run config_test.cpp
|
||||
: #args
|
||||
: #input-files
|
||||
|
9
test/config_test_c.c
Normal file
9
test/config_test_c.c
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user