This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via d5cdf89dd42290ce846e29309879a9263aa9e023 (commit) from 037f2ffabeabd1a2522169b7b766333a64680762 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/d5cdf89dd42290ce846e29309879a9263aa9e...
commit d5cdf89dd42290ce846e29309879a9263aa9e023 Author: BlueBear jiri.bluebear.dluhos@gmail.com Date: Sun May 8 17:33:29 2011 +0200
Fixed stupid typo in GP_ASSERT; minor cleanups
diff --git a/core/GP_Common.h b/core/GP_Common.h index 24039b6..c6005f8 100644 --- a/core/GP_Common.h +++ b/core/GP_Common.h @@ -50,50 +50,55 @@ })
/* - * Checks the condition and aborts immediately if it is not satisfied, - * printing the condition and location in the source. - * (Intended for checking for bugs within the library itself. - * GP_CHECK is used for reporting user errors, like invalid arguments.) + * The standard likely() and unlikely() used in Kernel */ -#define GP_ASSERT(cond) do { - if ((cond)) { - fprintf(stderr, "*** gfxprim: %s:%d: in %s: BUG - assertion failed: %sn", - __FILE__, __LINE__, __FUNCTION__, #cond); - abort(); - } - } while (0) +#ifndef likely + #ifdef __GNUC__ + #define likely(x) __builtin_expect(!!(x),1) + #define unlikely(x) __builtin_expect(!!(x),0) + #else + #define likely(x) x + #define unlikely(x) x + #endif +#endif
/* - * Abort and print abort location to stderr + * Aborts and prints the message along with the location in code + * to stderr. Used for fatal errors. */ #define GP_ABORT(msg) do { fprintf(stderr, "*** gfxprim: aborted: %s:%d: in %s: %sn", - __FILE__, __LINE__, __FUNCTION__, #msg); + __FILE__, __LINE__, __FUNCTION__, msg); abort(); } while (0)
/* + * Checks the condition and aborts immediately if it is not satisfied, + * printing the condition and location in the source. + * (Intended for checking for bugs within the library itself. + * GP_CHECK is used for reporting user errors, like invalid arguments.) + */ +#define GP_ASSERT(cond) do { + if (unlikely(!(cond))) { + fprintf(stderr, "*** gfxprim: %s:%d: in %s: BUG: assertion failed: %sn", + __FILE__, __LINE__, __FUNCTION__, #cond); + abort(); + } +} while (0) + +/* * Perform a runtime check, on failure abort and print a message. * (This macro is intended for checks for user-caused errors, * like invalid arguments, leaving the library in improper state etc. * For internal sanity checks, use GP_ASSERT.) */ #define GP_CHECK(cond, msg) do { - if (!(cond)) { - fprintf(stderr, "*** gfxprim: %s:%d: in %s: %sn", - __FILE__, __LINE__, __FUNCTION__, #msg); - abort(); - } - } while (0) - -/* - * The standard likely() and unlikely() used in Kernel - * TODO: Define as no-op for non-GCC compilers - */ -#ifndef likely -#define likely(x) __builtin_expect((x),1) -#define unlikely(x) __builtin_expect((x),0) -#endif + if (unlikely(!(cond))) { + fprintf(stderr, "*** gfxprim: %s:%d: in %s: %sn", + __FILE__, __LINE__, __FUNCTION__, msg); + abort(); + } +} while (0)
/* * Swap a and b using an intermediate variable
-----------------------------------------------------------------------
Summary of changes: core/GP_Common.h | 61 +++++++++++++++++++++++++++++------------------------ 1 files changed, 33 insertions(+), 28 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.