gdb/testsuite: Fix FAILs in gdb.linespec/cpcompletion.exp when using clang
authorBruno Larsen <blarsen@redhat.com>
Tue, 3 Jan 2023 14:07:47 +0000 (15:07 +0100)
committerBruno Larsen <blarsen@redhat.com>
Fri, 6 Jan 2023 09:50:43 +0000 (10:50 +0100)
commit695e9773786d79f191e9487a88d3b39a57d9c7e7
tree5ca0c8986e13c60bb08ec174c03fbde1ae16ea65
parent5fb0e308577143ceb313fde5538dc9ecb038f29f
gdb/testsuite: Fix FAILs in gdb.linespec/cpcompletion.exp when using clang

When using clang 16.0.0 to test gdb.linespec/cpcompletion.exp, I get 99
unexpected failures.  They all fail to produce a complete list of
completion options for a function, either overload2_function,
overload3_function or anon_ns_function.  This happens because clang is
optimizing them away, since they are never used.

Fix this by adding __attribute__((used)) to all declarations to the
aforementioned functions.
gdb/testsuite/gdb.linespec/cpls.cc