incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [PATCH] MSVC 7.0 stdlib compatibility patch
Date Fri, 22 Sep 2006 01:32:51 GMT
Farid Zaripov wrote:
>  > -----Original Message-----
>  > From: Martin Sebor [mailto:sebor@roguewave.com]
>  > Sent: Monday, September 18, 2006 3:49 AM
>  > To: stdcxx-dev@incubator.apache.org
>  > Subject: Re: [PATCH] Scripts, generating solution and
>  > projects for MSVC/ICC
>  >
>  > >   I have tried to build stdcxx on MSVC 7.0 and got some errors so I
>  > > can say that we don't support MSVC 7.0 at the moment.
>  >
>  > Let's fix these before committing the changes.
> 
>    VC7.0 ignores cv qualifiers on 'void' type when it's used as template
> argument (http://www.dotnet247.com/247reference/msgs/1/7727.aspx)
> 
>    Due to this bug the file include/rw/_autoptr.h has failed to compile.
> I've added test for that (CV_VOID_SPECIALIZATIONS.cpp) to the source 
> files in etc/config/src folder.

Okay, the new test looks good.

> 
> 
>    VC7.0 also do not support "Partial Ordering of Function Templates"
> (http://support.microsoft.com/kb/240869/).
> Due to this bug the etc/config/src/VA_LIST.cpp has failed to compile
> at configure step, which was caused the error:
> src\exception.cpp(503) : error C2065: 'va_copy' : undeclared identifier
> 
> 
>    And due this bug was another error:
> 
> include\loc\_num_put.cc(197) : error C2667: '__rw::__rw_iter_failed' :
> none of 2 overloads have a best conversion
>          include\loc\_num_put.cc(47): could be 'bool
> __rw::__rw_iter_failed(const std::ostreambuf_iterator<_CharT,_Traits> &)'
>          include\loc\_num_put.cc(43): or       'bool
> __rw::__rw_iter_failed(const _OutputIter &)'
>          while trying to match the argument list
> '(std::num_put<_CharT,_OutputIter>::iter_type)'
>          with
>          [
>              _CharT=wchar_t,
> 
> _OutputIter=std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t>>
>          ]

Yes, this was a fairly recent change of mine:
http://svn.apache.org/viewvc?view=rev&revision=420970

Since we're not testing with MSVC 7.0 I never found out about
it (until now). Thanks for investigating and coming up with a
fix for it.

> 
>    I've made the changes (the diff file stdlib.diff is attached):
> 
>    ChangeLog:
>    * limits: Corrected macro _RWSTD_SPECIALIZE_LIMITS
>    (#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC branch)
>    * CV_VOID_SPECIALIZATIONS.cpp: New file, checking for cv qualifiers
>    on type void
>    * VA_LIST.cpp: Added code to deal with compilers, which are not
>    supports the "Partial Ordering of Function Templates"

These two changes are fine. I assume the <limits> code has been
broken since 4.1.3. If so, can you please open a bug for it and
commit a fix for it separately, mentioning the bug key in your
ChangeLog so that it gets picked up by Jira?

Same for the VA_LIST.cpp problem (if it exists in 4.1.3).

>    * _num_put.cc (__rw_iter_failed): The same.

I'm going to have to think about this one. I appreciate the effort
you put into the workaround but it seems pretty involved and I'm
not sure we want to complicate our code quite so much just to work
around a bug in an old and fairly rarely used compiler. I wonder
if there's a simpler way to deal with it.

> 
> 
>    After that the stdlib has been compiled successfully, but rwtest
> failed with error:
> 
> tests\include\rw_char.h(125) : error C2446: '==' : no conversion from
> 'const int *' to 'void *const '
>          Conversion loses qualifiers
> tests\include\rw_char.h(133) : error C2446: '==' : no conversion from
> 'const int *' to 'void *const '
>          Conversion loses qualifiers
> tests\include\rw_char.h(169) : error C2446: '==' : no conversion from
> 'const int *' to 'void *const '
>          Conversion loses qualifiers
> tests\include\rw_char.h(170) : error C2446: '==' : no conversion from
> 'const int *' to 'void *const '
>          Conversion loses qualifiers
> 
>    I've made another patch (the diff file rw_char.h.diff is attached):
> 
>    ChangeLog:
>    * rw_char.h (UserCharFmatInit): Added _TEST_EXPORT specification
>    (UserInt): Added const_cast to avoid MSVC 7.0 error "C2446: '=='
>    : no conversion from 'const int *' to 'void *const '"


I think the casts could be simplified to this:

   RW_ASSERT (_RWSTD_CONST_CAST (const void*, rhs.ptr_) == &rhs.i_);

I'm concerned that the const might trip up other compilers (IIRC,
HP aCC had problems with adding const qualifiers in const casts).
With that it's okay.

> 
>    After that the rwtest has been compiled successfully, but many of
> tests has failed to compile. I've fixed the three tests yet
> (tests.diff):
> 
>    ChangeLog:
>    * _specialized.h: Added code to deal with compilers, which are not
>    supports the "Partial Ordering of Function Templates"
>    * 20.operators.cpp: added #include <cstddef> for std::size_t
>    * 20.pairs.cpp: Added #ifdef/#endif guard to avoid error
>    "Cannot access private copy constructor"

This looks good.

> 
>    The build log with errors is here: 
> http://people.apache.org/~faridz/buildlog.log

It's not pretty...

> 
>    Do we still want to support the MSVC 7.0? :)

That's a good question :) The examples seem to look okay (I only
spotted two compilation failures), so I wouldn't waste your time
on the tests. As long as the library compiles and is at least
somewhat usable.

We should probably decide when will be a good time to make a break
and stop worrying about these crippled compilers. It's way too time
consuming to be limiting ourselves to the language subset supported
by compilers as broken as MSVC 7 (or even MSVC 6!) But rather than
saying that certain compiler is not supported, I think we should
decide on the set of language features that we will expect to work,
such as partial specialization or partial ordering of function
templates. Anything else to add to the list?

Martin

Mime
View raw message