This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][libstdc++-v3 parallel mode] Patch for PR 39546
- From: Johannes Singler <singler at ira dot uka dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 05 May 2009 18:51:23 +0200
- Subject: Re: [PATCH][libstdc++-v3 parallel mode] Patch for PR 39546
- References: <49F9B887.8060605@ira.uka.de> <49F9BE91.5080007@oracle.com> <49FF1E98.8010204@ira.uka.de> <49FF5B5B.7000701@oracle.com>
Paolo Carlini wrote:
> Johannes Singler wrote:
>> Sorry, got you wrong, test case now included. Have rerun regression tests.
>>
>> 2009-05-04 Johannes Singler <singler@ira.uka.de>
>>
>> PR libstdc++/39546
>> * include/parallel/algo.h (find_switch):
>> Parametrize binder2nd with const T& instead of T.
>> * testsuite/25_algorithms/find/39546.cc: new test case
>>
> Generally ok, but please follow our practice for the testcase: thus have
> a separate test01 function, use in it VERIFY (test variable, include
> <testsuite_hooks.h>), always indent only 2 spaces at a time, copyright
> year only 2009, of course, etc.
Better now?
Tested x86_64-unknown-linux-gnu: No regressions
Please approve for mainline.
2009-05-05 Johannes Singler <singler@ira.uka.de>
PR libstdc++/39546
* include/parallel/algo.h (find_switch):
Parametrize binder2nd with const T& instead of T.
* testsuite/25_algorithms/find/39546.cc: new test case
-- Johannes
Index: include/parallel/algo.h
===================================================================
--- include/parallel/algo.h (revision 147003)
+++ include/parallel/algo.h (working copy)
@@ -149,8 +149,8 @@
if (_GLIBCXX_PARALLEL_CONDITION(true))
{
- binder2nd<__gnu_parallel::equal_to<value_type, T> >
- comp(__gnu_parallel::equal_to<value_type, T>(), val);
+ binder2nd<__gnu_parallel::equal_to<value_type, const T&> >
+ comp(__gnu_parallel::equal_to<value_type, const T&>(), val);
return __gnu_parallel::find_template(begin, end, begin, comp,
__gnu_parallel::
find_if_selector()).first;
Index: testsuite/25_algorithms/find/39546.cc
===================================================================
--- testsuite/25_algorithms/find/39546.cc (revision 0)
+++ testsuite/25_algorithms/find/39546.cc (revision 0)
@@ -0,0 +1,41 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 25.3.1 algorithms, find()
+
+#include <vector>
+#include <string>
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::vector<std::string> test;
+ test.push_back("one");
+ test.push_back("two");
+ test.push_back("three");
+
+ VERIFY(std::find(test.begin(), test.end(), "two") == test.begin() + 1);
+}
+
+// libstdc++/39546
+int
+main()
+{
+ test01();
+}