[test] Never use gcc __attribute__ magic for constructors.

The configure test for __attribute__((constructor)) succeeds when
compiling with Sun Studio 12 on OpenSolaris but the attribute
is just ignored and has no actual effect.  This causes the test
suite to not run any tests at all.  With this patch we revert to
always using make-cairo-test-constructors.pl.
This commit is contained in:
M Joonas Pihlaja 2009-05-24 16:19:31 +03:00
parent 46eb56a99f
commit cdd27a8d4c
5 changed files with 2 additions and 33 deletions

View file

@ -135,15 +135,5 @@ dnl ===========================================================================
dnl
dnl Test for the tools required for building one big test binary
dnl
AC_MSG_CHECKING([for the constructor attribute])
cairo_has_constructor_attribute="no"
AC_TRY_LINK([static void __attribute__((constructor)) constructor(void) {}], [],
cairo_has_constructor_attribute="yes"
)
AC_MSG_RESULT([$cairo_has_constructor_attribute])
if test "x$cairo_has_constructor_attribute" = "xyes"; then
AC_DEFINE(CAIRO_HAS_CONSTRUCTOR_ATTRIBUTE, 1, [Define to 1 if your compiler supports __attribute__(constructor)])
fi
AM_CONDITIONAL(CAIRO_HAS_CONSTRUCTOR_ATTRIBUTE, test "x$cairo_has_constructor_attribute" = "xyes")
AC_CHECK_FUNCS(fork waitpid raise)

View file

@ -73,11 +73,8 @@ cairo-test-constructors.c: Makefile $(test_sources) make-cairo-test-constructors
cairo_test_suite_SOURCES = \
$(cairo_test_suite_sources) \
$(cairo_test_suite_headers) \
$(test_sources)
if CAIRO_HAS_CONSTRUCTOR_ATTRIBUTE
else
cairo_test_suite_SOURCES += cairo-test-constructors.c
endif
$(test_sources) \
cairo-test-constructors.c
cairo_test_suite_LDADD = \
$(top_builddir)/test/pdiff/libpdiff.la \
$(top_builddir)/boilerplate/libcairoboilerplate.la \

View file

@ -64,10 +64,8 @@ cairo_test (const cairo_test_t *test);
void
cairo_test_fini (cairo_test_context_t *ctx);
#if ! CAIRO_HAS_CONSTRUCTOR_ATTRIBUTE
void
_cairo_test_runner_register_tests (void);
#endif
CAIRO_END_DECLS

View file

@ -599,9 +599,7 @@ main (int argc, char **argv)
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
#endif
#ifndef CAIRO_HAS_CONSTRUCTOR_ATTRIBUTE
_cairo_test_runner_register_tests ();
#endif
memset (&runner, 0, sizeof (runner));
runner.num_device_offsets = 1;

View file

@ -133,19 +133,6 @@ struct _cairo_test {
* one backend that is tested and if all tested backend pass according
* to the four criteria above.
*/
#if CAIRO_HAS_CONSTRUCTOR_ATTRIBUTE
#define CAIRO_TEST(name, description, keywords, requirements, width, height, preamble, draw) \
static void __attribute__((constructor)) _register_##name (void) \
{\
static const cairo_test_t test = { \
#name, description, \
keywords, requirements, \
width, height, \
preamble, draw \
}; \
cairo_test_register (&test); \
}
#else
#define CAIRO_TEST(name, description, keywords, requirements, width, height, preamble, draw) \
void _register_##name (void); \
void _register_##name (void) { \
@ -157,7 +144,6 @@ void _register_##name (void) { \
}; \
cairo_test_register (&test); \
}
#endif
void
cairo_test_register (const cairo_test_t *test);