From 4aa7c0729591d88474de585e4650b1a5e4ba3c22 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Sat, 5 Sep 2015 21:06:18 +0200 Subject: [PATCH] Made the samples compile with MSVC --- samples/CMakeLists.txt | 4 +++- samples/asserts.c | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 7767a42..5bdb842 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -1,4 +1,6 @@ -set(CMAKE_C_FLAGS "-std=c99 -Wall -Wextra -pedantic") +if (NOT MSVC) + set(CMAKE_C_FLAGS "-std=c99 -Wall -Wextra -pedantic") +endif () include_directories(../include) diff --git a/samples/asserts.c b/samples/asserts.c index 627f778..6b44cb9 100644 --- a/samples/asserts.c +++ b/samples/asserts.c @@ -64,6 +64,10 @@ Test(asserts, array) { int arr1[] = {1, 2, 3, 4}; int arr2[] = {4, 3, 2, 1}; + cr_assert_arrays_eq(arr1, arr1, 4); + cr_assert_arrays_neq(arr1, arr2, 4); + +#ifdef __GNUC__ struct dummy_struct s1[] = {{4, 2}, {2, 4}}; struct dummy_struct s2[2]; memset(s2, 0xFF, sizeof(s2)); @@ -72,9 +76,7 @@ Test(asserts, array) { s2[1].a = 2; s2[1].b = 4; - cr_assert_arrays_eq(arr1, arr1, 4); - cr_assert_arrays_neq(arr1, arr2, 4); - cr_assert_arrays_neq(s1, s2, 2); cr_assert_arrays_eq_cmp(s1, s2, 2, eq_dummy); +#endif }