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]

Porting Questions


I'm still working on porting libstdc++-v3 to our compiler.
I've run across a couple of problems that I'd like to get
some opinions on:

- There are many places where gcc's __builtin_* functions
are called.  Obviously, we don't have these.  Right now
I've #ifdef'd the code to call __builtin_* when __GNUC__
is defined and * otherwise.  I don't like this solution
in the long run, so would an additional test for these
functions and #define be appropriate?  For example, test
for __builting_alloca and #define ALLOCA_FUNCTION to
alloca or __builtin_alloca as appropriate.

- I have the same problem with NULL.  Our compiler doesn't
like the assignment of (void *)(0) to non-void pointers.
I could test for this as well and #define NULL_POINTER
to the appropriate thing.  Is there a better way.

Obviously these macro names can be haggled over, but I
would like some opinions so I don't have to go changing
things again later.  Also, I'd request that once I get my
changes merged in (hopefully within the month), developers
be careful about using gcc-specific things.  If they must
be allowed, can we agree that they should be configurable
or in some way detectable so that they can be disabled
for non-gcc builds?

Now, the big whopper:

- I get the library built but certain templates in the locale
library are not getting instantiated (in locale-inst.cc).
For example _M_initialize_moneypunct.  I've traced the problem
down to this:

_M_initialize_moneypunct is a member function of
moneypunct<charT, bool> with an empty implementation.  In
c++locale.cc (linked to c_locale_generic.cc in my build)
specializations for moneypunct<char>::_M_initialize_moneypunct
are provided.  However, this code is not visible when locale-inst.cc
is compiled.  Therefore, the empty implementation gets instantiated
for <charT, true> and <charT, false>::_M_initialize... never
gets instantiated (not sure why at the moment, as
moneypunct<char, false> is explicitly instantiated).

The fundamental problem is that c++local.cc is a link to
c_local_generic.cc which contains a lot more than just
specializations of templates.  It contains some _S_create_c_locale
functions (which are empty), meaning I can't just #include it
in locale-inst.cc without getting duplicate symbols.

How does this build work under g++ (i.e. how does it get
all the instantiations right when it can't see all the
code?) and how can I make it work in general for other
compilers?  I know there are various games I can play with
#include and preprocessor guards, but I'm looking for the Right
Way.

Thanks again!

-Dave


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