This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
A new patch for libstdc++
- To: egcs at cygnus dot com
- Subject: A new patch for libstdc++
- From: hjl at lucon dot org (H.J. Lu)
- Date: Fri, 10 Oct 1997 12:18:30 -0700 (PDT)
Hi,
It turned out the OUTOFRANGE bug is triggered by a typo. But you
still cannot throw out_of_range in string. Here is a new patch.
--
H.J. Lu (hjl@gnu.ai.mit.edu)
---
Fri Oct 10 12:15:51 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
* std/bastring.h (OUTOFRANGE): Use assert () for string.
Fix typo for others.
Mon Aug 25 17:31:49 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
* Makefile.in ($(SHLIB)): Use $(CC) instead of (CXX) to avoid
implicit -lstdc++.
Index: libstdc++/Makefile.in
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libstdc++/Makefile.in,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Makefile.in
--- Makefile.in 1997/08/29 00:32:44 1.1.1.2
+++ Makefile.in 1997/09/08 21:02:08
@@ -87,7 +87,7 @@
$(RANLIB) $(ARLIB)
$(SHLIB): piclist
- $(CXX) $(LIBCXXFLAGS) $(SHFLAGS) -shared -o $(SHLIB) `cat piclist` $(SHDEPS)
+ $(CC) $(LIBCXXFLAGS) $(SHFLAGS) -shared -o $(SHLIB) `cat piclist` $(SHDEPS)
$(SHARLIB): $(SHLIB)
-rm -f t$(SHARLIB)
Index: libstdc++/std/bastring.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libstdc++/std/bastring.h,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 bastring.h
--- bastring.h 1997/10/09 17:31:45 1.1.1.5
+++ bastring.h 1997/10/10 19:14:56
@@ -33,6 +33,7 @@
#endif
#include <cstddef>
+#include <typeinfo>
#include <std/straits.h>
extern "C++" {
@@ -365,10 +366,18 @@
#ifdef __STL_USE_EXCEPTIONS
#include <stdexcept>
-#define OUTOFRANGE(cond) \
- do { if (!(cond)) throw out_of_range (#cond); } while (0)
-#define LENGTHERROR(cond) \
- do { if (!(cond)) throw length_error (#cond); } while (0)
+#include <cassert>
+
+#define OUTOFRANGE(cond) \
+ if (typeid (value_type) == typeid (char)) \
+ assert (!(cond)); \
+ else \
+ do { if ((cond)) throw out_of_range (#cond); } while (0)
+#define LENGTHERROR(cond) \
+ if (typeid (value_type) == typeid (char)) \
+ assert (!(cond)); \
+ else \
+ do { if ((cond)) throw length_error (#cond); } while (0)
#else