This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: update DJGPP port



Hello,

this patch should fix most of remaining libstdc++ DJGPP
port problems. The building problems I've mentioned earlier
were bugs in compiler driver, however there is one libstdc++
bug - order of standard libraries in mknumeric_limits. Previous
order `-lgcc -lc' was bad for DJGPP, so I've reversed it. I
don't know if this is OK for other platforms, so those who
know may replace it with '-lgcc -lc -lgcc', if neccesarry.

Other problem - DJGPP configuration files were very outdated,
because information in porting.texi is outdated too. 

Please commit if OK, send comments otherwise.

(Please CC on replies)

TIA

2001-01-31  Laurynas Biveinis  <lauras@softhome.net>

	* mknumeric_limits: put '-lc' before '-lgcc' in LDFLAGS.

	* config/os/djgpp/ctype_base.h (ctype_base): __to_type
	definition. Replace enum with static const variables.

	* config/os/djgpp/ctype_inline.h (ctype<char>::is): remove
	throw specification, fix typos, use <static_cast>.
	(ctype<char>::scan_is): remove throw specification.
	(ctype<char>::scan_not): likewise.

	* config/os/djgpp/ctype_noninline.h (ctype<char>::ctype):
	fix typo.
	(ctype<char>::do_toupper(char)): use <static_cast).
	(ctype<char>::do_toupper(char *, const char *)): likewise.
	(ctype<char>::do_tolower(char)): use <static_cast).
	(ctype<char>::do_tolower(char *, const char *)): likewise.

Index: libstdc++-v3/mknumeric_limits
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/mknumeric_limits,v
retrieving revision 1.7
diff -u -u -p -r1.7 mknumeric_limits
--- mknumeric_limits	2000/12/22 08:15:27	1.7
+++ mknumeric_limits	2001/01/31 11:54:05
@@ -16,11 +16,11 @@ case `uname` in
 	    *pthread*)
 		LDFLAGS='-nodefaultlibs -lgcc -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a' ;;
 	    *)
-		LDFLAGS='-nodefaultlibs -lgcc -lc' ;;
+		LDFLAGS='-nodefaultlibs -lc -lgcc' ;;
 	esac
 	;;
     *)
-	LDFLAGS='-nodefaultlibs -lgcc -lc' ;;
+	LDFLAGS='-nodefaultlibs -lc -lgcc' ;;
 esac
 
 BUILD_DIR=$1
Index: libstdc++-v3/config/os/djgpp/bits/ctype_base.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/config/os/djgpp/bits/ctype_base.h,v
retrieving revision 1.2
diff -u -u -p -r1.2 ctype_base.h
--- ctype_base.h	2001/01/12 21:36:32	1.2
+++ ctype_base.h	2001/01/31 11:54:05
@@ -36,22 +36,21 @@
     typedef unsigned short 	mask;
     
     // Non-standard typedefs.
-    typedef unsigned char	__to_type;
+    typedef unsigned char *     __to_type;
 
-    enum
-    {
-      space = __dj_ISSPACE,	// Whitespace
-      print = __dj_ISPRINT,	// Printing
-      cntrl = __dj_ISCNTRL,	// Control character
-      upper = __dj_ISUPPER,	// UPPERCASE
-      lower = __dj_ISLOWER,	// lowercase
-      alpha = __dj_ISALPHA,	// Alphabetic
-      digit = __dj_ISDIGIT,	// Numeric
-      punct = __dj_ISPUNCT,     // Punctuation
-      xdigit = __dj_ISXDIGIT,   // Hexadecimal numeric
-      alnum = __dj_ISAL,        // Alphanumeric
-      graph = __dj_ISGRAPH	// Graphical
-    };
+    // NB: Offsets into ctype<char>::_M_table force a particular size
+    // on the mask type. Because of this, we don't use an enum.
+    static const mask space = __dj_ISSPACE;	// Whitespace
+    static const mask print = __dj_ISPRINT;	// Printing
+    static const mask cntrl = __dj_ISCNTRL;	// Control character
+    static const mask upper = __dj_ISUPPER;	// UPPERCASE
+    static const mask lower = __dj_ISLOWER;	// lowercase
+    static const mask alpha = __dj_ISALPHA;	// Alphabetic
+    static const mask digit = __dj_ISDIGIT;	// Numeric
+    static const mask punct = __dj_ISPUNCT;     // Punctuation
+    static const mask xdigit = __dj_ISXDIGIT;   // Hexadecimal numeric
+    static const mask alnum = __dj_ISALPHA;     // Alphanumeric
+    static const mask graph = __dj_ISGRAPH;	// Graphical
   };
 
 
Index: libstdc++-v3/config/os/djgpp/bits/ctype_inline.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/config/os/djgpp/bits/ctype_inline.h,v
retrieving revision 1.2
diff -u -u -p -r1.2 ctype_inline.h
--- ctype_inline.h	2001/01/12 21:36:32	1.2
+++ ctype_inline.h	2001/01/31 11:54:05
@@ -36,21 +36,21 @@
   
   bool
   ctype<char>::
-  is(mask __m, char __c) const throw()
-  { return _M_table[(unsigned char)(__c + 1)] & __m; }
+  is(mask __m, char __c) const 
+  { return _M_table[static_cast<unsigned char>(__c + 1)] & __m; }
 
   const char*
   ctype<char>::
-  is(const char* __low, const char* __high, mask* __vec) const throw()
+  is(const char* __low, const char* __high, mask* __vec) const 
   {
     while (__low < __high)
-      *__vec++ = _M_table[(unsigned char)(*__low++)];
+      *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
     return __high;
   }
 
   const char*
   ctype<char>::
-  scan_is(mask __m, const char* __low, const char* __high) const throw()
+  scan_is(mask __m, const char* __low, const char* __high) const
   {
     while (__low < __high && !this->is(__m, *__low))
       ++__low;
@@ -59,7 +59,7 @@
 
   const char*
   ctype<char>::
-  scan_not(mask __m, const char* __low, const char* __high) const throw()
+  scan_not(mask __m, const char* __low, const char* __high) const
   {
     while (__low < __high && this->is(__m, *__low) != 0)
       ++__low;
Index: libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h,v
retrieving revision 1.2
diff -u -u -p -r1.2 ctype_noninline.h
--- ctype_noninline.h	2001/01/12 21:36:32	1.2
+++ ctype_noninline.h	2001/01/31 11:54:06
@@ -40,7 +40,7 @@ extern unsigned char __dj_ctype_tolower[
   
   ctype<char>::ctype(const mask* __table = 0, bool __del = false, 
 	size_t __refs = 0) 
-    : _Ctype_nois<char>(__refs), 
+    : __ctype_abstract_base<char>(__refs), 
       _M_del(__table != 0 && __del), 
       _M_toupper(__dj_ctype_toupper), 
       _M_tolower(__dj_ctype_tolower),
@@ -50,14 +50,14 @@ extern unsigned char __dj_ctype_tolower[
 
   char
   ctype<char>::do_toupper(char __c) const
-  { return _M_toupper[(int)(__c)+1]) }
+  { return _M_toupper[static_cast<int>(__c)+1]; }
 
   const char*
   ctype<char>::do_toupper(char* __low, const char* __high) const
   {
     while (__low < __high)
       {
-	*__low = ::toupper((int) *__low);
+	*__low = ::toupper(static_cast<int> (*__low));
 	++__low;
       }
     return __high;
@@ -65,14 +65,14 @@ extern unsigned char __dj_ctype_tolower[
 
   char
   ctype<char>::do_tolower(char __c) const
-  { return _M_tolower[(int)(__c)+1]) }
+  { return _M_tolower[static_cast<int>(__c)+1]; }
 
   const char* 
   ctype<char>::do_tolower(char* __low, const char* __high) const
   {
     while (__low < __high)
       {
-	*__low = ::tolower((int) *__low);
+	*__low = ::tolower(static_cast<int> (*__low));
 	++__low;
       }
     return __high;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]