[memfault] Update macros to avoid namescape collision with memcheck

Basing the macro names of the memfault skin lead to a namespace
collision with memcheck. After updating the headers, update cairo's usage
to match.
This commit is contained in:
Chris Wilson 2009-05-15 16:57:49 +01:00
parent c897f36a6b
commit 791a6fa399
2 changed files with 32 additions and 32 deletions

View file

@ -41,7 +41,7 @@
#if HAVE_MEMFAULT
#include <memfault.h>
#define CAIRO_INJECT_FAULT() VALGRIND_INJECT_FAULT()
#define CAIRO_INJECT_FAULT() MEMFAULT_INJECT_FAULT()
#else
#define CAIRO_INJECT_FAULT() 0
#endif

View file

@ -131,7 +131,7 @@ _cairo_test_init (cairo_test_context_t *ctx,
{
char *log_name;
MF (VALGRIND_DISABLE_FAULTS ());
MF (MEMFAULT_DISABLE_FAULTS ());
#if HAVE_FEENABLEEXCEPT
feenableexcept (FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
@ -222,7 +222,7 @@ cairo_test_init_thread (cairo_test_context_t *ctx,
cairo_test_context_t *master,
int thread)
{
MF (VALGRIND_DISABLE_FAULTS ());
MF (MEMFAULT_DISABLE_FAULTS ());
*ctx = *master;
ctx->thread = thread;
@ -739,17 +739,17 @@ cairo_test_for_target (cairo_test_context_t *ctx,
#if HAVE_MEMFAULT
REPEAT:
VALGRIND_CLEAR_FAULTS ();
VALGRIND_RESET_LEAKS ();
MEMFAULT_CLEAR_FAULTS ();
MEMFAULT_RESET_LEAKS ();
ctx->last_fault_count = 0;
last_fault_count = VALGRIND_COUNT_FAULTS ();
last_fault_count = MEMFAULT_COUNT_FAULTS ();
/* Pre-initialise fontconfig so that the configuration is loaded without
* malloc failures (our primary goal is to test cairo fault tolerance).
*/
FcInit ();
VALGRIND_ENABLE_FAULTS ();
MEMFAULT_ENABLE_FAULTS ();
#endif
have_output = FALSE;
have_result = FALSE;
@ -772,7 +772,7 @@ REPEAT:
#if HAVE_MEMFAULT
if (ctx->malloc_failure &&
VALGRIND_COUNT_FAULTS () - last_fault_count > 0 &&
MEMFAULT_COUNT_FAULTS () - last_fault_count > 0 &&
cairo_surface_status (surface) == CAIRO_STATUS_NO_MEMORY)
{
goto REPEAT;
@ -780,7 +780,7 @@ REPEAT:
#endif
if (cairo_surface_status (surface)) {
MF (VALGRIND_PRINT_FAULTS ());
MF (MEMFAULT_PRINT_FAULTS ());
cairo_test_log (ctx, "Error: Created an error surface\n");
ret = CAIRO_TEST_FAILURE;
goto UNWIND_STRINGS;
@ -788,7 +788,7 @@ REPEAT:
/* Check that we created a surface of the expected type. */
if (cairo_surface_get_type (surface) != target->expected_type) {
MF (VALGRIND_PRINT_FAULTS ());
MF (MEMFAULT_PRINT_FAULTS ());
cairo_test_log (ctx, "Error: Created surface is of type %d (expected %d)\n",
cairo_surface_get_type (surface), target->expected_type);
ret = CAIRO_TEST_FAILURE;
@ -801,7 +801,7 @@ REPEAT:
expected_content = cairo_boilerplate_content (target->content);
if (cairo_surface_get_content (surface) != expected_content) {
MF (VALGRIND_PRINT_FAULTS ());
MF (MEMFAULT_PRINT_FAULTS ());
cairo_test_log (ctx, "Error: Created surface has content %d (expected %d)\n",
cairo_surface_get_content (surface), expected_content);
ret = CAIRO_TEST_FAILURE;
@ -856,11 +856,11 @@ REPEAT:
}
#if HAVE_MEMFAULT
VALGRIND_DISABLE_FAULTS ();
MEMFAULT_DISABLE_FAULTS ();
/* repeat test after malloc failure injection */
if (ctx->malloc_failure &&
VALGRIND_COUNT_FAULTS () - last_fault_count > 0 &&
MEMFAULT_COUNT_FAULTS () - last_fault_count > 0 &&
(status == CAIRO_TEST_NO_MEMORY ||
cairo_status (cr) == CAIRO_STATUS_NO_MEMORY ||
cairo_surface_status (surface) == CAIRO_STATUS_NO_MEMORY))
@ -874,9 +874,9 @@ REPEAT:
#if HAVE_FCFINI
FcFini ();
#endif
if (VALGRIND_COUNT_LEAKS () > 0) {
VALGRIND_PRINT_FAULTS ();
VALGRIND_PRINT_LEAKS ();
if (MEMFAULT_COUNT_LEAKS () > 0) {
MEMFAULT_PRINT_FAULTS ();
MEMFAULT_PRINT_LEAKS ();
}
}
@ -899,11 +899,11 @@ REPEAT:
}
#if HAVE_MEMFAULT
if (VALGRIND_COUNT_FAULTS () - last_fault_count > 0 &&
VALGRIND_HAS_FAULTS ())
if (MEMFAULT_COUNT_FAULTS () - last_fault_count > 0 &&
MEMFAULT_HAS_FAULTS ())
{
VALGRIND_PRINTF ("Unreported memfaults...");
VALGRIND_PRINT_FAULTS ();
MEMFAULT_PRINT_FAULTS ();
}
#endif
@ -920,18 +920,18 @@ REPEAT:
/* We need to re-enable faults as most meta-surface processing
* is done during cairo_surface_finish().
*/
VALGRIND_CLEAR_FAULTS ();
last_fault_count = VALGRIND_COUNT_FAULTS ();
VALGRIND_ENABLE_FAULTS ();
MEMFAULT_CLEAR_FAULTS ();
last_fault_count = MEMFAULT_COUNT_FAULTS ();
MEMFAULT_ENABLE_FAULTS ();
#endif
diff_status = target->finish_surface (surface);
#if HAVE_MEMFAULT
VALGRIND_DISABLE_FAULTS ();
MEMFAULT_DISABLE_FAULTS ();
if (ctx->malloc_failure &&
VALGRIND_COUNT_FAULTS () - last_fault_count > 0 &&
MEMFAULT_COUNT_FAULTS () - last_fault_count > 0 &&
diff_status == CAIRO_STATUS_NO_MEMORY)
{
cairo_destroy (cr);
@ -943,9 +943,9 @@ REPEAT:
#if HAVE_FCFINI
FcFini ();
#endif
if (VALGRIND_COUNT_LEAKS () > 0) {
VALGRIND_PRINT_FAULTS ();
VALGRIND_PRINT_LEAKS ();
if (MEMFAULT_COUNT_LEAKS () > 0) {
MEMFAULT_PRINT_FAULTS ();
MEMFAULT_PRINT_LEAKS ();
}
}
@ -1135,7 +1135,7 @@ UNWIND_CAIRO:
#if HAVE_MEMFAULT
if (ret == CAIRO_TEST_FAILURE && ctx->expectation != CAIRO_TEST_FAILURE)
VALGRIND_PRINT_FAULTS ();
MEMFAULT_PRINT_FAULTS ();
#endif
cairo_destroy (cr);
UNWIND_SURFACE:
@ -1152,13 +1152,13 @@ UNWIND_SURFACE:
FcFini ();
#endif
if (VALGRIND_COUNT_LEAKS () > 0) {
if (MEMFAULT_COUNT_LEAKS () > 0) {
if (ret != CAIRO_TEST_FAILURE ||
ctx->expectation == CAIRO_TEST_FAILURE)
{
VALGRIND_PRINT_FAULTS ();
MEMFAULT_PRINT_FAULTS ();
}
VALGRIND_PRINT_LEAKS ();
MEMFAULT_PRINT_LEAKS ();
}
}
@ -1648,7 +1648,7 @@ cairo_test_malloc_failure (const cairo_test_context_t *ctx,
int n_faults;
/* prevent infinite loops... */
n_faults = VALGRIND_COUNT_FAULTS ();
n_faults = MEMFAULT_COUNT_FAULTS ();
if (n_faults == ctx->last_fault_count)
return FALSE;