Simplify snprintf and vsnprintf checking for Visual Studio

remotes/origin/simplify-snprintf-checks
Petri Lehtinen 8 years ago
parent 762b299e71
commit 72fd2fec4c

@ -303,16 +303,6 @@ else()
set (JSON_INLINE)
endif()
# Find our snprintf
check_function_exists (snprintf HAVE_SNPRINTF)
check_function_exists (_snprintf HAVE__SNPRINTF)
if (HAVE_SNPRINTF)
set(JSON_SNPRINTF snprintf)
elseif (HAVE__SNPRINTF)
set(JSON_SNPRINTF _snprintf)
endif ()
check_c_source_compiles ("int main() { unsigned long val; __sync_bool_compare_and_swap(&val, 0, 1); return 0; } " HAVE_SYNC_BUILTINS)
check_c_source_compiles ("int main() { char l; unsigned long v; __atomic_test_and_set(&l, __ATOMIC_RELAXED); __atomic_store_n(&v, 1, __ATOMIC_RELEASE); __atomic_load_n(&v, __ATOMIC_ACQUIRE); return 0; }" HAVE_ATOMIC_BUILTINS)

@ -47,28 +47,6 @@
# define ssize_t @JSON_SSIZE@
#endif
#cmakedefine HAVE_SNPRINTF 1
/* snprintf should not be defined as macro with MSC_VER >= 1900 */
#if defined(_WIN32) || defined(WIN32)
# if defined(_MSC_VER) /* MS compiller */
# if (_MSC_VER < 1900) /* snprintf not introduced */
# if !defined(snprintf)
# define snprintf _snprintf
# define HAVE_SNPRINTF 1 /* snprintf defined manually */
# endif
# else
# define HAVE_SNPRINTF 1 /* snprintf available via sdk */
# endif
# endif
#endif
#ifndef HAVE_SNPRINTF
# define snprintf @JSON_SNPRINTF@
#endif
#cmakedefine HAVE_VSNPRINTF
#cmakedefine USE_URANDOM 1
#cmakedefine USE_WINDOWS_CRYPTOAPI 1

Loading…
Cancel
Save