From 308975919152fbf301861d88e2da9b522e3cf112 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Tue, 6 Oct 2020 15:08:37 +0100 Subject: [PATCH] Fix gdb.base/list.exp with Clang Two subtests of gdb.base/list.exp failed when built with Clang because the unused function "unused" was optimized out. This commit adds __attribute__ ((used)) to both definitions. gdb/testsuite/ChangeLog: * gdb.base/list0.c (unused): Add __attribute__ ((used)). * gdb.base/list1.c (unused): Likewise. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/list0.c | 2 +- gdb/testsuite/gdb.base/list1.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f91c4dcbbf3..7484d6e3e65 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-10-06 Gary Benson + + * gdb.base/list0.c (unused): Add __attribute__ ((used)). + * gdb.base/list1.c (unused): Likewise. + 2020-10-06 Gary Benson * gdb.base/list-ambiguous0.c (ambiguous_var): Add diff --git a/gdb/testsuite/gdb.base/list0.c b/gdb/testsuite/gdb.base/list0.c index 0255cf37e02..1e5b7c18ae2 100644 --- a/gdb/testsuite/gdb.base/list0.c +++ b/gdb/testsuite/gdb.base/list0.c @@ -36,7 +36,7 @@ int main () return 0; } -static void +static void __attribute__ ((used)) unused () { /* Not used for anything */ diff --git a/gdb/testsuite/gdb.base/list1.c b/gdb/testsuite/gdb.base/list1.c index a9f614f2f64..d694495c3fb 100644 --- a/gdb/testsuite/gdb.base/list1.c +++ b/gdb/testsuite/gdb.base/list1.c @@ -12,7 +12,7 @@ void bar (int x) long_line (); } -static void +static void __attribute__ ((used)) unused () { /* Not used for anything */ -- 2.30.2