mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
check: Avoid requring (u)intmax_t in macros
Previously embedded libcheck versions did not depend on (u)intmax_t and doing so would require projects using GStreamer's check framework to add AX_CREATE_STDINT_H to their configure.ac. A workaround is to fallback to glib types. This patch assumes that glib.h is always included before internal-check.h which is ok since everything Gstreamer would include gst/gstcheck.h instead of directly including internal-check.h. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727826
This commit is contained in:
parent
fb6ea425b0
commit
1cf733f282
1 changed files with 8 additions and 8 deletions
|
@ -25,8 +25,6 @@
|
|||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "_stdint.h"
|
||||
|
||||
/*
|
||||
Macros and functions starting with _ (underscore) are internal and
|
||||
may change without notice. You have been warned!.
|
||||
|
@ -461,9 +459,10 @@ CK_DLL_EXP void CK_EXPORT _ck_assert_failed (const char *file, int line,
|
|||
/* Signed and unsigned integer comparison macros with improved output compared to ck_assert(). */
|
||||
/* OP may be any comparison operator. */
|
||||
#define _ck_assert_int(X, OP, Y) do { \
|
||||
intmax_t _ck_x = (X); \
|
||||
intmax_t _ck_y = (Y); \
|
||||
ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: %s==%jd, %s==%jd", #X#OP#Y, #X, _ck_x, #Y, _ck_y); \
|
||||
gint64 _ck_x = (X); \
|
||||
gint64 _ck_y = (Y); \
|
||||
ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: " \
|
||||
"%s==%" G_GINT64_FORMAT ", %s==%" G_GINT64_FORMAT, #X#OP#Y, #X, _ck_x, #Y, _ck_y); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
|
@ -546,9 +545,10 @@ CK_DLL_EXP void CK_EXPORT _ck_assert_failed (const char *file, int line,
|
|||
#define ck_assert_int_ge(X, Y) _ck_assert_int(X, >=, Y)
|
||||
|
||||
#define _ck_assert_uint(X, OP, Y) do { \
|
||||
uintmax_t _ck_x = (X); \
|
||||
uintmax_t _ck_y = (Y); \
|
||||
ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: %s==%ju, %s==%ju", #X#OP#Y, #X, _ck_x, #Y, _ck_y); \
|
||||
guint64 _ck_x = (X); \
|
||||
guint64 _ck_y = (Y); \
|
||||
ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: " \
|
||||
"%s==%" G_GUINT64_FORMAT ", %s==%" G_GUINT64_FORMAT, #X#OP#Y, #X, _ck_x, #Y, _ck_y); \
|
||||
} while (0)
|
||||
/**
|
||||
* Check two unsigned integers to determine if X==Y
|
||||
|
|
Loading…
Reference in a new issue