Merge pull request #289 from akheron/simplify-snprintf-checks

Simplify snprintf and vsnprintf checking for Visual Studio
This commit is contained in:
Petri Lehtinen 2016-06-03 12:29:55 +03:00
commit 520340998f
3 changed files with 10 additions and 34 deletions

View File

@ -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)

View File

@ -1,6 +1,14 @@
environment:
matrix:
- VS: Visual Studio 9 2008
- VS: Visual Studio 10 2010
- VS: Visual Studio 11 2012
- VS: Visual Studio 12 2013
- VS: Visual Studio 14 2015
build_script:
- md build
- cd build
- cmake ..
- cmake -G "%VS%" ..
- cmake --build . --config Release
- ctest --output-on-failure

View File

@ -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