Mahh braainn huhts! (libstdc++-v3 vs Darwin)

Stan Shebs shebs@apple.com
Tue May 22 15:07:00 GMT 2001


Mainline libstdc++-v3 fails to build on Darwin because of a missing
definition for _BSD_WCHAR_T_.  After chasing tangled ifdefs for awhile,
we came up with the following patch to ginclude/stddef.h that allows
compilation to continue:

RCS file: /cvs/repository/CoreTools/gcc3/gcc/ginclude/stddef.h,v
retrieving revision 1.4
diff -c -3 -p -r1.4 stddef.h
*** stddef.h    2001/01/25 01:52:31     1.4
--- stddef.h    2001/05/15 22:09:02
*************** Boston, MA 02111-1307, USA.  */
*** 83,89 ****
  #undef _SIZE_T_
  #undef _BSD_SIZE_T_
  #endif
! #if defined (__need_wchar_t) || defined (_STDDEF_H_)
  #undef _WCHAR_T_
  #undef _BSD_WCHAR_T_
  #endif
--- 83,89 ----
  #undef _SIZE_T_
  #undef _BSD_SIZE_T_
  #endif
! #if defined (__need_wchar_t) //|| defined (_STDDEF_H_)
  #undef _WCHAR_T_
  #undef _BSD_WCHAR_T_
  #endif

This is almost certainly wrong, but I don't understand how things
are *supposed* to work here - testing the include guard seems pretty
lame to me, I guess it's connected to glibc including this file
multiple times or something.  Anyway, the #undef _BSD_WCHAR_T_ is
wanted because later on there is a #ifndef test that gives us the
value we really want, but __need_wchar_t is *not* defined because
Darwin is a BSD variant - or maybe I have all this backwards. :-) :-(

If anybody knows the theory of this stuff, and especially how it's
intended to work for BSD flavors, I'd be grateful for any hints.

Stan



More information about the Gcc mailing list