> -----Original Message-----
> From: Martin Sebor [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 18, 2006 3:49 AM
> To: [email protected]
> 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.
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>>
]
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"
* _num_put.cc (__rw_iter_failed): The same.
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 '"
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"
The build log with errors is here:
http://people.apache.org/~faridz/buildlog.log
Do we still want to support the MSVC 7.0? :)
Farid.
Index: etc/config/src/CV_VOID_SPECIALIZATIONS.cpp
===================================================================
--- etc/config/src/CV_VOID_SPECIALIZATIONS.cpp (revision 0)
+++ etc/config/src/CV_VOID_SPECIALIZATIONS.cpp (revision 0)
@@ -0,0 +1,24 @@
+// checking for cv qualifiers on type void
+
+#include "config.h"
+
+#ifdef _RWSTD_NO_NEW_CLASS_TEMPLATE_SYNTAX
+# define _RWSTD_SPECIALIZED_CLASS
+#else
+# define _RWSTD_SPECIALIZED_CLASS template<>
+#endif
+
+template <class T>
+struct S {};
+
+_RWSTD_SPECIALIZED_CLASS
+struct S<void> {};
+
+_RWSTD_SPECIALIZED_CLASS
+struct S<const void> {};
+
+_RWSTD_SPECIALIZED_CLASS
+struct S<volatile void> {};
+
+_RWSTD_SPECIALIZED_CLASS
+struct S<const volatile void> {};
Index: etc/config/src/VA_LIST.cpp
===================================================================
--- etc/config/src/VA_LIST.cpp (revision 447839)
+++ etc/config/src/VA_LIST.cpp (working copy)
@@ -51,7 +51,7 @@
const char* get_type_name (...) { return 0; }
-#if 1 // ndef _RWSTD_NO_CLASS_PARTIAL_SPEC
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
template <class T>
struct Type {
@@ -79,6 +79,8 @@
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
+#ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
+
template <class T>
int va_list_array_size_imp (T *va)
{
@@ -96,7 +98,39 @@
return va_list_array_size_imp (&va);
}
+#else // if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
+
template <class T>
+class is_array
+{
+ class yes {};
+
+ class no { yes yes_ [2]; };
+
+ template <class U> struct Type {};
+
+ template <class U, size_t N>
+ static yes test (Type<U[N]>);
+ static no test (...);
+
+public:
+ enum { value = sizeof (test (Type<T> ())) == sizeof (yes) };
+};
+
+template <class T>
+int va_list_array_size_imp (T **va)
+{
+ return sizeof (va_list) / sizeof **va;
+}
+
+int va_list_array_size (va_list va)
+{
+ return is_array<va_list>::value ? va_list_array_size_imp (&va) : 0;
+}
+
+#endif // _RWSTD_NO_PART_SPEC_OVERLOAD
+
+template <class T>
const char* va_list_type (T *va)
{
return get_type_name (*va);
@@ -161,13 +195,13 @@
if (array_size) {
printf ("typedef %s __rw_va_list [%d];\n"
- "// #define _RWSTD_NO_VA_LIST_ARRAY // va_list is an
array\n",
- type_name, array_size);
+ "// #define _RWSTD_NO_VA_LIST_ARRAY // va_list is an array\n",
+ type_name, array_size);
}
else {
printf ("typedef %s __rw_va_list;\n"
- "#define _RWSTD_NO_VA_LIST_ARRAY // va_list is object
type\n",
- type_name);
+ "#define _RWSTD_NO_VA_LIST_ARRAY // va_list is object type\n",
+ type_name);
}
puts ("#define _RWSTD_VA_LIST __rw_va_list");
Index: include/limits
===================================================================
--- include/limits (revision 447839)
+++ include/limits (working copy)
@@ -243,16 +243,16 @@
_RWSTD_CLASS_END
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
// define specializations for all cv-qualified types
-# define _RWSTD_SPECIALIZE_LIMITS(T, cpfx) \
- _RWSTD_CLASS_BEGIN (numeric_limits<T>) \
- _RWSTD_LIMITS_BODY (T, cpfx) \
- _RWSTD_CLASS_END; \
- _RWSTD_SPECIALIZED_CLASS \
- numeric_limits<const T>: numeric_limits<T> { }; \
- _RWSTD_SPECIALIZED_CLASS \
- numeric_limits<volatile T>: numeric_limits<T> { }; \
- _RWSTD_SPECIALIZED_CLASS \
- numeric_limits<const volatile T>: numeric_limits<T> { }
+# define _RWSTD_SPECIALIZE_LIMITS(T, cpfx) \
+ _RWSTD_CLASS_BEGIN (numeric_limits<T>) \
+ _RWSTD_LIMITS_BODY (T, cpfx) \
+ _RWSTD_CLASS_END \
+ _RWSTD_CLASS_BEGIN (numeric_limits<const T>: numeric_limits<T>) \
+ _RWSTD_CLASS_END \
+ _RWSTD_CLASS_BEGIN (numeric_limits<volatile T>: numeric_limits<T>) \
+ _RWSTD_CLASS_END \
+ _RWSTD_CLASS_BEGIN (numeric_limits<const volatile T>: numeric_limits<T>) \
+ _RWSTD_CLASS_END
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
Index: include/loc/_num_put.cc
===================================================================
--- include/loc/_num_put.cc (revision 447839)
+++ include/loc/_num_put.cc (working copy)
@@ -38,6 +38,8 @@
__rw_digit_map[];
+#ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
+
template <class _OutputIter>
inline bool
__rw_iter_failed (const _OutputIter&) { return false; }
@@ -49,6 +51,51 @@
return __it.failed ();
}
+#else // ifdef _RWSTD_NO_PART_SPEC_OVERLOAD
+
+template <class T>
+class __rw_is_ostreambuf_iterator
+{
+ class yes {};
+
+ class no { yes yes_ [2]; };
+
+ template <class U> struct Type {};
+
+ template <class _CharT, class _Traits>
+ static yes test (Type<_STD::ostreambuf_iterator<_CharT, _Traits> >);
+ static no test (...);
+
+public:
+ enum { value = sizeof (test (Type<T> ())) == sizeof (yes) };
+};
+
+template <bool HasFailed>
+struct __rw_iter_failed_impl
+{
+ template <class _OutputIter>
+ static bool doit (const _OutputIter& __it) { return false; }
+};
+
+template <>
+struct __rw_iter_failed_impl<true>
+{
+ template <class _CharT, class _Traits>
+ static bool doit (const _STD::ostreambuf_iterator<_CharT, _Traits>& __it)
+ {
+ return __it.failed ();
+ }
+};
+
+template <class _OutputIter>
+inline bool __rw_iter_failed (const _OutputIter& __it)
+{
+ return __rw_iter_failed_impl<
+ __rw_is_ostreambuf_iterator<_OutputIter>::value>::doit(__it);
+}
+
+#endif // _RWSTD_NO_PART_SPEC_OVERLOAD
+
} // namespace __rw
Index: include/rw/_autoptr.h
===================================================================
--- include/rw/_autoptr.h (revision 447839)
+++ include/rw/_autoptr.h (working copy)
@@ -56,6 +56,8 @@
typedef void _C_ref;
};
+#ifndef _RWSTD_NO_CV_VOID_SPECIALIZATIONS
+
_RWSTD_SPECIALIZED_CLASS
struct __rw_nonvoid_ref<const void>
{
@@ -74,6 +76,7 @@
typedef void _C_ref;
};
+#endif // _RWSTD_NO_CV_VOID_SPECIALIZATIONS
} // namespace __rw
Index: rw_char.h
===================================================================
--- rw_char.h (revision 447459)
+++ rw_char.h (working copy)
@@ -122,7 +122,10 @@
UserInt (const UserInt &rhs)
: ptr_ (&i_), i_ (rhs.i_) {
- RW_ASSERT (rhs.ptr_ == &rhs.i_); // verify rhs is valid
+ // verify rhs is valid
+ // const_cast used to avoid MSVC 7.0 error C2446:
+ // '==' : no conversion from 'const int *' to 'void *const '
+ RW_ASSERT (_RWSTD_CONST_CAST (const void* const, rhs.ptr_) == &rhs.i_);
RW_ASSERT (-1 <= rhs.i_ && rhs.i_ < 257); // i may be invalid
}
@@ -130,7 +133,8 @@
// for extra robustness
void operator= (const UserInt &rhs) {
RW_ASSERT (ptr_ == &i_); // verify *this is valid
- RW_ASSERT (rhs.ptr_ == &rhs.i_); // verify rhs is valid
+ // verify rhs is valid
+ RW_ASSERT (_RWSTD_CONST_CAST (const void* const, rhs.ptr_) == &rhs.i_);
RW_ASSERT (-1 <= i_ && i_ < 257); // i may be invalid
RW_ASSERT (-1 < rhs.i_ && rhs.i_ < 257); // rhs.i must ve valid
@@ -166,8 +170,10 @@
}
bool equal (const UserInt &rhs) const {
- RW_ASSERT (ptr_ == &i_); // verify *this is valid
- RW_ASSERT (rhs.ptr_ == &rhs.i_); // verify rhs is valid
+ // verify *this is valid
+ RW_ASSERT (_RWSTD_CONST_CAST (const void* const, ptr_) == &i_);
+ // verify rhs is valid
+ RW_ASSERT (_RWSTD_CONST_CAST (const void* const, rhs.ptr_) == &rhs.i_);
RW_ASSERT (-1 < i_ && i_ < 257); // i must ve valid
RW_ASSERT (-1 < rhs.i_ && rhs.i_ < 257); // rhs.i must be valid
@@ -499,7 +505,7 @@
}
-static const struct UserCharFmatInit {
+static const struct _TEST_EXPORT UserCharFmatInit {
UserCharFmatInit ();
} _rw_user_char_fmat_init;
Index: include/rw/_specialized.h
===================================================================
--- include/rw/_specialized.h (revision 447839)
+++ include/rw/_specialized.h (working copy)
@@ -76,6 +76,8 @@
#undef _RWSTD_CONTAINER_SIZE_TYPE
+#ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
+
template <class _TypeT, class _TypeU>
inline void
__rw_construct (_TypeT* __p, const _TypeU& __val)
@@ -92,7 +94,26 @@
__rw_construct (_RWSTD_CONST_CAST (_TypeT*, __p), __val);
}
+#else // #ifdef _RWSTD_NO_PART_SPEC_OVERLOAD
+template <class _TypeT, class _TypeU>
+inline void
+__rw_construct_impl (_TypeT* __p, const _TypeU& __val)
+{
+ ::new (_RWSTD_STATIC_CAST (void*, __p)) _TypeT (__val);
+}
+
+
+template <class _TypeT, class _TypeU>
+inline void
+__rw_construct (volatile _TypeT* __p, const _TypeU& __val)
+{
+ // remove volatile before invoking operator new
+ __rw_construct_impl (_RWSTD_CONST_CAST (_TypeT*, __p), __val);
+}
+
+#endif // _RWSTD_NO_PART_SPEC_OVERLOAD
+
template <class _TypeT>
inline void
__rw_destroy (_TypeT &__ref)
Index: tests/utilities/20.operators.cpp
===================================================================
--- tests/utilities/20.operators.cpp (revision 447883)
+++ tests/utilities/20.operators.cpp (working copy)
@@ -49,6 +49,7 @@
#include <string>
#include <vector>
#include <utility>
+#include <cstddef> // for std::size_t
#include <driver.h>
Index: tests/utilities/20.pairs.cpp
===================================================================
--- tests/utilities/20.pairs.cpp (revision 447883)
+++ tests/utilities/20.pairs.cpp (working copy)
@@ -62,8 +62,12 @@
// instead of qualifying it with its name to work around compiler
// bugs (e.g., SunPro 5.4 -- see PR #28117)
+#ifndef _RWSTD_NO_EMPTY_MEM_INITIALIZER
+
template pair<DefaultConstructible, DefaultConstructible>::pair ();
+#endif // _RWSTD_NO_EMPTY_MEM_INITIALIZER
+
template pair<CopyConstructible, CopyConstructible>::
pair (const CopyConstructible&, const CopyConstructible&);