This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] solaris c include model
On Wed, 11 Apr 2007, Benjamin Kosnik wrote:
In a nutshell, this introduces a new "C" header model, ie
--enable-cheaders=c_std_solaris. In this patch, this is the default
for solaris 2.7+, which should probably be tested or tweaked.
Thanks a lot for doing this work.
(precision: I won't have much access to any solaris system for a long
time, so I can only comment from what I remember of my earlier attempts)
To get this to work, you'll need to:
1) patch cc1plus so that __cplusplus is the correct value. (Also the
oldest libstdc++ PR)
2) patch gcc/ginclude/stddef.h
3) do some fixincludes on the solaris side, where extern "C" and
extern "C++" decls clash with gcc but not, apparently, with sunpro.
See the attached for a manual way to do this: I've not yet fought with
fixincludes for this.
4) patch libstdc++ with the mega-patch attached.
There are a lot of hacks in the libstdc++ bits here (strdup on
solaris??? How do I get this back? stddef.h is not figured out, and
it's apparent that better separation between C90 and C99 needs to take
place in wchar/wctype), but oh well. I'll try to fix this up when I
return.
In addition, this includes the libstdc++ parts of the newlib work.
Which is not finished yet either.
To intrepid solaris hackers, I say "bonne chance." It will be
interesting to see if you exist.
Some comments in random order:
* for qsort and bsearch, the problem comes from bug 2316. Your fix seems
strange, you now declare (for recent __cplusplus) only the extern c++
version of bsearch, which is defined nowhere. I would rather simply
remove the extern "C++" declaration and keep the other one as is until
2316 is fixed (not as violent as what I was mentionning in 30928. By
the way 30928 shows an other approach that gives a more uniform result
across solaris 8-11 but does not use the system headers as nicely as
you are trying to do). If 2316 is fixed then an extern "C++" version of
bsearch and qsort will need to be provided probably in libsupc++ or
some such.
* in math.h (for instance), you could #include <cmath> and #include_next
<math.h>, not simply the second one (not sure right now why I wanted
that, maybe just so cos(2) works after including math.h)
* a number of things become useless in the headers since you assume
solaris 7+ (like no stdlib.h or similar things)
* I am surprised you have not hit bug 30112 (only gives 4 failures in the
testsuite) and more importantly bug 27340 which should make valarray
unusable.
* for C99 functions you are going to have a hard time getting something
nice until solaris updates its headers some time after the standard is
accepted...
Good luck for continuing this work, and once again thank you.
--
Marc Glisse