From mboxrd@z Thu Jan 1 00:00:00 1970 From: hjl@lucon.org (H.J. Lu) To: egcs@cygnus.com Subject: A new patch for libstdc++ Date: Fri, 10 Oct 1997 17:21:00 -0000 Message-id: X-SW-Source: 1997-10/msg00432.html 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 +#include #include extern "C++" { @@ -365,10 +366,18 @@ #ifdef __STL_USE_EXCEPTIONS #include -#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 + +#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