Squashed 'third_party/google-glog/' changes from 5d46e1bcf..a1b6164ef

a1b6164ef windows: call to FormatMessage() should _IGNORE_INSERTS (#849)
278ed9689 simplify DLOG macro definition in NDEBUG mode (#830)
6ed0c9e58 added emscripten support (#846)
a34226ca9 support ndk r25 (#844)
c515e1ae2 remove unused STDC_HEADERS definition (#835)
79d692c64 Strip only the first leading @
086ce224d bazel: Use glog 0.6.0 in README.
b33e3bad4 Merge pull request #812 from google/release-0.6
54b8bcbbf release 0.6
864ef6492 Merge pull request #801 from skeptic-monkey/master
c640c2f7c Fix namespace resolution issue in LOG_EVERY_T
5addeedc0 Fix "'GLOG_EXPORT' macro redefined" on clang-cl
d153e294b Avoid "GLOG_EXPORT macro redefined" in clang-cl CI
c4ca519a8 Add CI job for clang-cl on Windows
a8e0007e9 Merge pull request #790 from git-hulk/feature/logs-to-stdout
553ddaea8 Merge pull request #794 from Arfrever/tests-TMPDIR
6d3f70a40 Pass EXIT_SUCCESS or EXIT_FAILURE to exit() and _exit()
612a7d28c Tests: Respect TEST_TMPDIR, TMPDIR, TMP environmental variables
180b700dd Add logtostdout and colorlogtostdout flags for logging to stdout
b38ed9d08 cmake_package_config_generate: Fix CMake warnings with CMake 3.23
9f0b7d3bf renamed GOOGLE_GLOG_DLL_DECL to GLOG_EXPORT
aa94e6b9a simplify flags export
17269d649 cmake: enable custom prefix by default
bc1fada1c libglog.pc: Set Libs.private for static linking
18836106d LogCleaner: avoid scanning logs too frequently
b0174b3dd On Solaris, uname() returns non-negative value
696941218 Changed my Email ID
643441014 cmake: require at least gflags 2.2.2
a8cfbe0c0 stdcxx: eliminate excessive use of std::string::c_str()
b3abfaa12 use uint32 for --max-log-size
43fc3bf91 Add log_year_in_prefix flag
42d509b1c revert to int atomics
224f66bb6 cmake: do not search for platform specific unwind
4ffa98388 ensure _Unwind_Backtrace to actually be available
087ad5bf3 eliminated clang warnings
9dc1107f8 run clang-tidy
dfb9ffc32 provide backward compatible send overload
c57511605 ci: removed deprecated msvc runner
d09b999f3 LogCleaner: make overdue_days_ unsigned int
baa7006e6 ci: enable warnings as errors
660352f02 cmake: require at least version 3.16 (fixes #705)
52354b2ad eliminate msvc warnings
ccbda2dfd LogCleaner: Fix relative paths and add a new test
ef36f800e Added an API to get GMT offset from LogMessageTime     * Added API to get GMT offset     * Made LogMessageTime as a memeber of LogMessage     * Refactored LogSink::send() method
ee6faf13b ci: use codecov token
6e9b2f16f cmake: set CMP0074 policy
f4dd77ae6 ci: reworked windows builds
503e3dec8 Add Zhuoran Shen to AUTHORS and CONTRIBUTORS
531659984 Fix log filename format
cd8fbd5fb ci: prefix artifact directories
c8a7f5abe ci: added checkout action
f47582361 ci: install lcov
f773eb9b6 ci: unzip artifacts into separate directories
f42fd3b15 ci: fixed unzipping multiple archives
cb7c19d36 ci: removed non standard --zero option
cf4c4699b ci: unzip artifacts individually
5a3bd74cf ci: replaced forEach by a loop
1da31df93 ci: name unpack step and fix indent
6bd5acfb6 ci: download workflow artifacts
8121c0755 ci: aggregate coverage in separate workflow
8b872216e ci: simplify coveralls job id
11f08e7bb Merge pull request #742 from google/protect-vlog
65199ed0b protect VLOG by use_logging
b79e18b78 ci: updated coveralls job id
4399e5664 ci: explicitly identify coveralls builds
9206460cd Merge pull request #739 from google/cmake-glog-modules-install
64b4e327f cmake: fixed glog-modules.cmake installation
4df5ae746 ci: added cmake package config test
ab5e10929 Revert "cmake: fix incorrect relative path concatenation (#733)"
32522a5f6 ci: notify coveralls on finished parallel builds
d581807e3 ci: run coveralls on completed workflow
6c9f5b2ec ci: added jobs to coveralls workflow
0798a37bb ci: added coveralls workflow
33696664c restore the stream format after writing the log prefix (#731)
68964b8db cmake: fix incorrect relative path concatenation (#733)
17e7679fd Merge pull request #654 from aesophor/fix-path
c27c3a803 make LogCleaner support relative paths
e8e40f76d Merge pull request #732 from google/log-cleaner-tests
3362cc6c7 added log cleaner tests and fixed paths
9cf0eb7c9 Merge pull request #724 from google/mock-log
1398762db added mock log test
ce3533613 Merge pull request #723 from google/coverage-use-templates
06e665108 ci: replace generated headers by templates
56d3facee Merge pull request #722 from google/linux-github-action
4a55b1158 ci: added linux github workflow
396558472 support stack unwind on Android
acda90348 Merge pull request #720 from google/gmock-support
8474b7854 added gmock support
831a6f823 Add -Werror to Bazel presubmits
c34dbe987 Fix `syscall` warning in Bazel Build
56523194b Merge pull request #716 from google/export-os-defines
f7407d4d2 export OS_* defines (fixes #715)
2412db315 `raw_logging.h` depends on type definition in `logging.h`. Resolve https://github.com/google/glog/issues/712
3b6b05d70 Use __EMSCRIPTEN__ instead of __USE_POSIX2
de81bb0aa Fix link error for Emscripten
9733727be Merge pull request #706 from dfreese/tsan_annotation
ffb40018a Change size type in AnnotateBenignRaceSized to size_t from long
6f9e32a79 Merge pull request #700 from Starsss/master
df95749e8 Fix: not implement virtual class when WITH_CUSTOM_PREFIX on
35983c895 Merge pull request #696 from Fettpet/signed_compare
9fce37c46 Add a static cast to compare unsigned with unsigned
a063a04ec Merge pull request #694 from google/more-warnings
92cb3c449 fixed additional warnings
f8c8e99fd Merge pull request #688 from google/eliminate-warnings
98e0e8c65 cmake: bump .so version
0b83bb203 eliminate warnings
370cb741b Merge pull request #674 from StephLin/readme-fix-header-id
3ce6090d0 override header language
36bcd28c6 Merge pull request #687 from google/exception-spec
dfe573088 bump version
717f56983 fixed exception specification mismatch
eca3ddef8 Merge pull request #685 from z-aki/master
4a4331f2f Fix syscall deprecation warning on macOS >= 10.12
a01d739ea Merge pull request #684 from sergiud/cmake-namespaced-gflags
8d3ce1c29 Merge pull request #686 from google/ci-more-targets
c39fcf6e8 ci: added more targets
47ad26d5c readme: fixed inconsistent formatting
5bf7fdea1 cmake: prefer linking against gflags::gflags (fixes #683)
42ce901f2 Merge pull request #669 from darbitman/log-every-time-period
a1374c420 Implement LOG_EVERY_T. Use <chrono> and <atomic> for C++11 or greater. For non-Windows pre-C++11 systems, use <time.h> and built-in atomic operations. For Windows pre-C++11, use the Windows implementations for time and atomic operations.
6e46c125e bazel: add GLOG_CUSTOM_PREFIX_SUPPORT
a41555685 Remove ubuntu1604 from presubmit.yml
a1fa841f3 readme: fix wrong header id
a4a725d54 Merge pull request #671 from sergiud/cmake-define-have-cxx11-atomic
44331dc24 Merge pull request #672 from sergiud/cmake-allow-to-override-fpic
f0bac8852 cmake: allow to override `-fPIC`
764162569 Merge pull request #670 from sergiud/cmake-msvc-snprintf
d25a1b7bc cmake: export `<atomic>` availability (fixes #667)
9c1a25b93 cmake: fixed msvc snprintf detection (fixes #668)
c1499f64a Export COPYING
03f2b3861 Merge pull request #650 from romange/Prod
86fea1ab2 Allow updating vmodule levels after vmodule was parsed, invalidate already cached site flags vmodule flag is relevant for GNUC environments only.
fef48c17e Merge pull request #656 from romange/cygwin
d2fed749a Fix cmake configuration for cygwin environment
0b3d4cb47 Merge pull request #651 from xkszltl/initapi
81e0d616e Expose `IsGoogleLoggingInitialized()` in public API. Usually library does not have control of the process lifespan. Without this function, it is impossible to init/shutdown reliably. It has been one of the major pain points for years when using glog in libraries.
d5c04eec9 bazel: Use glog 0.5.0 in README
8f9ccfe77 Merge pull request #646 from sergiud/release-0.5
36fee386f release 0.5
8d40d7564 Merge pull request #642 from husskade/patch-1
a23e96f04 readme: update CMake source directory option
0efaa59a7 Merge pull request #641 from sergiud/nullptr
230da316c Merge pull request #637 from xiaobfly/master
bda40ec00 Merge pull request #640 from sergiud/gflags-windows-linker-warnings
762a2a7ee eliminated gflags related linker warnings (#569)
7d4eeb14f Merge pull request #554 from santigl/santigl/custom-prefixer
0cbc23529 Add support for setting a custom prefix format
c7656c3ec CHECK support for nullptr (fixes #341)
663bb2696 Merge pull request #620 from sergiud/cmake-allow-to-disable-symbolize
7ec73b509 Merge pull request #639 from sergiud/fix-windows-builds
efc341d76 fixed windows builds
a79416bab Merge pull request #638 from NeroBurner/github_actions
63ec71b58 Add windows builds with GitHub Actions
39e83581d cmake: allow to disable symbolize
635a07818 fix LogCleaner::IsLogFromCurrentProject for filename_extension
e51790bf3 Merge pull request #625 from sergiud/remove-windows-headers
36e6ed910 Merge pull request #635 from google/win-headers
7d60d6e04 removed windows specific headers
1041a221b Use generated config.h for Windows.
82320a8a8 Merge pull request #631 from xiaobfly/master
bf183f44f Merge pull request #632 from sergiud/cmake-default-shared-libs
9ee010d85 cmake: build shared libs by default
4fca1b967 fixed filename extension
30bb9086d bazel: use expand_template instead of genrules
d66e59318 Merge pull request #618 from sergiud/ac_cv___attribute___printf_4_5
d5fdcfefc Merge pull request #623 from sergiud/language-version
7f8a48b3b Merge pull request #595 from r-barnes/richard/ctr_type_fix
5abed00e3 Merge pull request #626 from sergiud/use-c++-headers
bf3e5a80a Change counter type to uint64
01f3e543e use C++ headers
2f7d608a9 Merge pull request #627 from sergiud/cmake-no-c-compiler
3f4df6aee cmake: do not require a C compiler
7a6e743eb Merge pull request #624 from sergiud/qualify-std-string
e27f14119 Merge pull request #622 from sergiud/max_log_size-overflow
0b3c27d04 fully qualify std::string
5c57edfbc readme: document C++ version
20984f973 Merge pull request #621 from sergiud/cmake-use-gtest
3533c22d2 handle --max_log_size overflow
be25d94c2 cmake: optionally use gtest
45fdc922d Merge pull request #619 from sergiud/cmake-proper-symbol-export
c30896d3d cmake: export symbols selectively
b442ef807 build: set ac_cv___attribute___printf_4_5
d4e8ebab7 Add layering_check to Bazel CI.
0863ad797 bazel: declare headers in top-level rule
ce50c57b9 Rename BUILD to BUILD.bazel.
d824eae3c Merge pull request #613 from sergiud/cmake-unwind-patch-match
df3ce126d cmake: fixed unwind patch component match check
246e49ac4 Merge pull request #610 from sergiud/readme-cleanup
9881ea596 Fix race conditions in LOG_EVERY_N (#492)
4cef72332 Merge pull request #611 from sergiud/incorrect-cygwin64-define
544b4a4f5 Merge pull request #609 from sergiud/cmake-unwind-empty-patch-component
b9be6bb5d consolidate readme
6d14ac3ef Fix the symlink creation bug if using bazel
795384957 replaced __CYGWIN32__ and __CYGWIN64__ by __CYGWIN__
e370cd516 bump version
3b21da69e cmake: handle empty unwind version patch component
4fa737b62 Merge pull request #400 from guoyuhong/fixWebmailer
4f09bed0b Merge pull request #263 from kennyyu/tsan_benign_race
7bba6030c Merge pull request #592 from aesophor/fix-logcleaner-file-ext
7a8b66aa1 Merge pull request #593 from aesophor/fix-typo
6d5da2154 Merge pull request #608 from mahiuchun/stl
15d51a17c Make stl_logging_unittest more robust.
fe1287dd5 src/logging.cc: Fix a typo in comment
431d74c80 src/logging.cc: Make LogCleaner aware of filename extension (#589)
c8f8135a5 Merge pull request #502 from aesophor/encapsulate-log-cleaner
d82641f70 Merge branch 'master' into encapsulate-log-cleaner
cec37e1cf Merge pull request #542 from xulongwu4/master
b55437ac1 Fix logmailer problem for dynamic lib.
c5dcae830 Merge pull request #467 from sukill/master
b30a009fa Merge pull request #585 from sergiud/remove-drop-autoconf-support
b539557b3 removed autoconf support
d516278b1 Merge pull request #540 from pwnall/fix-uv-warn
6c0a5fcb5 Fix unused parameter warning on gcc.
f28ae960c Merge pull request #573 from msamoila/msamoila-use-utc-time
fa0d50f9f Merge pull request #570 from jiuqiant/patch-1
fcc9da24a Merge pull request #545 from julianaito/master
40ab82281 Merge pull request #438 from d-uspenskiy/master
4c5a60c3c Merge pull request #551 from aesophor/replace-sprintf
8ee2bb5b3 Merge pull request #553 from huangqinjin/android
024b095d7 Merge pull request #552 from huangqinjin/master
d44246069 Merge pull request #579 from arj-fb/safety_check_at_SymbolizeAndDemangle
5bc1e1177 Merge pull request #580 from Yicong-Huang/patch-1
af4df08e5 Merge pull request #576 from santigl/santigl/streambuf-overflow-override
725818984 Add `override` to `LogStreamBuf::overflow()`
c652590d8 Update CMakeLists.txt
e5ef2728b Added check for if info.dli_sname is NULL
909069ea8 Add FLAGS_log_utc_time; when 'true' the time will be written in log in UTC
64650ef2e Connect glog to Andorid logging API
0a2e5931b Fix build for Emscripten (#546)
0a12a96ce Output to logcat on Android
d8998fe4f Make message text null-terminated
2e87f98fe Replace sprintf() with snprintf() (#536)
7001ab9ec OpenBSD/powerpc: clang does not define _CALL_* use proper ifdef
4a82a856d Use NULL to indicate uninitialized VLOG_IS_ON site.
3ba897659 fix bazel build for freebsd
ceb716388 Add extra information in log file header (application build/version, actual duration time)
28321d895 Merge pull request #503 from alexsmac/fix-custom-logger-deletion
5b4fb63d2 Prepend the year to each glog line (#516) (#530)
7da49d48a Merge pull request #515 from segfaulthunter/doc
940335d82 Add vcpkg installation instructions (#517)
dfc0e441c Merge pull request #523 from edbaunton/cmake-have-symbolize
eb13e4f67 Allow CMake user to disable Symbolize functionality
195d416e3 Add target existence checks to Unwind find module (#518)
74076bebc Explain log levels.
130a3e10d Use file offsets in traces if object has no symbols (#513)
445af7ef7 Merge pull request #508 from xiaosuo/close
a35e612c5 Don't call close(2) more than once
36fa99ba2 src/logging.cc: check the entire filename format
0a6704b43 Fix missing deletion of custom Logger
7764e4a8b src/logging.cc: match logfile with base_filename
3b5f2807f src/logging.cc: encapsulate log cleaner
1b7d54143 Add note about `namespace` on Win32.
95a365579 Remove unnecessary `defines`
c0d2ceade Avoid leaking config.h
925858d99 add windows target to bazel CI
20919b325 add windows support for bazel bazed build
7f732529d apply buildifier on glog.bzl
1863b4228 Merge pull request #368 from UVV-gh/cmake-sdk-fix
c0463b17b added cmake package config unit test
9a43cfb8d install unwind find module alongside glog
19570c69c renamed and cleaned up the unwind find module
58d7f873d Added fixed log name support, take 2 (#489)
0bf00f95a Merge pull request #491 from aesophor/update-doc
0f4975a68 doc: add information about log cleaner
5ef521d4a Merge pull request #487 from Telunsu/fix_wrong_assignment
e58e596f1 src/logging.cc: fix wrong assignment
f811ae9ed Merge pull request #485 from ffontaine/master
3ee89c86d src/symbolize.cc: do not check for HAVE_DLFCN_H for macOS
4d6aff418 Merge pull request #477 from ffontaine/master
742fe94f2 Use libunwind as an imported target
9630e0e84 src/utilities: fix build without pthread
fd3dc2c63 Merge pull request #484 from sergiud/remove-executable-flag
eec1435d5 removed executable flag from .cmake file
e227697b0 Merge pull request #483 from loop0day/enhance
82d0860b7 Support pkg-config
e0a2521e3 Merge pull request #482 from google/revert-19-master
a6f7be14c Add support for automatic removal of old logs (#432)
15fb5ca5b Revert "Added fixed log name support"
5792d60d6 Merge pull request #441 from asekretenko/useconds
44f6079fa Merge pull request #19 from ezegomez/master
242130d30 Merge pull request #350 from TheModMaker/fixIosSim
1a4c47a74 Merge pull request #88 from kekstee/master
f17d11aa8 Merge pull request #161 from mpercy/thread-local-libunwind-2
1227cf4da Merge pull request #312 from ruslo/pr.api21
0f83e53c4 Merge pull request #443 from ammubhave/fix_musl_build
e558d50b0 Merge pull request #370 from hemantbits/patch-1
30f7f3ee9 Merge pull request #479 from neheb/patch-2
6f5699a23 Merge pull request #460 from neheb/patch-1
e24276a35 logging: Fix compilation with uClibc++
1d762fa5b googletest: Switch to nanosleep
1655f4f91 Merge pull request #475 from ffontaine/master
10498b485 src/symbolize.cc: fix build without dlfcn.h
1e6b9f329 declare FLAGS_vmodule
4cc89c9e2 Merge pull request #465 from durswd/support_clang-cl
a8fad525e Changed the order of conditions
00cb9f4e6 I supported clang-cl with BUILD_SHARED_LIBS
ba8a9f695 fix typo: TOOD -> TODO (#448)
0d0c25431 Don't test on Ubuntu 14.04 (#446)
6ca3d3cf5 Fix stacktrace on bazel build. (#347)
834dd780b Fix symbolize_unittest for musl builds
94a54120d Extended the LogSink interface to be able to pass microseconds.
96a2f23dc Merge pull request #419 from shinh/release-0-4-0
5c576f78c Merge pull request #431 from romkatv/disallow_prefix
29dd5da60 Add Roman Perepelitsa to AUTHORS and CONTRIBUTORS
4db063134 Protect macros from user code to the left of them
460ec1f56 Merge branch 'master' into release-0-4-0
41f4bf9cb Merge pull request #425 from plmuon/remove-time-from-raw-logging
64041397b Use `static` to define CheckStackTrace on non-GNU (#429)
7f91846ca Stop using auto_ptr (#428)
e5588de96 remove time from raw logging
7ffca211f fix appveyor link (#424)
ed1ef7c4d Apply #397 to glog/logging.h.in
1431a17f3 Merge pull request #420 from kwaegel/patch-1
1d98d00c7 Update ChangeLog to record release dates at least
342fa2674 Use push/pop macro when supressing warning
406b0e702 glog: release 0.4.0
6d6d31872 Run src/windows/preprocess.sh
41a6a7880 Fix warnings
a606c3187 Allow getpwuid_r to return missing entry.
d064ab8d0 Fix build for Android API < 21
4764ca65f Annotate LOG_EVERY_N macros as a benign race for TSAN
f581614a7 Use thread local for libunwind GetStackTrace()
47af307fa Added fixed log name support
d68736bc1 Respect configured docdir

git-subtree-dir: third_party/google-glog
git-subtree-split: a1b6164ef15cf4be3b1914f2df7125fc7ffc7ca8
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
Change-Id: I2286351db32cb46aa8743a28e191dfc9c62783da
diff --git a/src/glog/log_severity.h b/src/glog/log_severity.h
index 99945a4..aa48f53 100644
--- a/src/glog/log_severity.h
+++ b/src/glog/log_severity.h
@@ -30,14 +30,20 @@
 #ifndef BASE_LOG_SEVERITY_H__
 #define BASE_LOG_SEVERITY_H__
 
-// Annoying stuff for windows -- makes sure clients can import these functions
-#ifndef GOOGLE_GLOG_DLL_DECL
-# if defined(_WIN32) && !defined(__CYGWIN__)
-#   define GOOGLE_GLOG_DLL_DECL  __declspec(dllimport)
-# else
-#   define GOOGLE_GLOG_DLL_DECL
-# endif
-#endif
+// The recommended semantics of the log levels are as follows:
+//
+// INFO:
+//   Use for state changes or other major events, or to aid debugging.
+// WARNING:
+//   Use for undesired but relatively expected events, which may indicate a
+//   problem
+// ERROR:
+//   Use for undesired and unexpected events that the program can recover from.
+//   All ERRORs should be actionable - it should be appropriate to file a bug
+//   whenever an ERROR occurs in production.
+// FATAL:
+//   Use for undesired and unexpected events that the program cannot recover
+//   from.
 
 // Variables of type LogSeverity are widely taken to lie in the range
 // [0, NUM_SEVERITIES-1].  Be careful to preserve this assumption if
@@ -61,7 +67,7 @@
 #define DFATAL_LEVEL FATAL
 #endif
 
-extern GOOGLE_GLOG_DLL_DECL const char* const LogSeverityNames[NUM_SEVERITIES];
+extern GLOG_EXPORT const char* const LogSeverityNames[NUM_SEVERITIES];
 
 // NDEBUG usage helpers related to (RAW_)DCHECK:
 //
diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in
index 448253f..8a26cbc 100644
--- a/src/glog/logging.h.in
+++ b/src/glog/logging.h.in
@@ -1,4 +1,4 @@
-// Copyright (c) 1999, Google Inc.
+// Copyright (c) 2022, Google Inc.
 // All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -33,12 +33,18 @@
 // Pretty much everybody needs to #include this file so that they can
 // log various happenings.
 //
-#ifndef _LOGGING_H_
-#define _LOGGING_H_
+#ifndef GLOG_LOGGING_H
+#define GLOG_LOGGING_H
 
-#include <errno.h>
-#include <string.h>
-#include <time.h>
+#if @ac_cv_cxx11_chrono@ && __cplusplus >= 201103L
+#include <chrono>
+#endif
+
+#include <cerrno>
+#include <cstddef>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
 #include <iosfwd>
 #include <ostream>
 #include <sstream>
@@ -57,13 +63,10 @@
 #define GLOG_MSVC_POP_WARNING()
 #endif
 
-// Annoying stuff for windows -- makes sure clients can import these functions
-#ifndef GOOGLE_GLOG_DLL_DECL
-# if defined(_WIN32) && !defined(__CYGWIN__)
-#   define GOOGLE_GLOG_DLL_DECL  __declspec(dllimport)
-# else
-#   define GOOGLE_GLOG_DLL_DECL
-# endif
+#include <glog/platform.h>
+
+#if @ac_cv_have_glog_export@
+#include <glog/export.h>
 #endif
 
 // We care a lot about number of bits things take up.  Unfortunately,
@@ -86,9 +89,15 @@
 #include <gflags/gflags.h>
 #endif
 
+#if @ac_cv_cxx11_atomic@ && __cplusplus >= 201103L
+#include <atomic>
+#elif defined(GLOG_OS_WINDOWS)
+#include <Windows.h>
+#endif
+
 @ac_google_start_namespace@
 
-#if @ac_cv_have_uint16_t@      // the C99 format
+#if @ac_cv_have_stdint_h@      // the C99 format
 typedef int32_t int32;
 typedef uint32_t uint32;
 typedef int64_t int64;
@@ -107,8 +116,70 @@
 #error Do not know how to define a 32-bit integer quantity on your system
 #endif
 
+#if !(@ac_cv_have_ssize_t@)
+typedef ptrdiff_t ssize_t;
+#endif
+
+#if !(@ac_cv_have_mode_t@)
+typedef int mode_t;
+#endif
+
+typedef double WallTime;
+
+struct GLOG_EXPORT LogMessageTime {
+  LogMessageTime();
+  LogMessageTime(std::tm t);
+  LogMessageTime(std::time_t timestamp, WallTime now);
+
+  const time_t& timestamp() const { return timestamp_; }
+  const int& sec() const { return time_struct_.tm_sec; }
+  const int32_t& usec() const { return usecs_; }
+  const int&(min)() const { return time_struct_.tm_min; }
+  const int& hour() const { return time_struct_.tm_hour; }
+  const int& day() const { return time_struct_.tm_mday; }
+  const int& month() const { return time_struct_.tm_mon; }
+  const int& year() const { return time_struct_.tm_year; }
+  const int& dayOfWeek() const { return time_struct_.tm_wday; }
+  const int& dayInYear() const { return time_struct_.tm_yday; }
+  const int& dst() const { return time_struct_.tm_isdst; }
+  const long int& gmtoff() const { return gmtoffset_; }
+  const std::tm& tm() const { return time_struct_; }
+
+ private:
+  void init(const std::tm& t, std::time_t timestamp, WallTime now);
+  std::tm time_struct_;  // Time of creation of LogMessage
+  time_t timestamp_;     // Time of creation of LogMessage in seconds
+  int32_t usecs_;        // Time of creation of LogMessage - microseconds part
+  long int gmtoffset_;
+
+  void CalcGmtOffset();
+};
+
+#ifdef GLOG_CUSTOM_PREFIX_SUPPORT
+struct LogMessageInfo {
+  explicit LogMessageInfo(const char* const severity_,
+                          const char* const filename_,
+                          const int& line_number_,
+                          const int& thread_id_,
+                          const LogMessageTime& time_):
+      severity(severity_), filename(filename_), line_number(line_number_),
+      thread_id(thread_id_), time(time_)
+  {}
+
+  const char* const severity;
+  const char* const filename;
+  const int &line_number;
+  const int &thread_id;
+  const LogMessageTime& time;
+};
+
+typedef void(*CustomPrefixCallback)(std::ostream& s, const LogMessageInfo& l, void* data);
+
+#endif
+
 @ac_google_end_namespace@
 
+
 // The global value of GOOGLE_STRIP_LOG. All the messages logged to
 // LOG(XXX) with severity less than GOOGLE_STRIP_LOG will not be displayed.
 // If it can be determined at compile time that the message will not be
@@ -280,12 +351,13 @@
 //
 // Log lines have this form:
 //
-//     Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg...
+//     Lyyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg...
 //
 // where the fields are defined as follows:
 //
 //   L                A single character, representing the log level
 //                    (eg 'I' for INFO)
+//   yyyy             The year
 //   mm               The month (zero padded; ie May is '05')
 //   dd               The day (zero padded)
 //   hh:mm:ss.uuuuuu  Time in hours, minutes and fractional seconds
@@ -305,11 +377,36 @@
 // synchronized.  Hence, use caution when comparing the low bits of
 // timestamps from different machines.
 
+#pragma push_macro("DECLARE_VARIABLE")
+#pragma push_macro("DECLARE_bool")
+#pragma push_macro("DECLARE_string")
+#pragma push_macro("DECLARE_int32")
+#pragma push_macro("DECLARE_uint32")
+
+#ifdef DECLARE_VARIABLE
+#undef DECLARE_VARIABLE
+#endif
+
+#ifdef DECLARE_bool
+#undef DECLARE_bool
+#endif
+
+#ifdef DECLARE_string
+#undef DECLARE_string
+#endif
+
+#ifdef DECLARE_int32
+#undef DECLARE_int32
+#endif
+
+#ifdef DECLARE_uint32
+#undef DECLARE_uint32
+#endif
+
 #ifndef DECLARE_VARIABLE
-#define MUST_UNDEF_GFLAGS_DECLARE_MACROS
 #define DECLARE_VARIABLE(type, shorttype, name, tn)                     \
   namespace fL##shorttype {                                             \
-    extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name;                      \
+    extern GLOG_EXPORT type FLAGS_##name;                      \
   }                                                                     \
   using fL##shorttype::FLAGS_##name
 
@@ -321,15 +418,30 @@
 #define DECLARE_int32(name) \
   DECLARE_VARIABLE(@ac_google_namespace@::int32, I, name, int32)
 
+#if !defined(DECLARE_uint32)
+// uint32 specialization
+#define DECLARE_uint32(name) \
+  DECLARE_VARIABLE(@ac_google_namespace@::uint32, U, name, uint32)
+#endif // !defined(DECLARE_uint32) && !(@ac_cv_have_libgflags@)
+
 // Special case for string, because we have to specify the namespace
 // std::string, which doesn't play nicely with our FLAG__namespace hackery.
 #define DECLARE_string(name)                                            \
   namespace fLS {                                                       \
-    extern GOOGLE_GLOG_DLL_DECL std::string& FLAGS_##name;              \
+    extern GLOG_EXPORT std::string& FLAGS_##name;              \
   }                                                                     \
   using fLS::FLAGS_##name
 #endif
 
+// Set whether appending a timestamp to the log file name
+DECLARE_bool(timestamp_in_logfile_name);
+
+// Set whether log messages go to stdout instead of logfiles
+DECLARE_bool(logtostdout);
+
+// Set color messages logged to stdout (if supported by terminal).
+DECLARE_bool(colorlogtostdout);
+
 // Set whether log messages go to stderr instead of logfiles
 DECLARE_bool(logtostderr);
 
@@ -346,6 +458,9 @@
 // Set whether the log prefix should be prepended to each line of output.
 DECLARE_bool(log_prefix);
 
+// Set whether the year should be included in the log prefix.
+DECLARE_bool(log_year_in_prefix);
+
 // Log messages at a level <= this flag are buffered.
 // Log messages at a higher level are flushed immediately.
 DECLARE_int32(logbuflevel);
@@ -370,19 +485,16 @@
 
 DECLARE_int32(v);  // in vlog_is_on.cc
 
+DECLARE_string(vmodule); // also in vlog_is_on.cc
+
 // Sets the maximum log file size (in MB).
-DECLARE_int32(max_log_size);
+DECLARE_uint32(max_log_size);
 
 // Sets whether to avoid logging to the disk if the disk is full.
 DECLARE_bool(stop_logging_if_full_disk);
 
-#ifdef MUST_UNDEF_GFLAGS_DECLARE_MACROS
-#undef MUST_UNDEF_GFLAGS_DECLARE_MACROS
-#undef DECLARE_VARIABLE
-#undef DECLARE_bool
-#undef DECLARE_int32
-#undef DECLARE_string
-#endif
+// Use UTC time for logging
+DECLARE_bool(log_utc_time);
 
 // Log messages below the GOOGLE_STRIP_LOG level will be compiled away for
 // security reasons. See LOG(severtiy) below.
@@ -484,7 +596,8 @@
     LPSTR message = NULL; \
     LPSTR msg = reinterpret_cast<LPSTR>(&message); \
     DWORD message_length = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | \
-                         FORMAT_MESSAGE_FROM_SYSTEM, \
+                         FORMAT_MESSAGE_FROM_SYSTEM | \
+                         FORMAT_MESSAGE_IGNORE_INSERTS, \
                          0, result, 0, msg, 100, NULL); \
     if (message_length > 0) { \
       @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, 0, \
@@ -509,18 +622,38 @@
 @ac_google_start_namespace@
 
 // They need the definitions of integer types.
-#include "glog/log_severity.h"
-#include "glog/vlog_is_on.h"
+#include <glog/log_severity.h>
+#include <glog/vlog_is_on.h>
 
 // Initialize google's logging library. You will see the program name
 // specified by argv0 in log outputs.
-GOOGLE_GLOG_DLL_DECL void InitGoogleLogging(const char* argv0);
+GLOG_EXPORT void InitGoogleLogging(const char* argv0);
+
+#ifdef GLOG_CUSTOM_PREFIX_SUPPORT
+GLOG_EXPORT void InitGoogleLogging(const char* argv0,
+                                   CustomPrefixCallback prefix_callback,
+                                   void* prefix_callback_data = NULL);
+#endif
+
+// Check if google's logging library has been initialized.
+GLOG_EXPORT bool IsGoogleLoggingInitialized();
 
 // Shutdown google's logging library.
-GOOGLE_GLOG_DLL_DECL void ShutdownGoogleLogging();
+GLOG_EXPORT void ShutdownGoogleLogging();
+
+#if defined(__GNUC__)
+typedef void (*logging_fail_func_t)() __attribute__((noreturn));
+#else
+typedef void (*logging_fail_func_t)();
+#endif
 
 // Install a function which will be called after LOG(FATAL).
-GOOGLE_GLOG_DLL_DECL void InstallFailureFunction(void (*fail_func)());
+GLOG_EXPORT void InstallFailureFunction(logging_fail_func_t fail_func);
+
+// Enable/Disable old log cleaner.
+GLOG_EXPORT void EnableLogCleaner(unsigned int overdue_days);
+GLOG_EXPORT void DisableLogCleaner();
+GLOG_EXPORT void SetApplicationFingerprint(const std::string& fingerprint);
 
 class LogSink;  // defined below
 
@@ -554,7 +687,7 @@
 // NOTE: LOG(severity) expands to LogMessage().stream() for the specified
 // severity.
 #define LOG_TO_STRING(severity, message) \
-  LOG_TO_STRING_##severity(static_cast<string*>(message)).stream()
+  LOG_TO_STRING_##severity(static_cast<std::string*>(message)).stream()
 
 // If a non-NULL pointer is given, we push the message onto the end
 // of a vector of strings; otherwise, we report it with LOG(severity).
@@ -567,10 +700,8 @@
 #define LOG_STRING(severity, outvec) \
   LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream()
 
-#define LOG_IF(severity, condition) \
-  !(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
-#define SYSLOG_IF(severity, condition) \
-  !(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & SYSLOG(severity)
+#define LOG_IF(severity, condition) if(condition) LOG(severity)
+#define SYSLOG_IF(severity, condition) if(condition) SYSLOG(severity)
 
 #define LOG_ASSERT(condition)  \
   LOG_IF(FATAL, !(condition)) << "Assert failed: " #condition
@@ -611,10 +742,12 @@
 inline unsigned int   GetReferenceableValue(unsigned int       t) { return t; }
 inline long           GetReferenceableValue(long               t) { return t; }
 inline unsigned long  GetReferenceableValue(unsigned long      t) { return t; }
+#if __cplusplus >= 201103L
 inline long long      GetReferenceableValue(long long          t) { return t; }
 inline unsigned long long GetReferenceableValue(unsigned long long t) {
   return t;
 }
+#endif
 
 // This is a dummy class to define the following operator.
 struct DummyClassToDefineOperator {};
@@ -640,13 +773,20 @@
 
 // Overrides for char types provide readable values for unprintable
 // characters.
-template <> GOOGLE_GLOG_DLL_DECL
+template <> GLOG_EXPORT
 void MakeCheckOpValueString(std::ostream* os, const char& v);
-template <> GOOGLE_GLOG_DLL_DECL
+template <> GLOG_EXPORT
 void MakeCheckOpValueString(std::ostream* os, const signed char& v);
-template <> GOOGLE_GLOG_DLL_DECL
+template <> GLOG_EXPORT
 void MakeCheckOpValueString(std::ostream* os, const unsigned char& v);
 
+// This is required because nullptr is only present in c++ 11 and later.
+#if @ac_cv_cxx11_nullptr_t@ && __cplusplus >= 201103L
+// Provide printable value for nullptr_t
+template <> GLOG_EXPORT
+void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& v);
+#endif
+
 // Build the error message string. Specify no inlining for code size.
 template <typename T1, typename T2>
 std::string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext)
@@ -668,7 +808,7 @@
 // base::BuildCheckOpString(exprtext, base::Print<T1>, &v1,
 // base::Print<T2>, &v2), however this approach has complications
 // related to volatile arguments and function-pointer arguments).
-class GOOGLE_GLOG_DLL_DECL CheckOpMessageBuilder {
+class GLOG_EXPORT CheckOpMessageBuilder {
  public:
   // Inserts "exprtext" and " (" to the stream.
   explicit CheckOpMessageBuilder(const char *exprtext);
@@ -801,7 +941,7 @@
 // Helper functions for string comparisons.
 // To avoid bloat, the definitions are in logging.cc.
 #define DECLARE_CHECK_STROP_IMPL(func, expected) \
-  GOOGLE_GLOG_DLL_DECL std::string* Check##func##expected##Impl( \
+  GLOG_EXPORT std::string* Check##func##expected##Impl( \
       const char* s1, const char* s2, const char* names);
 DECLARE_CHECK_STROP_IMPL(strcmp, true)
 DECLARE_CHECK_STROP_IMPL(strcmp, false)
@@ -858,8 +998,7 @@
       __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, counter, \
       &@ac_google_namespace@::LogMessage::SendToLog)
 
-#define PLOG_IF(severity, condition) \
-  !(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & PLOG(severity)
+#define PLOG_IF(severity, condition) if(condition) PLOG(severity)
 
 // A CHECK() macro that postpends errno if the condition is false. E.g.
 //
@@ -888,8 +1027,101 @@
 #define LOG_OCCURRENCES LOG_EVERY_N_VARNAME(occurrences_, __LINE__)
 #define LOG_OCCURRENCES_MOD_N LOG_EVERY_N_VARNAME(occurrences_mod_n_, __LINE__)
 
+#if @ac_cv_cxx11_constexpr@ && __cplusplus >= 201103L
+#define GLOG_CONSTEXPR constexpr
+#else
+#define GLOG_CONSTEXPR const
+#endif
+
+#define LOG_TIME_PERIOD LOG_EVERY_N_VARNAME(timePeriod_, __LINE__)
+#define LOG_PREVIOUS_TIME_RAW LOG_EVERY_N_VARNAME(previousTimeRaw_, __LINE__)
+#define LOG_TIME_DELTA LOG_EVERY_N_VARNAME(deltaTime_, __LINE__)
+#define LOG_CURRENT_TIME LOG_EVERY_N_VARNAME(currentTime_, __LINE__)
+#define LOG_PREVIOUS_TIME LOG_EVERY_N_VARNAME(previousTime_, __LINE__)
+
+#if defined(__has_feature)
+#  if __has_feature(thread_sanitizer)
+#    define GLOG_SANITIZE_THREAD 1
+#  endif
+#endif
+
+#if !defined(GLOG_SANITIZE_THREAD) && defined(__SANITIZE_THREAD__) && __SANITIZE_THREAD__
+#  define GLOG_SANITIZE_THREAD 1
+#endif
+
+#if defined(GLOG_SANITIZE_THREAD)
+#define GLOG_IFDEF_THREAD_SANITIZER(X) X
+#else
+#define GLOG_IFDEF_THREAD_SANITIZER(X)
+#endif
+
+#if defined(GLOG_SANITIZE_THREAD)
+} // namespace google
+
+// We need to identify the static variables as "benign" races
+// to avoid noisy reports from TSAN.
+extern "C" void AnnotateBenignRaceSized(
+  const char *file,
+  int line,
+  const volatile void *mem,
+  size_t size,
+  const char *description);
+
+namespace google {
+#endif
+
+#if __cplusplus >= 201103L && @ac_cv_cxx11_chrono@ && @ac_cv_cxx11_atomic@ // Have <chrono> and <atomic>
+#define SOME_KIND_OF_LOG_EVERY_T(severity, seconds) \
+  GLOG_CONSTEXPR std::chrono::nanoseconds LOG_TIME_PERIOD = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::duration<double>(seconds)); \
+  static std::atomic<@ac_google_namespace@::int64> LOG_PREVIOUS_TIME_RAW; \
+  GLOG_IFDEF_THREAD_SANITIZER( \
+          AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_TIME_PERIOD, sizeof(@ac_google_namespace@::int64), "")); \
+  GLOG_IFDEF_THREAD_SANITIZER( \
+          AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_PREVIOUS_TIME_RAW, sizeof(@ac_google_namespace@::int64), "")); \
+  const auto LOG_CURRENT_TIME = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch()); \
+  const auto LOG_PREVIOUS_TIME = LOG_PREVIOUS_TIME_RAW.load(std::memory_order_relaxed); \
+  const auto LOG_TIME_DELTA = LOG_CURRENT_TIME - std::chrono::nanoseconds(LOG_PREVIOUS_TIME); \
+  if (LOG_TIME_DELTA > LOG_TIME_PERIOD) \
+    LOG_PREVIOUS_TIME_RAW.store(std::chrono::duration_cast<std::chrono::nanoseconds>(LOG_CURRENT_TIME).count(), std::memory_order_relaxed); \
+  if (LOG_TIME_DELTA > LOG_TIME_PERIOD) @ac_google_namespace@::LogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity).stream()
+#elif defined(GLOG_OS_WINDOWS)
+#define SOME_KIND_OF_LOG_EVERY_T(severity, seconds) \
+  GLOG_CONSTEXPR LONGLONG LOG_TIME_PERIOD = (seconds) * LONGLONG(1000000000); \
+  static LARGE_INTEGER LOG_PREVIOUS_TIME; \
+  LONGLONG LOG_TIME_DELTA; \
+  { \
+    LARGE_INTEGER currTime; \
+    LARGE_INTEGER freq; \
+    QueryPerformanceCounter(&currTime); \
+    QueryPerformanceFrequency(&freq); \
+    InterlockedCompareExchange64(&LOG_PREVIOUS_TIME.QuadPart, currTime.QuadPart, 0); \
+    LOG_TIME_DELTA = (currTime.QuadPart - LOG_PREVIOUS_TIME.QuadPart) * LONGLONG(1000000000) / freq.QuadPart; \
+    if (LOG_TIME_DELTA > LOG_TIME_PERIOD) InterlockedExchange64(&LOG_PREVIOUS_TIME.QuadPart, currTime.QuadPart); \
+  } \
+  if (LOG_TIME_DELTA > LOG_TIME_PERIOD) \
+    @ac_google_namespace@::LogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity).stream()
+#else
+#define SOME_KIND_OF_LOG_EVERY_T(severity, seconds) \
+  GLOG_CONSTEXPR @ac_google_namespace@::int64 LOG_TIME_PERIOD(seconds * 1000000000); \
+  static @ac_google_namespace@::int64 LOG_PREVIOUS_TIME; \
+  @ac_google_namespace@::int64 LOG_TIME_DELTA = 0; \
+  { \
+    timespec currentTime = {}; \
+    clock_gettime(CLOCK_MONOTONIC, &currentTime); \
+    LOG_TIME_DELTA = (currentTime.tv_sec * 1000000000 + currentTime.tv_nsec) - LOG_PREVIOUS_TIME; \
+  } \
+  if (LOG_TIME_DELTA > LOG_TIME_PERIOD) __sync_add_and_fetch(&LOG_PREVIOUS_TIME, LOG_TIME_DELTA); \
+  if (LOG_TIME_DELTA > LOG_TIME_PERIOD) @ac_google_namespace@::LogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity).stream()
+#endif
+
+#if @ac_cv_cxx11_atomic@ && __cplusplus >= 201103L
 #define SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \
-  static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \
+  static std::atomic<int> LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \
+  GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \
+  GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \
   ++LOG_OCCURRENCES; \
   if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
   if (LOG_OCCURRENCES_MOD_N == 1) \
@@ -898,16 +1130,20 @@
         &what_to_do).stream()
 
 #define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
-  static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \
+  static std::atomic<int> LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \
+  GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \
+  GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \
   ++LOG_OCCURRENCES; \
-  if (condition && \
+  if ((condition) && \
       ((LOG_OCCURRENCES_MOD_N=(LOG_OCCURRENCES_MOD_N + 1) % n) == (1 % n))) \
     @ac_google_namespace@::LogMessage( \
         __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
                  &what_to_do).stream()
 
 #define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
-  static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \
+  static std::atomic<int> LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \
+  GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \
+  GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \
   ++LOG_OCCURRENCES; \
   if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
   if (LOG_OCCURRENCES_MOD_N == 1) \
@@ -916,7 +1152,8 @@
         &what_to_do).stream()
 
 #define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
-  static int LOG_OCCURRENCES = 0; \
+  static std::atomic<int> LOG_OCCURRENCES(0); \
+  GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \
   if (LOG_OCCURRENCES <= n) \
     ++LOG_OCCURRENCES; \
   if (LOG_OCCURRENCES <= n) \
@@ -924,6 +1161,94 @@
         __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
         &what_to_do).stream()
 
+#elif defined(GLOG_OS_WINDOWS)
+
+#define SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \
+  static volatile unsigned LOG_OCCURRENCES = 0; \
+  static volatile unsigned LOG_OCCURRENCES_MOD_N = 0; \
+  InterlockedIncrement(&LOG_OCCURRENCES); \
+  if (InterlockedIncrement(&LOG_OCCURRENCES_MOD_N) > n) \
+    InterlockedExchangeSubtract(&LOG_OCCURRENCES_MOD_N, n); \
+  if (LOG_OCCURRENCES_MOD_N == 1) \
+    @ac_google_namespace@::LogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+        &what_to_do).stream()
+
+#define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
+  static volatile unsigned LOG_OCCURRENCES = 0; \
+  static volatile unsigned LOG_OCCURRENCES_MOD_N = 0; \
+  InterlockedIncrement(&LOG_OCCURRENCES); \
+  if ((condition) && \
+    ((InterlockedIncrement(&LOG_OCCURRENCES_MOD_N), \
+     (LOG_OCCURRENCES_MOD_N > n && InterlockedExchangeSubtract(&LOG_OCCURRENCES_MOD_N, n))), \
+     LOG_OCCURRENCES_MOD_N == 1)) \
+    @ac_google_namespace@::LogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+                 &what_to_do).stream()
+
+#define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
+  static volatile unsigned LOG_OCCURRENCES = 0; \
+  static volatile unsigned LOG_OCCURRENCES_MOD_N = 0; \
+  InterlockedIncrement(&LOG_OCCURRENCES); \
+  if (InterlockedIncrement(&LOG_OCCURRENCES_MOD_N) > n) \
+    InterlockedExchangeSubtract(&LOG_OCCURRENCES_MOD_N, n); \
+  if (LOG_OCCURRENCES_MOD_N == 1) \
+    @ac_google_namespace@::ErrnoLogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+        &what_to_do).stream()
+
+#define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
+  static volatile unsigned LOG_OCCURRENCES = 0; \
+  if (LOG_OCCURRENCES <= n) \
+    InterlockedIncrement(&LOG_OCCURRENCES); \
+  if (LOG_OCCURRENCES <= n) \
+    @ac_google_namespace@::LogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+        &what_to_do).stream()
+
+#else
+
+#define SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \
+  static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \
+  __sync_add_and_fetch(&LOG_OCCURRENCES, 1); \
+  if (__sync_add_and_fetch(&LOG_OCCURRENCES_MOD_N, 1) > n) \
+    __sync_sub_and_fetch(&LOG_OCCURRENCES_MOD_N, n); \
+  if (LOG_OCCURRENCES_MOD_N == 1) \
+    @ac_google_namespace@::LogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+        &what_to_do).stream()
+
+#define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
+  static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \
+  __sync_add_and_fetch(&LOG_OCCURRENCES, 1); \
+  if ((condition) && \
+      (__sync_add_and_fetch(&LOG_OCCURRENCES_MOD_N, 1) || true) && \
+      ((LOG_OCCURRENCES_MOD_N >= n && __sync_sub_and_fetch(&LOG_OCCURRENCES_MOD_N, n)) || true) && \
+      LOG_OCCURRENCES_MOD_N == (1 % n)) \
+    @ac_google_namespace@::LogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+                 &what_to_do).stream()
+
+#define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
+  static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \
+  __sync_add_and_fetch(&LOG_OCCURRENCES, 1); \
+  if (__sync_add_and_fetch(&LOG_OCCURRENCES_MOD_N, 1) > n) \
+    __sync_sub_and_fetch(&LOG_OCCURRENCES_MOD_N, n); \
+  if (LOG_OCCURRENCES_MOD_N == 1) \
+    @ac_google_namespace@::ErrnoLogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+        &what_to_do).stream()
+
+#define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
+  static int LOG_OCCURRENCES = 0; \
+  if (LOG_OCCURRENCES <= n) \
+    __sync_add_and_fetch(&LOG_OCCURRENCES, 1); \
+  if (LOG_OCCURRENCES <= n) \
+    @ac_google_namespace@::LogMessage( \
+        __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+        &what_to_do).stream()
+#endif
+
 namespace glog_internal_namespace_ {
 template <bool>
 struct CompileAssert {
@@ -932,12 +1257,14 @@
 
 // Returns true if FailureSignalHandler is installed.
 // Needs to be exported since it's used by the signalhandler_unittest.
-GOOGLE_GLOG_DLL_DECL bool IsFailureSignalHandlerInstalled();
+GLOG_EXPORT bool IsFailureSignalHandlerInstalled();
 }  // namespace glog_internal_namespace_
 
 #define LOG_EVERY_N(severity, n)                                        \
   SOME_KIND_OF_LOG_EVERY_N(severity, (n), @ac_google_namespace@::LogMessage::SendToLog)
 
+#define LOG_EVERY_T(severity, T) SOME_KIND_OF_LOG_EVERY_T(severity, (T))
+
 #define SYSLOG_EVERY_N(severity, n) \
   SOME_KIND_OF_LOG_EVERY_N(severity, (n), @ac_google_namespace@::LogMessage::SendToSyslogAndLog)
 
@@ -1003,24 +1330,17 @@
 
 #else  // !DCHECK_IS_ON()
 
-#define DLOG(severity) \
-  true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
+#define DLOG(severity) if((false)) LOG(severity)
 
-#define DVLOG(verboselevel) \
-  (true || !VLOG_IS_ON(verboselevel)) ?\
-    (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(INFO)
+#define DVLOG(verboselevel) if((false) && VLOG_IS_ON(verboselevel)) LOG(INFO)
 
-#define DLOG_IF(severity, condition) \
-  (true || !(condition)) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
+#define DLOG_IF(severity, condition) if((false) && (condition)) LOG(severity)
 
-#define DLOG_EVERY_N(severity, n) \
-  true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
+#define DLOG_EVERY_N(severity, n) if((false)) LOG(severity)
 
-#define DLOG_IF_EVERY_N(severity, condition, n) \
-  (true || !(condition))? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
+#define DLOG_IF_EVERY_N(severity, condition, n) if((false) && (condition)) LOG(severity)
 
-#define DLOG_ASSERT(condition) \
-  true ? (void) 0 : LOG_ASSERT(condition)
+#define DLOG_ASSERT(condition) if((false)) LOG_ASSERT(condition)
 
 // MSVC warning C4127: conditional expression is constant
 #define DCHECK(condition) \
@@ -1102,7 +1422,7 @@
 // LogMessage::LogStream is a std::ostream backed by this streambuf.
 // This class ignores overflow and leaves two bytes at the end of the
 // buffer to allow for a '\n' and '\0'.
-class GOOGLE_GLOG_DLL_DECL LogStreamBuf : public std::streambuf {
+class GLOG_EXPORT LogStreamBuf : public std::streambuf {
  public:
   // REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\0'.
   LogStreamBuf(char *buf, int len) {
@@ -1110,12 +1430,12 @@
   }
 
   // This effectively ignores overflow.
-  virtual int_type overflow(int_type ch) {
+  int_type overflow(int_type ch) {
     return ch;
   }
 
   // Legacy public ostrstream method.
-  size_t pcount() const { return pptr() - pbase(); }
+  size_t pcount() const { return static_cast<size_t>(pptr() - pbase()); }
   char* pbase() const { return std::streambuf::pbase(); }
 };
 
@@ -1130,7 +1450,7 @@
 // You shouldn't actually use LogMessage's constructor to log things,
 // though.  You should use the LOG() macro (and variants thereof)
 // above.
-class GOOGLE_GLOG_DLL_DECL LogMessage {
+class GLOG_EXPORT LogMessage {
 public:
   enum {
     // Passing kNoLogPrefix for the line number disables the
@@ -1147,16 +1467,11 @@
   // 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(push)
-# pragma warning(disable: 4275)
-#endif
-  class GOOGLE_GLOG_DLL_DECL LogStream : public std::ostream {
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
+GLOG_MSVC_PUSH_DISABLE_WARNING(4275)
+  class GLOG_EXPORT LogStream : public std::ostream {
+GLOG_MSVC_POP_WARNING()
   public:
-    LogStream(char *buf, int len, int ctr)
+    LogStream(char *buf, int len, int64 ctr)
         : std::ostream(NULL),
           streambuf_(buf, len),
           ctr_(ctr),
@@ -1164,8 +1479,8 @@
       rdbuf(&streambuf_);
     }
 
-    int ctr() const { return ctr_; }
-    void set_ctr(int ctr) { ctr_ = ctr; }
+    int64 ctr() const { return ctr_; }
+    void set_ctr(int64 ctr) { ctr_ = ctr; }
     LogStream* self() const { return self_; }
 
     // Legacy std::streambuf methods.
@@ -1177,7 +1492,7 @@
     LogStream(const LogStream&);
     LogStream& operator=(const LogStream&);
     base_logging::LogStreamBuf streambuf_;
-    int ctr_;  // Counter hack (for the LOG_EVERY_X() macro)
+    int64 ctr_;  // Counter hack (for the LOG_EVERY_X() macro)
     LogStream *self_;  // Consistency check hack
   };
 
@@ -1185,7 +1500,7 @@
   // icc 8 requires this typedef to avoid an internal compiler error.
   typedef void (LogMessage::*SendMethod)();
 
-  LogMessage(const char* file, int line, LogSeverity severity, int ctr,
+  LogMessage(const char* file, int line, LogSeverity severity, int64 ctr,
              SendMethod send_method);
 
   // Two special constructors that generate reduced amounts of code at
@@ -1252,6 +1567,8 @@
   // Must be called without the log_mutex held.  (L < log_mutex)
   static int64 num_messages(int severity);
 
+  const LogMessageTime& getLogMessageTime() const;
+
   struct LogMessageData;
 
 private:
@@ -1277,6 +1594,7 @@
   // LogMessage uses less stack space.
   LogMessageData* allocated_;
   LogMessageData* data_;
+  LogMessageTime logmsgtime_;
 
   friend class LogDestination;
 
@@ -1287,7 +1605,7 @@
 // This class happens to be thread-hostile because all instances share
 // a single data buffer, but since it can only be created just before
 // the process dies, we don't worry so much.
-class GOOGLE_GLOG_DLL_DECL LogMessageFatal : public LogMessage {
+class GLOG_EXPORT LogMessageFatal : public LogMessage {
  public:
   LogMessageFatal(const char* file, int line);
   LogMessageFatal(const char* file, int line, const CheckOpString& result);
@@ -1316,7 +1634,7 @@
 // reasonably good C++11 support, so we set LANG_CXX for it and
 // newer versions (_MSC_VER >= 1900).
 #if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L || \
-     (defined(_MSC_VER) && _MSC_VER >= 1900))
+     (defined(_MSC_VER) && _MSC_VER >= 1900)) && !defined(__UCLIBCXX_MAJOR__)
 // Helper for CHECK_NOTNULL().
 //
 // In C++11, all cases can be handled by a single function. Since the value
@@ -1348,15 +1666,14 @@
 // Allow folks to put a counter in the LOG_EVERY_X()'ed messages. This
 // only works if ostream is a LogStream. If the ostream is not a
 // LogStream you'll get an assert saying as much at runtime.
-GOOGLE_GLOG_DLL_DECL std::ostream& operator<<(std::ostream &os,
+GLOG_EXPORT std::ostream& operator<<(std::ostream &os,
                                               const PRIVATE_Counter&);
 
 
 // Derived class for PLOG*() above.
-class GOOGLE_GLOG_DLL_DECL ErrnoLogMessage : public LogMessage {
+class GLOG_EXPORT ErrnoLogMessage : public LogMessage {
  public:
-
-  ErrnoLogMessage(const char* file, int line, LogSeverity severity, int ctr,
+  ErrnoLogMessage(const char* file, int line, LogSeverity severity, int64 ctr,
                   void (LogMessage::*send_method)());
 
   // Postpends ": strerror(errno) [errno]".
@@ -1368,34 +1685,21 @@
 };
 
 
-// This class is used to explicitly ignore values in the conditional
-// logging macros.  This avoids compiler warnings like "value computed
-// is not used" and "statement has no effect".
-
-class GOOGLE_GLOG_DLL_DECL LogMessageVoidify {
- public:
-  LogMessageVoidify() { }
-  // This has to be an operator with a precedence lower than << but
-  // higher than ?:
-  void operator&(std::ostream&) { }
-};
-
-
 // Flushes all log files that contains messages that are at least of
 // the specified severity level.  Thread-safe.
-GOOGLE_GLOG_DLL_DECL void FlushLogFiles(LogSeverity min_severity);
+GLOG_EXPORT void FlushLogFiles(LogSeverity min_severity);
 
 // Flushes all log files that contains messages that are at least of
 // the specified severity level. Thread-hostile because it ignores
 // locking -- used for catastrophic failures.
-GOOGLE_GLOG_DLL_DECL void FlushLogFilesUnsafe(LogSeverity min_severity);
+GLOG_EXPORT void FlushLogFilesUnsafe(LogSeverity min_severity);
 
 //
 // Set the destination to which a particular severity level of log
 // messages is sent.  If base_filename is "", it means "don't log this
 // severity".  Thread-safe.
 //
-GOOGLE_GLOG_DLL_DECL void SetLogDestination(LogSeverity severity,
+GLOG_EXPORT void SetLogDestination(LogSeverity severity,
                                             const char* base_filename);
 
 //
@@ -1404,7 +1708,7 @@
 // you don't call this function, the symlink basename is the
 // invocation name of the program.  Thread-safe.
 //
-GOOGLE_GLOG_DLL_DECL void SetLogSymlink(LogSeverity severity,
+GLOG_EXPORT void SetLogSymlink(LogSeverity severity,
                                         const char* symlink_basename);
 
 //
@@ -1412,7 +1716,7 @@
 // Users should subclass LogSink and override send to do whatever they want.
 // Implementations must be thread-safe because a shared instance will
 // be called from whichever thread ran the LOG(XXX) line.
-class GOOGLE_GLOG_DLL_DECL LogSink {
+class GLOG_EXPORT LogSink {
  public:
   virtual ~LogSink();
 
@@ -1421,8 +1725,13 @@
   // during this call.
   virtual void send(LogSeverity severity, const char* full_filename,
                     const char* base_filename, int line,
-                    const struct ::tm* tm_time,
-                    const char* message, size_t message_len) = 0;
+                    const LogMessageTime& logmsgtime, const char* message,
+                    size_t message_len);
+  // Provide an overload for compatibility purposes
+  GLOG_DEPRECATED
+  virtual void send(LogSeverity severity, const char* full_filename,
+                    const char* base_filename, int line, const std::tm* t,
+                    const char* message, size_t message_len);
 
   // Redefine this to implement waiting for
   // the sink's logging logic to complete.
@@ -1442,13 +1751,13 @@
   // Returns the normal text output of the log message.
   // Can be useful to implement send().
   static std::string ToString(LogSeverity severity, const char* file, int line,
-                              const struct ::tm* tm_time,
+                              const LogMessageTime &logmsgtime,
                               const char* message, size_t message_len);
 };
 
 // Add or remove a LogSink as a consumer of logging data.  Thread-safe.
-GOOGLE_GLOG_DLL_DECL void AddLogSink(LogSink *destination);
-GOOGLE_GLOG_DLL_DECL void RemoveLogSink(LogSink *destination);
+GLOG_EXPORT void AddLogSink(LogSink *destination);
+GLOG_EXPORT void RemoveLogSink(LogSink *destination);
 
 //
 // Specify an "extension" added to the filename specified via
@@ -1456,7 +1765,7 @@
 // often used to append the port we're listening on to the logfile
 // name.  Thread-safe.
 //
-GOOGLE_GLOG_DLL_DECL void SetLogFilenameExtension(
+GLOG_EXPORT void SetLogFilenameExtension(
     const char* filename_extension);
 
 //
@@ -1464,12 +1773,12 @@
 // are logged to stderr (in addition to logging to the usual log
 // file(s)).  Thread-safe.
 //
-GOOGLE_GLOG_DLL_DECL void SetStderrLogging(LogSeverity min_severity);
+GLOG_EXPORT void SetStderrLogging(LogSeverity min_severity);
 
 //
 // Make it so that all log messages go only to stderr.  Thread-safe.
 //
-GOOGLE_GLOG_DLL_DECL void LogToStderr();
+GLOG_EXPORT void LogToStderr();
 
 //
 // Make it so that all log messages of at least a particular severity are
@@ -1477,15 +1786,15 @@
 // usual log file(s)).  The list of addresses is just a string containing
 // the email addresses to send to (separated by spaces, say).  Thread-safe.
 //
-GOOGLE_GLOG_DLL_DECL void SetEmailLogging(LogSeverity min_severity,
+GLOG_EXPORT void SetEmailLogging(LogSeverity min_severity,
                                           const char* addresses);
 
 // A simple function that sends email. dest is a commma-separated
 // list of addressess.  Thread-safe.
-GOOGLE_GLOG_DLL_DECL bool SendEmail(const char *dest,
-                                    const char *subject, const char *body);
+GLOG_EXPORT bool SendEmail(const char* dest, const char* subject,
+                           const char* body);
 
-GOOGLE_GLOG_DLL_DECL const std::vector<std::string>& GetLoggingDirectories();
+GLOG_EXPORT const std::vector<std::string>& GetLoggingDirectories();
 
 // For tests only:  Clear the internal [cached] list of logging directories to
 // force a refresh the next time GetLoggingDirectories is called.
@@ -1493,15 +1802,15 @@
 void TestOnly_ClearLoggingDirectoriesList();
 
 // Returns a set of existing temporary directories, which will be a
-// subset of the directories returned by GetLogginDirectories().
+// subset of the directories returned by GetLoggingDirectories().
 // Thread-safe.
-GOOGLE_GLOG_DLL_DECL void GetExistingTempDirectories(
+GLOG_EXPORT void GetExistingTempDirectories(
     std::vector<std::string>* list);
 
 // Print any fatal message again -- useful to call from signal handler
 // so that the last thing in the output is the fatal message.
 // Thread-hostile, but a race is unlikely.
-GOOGLE_GLOG_DLL_DECL void ReprintFatalMessage();
+GLOG_EXPORT void ReprintFatalMessage();
 
 // Truncate a log file that may be the append-only output of multiple
 // processes and hence can't simply be renamed/reopened (typically a
@@ -1510,17 +1819,16 @@
 // be racing with other writers, this approach has the potential to
 // lose very small amounts of data. For security, only follow symlinks
 // if the path is /proc/self/fd/*
-GOOGLE_GLOG_DLL_DECL void TruncateLogFile(const char *path,
-                                          int64 limit, int64 keep);
+GLOG_EXPORT void TruncateLogFile(const char* path, uint64 limit, uint64 keep);
 
 // Truncate stdout and stderr if they are over the value specified by
 // --max_log_size; keep the final 1MB.  This function has the same
 // race condition as TruncateLogFile.
-GOOGLE_GLOG_DLL_DECL void TruncateStdoutStderr();
+GLOG_EXPORT void TruncateStdoutStderr();
 
 // Return the string representation of the provided LogSeverity level.
 // Thread-safe.
-GOOGLE_GLOG_DLL_DECL const char* GetLogSeverityName(LogSeverity severity);
+GLOG_EXPORT const char* GetLogSeverityName(LogSeverity severity);
 
 // ---------------------------------------------------------------------
 // Implementation details that are not useful to most clients
@@ -1535,7 +1843,7 @@
 
 namespace base {
 
-class GOOGLE_GLOG_DLL_DECL Logger {
+class GLOG_EXPORT Logger {
  public:
   virtual ~Logger();
 
@@ -1550,7 +1858,7 @@
   virtual void Write(bool force_flush,
                      time_t timestamp,
                      const char* message,
-                     int message_len) = 0;
+                     size_t message_len) = 0;
 
   // Flush any buffered messages
   virtual void Flush() = 0;
@@ -1564,12 +1872,12 @@
 // Get the logger for the specified severity level.  The logger
 // remains the property of the logging module and should not be
 // deleted by the caller.  Thread-safe.
-extern GOOGLE_GLOG_DLL_DECL Logger* GetLogger(LogSeverity level);
+extern GLOG_EXPORT Logger* GetLogger(LogSeverity level);
 
 // Set the logger for the specified severity level.  The logger
 // becomes the property of the logging module and should not
 // be deleted by the caller.  Thread-safe.
-extern GOOGLE_GLOG_DLL_DECL void SetLogger(LogSeverity level, Logger* logger);
+extern GLOG_EXPORT void SetLogger(LogSeverity level, Logger* logger);
 
 }
 
@@ -1584,14 +1892,14 @@
 // cases, you do not need to check the error code and you can directly
 // use the value of "buf". It will never have an undefined value.
 // DEPRECATED: Use StrError(int) instead.
-GOOGLE_GLOG_DLL_DECL int posix_strerror_r(int err, char *buf, size_t len);
+GLOG_EXPORT int posix_strerror_r(int err, char *buf, size_t len);
 
 // A thread-safe replacement for strerror(). Returns a string describing the
 // given POSIX error code.
-GOOGLE_GLOG_DLL_DECL std::string StrError(int err);
+GLOG_EXPORT std::string StrError(int err);
 
 // A class for which we define operator<<, which does nothing.
-class GOOGLE_GLOG_DLL_DECL NullStream : public LogMessage::LogStream {
+class GLOG_EXPORT NullStream : public LogMessage::LogStream {
  public:
   // Initialize the LogStream so the messages can be written somewhere
   // (they'll never be actually displayed). This will be needed if a
@@ -1620,12 +1928,19 @@
 
 // Similar to NullStream, but aborts the program (without stack
 // trace), like LogMessageFatal.
-class GOOGLE_GLOG_DLL_DECL NullStreamFatal : public NullStream {
+class GLOG_EXPORT NullStreamFatal : public NullStream {
  public:
   NullStreamFatal() { }
   NullStreamFatal(const char* file, int line, const CheckOpString& result) :
       NullStream(file, line, result) { }
-  @ac_cv___attribute___noreturn@ ~NullStreamFatal() throw () { _exit(1); }
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4722)
+#endif // _MSC_VER
+  @ac_cv___attribute___noreturn@ ~NullStreamFatal() throw () { _exit(EXIT_FAILURE); }
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif // _MSC_VER
 };
 
 // Install a signal handler that will dump signal information and a stack
@@ -1644,15 +1959,21 @@
 // to use the failure signal handler for all threads.  The stack trace
 // will be shown only for the thread that receives the signal.  In other
 // words, stack traces of other threads won't be shown.
-GOOGLE_GLOG_DLL_DECL void InstallFailureSignalHandler();
+GLOG_EXPORT void InstallFailureSignalHandler();
 
 // Installs a function that is used for writing the failure dump.  "data"
 // is the pointer to the beginning of a message to be written, and "size"
 // is the size of the message.  You should not expect the data is
 // terminated with '\0'.
-GOOGLE_GLOG_DLL_DECL void InstallFailureWriter(
-    void (*writer)(const char* data, int size));
+GLOG_EXPORT void InstallFailureWriter(
+    void (*writer)(const char* data, size_t size));
 
 @ac_google_end_namespace@
 
-#endif // _LOGGING_H_
+#pragma pop_macro("DECLARE_VARIABLE")
+#pragma pop_macro("DECLARE_bool")
+#pragma pop_macro("DECLARE_string")
+#pragma pop_macro("DECLARE_int32")
+#pragma pop_macro("DECLARE_uint32")
+
+#endif // GLOG_LOGGING_H
diff --git a/src/glog/platform.h b/src/glog/platform.h
new file mode 100644
index 0000000..7893c45
--- /dev/null
+++ b/src/glog/platform.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Shinichiro Hamaji
+//
+// Detect supported platforms.
+
+#ifndef GLOG_PLATFORM_H
+#define GLOG_PLATFORM_H
+
+#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
+#define GLOG_OS_WINDOWS
+#elif defined(__CYGWIN__) || defined(__CYGWIN32__)
+#define GLOG_OS_CYGWIN
+#elif defined(linux) || defined(__linux) || defined(__linux__)
+#ifndef GLOG_OS_LINUX
+#define GLOG_OS_LINUX
+#endif
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+#define GLOG_OS_MACOSX
+#elif defined(__FreeBSD__)
+#define GLOG_OS_FREEBSD
+#elif defined(__NetBSD__)
+#define GLOG_OS_NETBSD
+#elif defined(__OpenBSD__)
+#define GLOG_OS_OPENBSD
+#elif defined(__EMSCRIPTEN__)
+#define GLOG_OS_EMSCRIPTEN
+#else
+// TODO(hamaji): Add other platforms.
+#error Platform not supported by glog. Please consider to contribute platform information by submitting a pull request on Github.
+#endif
+
+#endif // GLOG_PLATFORM_H
diff --git a/src/glog/raw_logging.h.in b/src/glog/raw_logging.h.in
index fa17057..66fec91 100644
--- a/src/glog/raw_logging.h.in
+++ b/src/glog/raw_logging.h.in
@@ -33,23 +33,20 @@
 // acquire any locks, and can therefore be used by low-level memory
 // allocation and synchronization code.
 
-#ifndef BASE_RAW_LOGGING_H_
-#define BASE_RAW_LOGGING_H_
+#ifndef GLOG_RAW_LOGGING_H
+#define GLOG_RAW_LOGGING_H
 
-#include <time.h>
+#include <ctime>
 
 @ac_google_start_namespace@
 
-#include "glog/log_severity.h"
-#include "glog/vlog_is_on.h"
+#include <glog/log_severity.h>
+#include <glog/logging.h>
+#include <glog/vlog_is_on.h>
 
-// Annoying stuff for windows -- makes sure clients can import these functions
-#ifndef GOOGLE_GLOG_DLL_DECL
-# if defined(_WIN32) && !defined(__CYGWIN__)
-#   define GOOGLE_GLOG_DLL_DECL  __declspec(dllimport)
-# else
-#   define GOOGLE_GLOG_DLL_DECL
-# endif
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvariadic-macros"
 #endif
 
 // This is similar to LOG(severity) << format... and VLOG(level) << format..,
@@ -64,8 +61,8 @@
 //   RAW_LOG(ERROR, "Failed foo with %i: %s", status, error);
 //   RAW_VLOG(3, "status is %i", status);
 // These will print an almost standard log lines like this to stderr only:
-//   E0821 211317 file.cc:123] RAW: Failed foo with 22: bad_file
-//   I0821 211317 file.cc:142] RAW: status is 20
+//   E20200821 211317 file.cc:123] RAW: Failed foo with 22: bad_file
+//   I20200821 211317 file.cc:142] RAW: status is 20
 #define RAW_LOG(severity, ...) \
   do { \
     switch (@ac_google_namespace@::GLOG_ ## severity) {  \
@@ -88,7 +85,7 @@
 
 // The following STRIP_LOG testing is performed in the header file so that it's
 // possible to completely compile out the logging code and the log messages.
-#if STRIP_LOG == 0
+#if !defined(STRIP_LOG) || STRIP_LOG == 0
 #define RAW_VLOG(verboselevel, ...) \
   do { \
     if (VLOG_IS_ON(verboselevel)) { \
@@ -99,35 +96,35 @@
 #define RAW_VLOG(verboselevel, ...) RawLogStub__(0, __VA_ARGS__)
 #endif // STRIP_LOG == 0
 
-#if STRIP_LOG == 0
+#if !defined(STRIP_LOG) || STRIP_LOG == 0
 #define RAW_LOG_INFO(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_INFO, \
                                    __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_INFO(...) @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__)
 #endif // STRIP_LOG == 0
 
-#if STRIP_LOG <= 1
+#if !defined(STRIP_LOG) || STRIP_LOG <= 1
 #define RAW_LOG_WARNING(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_WARNING,   \
                                       __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_WARNING(...) @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__)
 #endif // STRIP_LOG <= 1
 
-#if STRIP_LOG <= 2
+#if !defined(STRIP_LOG) || STRIP_LOG <= 2
 #define RAW_LOG_ERROR(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_ERROR,       \
                                     __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_ERROR(...) @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__)
 #endif // STRIP_LOG <= 2
 
-#if STRIP_LOG <= 3
+#if !defined(STRIP_LOG) || STRIP_LOG <= 3
 #define RAW_LOG_FATAL(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_FATAL,       \
                                     __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_FATAL(...) \
   do { \
     @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__);        \
-    exit(1); \
+    exit(EXIT_FAILURE); \
   } while (0)
 #endif // STRIP_LOG <= 3
 
@@ -160,6 +157,10 @@
 
 #endif  // NDEBUG
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+
 // Stub log function used to work around for unused variable warnings when
 // building with STRIP_LOG > 0.
 static inline void RawLogStub__(int /* ignored */, ...) {
@@ -169,17 +170,10 @@
 // Logs format... at "severity" level, reporting it
 // as called from file:line.
 // This does not allocate memory or acquire locks.
-GOOGLE_GLOG_DLL_DECL void RawLog__(LogSeverity severity,
-                                   const char* file,
-                                   int line,
-                                   const char* format, ...)
-   @ac_cv___attribute___printf_4_5@;
-
-// 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);
+GLOG_EXPORT void RawLog__(LogSeverity severity, const char* file, int line,
+                          const char* format, ...)
+    @ac_cv___attribute___printf_4_5@;
 
 @ac_google_end_namespace@
 
-#endif  // BASE_RAW_LOGGING_H_
+#endif  // GLOG_RAW_LOGGING_H
diff --git a/src/glog/stl_logging.h.in b/src/glog/stl_logging.h.in
index 600945d..bdfdc8b 100644
--- a/src/glog/stl_logging.h.in
+++ b/src/glog/stl_logging.h.in
@@ -59,7 +59,7 @@
 #include <utility>
 #include <vector>
 
-#ifdef GLOG_STL_LOGGING_FOR_UNORDERED
+#if defined(GLOG_STL_LOGGING_FOR_UNORDERED) && __cplusplus >= 201103L
 # include <unordered_map>
 # include <unordered_set>
 #endif
@@ -130,7 +130,7 @@
 
 OUTPUT_FOUR_ARG_CONTAINER(std::map)
 OUTPUT_FOUR_ARG_CONTAINER(std::multimap)
-#ifdef GLOG_STL_LOGGING_FOR_UNORDERED
+#if defined(GLOG_STL_LOGGING_FOR_UNORDERED) && __cplusplus >= 201103L
 OUTPUT_FOUR_ARG_CONTAINER(std::unordered_set)
 OUTPUT_FOUR_ARG_CONTAINER(std::unordered_multiset)
 #endif
@@ -153,7 +153,7 @@
   return out; \
 }
 
-#ifdef GLOG_STL_LOGGING_FOR_UNORDERED
+#if defined(GLOG_STL_LOGGING_FOR_UNORDERED) && __cplusplus >= 201103L
 OUTPUT_FIVE_ARG_CONTAINER(std::unordered_map)
 OUTPUT_FIVE_ARG_CONTAINER(std::unordered_multimap)
 #endif
diff --git a/src/glog/vlog_is_on.h.in b/src/glog/vlog_is_on.h.in
index 3f4c4a3..7526fc3 100644
--- a/src/glog/vlog_is_on.h.in
+++ b/src/glog/vlog_is_on.h.in
@@ -41,7 +41,7 @@
 //     // that can't be accomplished e.g. via just VLOG(2) << ...;
 //   }
 //
-// The truth value that VLOG_IS_ON(level) returns is determined by 
+// The truth value that VLOG_IS_ON(level) returns is determined by
 // the three verbosity level flags:
 //   --v=<n>  Gives the default maximal active V-logging level;
 //            0 is the default.
@@ -61,16 +61,7 @@
 #ifndef BASE_VLOG_IS_ON_H_
 #define BASE_VLOG_IS_ON_H_
 
-#include "glog/log_severity.h"
-
-// Annoying stuff for windows -- makes sure clients can import these functions
-#ifndef GOOGLE_GLOG_DLL_DECL
-# if defined(_WIN32) && !defined(__CYGWIN__)
-#   define GOOGLE_GLOG_DLL_DECL  __declspec(dllimport)
-# else
-#   define GOOGLE_GLOG_DLL_DECL
-# endif
-#endif
+#include <glog/log_severity.h>
 
 #if defined(__GNUC__)
 // We emit an anonymous static int* variable at every VLOG_IS_ON(n) site.
@@ -81,12 +72,11 @@
 // parsing of --vmodule flag and/or SetVLOGLevel calls.
 #define VLOG_IS_ON(verboselevel)                                \
   __extension__  \
-  ({ static @ac_google_namespace@::int32* vlocal__ = &@ac_google_namespace@::kLogSiteUninitialized;           \
+  ({ static @ac_google_namespace@::SiteFlag vlocal__ = {NULL, NULL, 0, NULL};       \
      @ac_google_namespace@::int32 verbose_level__ = (verboselevel);                    \
-     (*vlocal__ >= verbose_level__) &&                          \
-     ((vlocal__ != &@ac_google_namespace@::kLogSiteUninitialized) ||                   \
-      (@ac_google_namespace@::InitVLOG3__(&vlocal__, &FLAGS_v,                         \
-                   __FILE__, verbose_level__))); })
+     (vlocal__.level == NULL ? @ac_google_namespace@::InitVLOG3__(&vlocal__, &FLAGS_v, \
+                        __FILE__, verbose_level__) : *vlocal__.level >= verbose_level__); \
+  })
 #else
 // GNU extensions not available, so we do not support --vmodule.
 // Dynamic value of FLAGS_v always controls the logging level.
@@ -101,16 +91,16 @@
 //	 one needs to supply the exact --vmodule pattern that applied to them.
 //       (If no --vmodule pattern applied to them
 //       the value of FLAGS_v will continue to control them.)
-extern GOOGLE_GLOG_DLL_DECL int SetVLOGLevel(const char* module_pattern,
-                                             int log_level);
+extern GLOG_EXPORT int SetVLOGLevel(const char* module_pattern, int log_level);
 
 // Various declarations needed for VLOG_IS_ON above: =========================
 
-// Special value used to indicate that a VLOG_IS_ON site has not been
-// initialized.  We make this a large value, so the common-case check
-// of "*vlocal__ >= verbose_level__" in VLOG_IS_ON definition
-// passes in such cases and InitVLOG3__ is then triggered.
-extern @ac_google_namespace@::int32 kLogSiteUninitialized;
+struct SiteFlag {
+  @ac_google_namespace@::int32* level;
+  const char* base_name;
+  size_t base_len;
+  SiteFlag* next;
+};
 
 // Helper routine which determines the logging info for a particalur VLOG site.
 //   site_flag     is the address of the site-local pointer to the controlling
@@ -120,10 +110,9 @@
 //   verbose_level is the argument to VLOG_IS_ON
 // We will return the return value for VLOG_IS_ON
 // and if possible set *site_flag appropriately.
-extern GOOGLE_GLOG_DLL_DECL bool InitVLOG3__(
-    @ac_google_namespace@::int32** site_flag,
-    @ac_google_namespace@::int32* site_default,
-    const char* fname,
+extern GLOG_EXPORT bool InitVLOG3__(
+    @ac_google_namespace@::SiteFlag* site_flag,
+    @ac_google_namespace@::int32* site_default, const char* fname,
     @ac_google_namespace@::int32 verbose_level);
 
 #endif  // BASE_VLOG_IS_ON_H_