aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c++/target-flex-common.h
blob: 14523c435f6dcb718bea9a8a507df8a7ee09e245 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <cstdio>

#if __cplusplus >= 201103L
  #define BL_NOEXCEPT noexcept
#else
  #define BL_NOEXCEPT throw()
#endif

#if defined __has_builtin
# if __has_builtin (__builtin_LINE)
#  define VERIFY_LINE __builtin_LINE ()
# endif
#endif
#if !defined VERIFY_LINE
# define VERIFY_LINE __LINE__
#endif

/* I'm not a huge fan of macros but in the interest of keeping the code that
   isn't being tested as simple as possible, we use them.  */

#define VERIFY(EXPR) \
  do {										\
    if (!(EXPR))								\
      {										\
	std::printf("VERIFY ln: %d `" #EXPR "` evaluated to false\n",		\
		    VERIFY_LINE);						\
	inner_ok = false;							\
	goto end;								\
      }										\
  } while (false)

#define VERIFY_NON_TARGET(EXPR) \
  do {										\
    if (!(EXPR))								\
      {										\
	std::printf("VERIFY ln: %d `" #EXPR "` evaluated to false\n",		\
		    VERIFY_LINE);						\
	return false;								\
      }										\
  } while (false)