From 565ed9a6722ed06e1b49718b8e54ff4e25fa454e Mon Sep 17 00:00:00 2001 From: Snaipe Date: Tue, 8 Sep 2015 23:08:27 +0200 Subject: [PATCH] Made the deprecation message work with MSVC --- include/criterion/assert.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/criterion/assert.h b/include/criterion/assert.h index d3ebbff..4deab34 100644 --- a/include/criterion/assert.h +++ b/include/criterion/assert.h @@ -464,21 +464,26 @@ struct criterion_assert_args { // It shall be removed in the next major version of Criterion # ifndef CRITERION_NO_COMPAT -# define CRITERION_ASSERT_DEPRECATED_(Name) CRITERION_ASSERT_DEPRECATED__( \ - message \ - "The `" #Name "` macro is deprecated, " \ - "please use `cr_" #Name "` instead." \ +# define CRITERION_ASSERT_DEPRECATED_(Name) CRITERION_ASSERT_DEPRECATED__( \ + message \ + ("The `" #Name "` macro is deprecated, " \ + "please use `cr_" #Name "` instead.") \ ) # define CRITERION_ASSERT_DEPRECATED_B(Name, Newname) \ CRITERION_ASSERT_DEPRECATED__( \ message \ - "The `" #Name "` macro is deprecated, " \ - "please use `" #Newname "` instead." \ + ("The `" #Name "` macro is deprecated, " \ + "please use `" #Newname "` instead.") \ ) +# ifdef _MSC_VER +# define CRITERION_ASSERT_DEPRECATED__(Msg) \ + __pragma(Msg) +# else # define CRITERION_ASSERT_DEPRECATED__(Msg) \ _Pragma(#Msg) +# endif # ifndef assert # define assert(...) CRITERION_ASSERT_DEPRECATED_(assert) cr_assert(__VA_ARGS__)