Author: faridz
Date: Mon Oct 2 02:51:24 2006
New Revision: 451936
URL: http://svn.apache.org/viewvc?view=rev&rev=451936
Log:
2006-10-02 Farid Zaripov <[EMAIL PROTECTED]>
* _select.h (__rw_is_same): Renamed: yes; no; Type<class T> to:
_C_yes; _C_no; _C_Type<class _TypeV>
* 22.locale.num.get.cpp (do_test): Changed type of dummy argument
from charT to charT* to resolve MSVC 7.0 ambiguity
* 21.cwchar.cpp (swscanf, vfwprintf): Removed unused template
parameter SizeT to prevent MSVC 7.0 error:
error C2783: 'int std::swscanf(const WCharT *,const WCharT *,...)' :
could not deduce template argument for 'SizeT'
(fgetwc): Return type changed to wint_t to prevent MSVC 7.0 error:
error C2785: 'int std::fgetwc(FileT *)' and 'wint_t fgetwc(FILE *)'
have different return types
(test_functions): commented const to prevent MSVC 7.0 error:
error C2147: 'tm_buf' : const automatic array must be fully
initialized
* 21.cwctype.cpp (towlower, towupper, wctrans, wctype, towctrans):
Corrected return type to prevent MSVC 7.0 error:
error C2785: 'int std::towlower(T)' and 'wchar_t towlower(wchar_t)'
have different return types
(run_test): Added exercising of the std::towctrans()
* 26.c.math.cpp (test_declarations): Resolved MSVC 7.0 ambiguity:
error C2782: 'T std::modf(T,T *)' : template parameter 'T' is
ambiguous: could be 'double' or 'long double'
* 27.forward.cpp [_RWSTD_NO_PART_SPEC_OVERLOAD]: Added is_same_type
for compilers which not support the partial ordering of function
templates
* 25.search.cpp [_MSC_VER <= 1300]: Added explicit definition of the
NonPredicateTag<X>::DummyPredicate::funcalls_ to prevent MSVC 7.0
linker error
* alg_test.h [_MSC_VER <= 1300] (conv_to_bool): UniquePtr defined
as const void* to deal with MSVC 7.0
Modified:
incubator/stdcxx/trunk/include/rw/_select.h
incubator/stdcxx/trunk/tests/algorithms/25.search.cpp
incubator/stdcxx/trunk/tests/include/alg_test.h
incubator/stdcxx/trunk/tests/iostream/27.forward.cpp
incubator/stdcxx/trunk/tests/localization/22.locale.num.get.cpp
incubator/stdcxx/trunk/tests/numerics/26.c.math.cpp
incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp
incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp
Modified: incubator/stdcxx/trunk/include/rw/_select.h
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/rw/_select.h?view=diff&rev=451936&r1=451935&r2=451936
==============================================================================
--- incubator/stdcxx/trunk/include/rw/_select.h (original)
+++ incubator/stdcxx/trunk/include/rw/_select.h Mon Oct 2 02:51:24 2006
@@ -130,16 +130,16 @@
template <class _TypeT, class _TypeU>
struct __rw_is_same
{
- struct yes {};
- struct no { yes no_ [2]; };
- template <class T>
- struct Type {};
+ struct _C_yes {};
+ struct _C_no { _C_yes no_ [2]; };
+ template <class _TypeV>
+ struct _C_Type {};
- static yes test (Type<_TypeT>, Type<_TypeT>);
- static no test (...);
+ static _C_yes test (_C_Type<_TypeT>, _C_Type<_TypeT>);
+ static _C_no test (...);
- enum { _C_val = sizeof (test (Type<_TypeT> (),
- Type<_TypeU> ())) == sizeof (yes) };
+ enum { _C_val = sizeof (test (_C_Type<_TypeT> (),
+ _C_Type<_TypeU> ())) == sizeof (_C_yes) };
typedef _TYPENAME __rw_bool_t<_C_val>::_C_type _C_type;
};
Modified: incubator/stdcxx/trunk/tests/algorithms/25.search.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/algorithms/25.search.cpp?view=diff&rev=451936&r1=451935&r2=451936
==============================================================================
--- incubator/stdcxx/trunk/tests/algorithms/25.search.cpp (original)
+++ incubator/stdcxx/trunk/tests/algorithms/25.search.cpp Mon Oct 2 02:51:24
2006
@@ -6,16 +6,23 @@
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 1994-2005 Rogue Wave Software.
*
**************************************************************************/
@@ -189,6 +196,12 @@
template <class T>
std::size_t NonPredicateTag<T>::DummyPredicate::funcalls_;
+
+#if defined (_MSC_VER) && _MSC_VER <= 1300
+// to prevent MSVC 7.0 error LNK2001: unresolved external symbol "public:
+// static unsigned int NonPredicateTag<struct X>::DummyPredicate::funcalls_"
+std::size_t NonPredicateTag<X>::DummyPredicate::funcalls_;
+#endif
/**************************************************************************/
Modified: incubator/stdcxx/trunk/tests/include/alg_test.h
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/include/alg_test.h?view=diff&rev=451936&r1=451935&r2=451936
==============================================================================
--- incubator/stdcxx/trunk/tests/include/alg_test.h (original)
+++ incubator/stdcxx/trunk/tests/include/alg_test.h Mon Oct 2 02:51:24 2006
@@ -6,16 +6,23 @@
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 1994-2005 Rogue Wave Software.
*
**************************************************************************/
@@ -287,6 +294,7 @@
return conv_to_bool (val);
}
+#if !defined (_MSC_VER) || _MSC_VER > 1300
// unique pointer not compatible with any other
typedef bool conv_to_bool::*UniquePtr;
@@ -296,6 +304,13 @@
operator UniquePtr () const {
return val_ ? &conv_to_bool::val_ : UniquePtr (0);
}
+#else
+ typedef const void* UniquePtr;
+
+ operator UniquePtr () const {
+ return val_ ? &val_ : UniquePtr (0);
+ }
+#endif
private:
// not (publicly) Default-Constructible
Modified: incubator/stdcxx/trunk/tests/iostream/27.forward.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/iostream/27.forward.cpp?view=diff&rev=451936&r1=451935&r2=451936
==============================================================================
--- incubator/stdcxx/trunk/tests/iostream/27.forward.cpp (original)
+++ incubator/stdcxx/trunk/tests/iostream/27.forward.cpp Mon Oct 2 02:51:24
2006
@@ -6,16 +6,23 @@
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 1994-2005 Rogue Wave Software.
*
**************************************************************************/
@@ -124,12 +131,34 @@
/**************************************************************************/
+#ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
+
template <class T, class U>
bool is_same_type (const T*, const U*) { return false; }
template <class T>
bool is_same_type (const T*, const T*) { return true; }
+#else // ifdef _RWSTD_NO_PART_SPEC_OVERLOAD
+
+template <class T, class U>
+struct is_same
+{
+ struct yes {};
+ struct no { yes no_ [2]; };
+ template <class T>
+ struct Type {};
+
+ static yes test (Type<T>, Type<T>);
+ static no test (...);
+
+ enum { value = sizeof (test (Type<T> (), Type<U> ())) == sizeof (yes) };
+};
+
+template <class T, class U>
+bool is_same_type (const T*, const U*) { return is_same<T, U>::value; }
+
+#endif // _RWSTD_NO_PART_SPEC_OVERLOAD
/**************************************************************************/
Modified: incubator/stdcxx/trunk/tests/localization/22.locale.num.get.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.num.get.cpp?view=diff&rev=451936&r1=451935&r2=451936
==============================================================================
--- incubator/stdcxx/trunk/tests/localization/22.locale.num.get.cpp (original)
+++ incubator/stdcxx/trunk/tests/localization/22.locale.num.get.cpp Mon Oct 2
02:51:24 2006
@@ -6,22 +6,23 @@
*
***************************************************************************
*
- * Copyright 2005-2006 The Apache Software Foundation or its licensors,
- * as applicable.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at
*
- * Copyright 2002-2006 Rogue Wave Software.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 2002-2006 Rogue Wave Software.
*
**************************************************************************/
@@ -245,7 +246,7 @@
template <class charT, class nativeT>
int do_test (int lineno, // line number
- charT /* dummy */,
+ charT* /* dummy */,
const char *cname, // name of character type
IterType itype, // type of input iterator
const char *iname, // name of input iterator
@@ -442,15 +443,15 @@
{
switch (ctype) {
case narrow_char:
- return do_test (lineno, char (), cname, itype, iname,
+ return do_test (lineno, (char*)0, cname, itype, iname,
val, str, eat_expect, flags, err_expect, grouping);
case wide_char:
- return do_test (lineno, wchar_t (), cname, itype, iname,
+ return do_test (lineno, (wchar_t*)0, cname, itype, iname,
val, str, eat_expect, flags, err_expect, grouping);
case user_char:
break;
#if 0 // disabled
- return do_test (lineno, UserChar (), cname, itype, iname,
+ return do_test (lineno, (UserChar*)0, cname, itype, iname,
val, str, eat_expect, flags, err_expect, grouping);
#endif // disabled
}
Modified: incubator/stdcxx/trunk/tests/numerics/26.c.math.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/numerics/26.c.math.cpp?view=diff&rev=451936&r1=451935&r2=451936
==============================================================================
--- incubator/stdcxx/trunk/tests/numerics/26.c.math.cpp (original)
+++ incubator/stdcxx/trunk/tests/numerics/26.c.math.cpp Mon Oct 2 02:51:24 2006
@@ -319,7 +319,7 @@
(void)fmod (ld, ld);
(void)frexp (ld, &i);
(void)ldexp (ld, i);
- (void)modf (ld, &d);
+ (void)modf (ld, &ld);
(void)pow (ld, ld);
(void)pow (ld, i);
Modified: incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp?view=diff&rev=451936&r1=451935&r2=451936
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp Mon Oct 2 02:51:24 2006
@@ -6,16 +6,23 @@
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 1994-2005 Rogue Wave Software.
*
**************************************************************************/
@@ -632,10 +639,10 @@
template <class WCharT, class SizeT>
int swprintf (WCharT*, SizeT, const WCharT*, ...) { return ncalls++; }
-template <class WCharT, class SizeT>
+template <class WCharT>
int swscanf (const WCharT*, const WCharT*, ...) { return ncalls++; }
-template <class FileT, class WCharT, class SizeT, class VAList>
+template <class FileT, class WCharT, class VAList>
int vfwprintf (FileT*, const WCharT*, VAList) { return ncalls++; }
template <class WCharT, class VAList>
@@ -645,7 +652,7 @@
int vswprintf (WCharT*, SizeT, const WCharT*, VAList) { return ncalls++; }
template <class FileT>
-int fgetwc (FileT*) { return ncalls++; }
+wint_t fgetwc (FileT*) { return ncalls++; }
template <class WCharT, class FileT>
WCharT* fgetws (WCharT*, int, FileT*) { ncalls++; return 0; }
@@ -909,7 +916,9 @@
TEST (wchar_t*, wmemmove, (wstr, L"", size), WMEMMOVE, -1);
TEST (wchar_t*, wmemset, (wstr, L'\0', size), WMEMSET, -1);
- const int tm_buf [16] = { 0 };
+ // const commented to prevent MSVC 7.0 error:
+ // error C2147: 'tm_buf' : const automatic array must be fully initialized
+ /*const */int tm_buf [16] = { 0 };
const test_tm* tmb = (const test_tm*)&tm_buf;
TEST (test_size_t, wcsftime, (wstr, size, L"", tmb), WCSFTIME, -1);
Modified: incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp?view=diff&rev=451936&r1=451935&r2=451936
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp Mon Oct 2 02:51:24 2006
@@ -7,16 +7,23 @@
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 1994-2005 Rogue Wave Software.
*
**************************************************************************/
@@ -282,35 +289,35 @@
// define function template overloads for the <cctype> functions with
// the same name to detect whether the C versions are declared or not
-#define TEST_FUNCTION(name) \
- template <class T> int name (T) { \
+#define TEST_FUNCTION(name, ret) \
+ template <class T> ret name (T) { \
missing_set |= bit_ ## name; \
return -1; \
} typedef void rw_unused_typedef
_RWSTD_NAMESPACE (std) {
-TEST_FUNCTION (iswalnum);
-TEST_FUNCTION (iswalpha);
-TEST_FUNCTION (iswcntrl);
-TEST_FUNCTION (iswdigit);
-TEST_FUNCTION (iswgraph);
-TEST_FUNCTION (iswlower);
-TEST_FUNCTION (iswprint);
-TEST_FUNCTION (iswpunct);
-TEST_FUNCTION (iswspace);
-TEST_FUNCTION (iswupper);
-TEST_FUNCTION (iswxdigit);
-TEST_FUNCTION (towlower);
-TEST_FUNCTION (towupper);
-TEST_FUNCTION (wctrans);
-TEST_FUNCTION (wctype);
+TEST_FUNCTION (iswalnum, int);
+TEST_FUNCTION (iswalpha, int);
+TEST_FUNCTION (iswcntrl, int);
+TEST_FUNCTION (iswdigit, int);
+TEST_FUNCTION (iswgraph, int);
+TEST_FUNCTION (iswlower, int);
+TEST_FUNCTION (iswprint, int);
+TEST_FUNCTION (iswpunct, int);
+TEST_FUNCTION (iswspace, int);
+TEST_FUNCTION (iswupper, int);
+TEST_FUNCTION (iswxdigit, int);
+TEST_FUNCTION (towlower, wchar_t);
+TEST_FUNCTION (towupper, wchar_t);
+TEST_FUNCTION (wctrans, wctrans_t);
+TEST_FUNCTION (wctype, wctype_t);
template <class T, class U>
int iswctype (T, U) { missing_set |= bit_iswctype; return -1; }
template <class T, class U>
-int towctrans (T, U) { missing_set |= bit_towctrans; return -1; }
+wint_t towctrans (T, U) { missing_set |= bit_towctrans; return -1; }
} // namespace std
@@ -889,6 +896,16 @@
rw_assert (-1 != result && !(missing_set & bit_wctrans), 0, __LINE__,
"%s::wctrans (const char*) not defined", std_name);
+
+ // exercise std::towctrans(wint_t, wctrans_t)
+ rw_info (0, 0, 0,
+ "%s::towctrans(wint_t, wctrans_t) definition", std_name);
+
+ const test_wctrans_t category = 0;
+ result = std::towctrans (wc, category);
+
+ rw_assert (-1 != result && !(missing_set & bit_towctrans), 0, __LINE__,
+ "%s::towctrans(wint_t, wctrans_t) not defined", std_name);
//////////////////////////////////////////////////////////////////
if (rw_opt_no_behavior)