jit.dg: fix issue with compilation of test-threads.c
DejaGnu's <dejagnu.h> provides decls of various inline functions, of which the jit testsuite uses "pass", "fail" and "note". The jit testcase test-threads.c jumps through some hoops to make these functions threadsafe, using macros to rename the implementation in dejagnu.h, giving them a "dejagnu_" prefix, then reimplementing the names with wrappers that use a mutex. The DejaGnu functions gained a "static" modifier in ad36659ffa984a0541cfc2bd27f393e0d7d173a7, which appears to be in DejaGnu 1.5.2 onwards. Unfortunately, jit.dg/test-threads.c has forward decls of "dejagnu_pass" etc, and these don't have "static", leading to conflicts with later versions of DejaGnu for which "pass" etc have "static". This patch fixes things by removing the forward decls of "dejagnu_pass", moving the usage of them to a point at which dejagnu.h has been included, which ought to work with both earlier and later versions of DejaGnu. Fixes compilation of test-threads.c in jit testsuite. gcc/testsuite/ChangeLog: * jit.dg/test-threads.c (dejagnu_pass): Remove decl. (dejagnu_fail): Likewise. (dejagnu_note): Likewise. (pass): Provide forward decl, moving true decl to after #include of harness.h. (fail): Likewise. (note): Likewise. From-SVN: r244597
This commit is contained in:
parent
f8a94453ad
commit
551914b748
|
@ -1,3 +1,13 @@
|
||||||
|
2017-01-18 David Malcolm <dmalcolm@redhat.com>
|
||||||
|
|
||||||
|
* jit.dg/test-threads.c (dejagnu_pass): Remove decl.
|
||||||
|
(dejagnu_fail): Likewise.
|
||||||
|
(dejagnu_note): Likewise.
|
||||||
|
(pass): Provide forward decl, moving true decl to after #include
|
||||||
|
of harness.h.
|
||||||
|
(fail): Likewise.
|
||||||
|
(note): Likewise.
|
||||||
|
|
||||||
2017-01-18 Michael Meissner <meissner@linux.vnet.ibm.com>
|
2017-01-18 Michael Meissner <meissner@linux.vnet.ibm.com>
|
||||||
|
|
||||||
* gcc.target/powerpc/p9-xxbr-1.c: New test.
|
* gcc.target/powerpc/p9-xxbr-1.c: New test.
|
||||||
|
|
|
@ -20,9 +20,35 @@ static pthread_mutex_t dg_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
harness.h injects macros before including <dejagnu.h> so that the
|
harness.h injects macros before including <dejagnu.h> so that the
|
||||||
pass/fail functions become "dejagnu_pass"/"dejagnu_fail" etc. */
|
pass/fail functions become "dejagnu_pass"/"dejagnu_fail" etc. */
|
||||||
|
|
||||||
void dejagnu_pass (const char* fmt, ...);
|
/* Forward decls of our implementations of pass/fail/note. */
|
||||||
void dejagnu_fail (const char* fmt, ...);
|
|
||||||
void dejagnu_note (const char* fmt, ...);
|
inline void
|
||||||
|
pass (const char* fmt, ...);
|
||||||
|
|
||||||
|
inline void
|
||||||
|
fail (const char* fmt, ...);
|
||||||
|
|
||||||
|
inline void
|
||||||
|
note (const char* fmt, ...);
|
||||||
|
|
||||||
|
#define MAKE_DEJAGNU_H_THREADSAFE
|
||||||
|
|
||||||
|
/* We also need to provide our own version of TEST_NAME. */
|
||||||
|
#define TEST_NAME
|
||||||
|
|
||||||
|
/* We can now include all of the relevant selftests. */
|
||||||
|
|
||||||
|
#include "all-non-failing-tests.h"
|
||||||
|
|
||||||
|
#define TEST_PROVIDES_MAIN
|
||||||
|
#define TEST_ESCHEWS_TEST_JIT
|
||||||
|
|
||||||
|
/* Now construct a test case from all the other test cases.
|
||||||
|
|
||||||
|
We undefine COMBINED_TEST so that we can now include harness.h
|
||||||
|
"for real". */
|
||||||
|
#undef COMBINED_TEST
|
||||||
|
#include "harness.h"
|
||||||
|
|
||||||
/* We now provide our own implementations of "pass"/"fail"/"note", which
|
/* We now provide our own implementations of "pass"/"fail"/"note", which
|
||||||
call the underlying dejagnu implementations, but with a mutex. */
|
call the underlying dejagnu implementations, but with a mutex. */
|
||||||
|
@ -72,25 +98,6 @@ note (const char* fmt, ...)
|
||||||
pthread_mutex_unlock (&dg_mutex);
|
pthread_mutex_unlock (&dg_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAKE_DEJAGNU_H_THREADSAFE
|
|
||||||
|
|
||||||
/* We also need to provide our own version of TEST_NAME. */
|
|
||||||
#define TEST_NAME
|
|
||||||
|
|
||||||
/* We can now include all of the relevant selftests. */
|
|
||||||
|
|
||||||
#include "all-non-failing-tests.h"
|
|
||||||
|
|
||||||
#define TEST_PROVIDES_MAIN
|
|
||||||
#define TEST_ESCHEWS_TEST_JIT
|
|
||||||
|
|
||||||
/* Now construct a test case from all the other test cases.
|
|
||||||
|
|
||||||
We undefine COMBINED_TEST so that we can now include harness.h
|
|
||||||
"for real". */
|
|
||||||
#undef COMBINED_TEST
|
|
||||||
#include "harness.h"
|
|
||||||
|
|
||||||
struct thread_data
|
struct thread_data
|
||||||
{
|
{
|
||||||
pthread_t m_tid;
|
pthread_t m_tid;
|
||||||
|
|
Loading…
Reference in New Issue