|
27 | 27 | #include <unordered_map>
|
28 | 28 | #include <unordered_set>
|
29 | 29 |
|
| 30 | +#include "test_macros.h" |
| 31 | + |
30 | 32 | // To write a pretty-printer test:
|
31 | 33 | //
|
32 | 34 | // 1. Declare a variable of the type you want to test
|
|
54 | 56 | // ComparePrettyPrintTo*. Also, make sure neither it, nor the
|
55 | 57 | // variables we need present in the Compare functions are optimized
|
56 | 58 | // away.
|
57 |
| -void StopForDebugger(void *value, void *check) __attribute__((optnone)) { } |
| 59 | +#ifdef TEST_COMPILER_GCC |
| 60 | +#define OPT_NONE __attribute__((noinline)) |
| 61 | +#else |
| 62 | +#define OPT_NONE __attribute__((optnone)) |
| 63 | +#endif |
| 64 | +void StopForDebugger(void *value, void *check) OPT_NONE; |
| 65 | +void StopForDebugger(void *value, void *check) {} |
| 66 | + |
58 | 67 |
|
59 | 68 | // Prevents the compiler optimizing away the parameter in the caller function.
|
60 | 69 | template <typename Type>
|
61 |
| -void MarkAsLive(Type &&t) __attribute__((optnone)) { } |
| 70 | +void MarkAsLive(Type &&t) OPT_NONE; |
| 71 | +template <typename Type> |
| 72 | +void MarkAsLive(Type &&t) {} |
62 | 73 |
|
63 | 74 | // In all of the Compare(Expression)PrettyPrintTo(Regex/Chars) functions below,
|
64 | 75 | // the python script sets a breakpoint just before the call to StopForDebugger,
|
@@ -425,7 +436,7 @@ void set_iterator_test() {
|
425 | 436 | MarkAsLive(not_found);
|
426 | 437 | // Because the end_node is not easily detected, just be sure it doesn't crash.
|
427 | 438 | CompareExpressionPrettyPrintToRegex("not_found",
|
428 |
| - R"(std::__tree_const_iterator = {\[0x[a-f0-9]+\] = .*})"); |
| 439 | + R"(std::__tree_const_iterator ( = {\[0x[a-f0-9]+\] = .*}|<error reading variable:.*>))"); |
429 | 440 | }
|
430 | 441 |
|
431 | 442 | void map_iterator_test() {
|
|
0 commit comments