Fix gdb.base/list-ambiguous.exp with Clang
authorGary Benson <gbenson@redhat.com>
Tue, 6 Oct 2020 14:08:37 +0000 (15:08 +0100)
committerGary Benson <gbenson@redhat.com>
Tue, 6 Oct 2020 14:08:37 +0000 (15:08 +0100)
The ambiguous variable parts of gdb.base/list-ambiguous.exp failed
when built with Clang because the variable in question was unused
and was optimized out.  This commit adds __attribute__ ((used)) to
both definitions.

gdb/testsuite/ChangeLog:

* gdb.base/list-ambiguous0.c (ambiguous_var): Add
__attribute__ ((used)).
* gdb.base/list-ambiguous1.c (ambiguous_var): Likewise.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/list-ambiguous0.c
gdb/testsuite/gdb.base/list-ambiguous1.c

index a6ac59d5e939fdbba66008fc9c7f595c1e0b349d..f91c4dcbbf3ef8ed5338f86282546266b1d1ca9c 100644 (file)
@@ -1,3 +1,9 @@
+2020-10-06  Gary Benson <gbenson@redhat.com>
+
+       * gdb.base/list-ambiguous0.c (ambiguous_var): Add
+       __attribute__ ((used)).
+       * gdb.base/list-ambiguous1.c (ambiguous_var): Likewise.
+
 2020-10-06  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gdb.base/m32r.ld: Remove SEARCH_DIR line.  Add MEMORY regions,
index c8519cf2bede35d1a81fbc19bdf2a50198ce645d..0ad3f789c61cea60c308a59838149319449a7255 100644 (file)
@@ -25,7 +25,7 @@
 
 static void __attribute__ ((used)) ambiguous_fun (void) {}
 
-static int ambiguous_var;
+static int __attribute__ ((used)) ambiguous_var;
 
 
 
index 19906b579f33d60aa3b8100d87bc1bb837c8ac22..4de0f0e7627fa9225b2761875bf8698692e5d399 100644 (file)
@@ -28,7 +28,7 @@
    "list"'s behavior with ambiguous linespecs.  */
 static void __attribute__ ((used)) ambiguous_fun (void) {}
 
-static int ambiguous_var;
+static int __attribute__ ((used)) ambiguous_var;