Skip to content

Commit

Permalink
Remove usage of "lg" in printf format
Browse files Browse the repository at this point in the history
MinGW on Windows does not "lg". The reason is that MinGW mixes
GCC and the MSVC runtime. For GCC a long double is either
96-bit or 128-bit type for long double on x86 or x64 targets
(see http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html).
However, MSVC uses a 64-bit type
(see http://msdn.microsoft.com/en-us/library/9cx8xs15.aspx).
That means for MSVC "double" and "long double" are the same.

Because of this mismatch, the "l" in "lg", which is safely ignored
on Linux and BSD systems is not safely ignored in MSVC systems
where GCC is used to compile. This issue does not arise when using
VS compiler on Windows.
  • Loading branch information
brarcher committed Dec 22, 2016
1 parent b648c9a commit 5dcd72e
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/check.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_float_nonnan(X) _ck_assert_floating_nonnan(X, float, "l")
#define ck_assert_float_nonnan(X) _ck_assert_floating_nonnan(X, float, "")

/**
* Check two double precision floating point numbers to determine if X == Y
Expand All @@ -975,7 +975,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_eq(X, Y) _ck_assert_floating(X, ==, Y, double, "l")
#define ck_assert_double_eq(X, Y) _ck_assert_floating(X, ==, Y, double, "")
/**
* Check two double precision floating point numbers to determine if X != Y
*
Expand All @@ -988,7 +988,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_ne(X, Y) _ck_assert_floating(X, !=, Y, double, "l")
#define ck_assert_double_ne(X, Y) _ck_assert_floating(X, !=, Y, double, "")
/**
* Check two double precision floating point numbers to determine if X < Y
*
Expand All @@ -1001,7 +1001,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_lt(X, Y) _ck_assert_floating(X, <, Y, double, "l")
#define ck_assert_double_lt(X, Y) _ck_assert_floating(X, <, Y, double, "")
/**
* Check two double precision floating point numbers to determine if X <= Y
*
Expand All @@ -1014,7 +1014,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_le(X, Y) _ck_assert_floating(X, <=, Y, double, "l")
#define ck_assert_double_le(X, Y) _ck_assert_floating(X, <=, Y, double, "")
/**
* Check two double precision floating point numbers to determine if X > Y
*
Expand All @@ -1027,7 +1027,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_gt(X, Y) _ck_assert_floating(X, >, Y, double, "l")
#define ck_assert_double_gt(X, Y) _ck_assert_floating(X, >, Y, double, "")
/**
* Check two double precision floating point numbers to determine if X >= Y
*
Expand All @@ -1040,7 +1040,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_ge(X, Y) _ck_assert_floating(X, >=, Y, double, "l")
#define ck_assert_double_ge(X, Y) _ck_assert_floating(X, >=, Y, double, "")

/**
* Check two double precision floating point numbers to determine if X≈Y
Expand All @@ -1056,7 +1056,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_eq_tol(X, Y, T) _ck_assert_floating_absdiff_op_tol(X, Y, <, T, double, "l")
#define ck_assert_double_eq_tol(X, Y, T) _ck_assert_floating_absdiff_op_tol(X, Y, <, T, double, "")

/**
* Check two double precision floating point numbers to determine if not X≈Y
Expand All @@ -1072,7 +1072,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_ne_tol(X, Y, T) _ck_assert_floating_absdiff_op_tol(X, Y, >=, T, double, "l")
#define ck_assert_double_ne_tol(X, Y, T) _ck_assert_floating_absdiff_op_tol(X, Y, >=, T, double, "")

/**
* Check two double precision floating point numbers to determine if X>≈Y
Expand All @@ -1088,7 +1088,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_ge_tol(X, Y, T) _ck_assert_floating_op_tol(X, >, Y, T, -1, double, "l")
#define ck_assert_double_ge_tol(X, Y, T) _ck_assert_floating_op_tol(X, >, Y, T, -1, double, "")

/**
* Check two double precision floating point numbers to determine if X<≈Y
Expand All @@ -1104,7 +1104,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_le_tol(X, Y, T) _ck_assert_floating_op_tol(X, <, Y, T, 1, double, "l")
#define ck_assert_double_le_tol(X, Y, T) _ck_assert_floating_op_tol(X, <, Y, T, 1, double, "")

/**
* Check that a double precision floating point number is finite; i.e. is
Expand All @@ -1118,7 +1118,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_finite(X) _ck_assert_floating_finite(X, double, "l")
#define ck_assert_double_finite(X) _ck_assert_floating_finite(X, double, "")

/**
* Check that a double precision floating point number is infinite,
Expand All @@ -1132,7 +1132,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_infinite(X) _ck_assert_floating_infinite(X, double, "l")
#define ck_assert_double_infinite(X) _ck_assert_floating_infinite(X, double, "")

/**
* Check that a double precision floating point number
Expand All @@ -1146,7 +1146,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_nan(X) _ck_assert_floating_nan(X, double, "l")
#define ck_assert_double_nan(X) _ck_assert_floating_nan(X, double, "")

/**
* Check that a double precision floating point number is
Expand All @@ -1160,7 +1160,7 @@ do { \
*
* @since 0.11.0
*/
#define ck_assert_double_nonnan(X) _ck_assert_floating_nonnan(X, double, "l")
#define ck_assert_double_nonnan(X) _ck_assert_floating_nonnan(X, double, "")

/**
* Check two double precision floating point numbers to determine if X == Y
Expand Down

0 comments on commit 5dcd72e

Please sign in to comment.