FreeBSD 4.0 support now in

Loren James Rittle rittle@latour.rsch.comm.mot.com
Wed May 10 18:47:00 GMT 2000


> Loren, is there any way you can test this on a FreeBSD3.4 host? I've
> been using the testdrive.compaq.com site (way cool), and they only
> have 4.0 boxes.

> 2000-05-10  Benjamin Kosnik  <bkoz@redhat.com>

>	Finish up FreeBSD4.0 support.
>	* config/bsd/ctype.cc: Scope out toupper, tolower calls.
>	* config/generic/ctype.cc: And here.
>	* testsuite/21_strings/char_traits.cc (test02): Guard with
>	_GLIBCPP_USE_WCHAR_T.
[...]

So tested.  Without the included patch, libstdc++-v3 is still being
configured for config/generic instead of config/bsd on FreeBSD-3.4:

>From ``make bootstrap'' output:
...
checking <ctype> for bsd ... no
...
configure: warning: Using default ctype headers.
...

The reason is that _A, etc were changed to _CTYPE_A, etc on the 4.0
branch to help alleviate problems with C++ headers. ;-)

FYI: In order to see how general this config/bsd tree is with my
patch, I studied the CVSWEB archives from OpenBSD
( http://www.openbsd.org/cgi-bin/cvsweb/src/include/ctype.h ) and NetBSD
( http://cvsweb.netbsd.org/cgi-bin/cvsweb.cgi/basesrc/include/ctype.h -
shame on them for intentionally deleting older versions ;-).  I must
mention that both use a ctype.h scheme circa BSD4.3 not BSD4.4 that
would appear to match the test for newlib not bsd (in fact, I had to
explicitly check for the existence of __istype or I was afraid they
would match my new test but fail since they use a _ctype_ table
directly not a __istype macro).  So maybe that directory needs to be
explicitly named config/freebsd or config/bsd4.4 instead of
config/bsd.

Before included patch:

pass/fail results: 57/12 (used to be 56/13 - your checkin today fixed
the miscompilation of testsuite/21_strings/char_traits.cc for me as well.)

11 of those twelve still dump core here:

Program terminated with signal 11, Segmentation fault.
#0  std::basic_istream<char, std::char_traits<char> >::sentry::sentry (
    this=0xbfbfc267, __in=@0xbfbfc618, __noskipws=false)
    at ../../../../egcs/libstdc++-v3/config/generic/bits/ctype_specializations.h:40
40        { return _M_table[(unsigned char)(__c)] & __m; }

After included patch:

pass/fail results:  68/1

The remaining failure is in 27_io/ostream_inserter_arith.cc and has
something to do with

Here is a proposed patch to handle 'classic BSD' (at least BSD4.4) and
FreeBSD4.0+:

[If people would prefer zero #ifdef in config files, I could make
 this look more like the solaris subtree.]

[Due to size of patch, I will not include the generated files.  Also,
 my automake 1.4 appears to gratuitously change the layout of
 Makefile.in w.r.t. their checked in versions.  If Makefile.in
 really doesn't change after regen, please remove last line
 of the ChangeLog entry.  Finally, I don't see how I could have
 broken your 4.0 work, but for the record I've only tested on FreeBSD3.4.]

2000-05-10  Loren J. Rittle  <ljrittle@acm.org>

	* config/bsd/bits/ctype_base.h: Add support for plain BSD4.4.
	* acinclude.m4 (GLIBCPP_CHECK_CTYPE): Enhance bsd tests.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* */Makefile.in: Regenerate.

Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/acinclude.m4,v
retrieving revision 1.7
diff -p -r1.7 acinclude.m4
*** acinclude.m4	2000/05/10 00:23:47	1.7
--- acinclude.m4	2000/05/11 00:05:22
*************** AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
*** 311,323 ****
        ctype_default=no
      fi
  
      dnl Test for <ctype> functionality -- BSD
      AC_MSG_CHECKING([<ctype> for bsd ])
      AC_TRY_COMPILE([#include <ctype.h>],
      [int
      foo (int a)
!     { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
! 	+ _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
      ctype_bsd=yes, ctype_bsd=no)
      AC_MSG_RESULT($ctype_bsd)
      if test $ctype_bsd = "yes"; then
--- 311,337 ----
        ctype_default=no
      fi
  
+     dnl Test for <ctype> functionality -- FreeBSD4
+     AC_MSG_CHECKING([<ctype> for freebsd4 ])
+     AC_TRY_COMPILE([#include <ctype.h>],
+     [int
+     foo (int a)
+     { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
+ 	+ _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G + __istype (a, 0);}], \
+     ctype_freebsd=yes, ctype_freebsd=no)
+     AC_MSG_RESULT($ctype_freebsd)
+     if test $ctype_freebsd = "yes"; then
+       ctype_include_dir="config/bsd"
+       ctype_default=no
+     fi
+ 
      dnl Test for <ctype> functionality -- BSD
      AC_MSG_CHECKING([<ctype> for bsd ])
      AC_TRY_COMPILE([#include <ctype.h>],
      [int
      foo (int a)
!     { return _S + _R + _C + _U + _L + _A \
! 	+ _D + _P + _X + _G + __istype (a, 0);}], \
      ctype_bsd=yes, ctype_bsd=no)
      AC_MSG_RESULT($ctype_bsd)
      if test $ctype_bsd = "yes"; then
Index: config/bsd/bits/ctype_base.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/config/bsd/bits/ctype_base.h,v
retrieving revision 1.1
diff -p -r1.1 ctype_base.h
*** ctype_base.h	2000/05/10 00:21:45	1.1
--- ctype_base.h	2000/05/11 00:05:22
***************
*** 31,37 ****
  // ISO C++ 14882: 22.1  Locales
  //
    
! // Information as gleaned from /usr/include/ctype.h on FreeBSD 4.0
    
    struct ctype_base
    {
--- 31,40 ----
  // ISO C++ 14882: 22.1  Locales
  //
    
! // Information as gleaned from /usr/include/ctype.h on FreeBSD 3.4, 4.0
! // and all versions of the CVS managed file at:
! // :pserver:anoncvs@anoncvs.freebsd.org:/home/ncvs/src/include/ctype.h
! // which should cover more classic BSD configurations
    
    struct ctype_base
    {
***************
*** 41,46 ****
--- 44,51 ----
  
      enum
      {
+ #ifdef _CTYPE_S
+       // FreeBSD 4.0 uses this style of define.
        space = _CTYPE_S,
        print = _CTYPE_R,
        cntrl = _CTYPE_C,
***************
*** 52,57 ****
--- 57,76 ----
        xdigit = _CTYPE_X,
        alnum = _CTYPE_A | _CTYPE_D,
        graph = _CTYPE_G
+ #else
+       // Classic BSD uses this style of define.
+       space = _S,
+       print = _R,
+       cntrl = _C,
+       upper = _U,
+       lower = _L,
+       alpha = _A,
+       digit = _D,
+       punct = _P,
+       xdigit = _X,
+       alnum = _A | _D,
+       graph = _G
+ #endif
      };
    };
  


More information about the Libstdc++ mailing list