forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -56,16 +56,17 @@ struct overload2_arg9 {};
|
|||||||
struct overload2_arga {};
|
struct overload2_arga {};
|
||||||
|
|
||||||
#define GEN_OVERLOAD2_FUNCTIONS(ARG1, ARG2) \
|
#define GEN_OVERLOAD2_FUNCTIONS(ARG1, ARG2) \
|
||||||
void \
|
void __attribute__ ((used)) \
|
||||||
overload2_function (ARG1) \
|
overload2_function (ARG1) \
|
||||||
{} \
|
{} \
|
||||||
\
|
\
|
||||||
struct struct_overload2_test \
|
struct struct_overload2_test \
|
||||||
{ \
|
{ \
|
||||||
void overload2_function (ARG2); \
|
void __attribute__ ((used)) \
|
||||||
|
overload2_function (ARG2); \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
void \
|
void __attribute__ ((used)) \
|
||||||
struct_overload2_test::overload2_function (ARG2) \
|
struct_overload2_test::overload2_function (ARG2) \
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -99,23 +100,25 @@ namespace ns_overload2_test
|
|||||||
/* Code for the overload-3 test. */
|
/* Code for the overload-3 test. */
|
||||||
|
|
||||||
#define GEN_OVERLOAD3_FUNCTIONS(ARG1, ARG2) \
|
#define GEN_OVERLOAD3_FUNCTIONS(ARG1, ARG2) \
|
||||||
void \
|
void __attribute__ ((used)) \
|
||||||
overload3_function (ARG1) \
|
overload3_function (ARG1) \
|
||||||
{} \
|
{} \
|
||||||
void \
|
void __attribute__ ((used)) \
|
||||||
overload3_function (ARG2) \
|
overload3_function (ARG2) \
|
||||||
{} \
|
{} \
|
||||||
\
|
\
|
||||||
struct struct_overload3_test \
|
struct struct_overload3_test \
|
||||||
{ \
|
{ \
|
||||||
void overload3_function (ARG1); \
|
void __attribute__ ((used)) \
|
||||||
void overload3_function (ARG2); \
|
overload3_function (ARG1); \
|
||||||
|
void __attribute__ ((used)) \
|
||||||
|
overload3_function (ARG2); \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
void \
|
void __attribute__ ((used)) \
|
||||||
struct_overload3_test::overload3_function (ARG1) \
|
struct_overload3_test::overload3_function (ARG1) \
|
||||||
{} \
|
{} \
|
||||||
void \
|
void __attribute__ ((used)) \
|
||||||
struct_overload3_test::overload3_function (ARG2) \
|
struct_overload3_test::overload3_function (ARG2) \
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -343,15 +346,15 @@ namespace ns2_incomplete_scope_colon_test
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
void anon_ns_function ()
|
void __attribute__ ((used)) anon_ns_function ()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
struct anon_ns_struct
|
struct anon_ns_struct
|
||||||
{
|
{
|
||||||
void anon_ns_function ();
|
void __attribute__ ((used)) anon_ns_function ();
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void __attribute__ ((used))
|
||||||
anon_ns_struct::anon_ns_function ()
|
anon_ns_struct::anon_ns_function ()
|
||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
@@ -361,15 +364,15 @@ namespace the_anon_ns_wrapper_ns
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
void anon_ns_function ()
|
void __attribute__ ((used)) anon_ns_function ()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
struct anon_ns_struct
|
struct anon_ns_struct
|
||||||
{
|
{
|
||||||
void anon_ns_function ();
|
void __attribute__ ((used)) anon_ns_function ();
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void __attribute__ ((used))
|
||||||
anon_ns_struct::anon_ns_function ()
|
anon_ns_struct::anon_ns_function ()
|
||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user