2008-07-03 Farid Zaripov <faridz@apache.org>
Merged r671433, r671542, r671547, r671833, r671835, r671890,
r673060, r673067, r673109, r673122, r673125, r673156, r673604
from 4.2.x branch.
2008-06-25 Farid Zaripov <faridz@apache.org>
STDCXX-969
* include/fstream.cc (close): Reset input/output sequences to prevent
any subsequent I/O attempts on closed file.
2008-06-25 Farid Zaripov <farid_zaripov@epam.com>
STDCXX-152
* include/rw/_tree.h (_rb_tree): Rewrite typedefs to allow instantiate
map and set containers on incomplete type.
2008-06-25 Farid Zaripov <farid_zaripov@epam.com>
* include/rw/_mutex.h: #define WIN32_LEAN_AND_MEAN before #including
<windows.h> to prevent #including unneeded headers, especially
<winsock.h>, that causes an "WinSock.h has already been included"
errors when <winsock2.h> has been #included after <rw/_mutex.h>.
2008-06-26 Farid Zaripov <faridz@apache.com>
* tests/regress/23.containers.stdcxx-152.cpp: New regression test for
STDCXX-152 issue.
2008-06-26 Farid Zaripov <faridz@apache.com>
* tests/regress/23.vector.stdcxx-972.cpp: New regression test for
STDCXX-972 issue.
2008-06-26 Farid Zaripov <faridz@apache.com>
* tests/regress/27.filebuf.close.stdcxx-969.cpp: New regression test
for STDCXX-969 issue.
2008-07-01 Farid Zaripov <faridz@apache.com>
STDCXX-339
* README: Removed description of the outdated
_RWSTD_NO_INLINE_MEMBER_TEMPLATES config macro.
* etc/config/src/INLINE_MEMBER_TEMPLATES.cpp:
Deleted corresponding configuration test.
2008-07-01 Farid Zaripov <faridz@apache.com>
* include/rw/_config-msvcrt.h [_WIN64]: Don't #define
_RWSTD_NO_FWD_DECLARATIONS since the present forward
declarations are working fine on _WIN64.
* include/rw/_mutex.h [_WIN32 && _RWSTD_NO_FWD_DECLARATIONS]:
Reverted changes from r671547.
2008-07-01 Farid Zaripov <faridz@apache.com>
STDCXX-339
* etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp: Removed dependency
on deleted config test. Corrected name of the config macro
_RWSTD_NO_MEMBER_TEMPLATES. Replaced NO_MEMBER_TEMPLATE to
NO_MEMBER_TEMPLATES for consistency.
* etc/config/src/extern_template_imp.cpp: Ditto.
* etc/config/src/extern_template_imp.h: Removed using of the
NO_INLINE_MEMBER_TEMPLATE macro. Replaced NO_MEMBER_TEMPLATE to
NO_MEMBER_TEMPLATES for consistency.
* etc/config/src/MEMBER_TEMPLATES.cpp: Removed inclusion of the
deleted config test.
2008-07-01 Farid Zaripov <faridz@apache.com>
* etc/config/src/ATOMIC_OPS.cpp: Restored config test file, deleted
in rev. 614212.
* include/rw/_mutex.h: Define new macro _RWSTD_CRITICAL_SECTION
defined as _CRITICAL_SECTION on gcc/MinGW and _RTL_CRITICAL_SECTION
on other Windows compilers.
[_RWSTD_INTERLOCKED_T && !_MSC_VER] Added declarations of Win32 API
InterlockedXXX() functions. Added definitions of the inline
_InterlockedXXX() functions for consistency with MSVC's intinsics.
Use __try/__except on MSVC (and ICC/Windows) only.
2008-07-01 Farid Zaripov <faridz@apache.com>
* etc/config/windows/configure.wsf (checkArchitecture):
Corrected regular expression's.
(checkDependencies): Updated regular expression to find
the macros, that exactly matches to the required dependency.
2008-07-01 Farid Zaripov <faridz@apache.com>
* etc/config/src/libc_decl.sh: Echo linker's command line as well.
2008-07-03 Farid Zaripov <faridz@apache.com>
* util/gencat.cpp (main): Added code for generating
message catalogs on MinGW.
git-svn-id: https://svn.apache.org/repos/asf/stdcxx/trunk@673648 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/README b/README
index 09d0386..63b8c12 100644
--- a/README
+++ b/README
@@ -1008,12 +1008,6 @@
#defined at configuration time according to the declaration of
the POSIX function iconv().
- o _RWSTD_NO_INLINE_MEMBER_TEMPLATES [auto, lib, over]
-
- #defined at configuration time for C++ implementations that
- reject member templates completely defined within the body of the
- class or template of which they are a member.
-
o _RWSTD_NO_INSTANTIATE_DEFAULT_ARGS [auto, over]
#defined at configuration time for C++ implementations that
diff --git a/etc/config/src/ATOMIC_OPS.cpp b/etc/config/src/ATOMIC_OPS.cpp
new file mode 100644
index 0000000..19582b1
--- /dev/null
+++ b/etc/config/src/ATOMIC_OPS.cpp
@@ -0,0 +1,68 @@
+// checking for atomic operations
+
+/***************************************************************************
+ *
+ * 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 1999-2007 Rogue Wave Software, Inc.
+ *
+ **************************************************************************/
+
+#if defined (_WIN32) && !defined (_WIN64)
+
+#include <stdio.h>
+#include <windows.h>
+
+
+extern "C" {
+
+typedef int __stdcall pfiipv_t (int*);
+typedef int __stdcall pfiip_t (volatile int*);
+typedef long __stdcall pfllp_t (long*);
+typedef long __stdcall pfllpv_t (volatile long*);
+
+} // extern "C"
+
+
+const char* foo (pfiip_t) { return "int"; }
+const char* foo (pfiipv_t) { return "volatile int"; }
+
+const char* foo (pfllp_t) { return "long"; }
+const char* foo (pfllpv_t) { return "volatile long"; }
+
+
+int main ()
+{
+ // determine the argument type of InterlockedIncrement()
+ // (the type changes from long* to volatile long* depending
+ // on the version/patch of MSVC)
+
+ printf ("#define _RWSTD_INTERLOCKED_T %s\n", foo (InterlockedIncrement));
+
+ return 0;
+}
+
+#else // not 32-bit Windows
+
+#include <stdio.h>
+
+int main ()
+{
+ return 0;
+}
+
+#endif // Windows
diff --git a/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp b/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp
index b0ba08a..0006d1a 100644
--- a/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp
+++ b/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp
@@ -27,13 +27,9 @@
// establish dependencies on the config tests and define config
// macros used in the header below (the are not autodetected
// in headers)
-#ifdef _RWSTD_NO_INLINE_MEMBER_TEMPLATE
-# define NO_INLINE_MEMBER_TEMPLATE
-#endif // _RWSTD_NO_INLINE_MEMBER_TEMPLATE
-
-#ifdef _RWSTD_NO_MEMBER_TEMPLATE
-# define NO_MEMBER_TEMPLATE
-#endif // _RWSTD_NO_MEMBER_TEMPLATE
+#ifdef _RWSTD_NO_MEMBER_TEMPLATES
+# define NO_MEMBER_TEMPLATES
+#endif // _RWSTD_NO_MEMBER_TEMPLATES
// include a file containing the definition of a template
// and an extern template directive referencing an explicit
diff --git a/etc/config/src/INLINE_MEMBER_TEMPLATES.cpp b/etc/config/src/INLINE_MEMBER_TEMPLATES.cpp
deleted file mode 100644
index 4feb0b1..0000000
--- a/etc/config/src/INLINE_MEMBER_TEMPLATES.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// checking for inline member templates
-
-/***************************************************************************
- *
- * 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 1999-2007 Rogue Wave Software, Inc.
- *
- **************************************************************************/
-
-struct A
-{
- template <class T>
- struct AB { };
-
- template <class T>
- void foo (T) { }
-};
-
-
-template <class T>
-struct B
-{
- template <class U>
- struct BB { };
-
- template <class U>
- void foo (U) { }
-};
-
-
-// check that member templates are usable
-void foo (A a, A::AB<int> aab, B<int> b, B<char>::BB<int> bbb)
-{
- a.foo (aab);
-
- b.foo (bbb);
-}
diff --git a/etc/config/src/MEMBER_TEMPLATES.cpp b/etc/config/src/MEMBER_TEMPLATES.cpp
index 07bb611..873ffd5 100644
--- a/etc/config/src/MEMBER_TEMPLATES.cpp
+++ b/etc/config/src/MEMBER_TEMPLATES.cpp
@@ -22,9 +22,6 @@
*
**************************************************************************/
-// both tests must successfully compile
-#include "INLINE_MEMBER_TEMPLATES.cpp"
-
struct C
{
template <class T>
diff --git a/etc/config/src/extern_template_imp.cpp b/etc/config/src/extern_template_imp.cpp
index 42e6f1c..481072b 100644
--- a/etc/config/src/extern_template_imp.cpp
+++ b/etc/config/src/extern_template_imp.cpp
@@ -26,13 +26,9 @@
// establish dependencies on the config tests and define config
// macros used in the header below (the are not autodetected
// in headers)
-#ifdef _RWSTD_NO_INLINE_MEMBER_TEMPLATE
-# define NO_INLINE_MEMBER_TEMPLATE
-#endif // _RWSTD_NO_INLINE_MEMBER_TEMPLATE
-
-#ifndef _RWSTD_NO_MEMBER_TEMPLATE
-# define NO_MEMBER_TEMPLATE
-#endif // _RWSTD_NO_MEMBER_TEMPLATE
+#ifndef _RWSTD_NO_MEMBER_TEMPLATES
+# define NO_MEMBER_TEMPLATES
+#endif // _RWSTD_NO_MEMBER_TEMPLATES
// explicitly instantiate the template defined in the header
#define INSTANTIATE
diff --git a/etc/config/src/extern_template_imp.h b/etc/config/src/extern_template_imp.h
index 4d6eae4..a0e4e05 100644
--- a/etc/config/src/extern_template_imp.h
+++ b/etc/config/src/extern_template_imp.h
@@ -47,33 +47,27 @@
return bar ();
}
-#if defined (NO_INLINE_MEMBER_TEMPLATE)
+#if defined (NO_MEMBER_TEMPLATES)
int inline_member_template (int) const {
return 0;
}
-#else // if !defined (NO_INLINE_MEMBER_TEMPLATE)
+ int member_template (int) const {
+ return 0;
+ }
+
+#else // if !defined (NO_MEMBER_TEMPLATES)
template <class U>
U inline_member_template (U) const {
return U ();
}
-#endif // NO_INLINE_MEMBER_TEMPLATE
-
-#if defined (NO_MEMBER_TEMPLATE)
-
- int member_template (int) const {
- return 0;
- }
-
-#else // if !defined (NO_MEMBER_TEMPLATE)
-
template <class U>
U member_template (U) const;
-#endif // NO_MEMBER_TEMPLATE
+#endif // NO_MEMBER_TEMPLATES
};
@@ -93,7 +87,7 @@
#endif // INSTANTIATE
}
-#if !defined (NO_MEMBER_TEMPLATE)
+#if !defined (NO_MEMBER_TEMPLATES)
template <class T>
template <class U>
@@ -102,7 +96,7 @@
return U ();
}
-#endif // NO_MEMBER_TEMPLATE
+#endif // NO_MEMBER_TEMPLATES
#if defined (INSTANTIATE)
diff --git a/etc/config/src/libc_decl.sh b/etc/config/src/libc_decl.sh
index 785a02a..7e1136b 100755
--- a/etc/config/src/libc_decl.sh
+++ b/etc/config/src/libc_decl.sh
@@ -348,7 +348,8 @@
echo "$CXX -c -DCHECK_DECL $CXXFLAGS $WARNFLAGS " \
"-DHDRNAME=\"<$hdrname>\" -DFUNNAME=$funname " \
"-DFUN=$f -DTAKE_ADDR=$take_addr " \
- "$tmpsrc -o $tmpobj" >>$logfile 2>&1
+ "$tmpsrc -o $tmpobj" \
+ "&& $LD $tmpobj $LDFLAGS -l$lib" >>$logfile 2>&1
# spell out all arguments just like above, being careful
# about quoting HDRNAME
diff --git a/etc/config/windows/configure.wsf b/etc/config/windows/configure.wsf
index 0409928..7ebf945 100644
--- a/etc/config/windows/configure.wsf
+++ b/etc/config/windows/configure.wsf
@@ -391,11 +391,11 @@
sizes += "-";
}
}
- var rxLP32 = /24?4/;
- var rxILP32 = /44?4/;
- var rxILP64 = /88?8/;
+ var rxLP32 = /24.4/;
+ var rxILP32 = /44.4/;
+ var rxILP64 = /88.8/;
var rxLLP64 = /4488/;
- var rxLP64 = /48?8/;
+ var rxLP64 = /48.8/;
var arch;
if (rxLP32.test(sizes))
{
@@ -920,7 +920,7 @@
var dep = /_RWSTD_(?:NO_)?(\S+)/.exec(deps[i])[1];
// remove _IN_LIBC | _IN_LIBM from dependency string
dep = dep.replace(/_IN_LIB[CM]/, "");
- var rx = new RegExp("_RWSTD_NO_" + dep);
+ var rx = new RegExp("\\s+_RWSTD_NO_" + dep + "\\s+");
if (!rx.test(configText))
{
if (dumpUnresolved)
diff --git a/include/fstream.cc b/include/fstream.cc
index 973b40b..46a5199 100644
--- a/include/fstream.cc
+++ b/include/fstream.cc
@@ -106,6 +106,10 @@
_C_file = 0;
_C_cur_pos = _C_beg_pos = pos_type (off_type (-1));
+ // reset input/output sequences to prevent any
+ // subsequent I/O attempts on closed file
+ this->setg (0, 0, 0);
+ this->setp (0, 0);
}
// rethrow the caught exception
@@ -119,6 +123,11 @@
// zero out the file pointer except when detaching fd
_C_file = 0;
_C_cur_pos = _C_beg_pos = pos_type (off_type (-1));
+
+ // reset input/output sequences to prevent any
+ // subsequent I/O attempts on closed file
+ this->setg (0, 0, 0);
+ this->setp (0, 0);
}
return __retval;
diff --git a/include/rw/_config-msvcrt.h b/include/rw/_config-msvcrt.h
index e40f037..753c00d 100644
--- a/include/rw/_config-msvcrt.h
+++ b/include/rw/_config-msvcrt.h
@@ -93,11 +93,6 @@
# define _RWSTD_LONG_LONG __int64
#endif // _MSC_VER <= 1300 || _RWSTD_NO_LONG_LONG
-#if defined (_WIN64)
- // FIXME: handle by forward declaring fuctions in <rw/_mutex.h>
-# define _RWSTD_NO_FWD_DECLARATIONS
-#endif // _WIN64
-
#if defined (WIN32) && !defined(_WIN32)
# define _WIN32
#endif
diff --git a/include/rw/_mutex.h b/include/rw/_mutex.h
index 0fdd361..2826dc6 100644
--- a/include/rw/_mutex.h
+++ b/include/rw/_mutex.h
@@ -122,12 +122,21 @@
#elif defined (_WIN32)
+# ifdef __MINGW32__
+# define _RWSTD_CRITICAL_SECTION _CRITICAL_SECTION
+# else
+# define _RWSTD_CRITICAL_SECTION _RTL_CRITICAL_SECTION
+# endif
+
# ifdef _RWSTD_NO_FWD_DECLARATIONS
+ // #including <windows.h> without WIN32_LEAN_AND_MEAN macro defined
+ // may cause an errors "WinSock.h has already been included"
+ // when <winsock2.h> has been included after this header
# include <windows.h>
-# define _RWSTD_MUTEX_T _RTL_CRITICAL_SECTION
+# define _RWSTD_MUTEX_T _RWSTD_CRITICAL_SECTION
-# else // if defined (_RWSTD_NO_FWD_DECLARATIONS)
+# else // if !defined (_RWSTD_NO_FWD_DECLARATIONS)
// avoid #including this header (MFC doesn't like it)
// # include <windows.h>
@@ -135,19 +144,32 @@
extern "C" {
// but rather declare these globals here
-struct _RTL_CRITICAL_SECTION;
+struct _RWSTD_CRITICAL_SECTION;
__declspec (dllimport) void __stdcall
-InitializeCriticalSection (_RTL_CRITICAL_SECTION*);
+InitializeCriticalSection (_RWSTD_CRITICAL_SECTION*);
__declspec (dllimport) void __stdcall
-EnterCriticalSection (_RTL_CRITICAL_SECTION*);
+EnterCriticalSection (_RWSTD_CRITICAL_SECTION*);
__declspec (dllimport) void __stdcall
-LeaveCriticalSection (_RTL_CRITICAL_SECTION*);
+LeaveCriticalSection (_RWSTD_CRITICAL_SECTION*);
__declspec (dllimport) void __stdcall
-DeleteCriticalSection (_RTL_CRITICAL_SECTION*);
+DeleteCriticalSection (_RWSTD_CRITICAL_SECTION*);
+
+# if defined (_RWSTD_INTERLOCKED_T) && !defined (_MSC_VER)
+
+__declspec (dllimport) long __stdcall
+InterlockedIncrement (_RWSTD_INTERLOCKED_T*);
+
+__declspec (dllimport) long __stdcall
+InterlockedDecrement (_RWSTD_INTERLOCKED_T*);
+
+__declspec (dllimport) long __stdcall
+InterlockedExchange (_RWSTD_INTERLOCKED_T*, long);
+
+# endif // _RWSTD_INTERLOCKED_T && !_MSC_VER
} // extern "C"
@@ -199,15 +221,40 @@
# pragma intrinsic (_InterlockedExchange64)
# endif // _RWSTD_MSVC
# endif // _M_X64
+# elif defined (_RWSTD_INTERLOCKED_T)
+
+inline long _InterlockedIncrement (volatile long *__x)
+{
+ return InterlockedIncrement (
+ _RWSTD_CONST_CAST (_RWSTD_INTERLOCKED_T*, __x));
+}
+
+inline long _InterlockedDecrement (volatile long *__x)
+{
+ return InterlockedDecrement (
+ _RWSTD_CONST_CAST (_RWSTD_INTERLOCKED_T*, __x));
+}
+
+inline long _InterlockedExchange (volatile long *__x, long __y)
+{
+ return InterlockedExchange (
+ _RWSTD_CONST_CAST (_RWSTD_INTERLOCKED_T*, __x), __y);
+}
+
# endif // _MSC_VER
_RWSTD_NAMESPACE (__rw) {
+# ifndef _MSC_VER
+# define __try if (1)
+# define __except(ignore) else if (0)
+# endif // _MSC_VER
+
// Win32/64 throws non-C++ exceptions rather than returning error status
// from some system calls like most other operating systems do
-inline int __rw_mutex_init (_RTL_CRITICAL_SECTION *__mutex)
+inline int __rw_mutex_init (_RWSTD_CRITICAL_SECTION *__mutex)
{
__try {
InitializeCriticalSection (__mutex);
@@ -218,7 +265,7 @@
return 0;
}
-inline int __rw_mutex_destroy (_RTL_CRITICAL_SECTION *__mutex)
+inline int __rw_mutex_destroy (_RWSTD_CRITICAL_SECTION *__mutex)
{
__try {
DeleteCriticalSection (__mutex);
@@ -229,7 +276,7 @@
return 0;
}
-inline int __rw_mutex_lock (_RTL_CRITICAL_SECTION *__mutex)
+inline int __rw_mutex_lock (_RWSTD_CRITICAL_SECTION *__mutex)
{
__try {
EnterCriticalSection (__mutex);
@@ -240,7 +287,7 @@
return 0;
}
-inline int __rw_mutex_unlock (_RTL_CRITICAL_SECTION *__mutex)
+inline int __rw_mutex_unlock (_RWSTD_CRITICAL_SECTION *__mutex)
{
__try {
LeaveCriticalSection (__mutex);
@@ -252,13 +299,18 @@
}
# define _RWSTD_MUTEX_INIT(mutex) \
- __rw_mutex_init (_RWSTD_REINTERPRET_CAST (_RTL_CRITICAL_SECTION*, &mutex))
+ __rw_mutex_init (_RWSTD_REINTERPRET_CAST (_RWSTD_CRITICAL_SECTION*, &mutex))
# define _RWSTD_MUTEX_DESTROY(mutex) \
- __rw_mutex_destroy (_RWSTD_REINTERPRET_CAST (_RTL_CRITICAL_SECTION*, &mutex))
+ __rw_mutex_destroy (_RWSTD_REINTERPRET_CAST (_RWSTD_CRITICAL_SECTION*, &mutex))
# define _RWSTD_MUTEX_LOCK(mutex) \
- __rw_mutex_lock (_RWSTD_REINTERPRET_CAST (_RTL_CRITICAL_SECTION*, &mutex))
+ __rw_mutex_lock (_RWSTD_REINTERPRET_CAST (_RWSTD_CRITICAL_SECTION*, &mutex))
# define _RWSTD_MUTEX_UNLOCK(mutex) \
- __rw_mutex_unlock (_RWSTD_REINTERPRET_CAST (_RTL_CRITICAL_SECTION*, &mutex))
+ __rw_mutex_unlock (_RWSTD_REINTERPRET_CAST (_RWSTD_CRITICAL_SECTION*, &mutex))
+
+# ifndef _MSC_VER
+# undef __try
+# undef __except
+# endif // _MSC_VER
} // namespace __rw
diff --git a/include/rw/_tree.h b/include/rw/_tree.h
index 743947d..67236c2 100644
--- a/include/rw/_tree.h
+++ b/include/rw/_tree.h
@@ -261,9 +261,9 @@
typedef __rw_rb_tree_node<_Alloc,_Val,_Key,_KeyOf> _C_node_t;
typedef _RWSTD_ALLOC_TYPE (_Alloc,_Val) _C_val_alloc_t;
- typedef _TYPENAME _C_node_t::_C_key_alloc_t _C_key_alloc_t;
- typedef _TYPENAME _C_node_t::_C_node_alloc_t _C_node_alloc_t;
- typedef _TYPENAME _C_node_t::_C_link_t _C_link_t;
+ typedef _RWSTD_REBIND (_Alloc, _Key) _C_key_alloc_t;
+ typedef _RWSTD_REBIND (_Alloc, _C_node_t) _C_node_alloc_t;
+ typedef _TYPENAME _C_node_alloc_t::pointer _C_link_t;
public:
diff --git a/tests/regress/23.containers.stdcxx-152.cpp b/tests/regress/23.containers.stdcxx-152.cpp
new file mode 100644
index 0000000..19bae4a
--- /dev/null
+++ b/tests/regress/23.containers.stdcxx-152.cpp
@@ -0,0 +1,97 @@
+/***************************************************************************
+ *
+ * 23.containers.stdcxx-152.cpp - regression test for STDCXX-152
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * 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.
+ *
+ **************************************************************************/
+
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+
+using namespace std;
+
+template <class T>
+struct TestMap
+{
+ typedef map<T, TestMap> Map;
+ typedef typename Map::value_type value_type;
+ Map data;
+};
+
+
+template <class T>
+struct TestMultiMap
+{
+ typedef multimap<T, TestMultiMap> MultiMap;
+ typedef typename MultiMap::value_type value_type;
+ MultiMap data;
+};
+
+
+template <class T>
+struct TestSet
+{
+ typedef set<pair<T, TestSet> > Set;
+ typedef typename Set::value_type value_type;
+ Set data;
+};
+
+bool operator< (const pair<string, TestSet<string> >& lhs,
+ const pair<string, TestSet<string> >& rhs)
+{
+ return lhs.first < rhs.first;
+}
+
+
+template <class T>
+struct TestMultiSet
+{
+ typedef multiset<pair<T, TestMultiSet> > MultiSet;
+ typedef typename MultiSet::value_type value_type;
+ MultiSet data;
+};
+
+bool operator< (const pair<string, TestMultiSet<string> >& lhs,
+ const pair<string, TestMultiSet<string> >& rhs)
+{
+ return lhs.first < rhs.first;
+}
+
+
+int main ()
+{
+ TestMap<string> test1;
+ test1.data.insert (make_pair ("test1", test1));
+
+ TestMultiMap<string> test2;
+ test2.data.insert (make_pair ("test2", test2));
+
+ TestSet<string> test3;
+ test3.data.insert (make_pair ("test3", test3));
+
+ TestMultiSet<string> test4;
+ test4.data.insert (make_pair ("test4", test4));
+
+ return 0;
+}
diff --git a/tests/regress/23.vector.stdcxx-972.cpp b/tests/regress/23.vector.stdcxx-972.cpp
new file mode 100644
index 0000000..69267ea
--- /dev/null
+++ b/tests/regress/23.vector.stdcxx-972.cpp
@@ -0,0 +1,53 @@
+/************************************************************************
+ *
+ * 23.vector.stdcxx-972.cpp - regression test for STDCXX-972
+ *
+ * https://issues.apache.org/jira/browse/STDCXX-972
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * 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.
+ *
+ **************************************************************************/
+
+#include <vector> // for vector
+
+
+void test ()
+{
+ typedef std::vector<bool> Vector;
+ typedef Vector::iterator Iter;
+ typedef Vector::const_iterator CIter;
+
+ Vector vec (10);
+
+ Iter it = vec.begin ();
+ CIter cit = vec.begin ();
+
+ 5 + it;
+ 5 + cit;
+}
+
+
+int main ()
+{
+ test ();
+ // compile-time only test
+ return 0;
+}
diff --git a/tests/regress/27.filebuf.close.stdcxx-969.cpp b/tests/regress/27.filebuf.close.stdcxx-969.cpp
new file mode 100644
index 0000000..d2e36cb
--- /dev/null
+++ b/tests/regress/27.filebuf.close.stdcxx-969.cpp
@@ -0,0 +1,61 @@
+/************************************************************************
+ *
+ * 27.filebuf.close.stdcxx-969.cpp - regression test for STDCXX-969
+ *
+ * http://issues.apache.org/jira/browse/STDCXX-969
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * 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.
+ *
+ **************************************************************************/
+
+#include <cassert>
+#include <fstream>
+
+int main ()
+{
+ struct Filebuf : std::filebuf
+ {
+ char* pubgptr () const {
+ return gptr ();
+ }
+
+ char* pubpptr () const {
+ return pptr ();
+ }
+ };
+
+ Filebuf fb;
+ fb.open (__FILE__, std::ios::in);
+
+ fb.sgetc ();
+ fb.close ();
+
+ // verify that get area is not active after close()
+ assert (0 == fb.pubgptr ());
+ // verify that put area is not active after close()
+ assert (0 == fb.pubpptr ());
+
+ // verify that calling pubsync() after close()
+ // doesn't abort the program on MSVC 8.0 and later
+ fb.pubsync ();
+
+ return 0;
+}
diff --git a/util/gencat.cpp b/util/gencat.cpp
index 1e7aecd..6bbfb8d 100644
--- a/util/gencat.cpp
+++ b/util/gencat.cpp
@@ -114,11 +114,7 @@
#ifdef _WIN32
-# ifndef _WIN64
-# define PLATFORM "X86"
-# else // _WIN64
-# define PLATFORM "X64"
-# endif // _WIN64
+# ifndef __MINGW32__
const char* const env_vars [] = {
"VS90COMNTOOLS", "VS80COMNTOOLS",
@@ -138,14 +134,35 @@
cmd.push_back ('\"');
}
+ if (!cmd.empty ())
+ cmd += " && ";
+
+# endif // !__MINGW32__
+
const char* const dll_name = argv [0];
const char* const rc_name = argv [1];
std::string res_name (rc_name);
change_ext (res_name, ".res");
- if (!cmd.empty ())
- cmd += " && ";
+# ifdef __MINGW32__
+
+ cmd += "windres -O coff -i ";
+ cmd += rc_name;
+ cmd += " -o ";
+ cmd += res_name;
+ cmd += " && gcc -shared -o ";
+ cmd += dll_name;
+ cmd += ' ';
+ cmd += res_name;
+
+# else
+
+# ifndef _WIN64
+# define PLATFORM "X86"
+# else // _WIN64
+# define PLATFORM "X64"
+# endif // _WIN64
cmd += "rc ";
cmd += rc_name;
@@ -154,6 +171,8 @@
cmd += ' ';
cmd += res_name;
+# endif // __MINGW32__
+
const int ret = std::system (cmd.c_str ());
std::remove (res_name.c_str ());