ustl: disable bounds check exceptions when not using libstdc++, fixes compile errors
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 2 Feb 2011 02:36:52 +0000 (02:36 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 2 Feb 2011 02:36:52 +0000 (02:36 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@25304 3c298f89-4303-0410-b956-a3cf2f4a3e73

libs/ustl/files/config.h
libs/ustl/patches/003-fix_stream_bounds_check_dep.patch [new file with mode: 0644]

index 3486496..903e225 100644 (file)
@@ -15,6 +15,9 @@
 // Define to the address where bug reports for this package should be sent.
 #define USTL_BUGREPORT "Mike Sharov <msharov@users.sourceforge.net>"
 
+/// Define to 1 if you want to build without libstdc++
+#define WITHOUT_LIBSTDCPP 1
+
 /// Define to 1 if you want stream operations to throw exceptions on
 /// insufficient data or insufficient space. All these errors should
 /// be preventable in output code; the input code should verify the
 ///
 #undef WANT_STREAM_BOUNDS_CHECKING
 
-#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG)
+#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG) && !defined(WITHOUT_LIBSTDCPP)
     #define WANT_STREAM_BOUNDS_CHECKING 1
 #endif
 
-/// Define to 1 if you want to build without libstdc++
-#define WITHOUT_LIBSTDCPP 1
-
 /// Define to 1 if you don't want the standard streams.
 /// You will not be able to run bvt tests if you do this.
 ///
diff --git a/libs/ustl/patches/003-fix_stream_bounds_check_dep.patch b/libs/ustl/patches/003-fix_stream_bounds_check_dep.patch
new file mode 100644 (file)
index 0000000..6def743
--- /dev/null
@@ -0,0 +1,54 @@
+--- a/config.h.in
++++ b/config.h.in
+@@ -15,6 +15,9 @@
+ // Define to the address where bug reports for this package should be sent.
+ #define USTL_BUGREPORT        "@PACKAGE_BUGREPORT@"
++/// Define to 1 if you want to build without libstdc++
++#undef WITHOUT_LIBSTDCPP
++
+ /// Define to 1 if you want stream operations to throw exceptions on
+ /// insufficient data or insufficient space. All these errors should
+ /// be preventable in output code; the input code should verify the
+@@ -23,13 +26,10 @@
+ ///
+ #undef WANT_STREAM_BOUNDS_CHECKING
+-#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG)
++#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG) && !defined(WITHOUT_LIBSTDCPP)
+     #define WANT_STREAM_BOUNDS_CHECKING 1
+ #endif
+-/// Define to 1 if you want to build without libstdc++
+-#undef WITHOUT_LIBSTDCPP
+-
+ /// Define to 1 if you don't want the standard streams.
+ /// You will not be able to run bvt tests if you do this.
+ ///
+--- a/mostream.h
++++ b/mostream.h
+@@ -11,7 +11,9 @@
+ #include "memlink.h"
+ #include "uexception.h"
+ #include "utf8.h"
++#ifdef WANT_STREAM_BOUNDS_CHECKING
+ #include <typeinfo>
++#endif
+ namespace ustl {
+--- a/uctrstrm.h
++++ b/uctrstrm.h
+@@ -109,8 +109,12 @@
+     size_type n;
+     is >> n;
+     const size_type expectedSize = n * stream_size_of(value_type());
++#ifdef WANT_STREAM_BOUNDS_CHECKING
+     if (expectedSize > is.remaining())
+       throw stream_bounds_exception ("read", typeid(v).name(), is.pos(), expectedSize, is.remaining());
++#else
++    assert(expectedSize <= is.remaining());
++#endif
+     v.resize (n);
+     nr_container_read (is, v);
+     is.align();