comparison libstdc++-v3/testsuite/util/testsuite_hooks.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900 (2020-02-13)
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // -*- C++ -*- 1 // -*- C++ -*-
2 // Utility subroutines for the C++ library testsuite. 2 // Utility subroutines for the C++ library testsuite.
3 // 3 //
4 // Copyright (C) 2000-2018 Free Software Foundation, Inc. 4 // Copyright (C) 2000-2020 Free Software Foundation, Inc.
5 // 5 //
6 // This file is part of the GNU ISO C++ Library. This library is free 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 7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the 8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option) 9 // Free Software Foundation; either version 3, or (at your option)
44 #define _GLIBCXX_TESTSUITE_HOOKS_H 44 #define _GLIBCXX_TESTSUITE_HOOKS_H
45 45
46 #include <bits/c++config.h> 46 #include <bits/c++config.h>
47 #include <bits/functexcept.h> 47 #include <bits/functexcept.h>
48 #include <ctime> 48 #include <ctime>
49 #include <stdio.h>
49 50
50 #ifdef _GLIBCXX_HAVE_SYS_STAT_H 51 #ifdef _GLIBCXX_HAVE_SYS_STAT_H
51 #include <sys/stat.h> 52 #include <sys/stat.h>
53 #endif
54
55 #ifdef stderr
56 # define _VERIFY_PRINT(S, F, L, P, C) __builtin_fprintf(stderr, S, F, L, P, C)
57 #else
58 # define _VERIFY_PRINT(S, F, L, P, C) __builtin_printf(S, F, L, P, C)
52 #endif 59 #endif
53 60
54 #define VERIFY(fn) \ 61 #define VERIFY(fn) \
55 do \ 62 do \
56 { \ 63 { \
57 if (! (fn)) \ 64 if (! (fn)) \
58 { \ 65 { \
59 __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", \ 66 _VERIFY_PRINT("%s:%d: %s: Assertion '%s' failed.\n", \
60 __FILE__, __LINE__, __PRETTY_FUNCTION__, #fn); \ 67 __FILE__, __LINE__, __PRETTY_FUNCTION__, #fn); \
61 __builtin_abort(); \ 68 __builtin_abort(); \
62 } \ 69 } \
63 } while (false) 70 } while (false)
64 71
65 #ifdef _GLIBCXX_HAVE_UNISTD_H 72 #ifdef _GLIBCXX_HAVE_UNISTD_H
317 struct conversion 324 struct conversion
318 { 325 {
319 typedef typename _Container::const_iterator const_iterator; 326 typedef typename _Container::const_iterator const_iterator;
320 327
321 // Implicit conversion iterator to const_iterator. 328 // Implicit conversion iterator to const_iterator.
322 static const_iterator 329 static void
323 iterator_to_const_iterator() 330 iterator_to_const_iterator()
324 { 331 {
325 _Container v; 332 _Container v;
326 const_iterator it = v.begin(); 333 const_iterator i __attribute__((unused)) = const_iterator(v.begin());
327 const_iterator end = v.end(); 334 const_iterator j __attribute__((unused)) = true ? i : v.begin();
328 return it == end ? v.end() : it; 335 #if __cplusplus >= 201103L
336 const_iterator k __attribute__((unused)) { v.begin() };
337 #endif
329 } 338 }
330 }; 339 };
331 340
332 // A binary semaphore for use across multiple processes. 341 // A binary semaphore for use across multiple processes.
333 class semaphore 342 class semaphore