+2011-02-09 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/future (packaged_task::operator bool): Rename to...
+ (packaged_task::valid): ...this.
+ * testsuite/30_threads/packaged_task/cons/1.cc: Adjust.
+ * testsuite/30_threads/packaged_task/cons/2.cc: Adjust.
+ * testsuite/30_threads/packaged_task/cons/move.cc: Adjust.
+ * testsuite/30_threads/packaged_task/cons/move_assign.cc: Adjust.
+ * testsuite/30_threads/packaged_task/cons/alloc.cc: Adjust.
+ * testsuite/30_threads/packaged_task/members/invoke.cc: Adjust.
+ * testsuite/30_threads/packaged_task/members/reset.cc: Adjust.
+ * testsuite/30_threads/packaged_task/members/reset2.cc: Adjust.
+ * testsuite/30_threads/packaged_task/members/swap.cc: Adjust.
+ * testsuite/30_threads/packaged_task/members/boolconv.cc: Remove.
+ * testsuite/30_threads/packaged_task/members/valid.cc: Add.
+
2011-02-09 Paolo Carlini <paolo.carlini@oracle.com>
* doc/xml/manual/io.xml: Fix typo.
// <future> -*- C++ -*-
-// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 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
swap(packaged_task& __other)
{ _M_state.swap(__other._M_state); }
- explicit operator bool() const { return static_cast<bool>(_M_state); }
+ bool
+ valid() const
+ { return static_cast<bool>(_M_state); }
// Result retrieval
future<_Res>
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 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
using namespace __gnu_test;
packaged_task<int ()> p1;
- VERIFY( !static_cast<bool>(p1) );
+ VERIFY( !p1.valid() );
packaged_task<int& ()> p2;
- VERIFY( !static_cast<bool>(p2) );
+ VERIFY( !p2.valid() );
packaged_task<void ()> p3;
- VERIFY( !static_cast<bool>(p3) );
+ VERIFY( !p3.valid() );
packaged_task<ClassType ()> p4;
- VERIFY( !static_cast<bool>(p4) );
+ VERIFY( !p4.valid() );
packaged_task<AbstractClass& (int)> p5;
- VERIFY( !static_cast<bool>(p5) );
+ VERIFY( !p5.valid() );
}
int main()
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 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
using std::packaged_task;
packaged_task<int ()> p1(f1);
- VERIFY( static_cast<bool>(p1) );
+ VERIFY( p1.valid() );
packaged_task<int& ()> p2(f2);
- VERIFY( static_cast<bool>(p2) );
+ VERIFY( p2.valid() );
packaged_task<void ()> p3(f3);
- VERIFY( static_cast<bool>(p3) );
+ VERIFY( p3.valid() );
packaged_task<ClassType ()> p4(f4);
- VERIFY( static_cast<bool>(p4) );
+ VERIFY( p4.valid() );
packaged_task<AbstractClass& (int)> p5(f5);
- VERIFY( static_cast<bool>(p5) );
+ VERIFY( p5.valid() );
}
int main()
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2010 Free Software Foundation, Inc.
+// Copyright (C) 2010, 2011 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
uneq_allocator<char> alloc(99);
packaged_task<int ()> p1(allocator_arg, alloc, f);
- VERIFY( static_cast<bool>(p1) );
+ VERIFY( p1.valid() );
p1();
VERIFY( p1.get_future().get() == 5 );
}
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 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
// move
packaged_task<int()> p1(f1);
packaged_task<int()> p2(std::move(p1));
- VERIFY( !static_cast<bool>(p1) );
- VERIFY( static_cast<bool>(p2) );
+ VERIFY( !p1.valid() );
+ VERIFY( p2.valid() );
}
int main()
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2011 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
std::packaged_task<int()> p1;
std::packaged_task<int()> p2(gen);
p1 = std::move(p2);
- VERIFY( static_cast<bool>(p1) );
- VERIFY( !static_cast<bool>(p2) );
+ VERIFY( p1.valid() );
+ VERIFY( !p2.valid() );
}
int main()
+++ /dev/null
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
-// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
-// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
-// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
-// { dg-require-cstdint "" }
-// { dg-require-gthreads "" }
-// { dg-require-atomic-builtins "" }
-
-// 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/>.
-
-
-#include <future>
-#include <testsuite_hooks.h>
-
-int zero() { return 0; }
-
-void test01()
-{
- bool test __attribute__((unused)) = true;
-
- std::packaged_task<int()> p1;
- VERIFY( !static_cast<bool>(p1) );
-
- std::packaged_task<int()> p2(zero);
- VERIFY( static_cast<bool>(p2) );
-}
-
-int main()
-{
- test01();
- return 0;
-}
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 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
p1();
- VERIFY( static_cast<bool>(p1) );
+ VERIFY( p1.valid() );
VERIFY( f1.get() == 0 );
}
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009. 2010, 2011 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
future<int> f1 = p1.get_future();
p1.reset();
- VERIFY( static_cast<bool>(p1) );
+ VERIFY( p1.valid() );
future<int> f2 = p1.get_future();
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 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
p1();
p1.reset();
- VERIFY( static_cast<bool>(p1) );
+ VERIFY( p1.valid() );
VERIFY( f1.get() == 0 );
std::future<int> f2 = p1.get_future();
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 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
std::packaged_task<int()> p1(zero);
std::packaged_task<int()> p2;
- VERIFY( static_cast<bool>(p1) );
- VERIFY( !static_cast<bool>(p2) );
+ VERIFY( p1.valid() );
+ VERIFY( !p2.valid() );
p1.swap(p2);
- VERIFY( !static_cast<bool>(p1) );
- VERIFY( static_cast<bool>(p2) );
+ VERIFY( !p1.valid() );
+ VERIFY( p2.valid() );
}
int main()
--- /dev/null
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2011 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/>.
+
+
+#include <future>
+#include <testsuite_hooks.h>
+
+int zero() { return 0; }
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::packaged_task<int()> p1;
+ VERIFY( !p1.valid() );
+
+ std::packaged_task<int()> p2(zero);
+ VERIFY( p2.valid() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}