From bdb307ac4a6ad20e687f286491a3d9df6807567f Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann?= Date: Sat, 19 May 2007 15:53:37 -0400 Subject: [PATCH] Add macro FUNC that expands to __PRETTY_FUNCTION__ or __func__ depending on the compiler. --- configure.ac | 1 - pixman/pixman-private.h | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index a4aeb1c..18a0ce4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,3 @@ - dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 272fbed..bb0d4b1 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -10,6 +10,14 @@ #define DEBUG 1 +#if defined (__GNUC__) +# define FUNC ((const char*) (__PRETTY_FUNCTION__)) +#elif defined (__sun) || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) +# define FUNC ((const char*) (__func__)) +#else +# define FUNC ((const char*) ("???")) +#endif + #if DEBUG #define return_if_fail(expr) \ @@ -17,7 +25,7 @@ { \ if (!(expr)) \ { \ - fprintf(stderr, "In %s: %s failed\n", __FUNCTION__, #expr); \ + fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \ return; \ } \ } \ @@ -28,7 +36,7 @@ { \ if (!(expr)) \ { \ - fprintf(stderr, "In %s: %s failed\n", __FUNCTION__, #expr); \ + fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \ return (retval); \ } \ } \ -- 2.7.4