mirror of
https://github.com/google/snappy.git
synced 2024-11-28 05:44:33 +00:00
Fixed unit tests to compile under MSVC.
1. Including config.h in test. 2. Including windows.h before zippy-test.h. 3. Removed definition of WIN32_LEAN_AND_MEAN. This caused problems in build environments that define WIN32_LEAN_AND_MEAN as our definition didn't check for prior existence. This constant is old and no longer needed anyhow. 4. Disable MSVC warning 4722 since ~LogMessageCrash() never returns. A=cmumford R=jeff
This commit is contained in:
parent
86eb8b152b
commit
e7a897e187
|
@ -28,13 +28,16 @@
|
||||||
//
|
//
|
||||||
// Various stubs for the unit tests for the open-source version of Snappy.
|
// Various stubs for the unit tests for the open-source version of Snappy.
|
||||||
|
|
||||||
#include "snappy-test.h"
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_WINDOWS_H
|
#ifdef HAVE_WINDOWS_H
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "snappy-test.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
DEFINE_bool(run_microbenchmarks, true,
|
DEFINE_bool(run_microbenchmarks, true,
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_WINDOWS_H
|
#ifdef HAVE_WINDOWS_H
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -548,6 +547,13 @@ class LogMessage {
|
||||||
PREDICT_TRUE(condition) ? (void)0 : \
|
PREDICT_TRUE(condition) ? (void)0 : \
|
||||||
snappy::LogMessageVoidify() & snappy::LogMessageCrash()
|
snappy::LogMessageVoidify() & snappy::LogMessageCrash()
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// ~LogMessageCrash calls abort() and therefore never exits. This is by design
|
||||||
|
// so temporarily disable warning C4722.
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4722)
|
||||||
|
#endif
|
||||||
|
|
||||||
class LogMessageCrash : public LogMessage {
|
class LogMessageCrash : public LogMessage {
|
||||||
public:
|
public:
|
||||||
LogMessageCrash() { }
|
LogMessageCrash() { }
|
||||||
|
@ -557,6 +563,10 @@ class LogMessageCrash : public LogMessage {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
// This class is used to explicitly ignore values in the conditional
|
// This class is used to explicitly ignore values in the conditional
|
||||||
// logging macros. This avoids compiler warnings like "value computed
|
// logging macros. This avoids compiler warnings like "value computed
|
||||||
// is not used" and "statement has no effect".
|
// is not used" and "statement has no effect".
|
||||||
|
|
Loading…
Reference in a new issue