From 78de0c92223b854000cefc97f62273c97dfc9765 Mon Sep 17 00:00:00 2001 From: yuslepukhin Date: Tue, 8 Dec 2015 08:38:21 -0800 Subject: [PATCH] Fix up VS 15 build. Fix warnings Take advantage of native snprintf on VS 15 --- CMakeLists.txt | 2 +- port/win/port_win.h | 15 +++------------ tools/db_stress.cc | 3 ++- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51749bae0d..5af376c487 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ # 3. Run cmake to generate project files for Windows, add more options to enable required third-party libraries. # See thirdparty.inc for more information. # sample command: cmake -G "Visual Studio 12 Win64" -DGFLAGS=1 -DSNAPPY=1 -DJEMALLOC=1 .. -# OR for VS Studio 15 cmake -G "Visual Studio 12 Win64" -DGFLAGS=1 -DSNAPPY=1 -DJEMALLOC=1 .. +# OR for VS Studio 15 cmake -G "Visual Studio 14 Win64" -DGFLAGS=1 -DSNAPPY=1 -DJEMALLOC=1 .. # 4. Then build the project in debug mode (you may want to add /m[:] flag to run msbuild in parallel threads # or simply /m ot use all avail cores) # msbuild rocksdb.sln diff --git a/port/win/port_win.h b/port/win/port_win.h index 9d5be2c789..6b79200238 100644 --- a/port/win/port_win.h +++ b/port/win/port_win.h @@ -42,11 +42,6 @@ #define strcasecmp _stricmp #endif -// defined in stdio.h -#ifndef snprintf -#define snprintf _snprintf -#endif - #undef GetCurrentTime #undef DeleteFile @@ -108,6 +103,9 @@ const size_t kMaxSizet = std::numeric_limits::max(); #else //_MSC_VER +// VS 15 has snprintf +#define snprintf _snprintf + #define ROCKSDB_NOEXCEPT // std::numeric_limits::max() is not constexpr just yet // therefore, use the same limits @@ -245,13 +243,6 @@ extern void InitOnce(OnceType* once, void (*initializer)()); #define CACHE_LINE_SIZE 64U -#ifdef min -#undef min -#endif -#ifdef max -#undef max -#endif - // For Thread Local Storage abstraction typedef DWORD pthread_key_t; diff --git a/tools/db_stress.cc b/tools/db_stress.cc index 1b1672ca22..669ca6c53f 100644 --- a/tools/db_stress.cc +++ b/tools/db_stress.cc @@ -610,7 +610,8 @@ class Stats { "", bytes_mb, rate, (100*writes_)/done_, done_); fprintf(stdout, "%-12s: Wrote %ld times\n", "", writes_); fprintf(stdout, "%-12s: Deleted %ld times\n", "", deletes_); - fprintf(stdout, "%-12s: Single deleted %ld times\n", "", single_deletes_); + fprintf(stdout, "%-12s: Single deleted %" ROCKSDB_PRIszt " times\n", "", + single_deletes_); fprintf(stdout, "%-12s: %ld read and %ld found the key\n", "", gets_, founds_); fprintf(stdout, "%-12s: Prefix scanned %ld times\n", "", prefixes_);