Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70953 - in trunk: boost boost/config boost/config/compiler boost/config/platform boost/config/stdlib libs/config/test
From: john_at_[hidden]
Date: 2011-04-03 13:55:32


Author: johnmaddock
Date: 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
New Revision: 70953
URL: http://svn.boost.org/trac/boost/changeset/70953

Log:
Make Boost.Config C language compatible.
Added:
   trunk/libs/config/test/config_test_c.c (contents, props changed)
Text files modified:
   trunk/boost/config.hpp | 2 +-
   trunk/boost/config/compiler/borland.hpp | 4 +++-
   trunk/boost/config/compiler/codegear.hpp | 2 +-
   trunk/boost/config/compiler/digitalmars.hpp | 2 ++
   trunk/boost/config/compiler/intel.hpp | 2 ++
   trunk/boost/config/platform/linux.hpp | 4 ++++
   trunk/boost/config/platform/symbian.hpp | 2 +-
   trunk/boost/config/select_stdlib_config.hpp | 6 +++++-
   trunk/boost/config/stdlib/dinkumware.hpp | 2 ++
   trunk/boost/config/stdlib/libcpp.hpp | 2 +-
   trunk/boost/config/stdlib/msl.hpp | 2 ++
   trunk/boost/config/stdlib/sgi.hpp | 2 +-
   trunk/boost/config/stdlib/stlport.hpp | 4 ++--
   trunk/boost/config/suffix.hpp | 10 +++++-----
   trunk/libs/config/test/Jamfile.v2 | 3 ++-
   15 files changed, 34 insertions(+), 15 deletions(-)

Modified: trunk/boost/config.hpp
==============================================================================
--- trunk/boost/config.hpp (original)
+++ trunk/boost/config.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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:

Modified: trunk/boost/config/compiler/borland.hpp
==============================================================================
--- trunk/boost/config/compiler/borland.hpp (original)
+++ trunk/boost/config/compiler/borland.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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:

Modified: trunk/boost/config/compiler/codegear.hpp
==============================================================================
--- trunk/boost/config/compiler/codegear.hpp (original)
+++ trunk/boost/config/compiler/codegear.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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

Modified: trunk/boost/config/compiler/digitalmars.hpp
==============================================================================
--- trunk/boost/config/compiler/digitalmars.hpp (original)
+++ trunk/boost/config/compiler/digitalmars.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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

Modified: trunk/boost/config/compiler/intel.hpp
==============================================================================
--- trunk/boost/config/compiler/intel.hpp (original)
+++ trunk/boost/config/compiler/intel.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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 @@
 // 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

Modified: trunk/boost/config/platform/linux.hpp
==============================================================================
--- trunk/boost/config/platform/linux.hpp (original)
+++ trunk/boost/config/platform/linux.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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

Modified: trunk/boost/config/platform/symbian.hpp
==============================================================================
--- trunk/boost/config/platform/symbian.hpp (original)
+++ trunk/boost/config/platform/symbian.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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

Modified: trunk/boost/config/select_stdlib_config.hpp
==============================================================================
--- trunk/boost/config/select_stdlib_config.hpp (original)
+++ trunk/boost/config/select_stdlib_config.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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

Modified: trunk/boost/config/stdlib/dinkumware.hpp
==============================================================================
--- trunk/boost/config/stdlib/dinkumware.hpp (original)
+++ trunk/boost/config/stdlib/dinkumware.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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)
 //

Modified: trunk/boost/config/stdlib/libcpp.hpp
==============================================================================
--- trunk/boost/config/stdlib/libcpp.hpp (original)
+++ trunk/boost/config/stdlib/libcpp.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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++!"

Modified: trunk/boost/config/stdlib/msl.hpp
==============================================================================
--- trunk/boost/config/stdlib/msl.hpp (original)
+++ trunk/boost/config/stdlib/msl.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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

Modified: trunk/boost/config/stdlib/sgi.hpp
==============================================================================
--- trunk/boost/config/stdlib/sgi.hpp (original)
+++ trunk/boost/config/stdlib/sgi.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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

Modified: trunk/boost/config/stdlib/stlport.hpp
==============================================================================
--- trunk/boost/config/stdlib/stlport.hpp (original)
+++ trunk/boost/config/stdlib/stlport.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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 @@
 //
 // 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)

Modified: trunk/boost/config/suffix.hpp
==============================================================================
--- trunk/boost/config/suffix.hpp (original)
+++ trunk/boost/config/suffix.hpp 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -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 @@
 // 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 @@
 //
 
 
-#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 @@
 
 // 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

Modified: trunk/libs/config/test/Jamfile.v2
==============================================================================
--- trunk/libs/config/test/Jamfile.v2 (original)
+++ trunk/libs/config/test/Jamfile.v2 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -24,7 +24,8 @@
 }
 
 test-suite config
- :
+ :
+ [ compile config_test_c.c ]
     [ run config_test.cpp
           : #args
           : #input-files

Added: trunk/libs/config/test/config_test_c.c
==============================================================================
--- (empty file)
+++ trunk/libs/config/test/config_test_c.c 2011-04-03 13:55:30 EDT (Sun, 03 Apr 2011)
@@ -0,0 +1,9 @@
+
+
+#include <boost/config.hpp>
+
+
+int main()
+{
+ return 0;
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk