[PATCH] 22.locale.ctype.is.cpp

2007-11-14 Thread Farid Zaripov
  The 22.locale.ctype.is.cpp test contains two functions: test_libc<>()
and test_libstd<>().

  If I understand correctly, the test_libc<>() designed to check the
system locales (it
iterates the all locales, returned by rw_locales()), and test_libstd<>()
designed to
check the "test-locale" locale (created by rw_create_locale()).

  First invoked test_libstd(). From there invoked
rw_create_locale() function,
which set RWSTD_LOCALE_ROOT environment variable to the temporary
directory
with "test-locale" locale.

  Then invoked test_libc(). It invokes rw_locales(), which uses
"locale -a" command.
But locale utility, if RWSTD_LOCALE_ROOT environment variable is
defined, returns
list of the library locales. In this case it returns "C" and
"test-locale". Also rw_locales()
checks the locale names by invoking std::setlocale(). Of course
std::setlocale(LC_ALL, "test-locale")
fails and as a result the rw_locales returns "C\0\0" string.

  The patch below resolves this situation by invoking first both
test_libc and test_libc
and then test_libstd and test_libstd.


  ChangeLog:
  * 22.locale.ctype.is.cpp (run_test<>): The compile time
  checks moved to test_libstd(); The function run_test<>()
  removed; The test_libstd() and test_libc() funtions are
  invoked from non-template run_test() to invoke them in
  the following order: test_libc(), test_libc(),
  test_libstd(), test_libstd().


Index: 22.locale.ctype.is.cpp
===
--- 22.locale.ctype.is.cpp  (revision 594578)
+++ 22.locale.ctype.is.cpp  (working copy)
@@ -840,6 +840,12 @@
 template 
 void test_libstd (charT, const char *cname)
 {
+if (0) {
+// do a compile time only test on use_facet and has_facet
+_STD_HAS_FACET (std::ctype_byname, std::locale ());
+_STD_USE_FACET (std::ctype_byname, std::locale ());
+}
+
 const char cmap_1[] = {
 " \"ANSI_X3.4-1968\"\n"
 " 1\n"
@@ -1025,27 +1031,15 @@
 
 
/***
***/
 
-template 
-void run_test (charT, const char *cname)
-{
-if (0) {
-// do a compile time only test on use_facet and has_facet
-_STD_HAS_FACET (std::ctype_byname, std::locale ());
-_STD_USE_FACET (std::ctype_byname, std::locale ());
-}
-
-test_libstd (charT (), cname);
-test_libc (charT (), cname);
-}
-
-/**
/
-
 static int
 run_test (int, char**)
 {
-run_test (char (), "char");
-run_test (wchar_t (), "wchar_t");
+test_libc (char (), "char");
+test_libc (wchar_t (), "wchar_t");
 
+test_libstd (char (), "char");
+test_libstd (wchar_t (), "wchar_t");
+
 return 0;
 }
 
  

Farid.


Re: svn commit: r594966 - in /incubator/stdcxx/branches/4.2.x/examples/tutorial: icecream.cpp out/icecream.out

2007-11-14 Thread Martin Sebor

[EMAIL PROTECTED] wrote:

Author: faridz
Date: Wed Nov 14 09:34:27 2007
New Revision: 594966


Btw., for strict const-correctness the eventComparator operator
should be a const member function.

Martin



URL: http://svn.apache.org/viewvc?rev=594966&view=rev
Log:
2007-11-14 Farid Zaripov <[EMAIL PROTECTED]>

STDCXX-661
* tutorial/icecream.cpp (class event): Removed unused operator>().
(eventComparator): Defined as separate struct instead of typedef
std::greater<>.
* tutorial/out/icecream.out: Updated .out file to reflect the
changes above.

Modified:
incubator/stdcxx/branches/4.2.x/examples/tutorial/icecream.cpp
incubator/stdcxx/branches/4.2.x/examples/tutorial/out/icecream.out

Modified: incubator/stdcxx/branches/4.2.x/examples/tutorial/icecream.cpp
URL: 
http://svn.apache.org/viewvc/incubator/stdcxx/branches/4.2.x/examples/tutorial/icecream.cpp?rev=594966&r1=594965&r2=594966&view=diff
==
--- incubator/stdcxx/branches/4.2.x/examples/tutorial/icecream.cpp (original)
+++ incubator/stdcxx/branches/4.2.x/examples/tutorial/icecream.cpp Wed Nov 14 
09:34:27 2007
@@ -41,16 +41,17 @@
 event (unsigned int t) : time (t)
 { }
 
-// Execute event my invoking this method.

+// Execute event by invoking this method.
 virtual void processEvent () = 0;
-bool operator> ( const event* evt_ ) {
-return time > evt_->time;
-}
 
 const unsigned int time;

 };
 
-typedef std::greater eventComparator;

+struct eventComparator {
+bool operator() (const event * left, const event * right) {
+return left->time > right->time;
+}
+};
 
 
 // Framework for discrete event-driven simulations.

@@ -66,14 +67,14 @@
 protected:
 std::priority_queue >,
-eventComparator > eventQueue;
+eventComparator> eventQueue;
 };
 
 
 void simulation::run () {
-
+

 while (! eventQueue.empty ()) {
-
+

 event * nextEvent = eventQueue.top ();
 eventQueue.pop ();
 time = nextEvent->time;
@@ -147,7 +148,7 @@
 
 
 void arriveEvent::processEvent () {
-
+

 if (theSimulation.canSeat (size))
 theSimulation.scheduleEvent
 (new orderEvent (time + 1 + irand (4), size));
@@ -155,7 +156,7 @@
 
 
 void orderEvent::processEvent () {
-
+

 // Each person orders some number of scoops.
 for (unsigned int i = 0; i < size; i++)
 theSimulation.order (1 + irand (4));
@@ -174,7 +175,7 @@
 
 // If sufficient room then seat customers.

 bool storeSimulation::canSeat (unsigned int numberOfPeople) {
-
+

 std::cout << "Time: " << time;
 std::cout << " group of " << numberOfPeople << " customers arrives";
 
@@ -192,7 +193,7 @@
 
 // Service icecream, compute profits.

 void storeSimulation::order (unsigned int numberOfScoops) {
-
+

 std::cout << "Time: " << time << " serviced order for "
   << numberOfScoops << '\n';
 profit += 0.35 * numberOfScoops;
@@ -201,7 +202,7 @@
 
 // People leave, free up chairs.

 void storeSimulation::leave (unsigned int numberOfPeople) {
-
+

 std::cout << "Time: " << time << " group of size "
   << numberOfPeople << " leaves\n";
 freeChairs += numberOfPeople;
@@ -209,7 +210,7 @@
 
 
 int main () {
-
+

 std::cout << "Ice Cream Store simulation from Chapter 9\n";
 
 // Load queue with some number of initial events.


Modified: incubator/stdcxx/branches/4.2.x/examples/tutorial/out/icecream.out
URL: 
http://svn.apache.org/viewvc/incubator/stdcxx/branches/4.2.x/examples/tutorial/out/icecream.out?rev=594966&r1=594965&r2=594966&view=diff
==
--- incubator/stdcxx/branches/4.2.x/examples/tutorial/out/icecream.out 
(original)
+++ incubator/stdcxx/branches/4.2.x/examples/tutorial/out/icecream.out Wed Nov 
14 09:34:27 2007
@@ -11,46 +11,46 @@
 pumping queue with event 17
 Time: 0 group of 2 customers arrives is seated
 Time: 0 group of 4 customers arrives is seated
-Time: 3 serviced order for 3
+Time: 2 group of 3 customers arrives is seated
 Time: 3 serviced order for 4
 Time: 3 serviced order for 1
 Time: 3 serviced order for 1
-Time: 10 group of size 4 leaves
-Time: 2 group of 3 customers arrives is seated
-Time: 5 serviced order for 4
+Time: 3 serviced order for 3
+Time: 4 serviced order for 4
+Time: 4 serviced order for 1
+Time: 4 group of size 4 leaves
+Time: 5 serviced order for 2
 Time: 5 serviced order for 1
 Time: 5 serviced order for 3
-Time: 13 group of size 3 leaves
 Time: 7 group of 1 customers arrives is seated
-Time: 8 serviced order for 3
-Time: 10 group of size 1 leaves
+Time: 7 group of size 2 leaves
+Time: 7 group of size 3 leaves
 Time: 8 group of 3 customers arrives is seated
-Time: 11 serviced order for 4
-Time: 11 serviced order for 3
-Time: 11 serviced order for 1
-T

[jira] Resolved: (STDCXX-661) Unstable icecream.cpp example output

2007-11-14 Thread Farid Zaripov (JIRA)

 [ 
https://issues.apache.org/jira/browse/STDCXX-661?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Farid Zaripov resolved STDCXX-661.
--

Resolution: Fixed

> Unstable icecream.cpp example output
> 
>
> Key: STDCXX-661
> URL: https://issues.apache.org/jira/browse/STDCXX-661
> Project: C++ Standard Library
>  Issue Type: Bug
>  Components: Examples
>Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0
> Environment: All
>Reporter: Farid Zaripov
>Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: icecream.patch
>
>
> The result of icecream example is different from run to run.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (STDCXX-661) Unstable icecream.cpp example output

2007-11-14 Thread Farid Zaripov (JIRA)

[ 
https://issues.apache.org/jira/browse/STDCXX-661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542501
 ] 

Farid Zaripov commented on STDCXX-661:
--

Hmm, the User Guide already contains code, equal to my patch, so there nothing 
to update (except the "eventComparison" -> "eventComparator") :)

I think it would be easier to rename this binary predicate in the example.

> Unstable icecream.cpp example output
> 
>
> Key: STDCXX-661
> URL: https://issues.apache.org/jira/browse/STDCXX-661
> Project: C++ Standard Library
>  Issue Type: Bug
>  Components: Examples
>Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0
> Environment: All
>Reporter: Farid Zaripov
>Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: icecream.patch
>
>
> The result of icecream example is different from run to run.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (STDCXX-661) Unstable icecream.cpp example output

2007-11-14 Thread Martin Sebor (JIRA)

[ 
https://issues.apache.org/jira/browse/STDCXX-661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542493
 ] 

Martin Sebor commented on STDCXX-661:
-

Note on the patch: example programs should not be using reserved names 
(anything that starts with underscores). Other than that it looks good to me.

Don't forget to update the User Guide: 
http://incubator.apache.org/stdcxx/doc/stdlibug/11-3.html#idx215

> Unstable icecream.cpp example output
> 
>
> Key: STDCXX-661
> URL: https://issues.apache.org/jira/browse/STDCXX-661
> Project: C++ Standard Library
>  Issue Type: Bug
>  Components: Examples
>Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0
> Environment: All
>Reporter: Farid Zaripov
>Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: icecream.patch
>
>
> The result of icecream example is different from run to run.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Closed: (STDCXX-543) test suite failures due excessively long command lines

2007-11-14 Thread Farid Zaripov (JIRA)

 [ 
https://issues.apache.org/jira/browse/STDCXX-543?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Farid Zaripov closed STDCXX-543.



> test suite failures due excessively long command lines
> --
>
> Key: STDCXX-543
> URL: https://issues.apache.org/jira/browse/STDCXX-543
> Project: C++ Standard Library
>  Issue Type: Bug
>  Components: Utilities
>Affects Versions: trunk
> Environment: Windows 2000
>Reporter: Martin Sebor
>Assignee: Farid Zaripov
>Priority: Critical
> Fix For: 4.2.0
>
>
> The test infrastructure (the exec utility to be exact) fails on platforms 
> such as Windows 2000 that impose a low limit on the length of the command 
> line. See the following post:
> http://www.nabble.com/RE%3A-Windows-build-failures-p12508639.html
> As Farid says in his post, to prevent such failures, excessively long command 
> lines need to be written to a temporary file by the infrastructure and 
> subsequently read from it by the exec utility.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (STDCXX-543) test suite failures due excessively long command lines

2007-11-14 Thread Farid Zaripov (JIRA)

 [ 
https://issues.apache.org/jira/browse/STDCXX-543?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Farid Zaripov updated STDCXX-543:
-

Fix Version/s: (was: 4.2.1)
   4.2.0

Fix versions reverted back to 4.2.0. Another issue STDCXX-667 created.

> test suite failures due excessively long command lines
> --
>
> Key: STDCXX-543
> URL: https://issues.apache.org/jira/browse/STDCXX-543
> Project: C++ Standard Library
>  Issue Type: Bug
>  Components: Utilities
>Affects Versions: trunk
> Environment: Windows 2000
>Reporter: Martin Sebor
>Assignee: Farid Zaripov
>Priority: Critical
> Fix For: 4.2.0
>
>
> The test infrastructure (the exec utility to be exact) fails on platforms 
> such as Windows 2000 that impose a low limit on the length of the command 
> line. See the following post:
> http://www.nabble.com/RE%3A-Windows-build-failures-p12508639.html
> As Farid says in his post, to prevent such failures, excessively long command 
> lines need to be written to a temporary file by the infrastructure and 
> subsequently read from it by the exec utility.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (STDCXX-667) Change the syntax of the @filelist parameter of the exec utility to the unix style

2007-11-14 Thread Farid Zaripov (JIRA)

 [ 
https://issues.apache.org/jira/browse/STDCXX-667?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Farid Zaripov updated STDCXX-667:
-

Issue Type: Improvement  (was: Bug)

> Change the syntax of the @filelist parameter of the exec utility to the unix 
> style
> --
>
> Key: STDCXX-667
> URL: https://issues.apache.org/jira/browse/STDCXX-667
> Project: C++ Standard Library
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 4.2.0
> Environment: All
>Reporter: Farid Zaripov
>Priority: Minor
>
> The syntax of the command line of the exec utility (especially @filelist 
> option) should be changed to unix style.
> And possibly the unix makefiles should be updated to pass the list of the 
> executables using the external file if the resulting command line is too long.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (STDCXX-667) Change the syntax of the @filelist parameter of the exec utility to the unix style

2007-11-14 Thread Farid Zaripov (JIRA)
Change the syntax of the @filelist parameter of the exec utility to the unix 
style
--

 Key: STDCXX-667
 URL: https://issues.apache.org/jira/browse/STDCXX-667
 Project: C++ Standard Library
  Issue Type: Bug
  Components: Utilities
Affects Versions: 4.2.0
 Environment: All
Reporter: Farid Zaripov
Priority: Minor


The syntax of the command line of the exec utility (especially @filelist 
option) should be changed to unix style.

And possibly the unix makefiles should be updated to pass the list of the 
executables using the external file if the resulting command line is too long.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (STDCXX-666) [MSVC 8-x64] 21.string.cons.cpp test fails in optimized builds due to bad codegeneration by the compiler

2007-11-14 Thread Farid Zaripov (JIRA)
[MSVC 8-x64] 21.string.cons.cpp test fails in optimized builds due to bad 
codegeneration by the compiler


 Key: STDCXX-666
 URL: https://issues.apache.org/jira/browse/STDCXX-666
 Project: C++ Standard Library
  Issue Type: Bug
  Components: Tests
Affects Versions: 4.2.0
 Environment: MSVC 8.0-x64, builds 8{d|s}, 12{d|s}
Reporter: Farid Zaripov
 Fix For: 4.2.1


The 21.string.cons.cpp test fails with 16 assertions on 64-bit MSVC in 
optimized builds.
The reason is the bad codegeneration in __rw_new_capacity() inlined in 
std::basic_string ctors. Because of this bug the __rw_new_capacity(0, const 
std::basic_string<> *) returns value greater that size_max() and ctor throws 
exception.

The temporary workaround might be definition of the __rw_new_capacity() as 
__declspec (noinline).

--
Index: include/string
===
--- include/string  (revision 593511)
+++ include/string  (working copy)
@@ -1528,8 +1528,13 @@
 // more specialized version for basic_string<>; may be further specialized  // 
in user code for example on a user-defined allocator
 
+#if !defined (_WIN64) || !defined (_MSC_VER) || defined
(__INTEL_COMPILER)
 template   inline 
_RWSTD_STRING_SIZE_TYPE
+#else// _WIN64 && _MSC_VER && !__INTEL_COMPILER
+template  __declspec 
+(noinline) _RWSTD_STRING_SIZE_TYPE
+#endif   // !_WIN64 || !_MSC_VER || __INTEL_COMPILER
 __rw_new_capacity (_RWSTD_STRING_SIZE_TYPE __size,
const _STD::basic_string<_CharT, _Traits,
_Allocator>*)
 {
--


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.