OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libstdc++-v3/] [testsuite/] [util/] [thread/] [all.h] - Blame information for rev 424

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
// -*- C++ -*-
2
// Utilities for testing threads for the C++ library testsuite.
3
//
4
// Copyright (C) 2009 Free Software Foundation, Inc.
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the
8
// terms of the GNU General Public License as published by the
9
// Free Software Foundation; either version 3, or (at your option)
10
// any later version.
11
//
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// GNU General Public License for more details.
16
//
17
// You should have received a copy of the GNU General Public License along
18
// with this library; see the file COPYING3.  If not see
19
// <http://www.gnu.org/licenses/>.
20
//
21
 
22
#ifndef _GLIBCXX_TESTSUITE_THREAD_H
23
#define _GLIBCXX_TESTSUITE_THREAD_H
24
 
25
#include <sstream>
26
#include <stdexcept>
27
#include <type_traits>
28
 
29
// C++0x only.
30
namespace __gnu_test
31
{
32
  // Assume _Tp::native_handle_type.
33
  // Check C++ to native_handle_type characteristics: size and alignment.
34
  template<typename _Tp>
35
    void
36
    compare_type_to_native_type()
37
    {
38
      typedef _Tp test_type;
39
 
40
      // Remove possible pointer type.
41
      typedef typename test_type::native_handle_type native_handle;
42
      typedef typename std::remove_pointer<native_handle>::type native_type;
43
 
44
      int st = sizeof(test_type);
45
      int snt = sizeof(native_type);
46
      int at = __alignof__(test_type);
47
      int ant = __alignof__(native_type);
48
      if (st != snt || at != ant)
49
        {
50
          std::ostringstream s;
51
          s << std::endl;
52
          s << "size of _Tp: " << st << std::endl;
53
          s << "alignment of _Tp: " << st << std::endl;
54
          s << "size of *(_Tp::native_handle_type): " << snt << std::endl;
55
          s << "alignment of *(_Tp::native_handle_type): " << snt << std::endl;
56
          throw std::runtime_error(s.str());
57
        }
58
    }
59
} // namespace __gnu_test
60
 
61
#endif // _GLIBCXX_TESTSUITE_THREAD_H
62
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.