From: Eric Fiselier Date: Fri, 13 Sep 2019 19:04:33 +0000 (+0000) Subject: Fix pretty printer test with GCC X-Git-Tag: llvmorg-11-init~9222 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=556027085583470dc0db1c821ecdf1b5c1804154;p=platform%2Fupstream%2Fllvm.git Fix pretty printer test with GCC llvm-svn: 371884 --- diff --git a/libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp b/libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp index 0b32ef8..138af7e 100644 --- a/libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp +++ b/libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp @@ -27,6 +27,8 @@ #include #include +#include "test_macros.h" + // To write a pretty-printer test: // // 1. Declare a variable of the type you want to test @@ -54,11 +56,20 @@ // ComparePrettyPrintTo*. Also, make sure neither it, nor the // variables we need present in the Compare functions are optimized // away. -void StopForDebugger(void *value, void *check) __attribute__((optnone)) { } +#ifdef TEST_COMPILER_GCC +#define OPT_NONE __attribute__((noinline)) +#else +#define OPT_NONE __attribute__((optnone)) +#endif +void StopForDebugger(void *value, void *check) OPT_NONE; +void StopForDebugger(void *value, void *check) {} + // Prevents the compiler optimizing away the parameter in the caller function. template -void MarkAsLive(Type &&t) __attribute__((optnone)) { } +void MarkAsLive(Type &&t) OPT_NONE; +template +void MarkAsLive(Type &&t) {} // In all of the Compare(Expression)PrettyPrintTo(Regex/Chars) functions below, // the python script sets a breakpoint just before the call to StopForDebugger, @@ -425,7 +436,7 @@ void set_iterator_test() { MarkAsLive(not_found); // Because the end_node is not easily detected, just be sure it doesn't crash. CompareExpressionPrettyPrintToRegex("not_found", - R"(std::__tree_const_iterator = {\[0x[a-f0-9]+\] = .*})"); + R"(std::__tree_const_iterator ( = {\[0x[a-f0-9]+\] = .*}|))"); } void map_iterator_test() {