diff options
Diffstat (limited to 'extern/glog/src/windows')
-rw-r--r-- | extern/glog/src/windows/glog/logging.h | 35 | ||||
-rw-r--r-- | extern/glog/src/windows/glog/raw_logging.h | 5 | ||||
-rw-r--r-- | extern/glog/src/windows/port.cc | 13 | ||||
-rw-r--r-- | extern/glog/src/windows/port.h | 23 | ||||
-rwxr-xr-x | extern/glog/src/windows/preprocess.sh | 2 |
5 files changed, 41 insertions, 37 deletions
diff --git a/extern/glog/src/windows/glog/logging.h b/extern/glog/src/windows/glog/logging.h index f521a2b9424..3681fa3fcc4 100644 --- a/extern/glog/src/windows/glog/logging.h +++ b/extern/glog/src/windows/glog/logging.h @@ -572,8 +572,10 @@ class LogSink; // defined below LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream() #define LOG_IF(severity, condition) \ + static_cast<void>(0), \ !(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity) #define SYSLOG_IF(severity, condition) \ + static_cast<void>(0), \ !(condition) ? (void) 0 : google::LogMessageVoidify() & SYSLOG(severity) #define LOG_ASSERT(condition) \ @@ -863,6 +865,7 @@ DECLARE_CHECK_STROP_IMPL(strcasecmp, false) &google::LogMessage::SendToLog) #define PLOG_IF(severity, condition) \ + static_cast<void>(0), \ !(condition) ? (void) 0 : google::LogMessageVoidify() & PLOG(severity) // A CHECK() macro that postpends errno if the condition is false. E.g. @@ -935,16 +938,11 @@ struct CompileAssert { struct CrashReason; // Returns true if FailureSignalHandler is installed. -bool IsFailureSignalHandlerInstalled(); +// Needs to be exported since it's used by the signalhandler_unittest. +GOOGLE_GLOG_DLL_DECL bool IsFailureSignalHandlerInstalled(); } // namespace glog_internal_namespace_ -#define GOOGLE_GLOG_COMPILE_ASSERT(expr, msg) \ - typedef google::glog_internal_namespace_::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] - #define LOG_EVERY_N(severity, n) \ - GOOGLE_GLOG_COMPILE_ASSERT(google::GLOG_ ## severity < \ - google::NUM_SEVERITIES, \ - INVALID_REQUESTED_LOG_SEVERITY); \ SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToLog) #define SYSLOG_EVERY_N(severity, n) \ @@ -1012,23 +1010,29 @@ const LogSeverity GLOG_0 = GLOG_ERROR; #else // !DCHECK_IS_ON() -#define DLOG(severity) \ +#define DLOG(severity) \ + static_cast<void>(0), \ true ? (void) 0 : google::LogMessageVoidify() & LOG(severity) -#define DVLOG(verboselevel) \ - (true || !VLOG_IS_ON(verboselevel)) ?\ +#define DVLOG(verboselevel) \ + static_cast<void>(0), \ + (true || !VLOG_IS_ON(verboselevel)) ? \ (void) 0 : google::LogMessageVoidify() & LOG(INFO) #define DLOG_IF(severity, condition) \ + static_cast<void>(0), \ (true || !(condition)) ? (void) 0 : google::LogMessageVoidify() & LOG(severity) #define DLOG_EVERY_N(severity, n) \ + static_cast<void>(0), \ true ? (void) 0 : google::LogMessageVoidify() & LOG(severity) #define DLOG_IF_EVERY_N(severity, condition, n) \ + static_cast<void>(0), \ (true || !(condition))? (void) 0 : google::LogMessageVoidify() & LOG(severity) #define DLOG_ASSERT(condition) \ + static_cast<void>(0), \ true ? (void) 0 : LOG_ASSERT(condition) // MSVC warning C4127: conditional expression is constant @@ -1113,10 +1117,11 @@ namespace base_logging { // buffer to allow for a '\n' and '\0'. class GOOGLE_GLOG_DLL_DECL LogStreamBuf : public std::streambuf { public: - // REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\n'. + // REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\0'. LogStreamBuf(char *buf, int len) { setp(buf, buf + len - 2); } + // This effectively ignores overflow. virtual int_type overflow(int_type ch) { return ch; @@ -1155,13 +1160,9 @@ public: // 2005 if you are deriving from a type in the Standard C++ Library" // http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx // Let's just ignore the warning. -#ifdef _MSC_VER -# pragma warning(disable: 4275) -#endif +GLOG_MSVC_PUSH_DISABLE_WARNING(4275) class GOOGLE_GLOG_DLL_DECL LogStream : public std::ostream { -#ifdef _MSC_VER -# pragma warning(default: 4275) -#endif +GLOG_MSVC_POP_WARNING() public: LogStream(char *buf, int len, int ctr) : std::ostream(NULL), diff --git a/extern/glog/src/windows/glog/raw_logging.h b/extern/glog/src/windows/glog/raw_logging.h index 4757a719db7..e0e6d6f1a25 100644 --- a/extern/glog/src/windows/glog/raw_logging.h +++ b/extern/glog/src/windows/glog/raw_logging.h @@ -179,11 +179,6 @@ GOOGLE_GLOG_DLL_DECL void RawLog__(LogSeverity severity, const char* format, ...) ; -// Hack to propagate time information into this module so that -// this module does not have to directly call localtime_r(), -// which could allocate memory. -GOOGLE_GLOG_DLL_DECL void RawLog__SetLastTime(const struct tm& t, int usecs); - } #endif // BASE_RAW_LOGGING_H_ diff --git a/extern/glog/src/windows/port.cc b/extern/glog/src/windows/port.cc index d9943254ee5..19bda367c62 100644 --- a/extern/glog/src/windows/port.cc +++ b/extern/glog/src/windows/port.cc @@ -38,15 +38,8 @@ #include "config.h" #include <stdarg.h> // for va_list, va_start, va_end -#include <string.h> // for strstr() -#include <assert.h> -#include <string> -#include <vector> #include "port.h" -using std::string; -using std::vector; - // These call the windows _vsnprintf, but always NUL-terminate. int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) { if (size == 0) // not even room for a \0? @@ -55,6 +48,12 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) { return _vsnprintf(str, size-1, format, ap); } +#ifndef HAVE_LOCALTIME_R +struct tm* localtime_r(const time_t* timep, struct tm* result) { + localtime_s(result, timep); + return result; +} +#endif // not HAVE_LOCALTIME_R #ifndef HAVE_SNPRINTF int snprintf(char *str, size_t size, const char *format, ...) { va_list ap; diff --git a/extern/glog/src/windows/port.h b/extern/glog/src/windows/port.h index 819846151b9..7b4b9c8545b 100644 --- a/extern/glog/src/windows/port.h +++ b/extern/glog/src/windows/port.h @@ -70,8 +70,11 @@ * 4715: for some reason VC++ stopped realizing you can't return after abort() * 4800: we know we're casting ints/char*'s to bools, and we're ok with that * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror() + * 4312: Converting uint32_t to a pointer when testing %p + * 4267: also subtracting two size_t to int + * 4722: Destructor never returns due to abort() */ -#pragma warning(disable:4244 4251 4355 4715 4800 4996) +#pragma warning(disable:4244 4251 4355 4715 4800 4996 4267 4312 4722) /* file I/O */ #define PATH_MAX 1024 @@ -86,6 +89,11 @@ #define pclose _pclose #define R_OK 04 /* read-only (for access()) */ #define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) + +#define O_WRONLY _O_WRONLY +#define O_CREAT _O_CREAT +#define O_EXCL _O_EXCL + #ifndef __MINGW32__ enum { STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2 }; #endif @@ -136,19 +144,20 @@ typedef int pid_t; #endif // _MSC_VER // ----------------------------------- THREADS -#ifndef __MINGW32__ +#if defined(HAVE_PTHREAD) +# include <pthread.h> +#else // no PTHREAD typedef DWORD pthread_t; typedef DWORD pthread_key_t; typedef LONG pthread_once_t; enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock #define pthread_self GetCurrentThreadId #define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2)) +#endif // HAVE_PTHREAD -inline struct tm* localtime_r(const time_t* timep, struct tm* result) { - localtime_s(result, timep); - return result; -} -#endif +#ifndef HAVE_LOCALTIME_R +extern GOOGLE_GLOG_DLL_DECL struct tm* localtime_r(const time_t* timep, struct tm* result); +#endif // not HAVE_LOCALTIME_R inline char* strerror_r(int errnum, char* buf, size_t buflen) { strerror_s(buf, buflen, errnum); diff --git a/extern/glog/src/windows/preprocess.sh b/extern/glog/src/windows/preprocess.sh index 5398988e7ea..c35e92913b6 100755 --- a/extern/glog/src/windows/preprocess.sh +++ b/extern/glog/src/windows/preprocess.sh @@ -95,7 +95,7 @@ DLLDEF_DEFINES="\ -e "s!@ac_cv_have_libgflags@!0!g" \ -e "s!@ac_cv_have___builtin_expect@!0!g" \ -e "s!@ac_cv_cxx_using_operator@!1!g" \ - -e "s!@ac_cv___attribute___noreturn@!!g" \ + -e "s!@ac_cv___attribute___noreturn@!__declspec(noreturn)!g" \ -e "s!@ac_cv___attribute___noinline@!!g" \ -e "s!@ac_cv___attribute___printf_4_5@!!g" \ -e "s!@ac_google_attribute@!${HAVE___ATTRIBUTE__:-0}!g" \ |