Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-03-11 23:52:25 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-03-11 23:52:25 +0400
commit42b3463030b07ba3a87574c173e759e3bb15353b (patch)
tree1f7c20c45c294d9137bd75efabc414b02e6d7f60 /extern/libmv/third_party/glog
parentc21c58f44c16b3d503d81577c1943f1f4b47b675 (diff)
Bundle new upstream version of libmv from own branch
This version of libmv includes new gflags and glog libraries which makes it possible to compile libmv with clang compiler. Also remove code from CMakeLists which was disabling libmv if using clang. Tested on linux with gcc-4.6 and clang-3.0, windows cmake+msvc and scons+mingw. Could be some issues with other platforms/build system which shall be simple to resolve.
Diffstat (limited to 'extern/libmv/third_party/glog')
-rw-r--r--extern/libmv/third_party/glog/ChangeLog10
-rw-r--r--extern/libmv/third_party/glog/README.libmv50
-rw-r--r--extern/libmv/third_party/glog/src/base/commandlineflags.h4
-rw-r--r--extern/libmv/third_party/glog/src/base/googleinit.h2
-rw-r--r--extern/libmv/third_party/glog/src/config_freebsd.h11
-rw-r--r--extern/libmv/third_party/glog/src/config_linux.h30
-rw-r--r--extern/libmv/third_party/glog/src/config_mac.h12
-rw-r--r--extern/libmv/third_party/glog/src/demangle.cc378
-rw-r--r--extern/libmv/third_party/glog/src/glog/log_severity.h10
-rw-r--r--extern/libmv/third_party/glog/src/glog/logging.h96
-rw-r--r--extern/libmv/third_party/glog/src/glog/raw_logging.h12
-rw-r--r--extern/libmv/third_party/glog/src/logging.cc83
-rw-r--r--extern/libmv/third_party/glog/src/raw_logging.cc2
-rw-r--r--extern/libmv/third_party/glog/src/signalhandler.cc10
-rw-r--r--extern/libmv/third_party/glog/src/stacktrace_libunwind-inl.h2
-rw-r--r--extern/libmv/third_party/glog/src/stacktrace_x86_64-inl.h4
-rw-r--r--extern/libmv/third_party/glog/src/symbolize.cc8
-rw-r--r--extern/libmv/third_party/glog/src/symbolize.h2
-rw-r--r--extern/libmv/third_party/glog/src/utilities.cc27
-rw-r--r--extern/libmv/third_party/glog/src/utilities.h4
-rw-r--r--extern/libmv/third_party/glog/src/vlog_is_on.cc6
-rw-r--r--extern/libmv/third_party/glog/src/windows/glog/log_severity.h10
-rw-r--r--extern/libmv/third_party/glog/src/windows/glog/logging.h95
-rw-r--r--extern/libmv/third_party/glog/src/windows/glog/raw_logging.h12
-rw-r--r--extern/libmv/third_party/glog/src/windows/port.h18
-rw-r--r--[-rwxr-xr-x]extern/libmv/third_party/glog/src/windows/preprocess.sh0
26 files changed, 543 insertions, 355 deletions
diff --git a/extern/libmv/third_party/glog/ChangeLog b/extern/libmv/third_party/glog/ChangeLog
index 350fee921e3..6ac0b0f0575 100644
--- a/extern/libmv/third_party/glog/ChangeLog
+++ b/extern/libmv/third_party/glog/ChangeLog
@@ -1,3 +1,13 @@
+2012-01-12 Google Inc. <opensource@google.com>
+
+ * google-glog: version 0.3.2
+ * Clang support.
+ * Demangler and stacktrace improvement for newer GCCs.
+ * Now fork(2) doesn't mess up log files.
+ * Make valgrind happier.
+ * Reduce warnings for more -W options.
+ * Provide a workaround for ERROR defined by windows.h.
+
2010-06-15 Google Inc. <opensource@google.com>
* google-glog: version 0.3.1
diff --git a/extern/libmv/third_party/glog/README.libmv b/extern/libmv/third_party/glog/README.libmv
index 8f1243b2430..025a70b76a5 100644
--- a/extern/libmv/third_party/glog/README.libmv
+++ b/extern/libmv/third_party/glog/README.libmv
@@ -1,38 +1,24 @@
Project: Google Logging
URL: http://code.google.com/p/google-glog/
License: New BSD
-Upstream version: 0.3.1
+Upstream version: 0.3.2
Local modifications:
Upgrading Notes
-* Had to change #include <gflags/gflags.h> to #include "gflags/gflags.h"
-* Make sure to copy over a config_YOUR_PLATFORM.h and put it in config.h
-
-Old changes which got obsoleted (maybe?) by 0.3.1 merge:
-* The config_linux.h is generated by configure on Keir's Ubuntu 9.04 desktop.
-* Commented out some struct ::tm weirdness causing compile failures on
- ubuntu 8.10 and 9.04.
-* Switched several initializers to memset instead of = {}.
-* Changed some includes pointing to gflags. Not sure why the regular inclusion
- didn't work.
-* Added some compile flags to silence various warnings, allowing us to keep the
- differences between upstream small.
-* Don't redefine _XOPEN_SOURCE.
-* Added "google::" to GetReferenceableValue in CHECK_OP_LOG.
-* Add virtual destructor to Thread in googletest.h.
-* Update windows/glog/log_severity to build with QT library that include WinGDI
- (It cause a double definition of ERROR variable).
-
-Old changes which got obsoleted (maybe?) by 0.2.1 merge:
-* Added #ifndef / def REG_EIP; not sure what that is.
-* Added (void) arg stuff to prevent unused variable warnings.
-* Added google:: namespace prefix to GetReferencableValue
-* Added assignments for several functions marked with no_ignore_return, where
- the return value was ignored.
-* Commented out the unused function DumpPCAndSymbol() in utilities.cc to silent
- gcc on the mac
-
-TODO(keir): Remove any obsoleted changes above if they are not necessary after
-testing on more platforms.
-
-WARNING: Mac port not updated for 0.2.1
+* Replace <gflags/gflags.h> with "third_party/gflags/gflags/gflags.h" which is easier
+ to setup things in libmv and also helps with setting up building libmv into
+ external applications.
+* Replace "glog/logging.h" and "glog/logging.h" with <glog/logging.h> and <glog/logging.h>
+ which is needed on Windows platform because otherwise files like logging.cc will be using
+ relative path which points to headers used by linux instead of headers need to be used
+ on Windows.
+* Replace _asm int 3 with __debugbreak(). Such assembler code is obsolete and doesn't work
+ with 64bit versions of MSVC compilers.
+* Do not use stacktrace for MinGW and FreeBSD because it leads into issues accessing
+ some specific data on this platforms.
+* Define HAVE_LIB_GFLAGS for Windows builds.
+* Do not define __declspec(dllimport) for MinGW platforms.
+* Setup proper includes and datatypes for int32, uint32, int64 and uint64 for MinGW
+* Do not define va_copy for MinGW platforms (it's already defined there).
+* Patch localtime_r to be working fine with MinGW, disable strerror_r for MinGW because
+ of lack of needed functions.
diff --git a/extern/libmv/third_party/glog/src/base/commandlineflags.h b/extern/libmv/third_party/glog/src/base/commandlineflags.h
index 6c529ccd847..483a96ee80b 100644
--- a/extern/libmv/third_party/glog/src/base/commandlineflags.h
+++ b/extern/libmv/third_party/glog/src/base/commandlineflags.h
@@ -55,11 +55,11 @@
#ifdef HAVE_LIB_GFLAGS
-#include "third_party/gflags/gflags.h"
+#include "third_party/gflags/gflags/gflags.h"
#else
-#include "glog/logging.h"
+#include <glog/logging.h>
#define DECLARE_VARIABLE(type, name, tn) \
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead { \
diff --git a/extern/libmv/third_party/glog/src/base/googleinit.h b/extern/libmv/third_party/glog/src/base/googleinit.h
index c907308e852..5a8b515cd60 100644
--- a/extern/libmv/third_party/glog/src/base/googleinit.h
+++ b/extern/libmv/third_party/glog/src/base/googleinit.h
@@ -36,7 +36,7 @@
class GoogleInitializer {
public:
typedef void (*void_function)(void);
- GoogleInitializer(const char* name, void_function f) {
+ GoogleInitializer(const char*, void_function f) {
f();
}
};
diff --git a/extern/libmv/third_party/glog/src/config_freebsd.h b/extern/libmv/third_party/glog/src/config_freebsd.h
index 28fa1f1c78b..a671a0080b3 100644
--- a/extern/libmv/third_party/glog/src/config_freebsd.h
+++ b/extern/libmv/third_party/glog/src/config_freebsd.h
@@ -122,13 +122,13 @@
#define PACKAGE_NAME "glog"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "glog 0.3.1"
+#define PACKAGE_STRING "glog 0.3.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "glog"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.3.1"
+#define PACKAGE_VERSION "0.3.2"
/* How to access the PC from a struct ucontext */
/* #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP] */
@@ -151,7 +151,7 @@
#define TEST_SRC_DIR "."
/* Version number of package */
-#define VERSION "0.3.1"
+#define VERSION "0.3.2"
/* Stops putting the code inside the Google namespace */
#define _END_GOOGLE_NAMESPACE_ }
@@ -159,3 +159,8 @@
/* Puts following code inside the Google namespace */
#define _START_GOOGLE_NAMESPACE_ namespace google {
+/* isn't getting defined by configure script when clang compilers are used
+ and cuases compilation errors in stactrace/unwind modules */
+#ifdef __clang__
+# define NO_FRAME_POINTER
+#endif
diff --git a/extern/libmv/third_party/glog/src/config_linux.h b/extern/libmv/third_party/glog/src/config_linux.h
index faf032949bb..19beaa5cf40 100644
--- a/extern/libmv/third_party/glog/src/config_linux.h
+++ b/extern/libmv/third_party/glog/src/config_linux.h
@@ -110,7 +110,11 @@
#define HAVE___BUILTIN_EXPECT 1
/* define if your compiler has __sync_val_compare_and_swap */
-/* #undef HAVE___SYNC_VAL_COMPARE_AND_SWAP */
+#define HAVE___SYNC_VAL_COMPARE_AND_SWAP 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "glog"
@@ -122,22 +126,19 @@
#define PACKAGE_NAME "glog"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "glog 0.3.1"
+#define PACKAGE_STRING "glog 0.3.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "glog"
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.3.1"
+#define PACKAGE_VERSION "0.3.2"
/* How to access the PC from a struct ucontext */
-#if defined(_M_X64) || defined(__amd64__) || defined(__x86_64__)
- #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP]
-#elif defined(_M_IX86) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)
- #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_EIP]
-#else
- #undef PC_FROM_UCONTEXT
-#endif
+#define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP]
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
@@ -149,7 +150,6 @@
/* Define to 1 if you have the ANSI C header files. */
/* #undef STDC_HEADERS */
-#define STDC_HEADERS 1
/* the namespace where STL code like vector<> is defined */
#define STL_NAMESPACE std
@@ -157,10 +157,16 @@
#define TEST_SRC_DIR "."
/* Version number of package */
-#define VERSION "0.3.1"
+#define VERSION "0.3.2"
/* Stops putting the code inside the Google namespace */
#define _END_GOOGLE_NAMESPACE_ }
/* Puts following code inside the Google namespace */
#define _START_GOOGLE_NAMESPACE_ namespace google {
+
+/* isn't getting defined by configure script when clang compilers are used
+ and cuases compilation errors in stactrace/unwind modules */
+#ifdef __clang__
+# define NO_FRAME_POINTER
+#endif
diff --git a/extern/libmv/third_party/glog/src/config_mac.h b/extern/libmv/third_party/glog/src/config_mac.h
index 5f953d17ba9..9756fde22f3 100644
--- a/extern/libmv/third_party/glog/src/config_mac.h
+++ b/extern/libmv/third_party/glog/src/config_mac.h
@@ -122,13 +122,13 @@
#define PACKAGE_NAME "glog"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "glog 0.3.1"
+#define PACKAGE_STRING "glog 0.3.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "glog"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.3.1"
+#define PACKAGE_VERSION "0.3.2"
/* How to access the PC from a struct ucontext */
#undef PC_FROM_UCONTEXT
@@ -150,10 +150,16 @@
#define TEST_SRC_DIR "."
/* Version number of package */
-#define VERSION "0.3.1"
+#define VERSION "0.3.2"
/* Stops putting the code inside the Google namespace */
#define _END_GOOGLE_NAMESPACE_ }
/* Puts following code inside the Google namespace */
#define _START_GOOGLE_NAMESPACE_ namespace google {
+
+/* isn't getting defined by configure script when clang compilers are used
+ and cuases compilation errors in stactrace/unwind modules */
+#ifdef __clang__
+# define NO_FRAME_POINTER
+#endif
diff --git a/extern/libmv/third_party/glog/src/demangle.cc b/extern/libmv/third_party/glog/src/demangle.cc
index 46556bf3c13..0daf30893b3 100644
--- a/extern/libmv/third_party/glog/src/demangle.cc
+++ b/extern/libmv/third_party/glog/src/demangle.cc
@@ -28,6 +28,11 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: Satoru Takabayashi
+//
+// For reference check out:
+// http://www.codesourcery.com/public/cxx-abi/abi.html#mangling
+//
+// Note that we only have partial C++0x support yet.
#include <stdio.h> // for NULL
#include "demangle.h"
@@ -138,14 +143,12 @@ static const AbbrevPair kSubstitutionList[] = {
// State needed for demangling.
typedef struct {
const char *mangled_cur; // Cursor of mangled name.
- const char *mangled_end; // End of mangled name.
char *out_cur; // Cursor of output string.
const char *out_begin; // Beginning of output string.
const char *out_end; // End of output string.
const char *prev_name; // For constructors/destructors.
int prev_name_length; // For constructors/destructors.
- int nest_level; // For nested names.
- int number; // Remember the previous number.
+ short nest_level; // For nested names.
bool append; // Append flag.
bool overflowed; // True if output gets overflowed.
} State;
@@ -161,6 +164,16 @@ static size_t StrLen(const char *str) {
return len;
}
+// Returns true if "str" has at least "n" characters remaining.
+static bool AtLeastNumCharsRemaining(const char *str, int n) {
+ for (int i = 0; i < n; ++i) {
+ if (str == '\0') {
+ return false;
+ }
+ }
+ return true;
+}
+
// Returns true if "str" has "prefix" as a prefix.
static bool StrPrefix(const char *str, const char *prefix) {
size_t i = 0;
@@ -174,39 +187,33 @@ static bool StrPrefix(const char *str, const char *prefix) {
static void InitState(State *state, const char *mangled,
char *out, int out_size) {
state->mangled_cur = mangled;
- state->mangled_end = mangled + StrLen(mangled);
state->out_cur = out;
state->out_begin = out;
state->out_end = out + out_size;
state->prev_name = NULL;
state->prev_name_length = -1;
state->nest_level = -1;
- state->number = -1;
state->append = true;
state->overflowed = false;
}
-// Calculates the remaining length of the mangled name.
-static int RemainingLength(State *state) {
- return state->mangled_end - state->mangled_cur;
-}
-
-// Returns true and advances "mangled_cur" if we find "c" at
-// "mangled_cur" position.
-static bool ParseChar(State *state, const char c) {
- if (RemainingLength(state) >= 1 && *state->mangled_cur == c) {
+// Returns true and advances "mangled_cur" if we find "one_char_token"
+// at "mangled_cur" position. It is assumed that "one_char_token" does
+// not contain '\0'.
+static bool ParseOneCharToken(State *state, const char one_char_token) {
+ if (state->mangled_cur[0] == one_char_token) {
++state->mangled_cur;
return true;
}
return false;
}
-// Returns true and advances "mangled_cur" if we find "two_chars" at
-// "mangled_cur" position.
-static bool ParseTwoChar(State *state, const char *two_chars) {
- if (RemainingLength(state) >= 2 &&
- state->mangled_cur[0] == two_chars[0] &&
- state->mangled_cur[1] == two_chars[1]) {
+// Returns true and advances "mangled_cur" if we find "two_char_token"
+// at "mangled_cur" position. It is assumed that "two_char_token" does
+// not contain '\0'.
+static bool ParseTwoCharToken(State *state, const char *two_char_token) {
+ if (state->mangled_cur[0] == two_char_token[0] &&
+ state->mangled_cur[1] == two_char_token[1]) {
state->mangled_cur += 2;
return true;
}
@@ -216,13 +223,13 @@ static bool ParseTwoChar(State *state, const char *two_chars) {
// Returns true and advances "mangled_cur" if we find any character in
// "char_class" at "mangled_cur" position.
static bool ParseCharClass(State *state, const char *char_class) {
- if (state->mangled_cur == state->mangled_end) {
+ if (state->mangled_cur == '\0') {
return false;
}
const char *p = char_class;
for (; *p != '\0'; ++p) {
- if (*state->mangled_cur == *p) {
- state->mangled_cur += 1;
+ if (state->mangled_cur[0] == *p) {
+ ++state->mangled_cur;
return true;
}
}
@@ -230,7 +237,7 @@ static bool ParseCharClass(State *state, const char *char_class) {
}
// This function is used for handling an optional non-terminal.
-static bool Optional(bool status) {
+static bool Optional(bool) {
return true;
}
@@ -245,6 +252,16 @@ static bool OneOrMore(ParseFunc parse_func, State *state) {
return false;
}
+// This function is used for handling <non-terminal>* syntax. The function
+// always returns true and must be followed by a termination token or a
+// terminating sequence not handled by parse_func (e.g.
+// ParseOneCharToken(state, 'E')).
+static bool ZeroOrMore(ParseFunc parse_func, State *state) {
+ while (parse_func(state)) {
+ }
+ return true;
+}
+
// Append "str" at "out_cur". If there is an overflow, "overflowed"
// is set to true for later use. The output string is ensured to
// always terminate with '\0' as long as there is no overflow.
@@ -270,7 +287,37 @@ static bool IsLower(char c) {
}
static bool IsAlpha(char c) {
- return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
+}
+
+static bool IsDigit(char c) {
+ return c >= '0' && c <= '9';
+}
+
+// Returns true if "str" is a function clone suffix. These suffixes are used
+// by GCC 4.5.x and later versions to indicate functions which have been
+// cloned during optimization. We treat any sequence (.<alpha>+.<digit>+)+ as
+// a function clone suffix.
+static bool IsFunctionCloneSuffix(const char *str) {
+ size_t i = 0;
+ while (str[i] != '\0') {
+ // Consume a single .<alpha>+.<digit>+ sequence.
+ if (str[i] != '.' || !IsAlpha(str[i + 1])) {
+ return false;
+ }
+ i += 2;
+ while (IsAlpha(str[i])) {
+ ++i;
+ }
+ if (str[i] != '.' || !IsDigit(str[i + 1])) {
+ return false;
+ }
+ i += 2;
+ while (IsDigit(str[i])) {
+ ++i;
+ }
+ }
+ return true; // Consumed everything in "str".
}
// Append "str" with some tweaks, iff "append" state is true.
@@ -309,7 +356,7 @@ static bool EnterNestedName(State *state) {
}
// This function is used for handling nested names.
-static bool LeaveNestedName(State *state, int prev_value) {
+static bool LeaveNestedName(State *state, short prev_value) {
state->nest_level = prev_value;
return true;
}
@@ -349,11 +396,11 @@ static void MaybeCancelLastSeparator(State *state) {
}
}
-// Returns true if identifier pointed by "mangled_cur" is anonymous
-// namespace.
-static bool IdentifierIsAnonymousNamespace(State *state) {
- const char anon_prefix[] = "_GLOBAL__N_";
- return (state->number > sizeof(anon_prefix) - 1 && // Should be longer.
+// Returns true if the identifier of the given length pointed to by
+// "mangled_cur" is anonymous namespace.
+static bool IdentifierIsAnonymousNamespace(State *state, int length) {
+ static const char anon_prefix[] = "_GLOBAL__N_";
+ return (length > (int)sizeof(anon_prefix) - 1 && // Should be longer.
StrPrefix(state->mangled_cur, anon_prefix));
}
@@ -368,10 +415,10 @@ static bool ParsePrefix(State *state);
static bool ParseUnqualifiedName(State *state);
static bool ParseSourceName(State *state);
static bool ParseLocalSourceName(State *state);
-static bool ParseNumber(State *state);
+static bool ParseNumber(State *state, int *number_out);
static bool ParseFloatNumber(State *state);
static bool ParseSeqId(State *state);
-static bool ParseIdentifier(State *state);
+static bool ParseIdentifier(State *state, int length);
static bool ParseOperatorName(State *state);
static bool ParseSpecialName(State *state);
static bool ParseCallOffset(State *state);
@@ -428,17 +475,7 @@ static bool ParseSubstitution(State *state);
// <mangled-name> ::= _Z <encoding>
static bool ParseMangledName(State *state) {
- if (ParseTwoChar(state, "_Z") && ParseEncoding(state)) {
- // Append trailing version suffix if any.
- // ex. _Z3foo@@GLIBCXX_3.4
- if (state->mangled_cur < state->mangled_end &&
- state->mangled_cur[0] == '@') {
- MaybeAppend(state, state->mangled_cur);
- state->mangled_cur = state->mangled_end;
- }
- return true;
- }
- return false;
+ return ParseTwoCharToken(state, "_Z") && ParseEncoding(state);
}
// <encoding> ::= <(function) name> <bare-function-type>
@@ -488,7 +525,7 @@ static bool ParseUnscopedName(State *state) {
}
State copy = *state;
- if (ParseTwoChar(state, "St") &&
+ if (ParseTwoCharToken(state, "St") &&
MaybeAppend(state, "std::") &&
ParseUnqualifiedName(state)) {
return true;
@@ -507,12 +544,12 @@ static bool ParseUnscopedTemplateName(State *state) {
// ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
static bool ParseNestedName(State *state) {
State copy = *state;
- if (ParseChar(state, 'N') &&
+ if (ParseOneCharToken(state, 'N') &&
EnterNestedName(state) &&
Optional(ParseCVQualifiers(state)) &&
ParsePrefix(state) &&
LeaveNestedName(state, copy.nest_level) &&
- ParseChar(state, 'E')) {
+ ParseOneCharToken(state, 'E')) {
return true;
}
*state = copy;
@@ -565,7 +602,8 @@ static bool ParseUnqualifiedName(State *state) {
// <source-name> ::= <positive length number> <identifier>
static bool ParseSourceName(State *state) {
State copy = *state;
- if (ParseNumber(state) && ParseIdentifier(state)) {
+ int length = -1;
+ if (ParseNumber(state, &length) && ParseIdentifier(state, length)) {
return true;
}
*state = copy;
@@ -579,7 +617,7 @@ static bool ParseSourceName(State *state) {
// http://gcc.gnu.org/viewcvs?view=rev&revision=124467
static bool ParseLocalSourceName(State *state) {
State copy = *state;
- if (ParseChar(state, 'L') && ParseSourceName(state) &&
+ if (ParseOneCharToken(state, 'L') && ParseSourceName(state) &&
Optional(ParseDiscriminator(state))) {
return true;
}
@@ -588,15 +626,17 @@ static bool ParseLocalSourceName(State *state) {
}
// <number> ::= [n] <non-negative decimal integer>
-static bool ParseNumber(State *state) {
+// If "number_out" is non-null, then *number_out is set to the value of the
+// parsed number on success.
+static bool ParseNumber(State *state, int *number_out) {
int sign = 1;
- if (ParseChar(state, 'n')) {
+ if (ParseOneCharToken(state, 'n')) {
sign = -1;
}
const char *p = state->mangled_cur;
int number = 0;
- for (;p < state->mangled_end; ++p) {
- if ((*p >= '0' && *p <= '9')) {
+ for (;*p != '\0'; ++p) {
+ if (IsDigit(*p)) {
number = number * 10 + (*p - '0');
} else {
break;
@@ -604,7 +644,9 @@ static bool ParseNumber(State *state) {
}
if (p != state->mangled_cur) { // Conversion succeeded.
state->mangled_cur = p;
- state->number = number * sign;
+ if (number_out != NULL) {
+ *number_out = number * sign;
+ }
return true;
}
return false;
@@ -614,19 +656,13 @@ static bool ParseNumber(State *state) {
// hexadecimal string.
static bool ParseFloatNumber(State *state) {
const char *p = state->mangled_cur;
- int number = 0;
- for (;p < state->mangled_end; ++p) {
- if ((*p >= '0' && *p <= '9')) {
- number = number * 16 + (*p - '0');
- } else if (*p >= 'a' && *p <= 'f') {
- number = number * 16 + (*p - 'a' + 10);
- } else {
+ for (;*p != '\0'; ++p) {
+ if (!IsDigit(*p) && !(*p >= 'a' && *p <= 'f')) {
break;
}
}
if (p != state->mangled_cur) { // Conversion succeeded.
state->mangled_cur = p;
- state->number = number;
return true;
}
return false;
@@ -636,37 +672,30 @@ static bool ParseFloatNumber(State *state) {
// using digits and upper case letters
static bool ParseSeqId(State *state) {
const char *p = state->mangled_cur;
- int number = 0;
- for (;p < state->mangled_end; ++p) {
- if ((*p >= '0' && *p <= '9')) {
- number = number * 36 + (*p - '0');
- } else if (*p >= 'A' && *p <= 'Z') {
- number = number * 36 + (*p - 'A' + 10);
- } else {
+ for (;*p != '\0'; ++p) {
+ if (!IsDigit(*p) && !(*p >= 'A' && *p <= 'Z')) {
break;
}
}
if (p != state->mangled_cur) { // Conversion succeeded.
state->mangled_cur = p;
- state->number = number;
return true;
}
return false;
}
-// <identifier> ::= <unqualified source code identifier>
-static bool ParseIdentifier(State *state) {
- if (state->number == -1 ||
- RemainingLength(state) < state->number) {
+// <identifier> ::= <unqualified source code identifier> (of given length)
+static bool ParseIdentifier(State *state, int length) {
+ if (length == -1 ||
+ !AtLeastNumCharsRemaining(state->mangled_cur, length)) {
return false;
}
- if (IdentifierIsAnonymousNamespace(state)) {
+ if (IdentifierIsAnonymousNamespace(state, length)) {
MaybeAppend(state, "(anonymous namespace)");
} else {
- MaybeAppendWithLength(state, state->mangled_cur, state->number);
+ MaybeAppendWithLength(state, state->mangled_cur, length);
}
- state->mangled_cur += state->number;
- state->number = -1; // Reset the number.
+ state->mangled_cur += length;
return true;
}
@@ -674,12 +703,12 @@ static bool ParseIdentifier(State *state) {
// ::= cv <type> # (cast)
// ::= v <digit> <source-name> # vendor extended operator
static bool ParseOperatorName(State *state) {
- if (RemainingLength(state) < 2) {
+ if (!AtLeastNumCharsRemaining(state->mangled_cur, 2)) {
return false;
}
// First check with "cv" (cast) case.
State copy = *state;
- if (ParseTwoChar(state, "cv") &&
+ if (ParseTwoCharToken(state, "cv") &&
MaybeAppend(state, "operator ") &&
EnterNestedName(state) &&
ParseType(state) &&
@@ -689,7 +718,7 @@ static bool ParseOperatorName(State *state) {
*state = copy;
// Then vendor extended operators.
- if (ParseChar(state, 'v') && ParseCharClass(state, "0123456789") &&
+ if (ParseOneCharToken(state, 'v') && ParseCharClass(state, "0123456789") &&
ParseSourceName(state)) {
return true;
}
@@ -738,34 +767,34 @@ static bool ParseOperatorName(State *state) {
// stack traces. The are special data.
static bool ParseSpecialName(State *state) {
State copy = *state;
- if (ParseChar(state, 'T') &&
+ if (ParseOneCharToken(state, 'T') &&
ParseCharClass(state, "VTIS") &&
ParseType(state)) {
return true;
}
*state = copy;
- if (ParseTwoChar(state, "Tc") && ParseCallOffset(state) &&
+ if (ParseTwoCharToken(state, "Tc") && ParseCallOffset(state) &&
ParseCallOffset(state) && ParseEncoding(state)) {
return true;
}
*state = copy;
- if (ParseTwoChar(state, "GV") &&
+ if (ParseTwoCharToken(state, "GV") &&
ParseName(state)) {
return true;
}
*state = copy;
- if (ParseChar(state, 'T') && ParseCallOffset(state) &&
+ if (ParseOneCharToken(state, 'T') && ParseCallOffset(state) &&
ParseEncoding(state)) {
return true;
}
*state = copy;
// G++ extensions
- if (ParseTwoChar(state, "TC") && ParseType(state) &&
- ParseNumber(state) && ParseChar(state, '_') &&
+ if (ParseTwoCharToken(state, "TC") && ParseType(state) &&
+ ParseNumber(state, NULL) && ParseOneCharToken(state, '_') &&
DisableAppend(state) &&
ParseType(state)) {
RestoreAppend(state, copy.append);
@@ -773,23 +802,23 @@ static bool ParseSpecialName(State *state) {
}
*state = copy;
- if (ParseChar(state, 'T') && ParseCharClass(state, "FJ") &&
+ if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "FJ") &&
ParseType(state)) {
return true;
}
*state = copy;
- if (ParseTwoChar(state, "GR") && ParseName(state)) {
+ if (ParseTwoCharToken(state, "GR") && ParseName(state)) {
return true;
}
*state = copy;
- if (ParseTwoChar(state, "GA") && ParseEncoding(state)) {
+ if (ParseTwoCharToken(state, "GA") && ParseEncoding(state)) {
return true;
}
*state = copy;
- if (ParseChar(state, 'T') && ParseCharClass(state, "hv") &&
+ if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "hv") &&
ParseCallOffset(state) && ParseEncoding(state)) {
return true;
}
@@ -801,14 +830,14 @@ static bool ParseSpecialName(State *state) {
// ::= v <v-offset> _
static bool ParseCallOffset(State *state) {
State copy = *state;
- if (ParseChar(state, 'h') &&
- ParseNVOffset(state) && ParseChar(state, '_')) {
+ if (ParseOneCharToken(state, 'h') &&
+ ParseNVOffset(state) && ParseOneCharToken(state, '_')) {
return true;
}
*state = copy;
- if (ParseChar(state, 'v') &&
- ParseVOffset(state) && ParseChar(state, '_')) {
+ if (ParseOneCharToken(state, 'v') &&
+ ParseVOffset(state) && ParseOneCharToken(state, '_')) {
return true;
}
*state = copy;
@@ -818,14 +847,14 @@ static bool ParseCallOffset(State *state) {
// <nv-offset> ::= <(offset) number>
static bool ParseNVOffset(State *state) {
- return ParseNumber(state);
+ return ParseNumber(state, NULL);
}
// <v-offset> ::= <(offset) number> _ <(virtual offset) number>
static bool ParseVOffset(State *state) {
State copy = *state;
- if (ParseNumber(state) && ParseChar(state, '_') &&
- ParseNumber(state)) {
+ if (ParseNumber(state, NULL) && ParseOneCharToken(state, '_') &&
+ ParseNumber(state, NULL)) {
return true;
}
*state = copy;
@@ -836,7 +865,7 @@ static bool ParseVOffset(State *state) {
// ::= D0 | D1 | D2
static bool ParseCtorDtorName(State *state) {
State copy = *state;
- if (ParseChar(state, 'C') &&
+ if (ParseOneCharToken(state, 'C') &&
ParseCharClass(state, "123")) {
const char * const prev_name = state->prev_name;
const int prev_name_length = state->prev_name_length;
@@ -845,7 +874,7 @@ static bool ParseCtorDtorName(State *state) {
}
*state = copy;
- if (ParseChar(state, 'D') &&
+ if (ParseOneCharToken(state, 'D') &&
ParseCharClass(state, "012")) {
const char * const prev_name = state->prev_name;
const int prev_name_length = state->prev_name_length;
@@ -858,11 +887,12 @@ static bool ParseCtorDtorName(State *state) {
}
// <type> ::= <CV-qualifiers> <type>
-// ::= P <type>
-// ::= R <type>
-// ::= C <type>
-// ::= G <type>
-// ::= U <source-name> <type>
+// ::= P <type> # pointer-to
+// ::= R <type> # reference-to
+// ::= O <type> # rvalue reference-to (C++0x)
+// ::= C <type> # complex pair (C 2000)
+// ::= G <type> # imaginary (C 2000)
+// ::= U <source-name> <type> # vendor extended type qualifier
// ::= <builtin-type>
// ::= <function-type>
// ::= <class-enum-type>
@@ -871,6 +901,11 @@ static bool ParseCtorDtorName(State *state) {
// ::= <template-template-param> <template-args>
// ::= <template-param>
// ::= <substitution>
+// ::= Dp <type> # pack expansion of (C++0x)
+// ::= Dt <expression> E # decltype of an id-expression or class
+// # member access (C++0x)
+// ::= DT <expression> E # decltype of an expression (C++0x)
+//
static bool ParseType(State *state) {
// We should check CV-qualifers, and PRGC things first.
State copy = *state;
@@ -879,12 +914,23 @@ static bool ParseType(State *state) {
}
*state = copy;
- if (ParseCharClass(state, "PRCG") && ParseType(state)) {
+ if (ParseCharClass(state, "OPRCG") && ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseTwoCharToken(state, "Dp") && ParseType(state)) {
return true;
}
*state = copy;
- if (ParseChar(state, 'U') && ParseSourceName(state) &&
+ if (ParseOneCharToken(state, 'D') && ParseCharClass(state, "tT") &&
+ ParseExpression(state) && ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'U') && ParseSourceName(state) &&
ParseType(state)) {
return true;
}
@@ -918,9 +964,9 @@ static bool ParseType(State *state) {
// ParseType().
static bool ParseCVQualifiers(State *state) {
int num_cv_qualifiers = 0;
- num_cv_qualifiers += ParseChar(state, 'r');
- num_cv_qualifiers += ParseChar(state, 'V');
- num_cv_qualifiers += ParseChar(state, 'K');
+ num_cv_qualifiers += ParseOneCharToken(state, 'r');
+ num_cv_qualifiers += ParseOneCharToken(state, 'V');
+ num_cv_qualifiers += ParseOneCharToken(state, 'K');
return num_cv_qualifiers > 0;
}
@@ -937,7 +983,7 @@ static bool ParseBuiltinType(State *state) {
}
State copy = *state;
- if (ParseChar(state, 'u') && ParseSourceName(state)) {
+ if (ParseOneCharToken(state, 'u') && ParseSourceName(state)) {
return true;
}
*state = copy;
@@ -947,8 +993,9 @@ static bool ParseBuiltinType(State *state) {
// <function-type> ::= F [Y] <bare-function-type> E
static bool ParseFunctionType(State *state) {
State copy = *state;
- if (ParseChar(state, 'F') && Optional(ParseChar(state, 'Y')) &&
- ParseBareFunctionType(state) && ParseChar(state, 'E')) {
+ if (ParseOneCharToken(state, 'F') &&
+ Optional(ParseOneCharToken(state, 'Y')) &&
+ ParseBareFunctionType(state) && ParseOneCharToken(state, 'E')) {
return true;
}
*state = copy;
@@ -977,14 +1024,14 @@ static bool ParseClassEnumType(State *state) {
// ::= A [<(dimension) expression>] _ <(element) type>
static bool ParseArrayType(State *state) {
State copy = *state;
- if (ParseChar(state, 'A') && ParseNumber(state) &&
- ParseChar(state, '_') && ParseType(state)) {
+ if (ParseOneCharToken(state, 'A') && ParseNumber(state, NULL) &&
+ ParseOneCharToken(state, '_') && ParseType(state)) {
return true;
}
*state = copy;
- if (ParseChar(state, 'A') && Optional(ParseExpression(state)) &&
- ParseChar(state, '_') && ParseType(state)) {
+ if (ParseOneCharToken(state, 'A') && Optional(ParseExpression(state)) &&
+ ParseOneCharToken(state, '_') && ParseType(state)) {
return true;
}
*state = copy;
@@ -994,7 +1041,7 @@ static bool ParseArrayType(State *state) {
// <pointer-to-member-type> ::= M <(class) type> <(member) type>
static bool ParsePointerToMemberType(State *state) {
State copy = *state;
- if (ParseChar(state, 'M') && ParseType(state) &&
+ if (ParseOneCharToken(state, 'M') && ParseType(state) &&
ParseType(state)) {
return true;
}
@@ -1005,14 +1052,14 @@ static bool ParsePointerToMemberType(State *state) {
// <template-param> ::= T_
// ::= T <parameter-2 non-negative number> _
static bool ParseTemplateParam(State *state) {
- if (ParseTwoChar(state, "T_")) {
+ if (ParseTwoCharToken(state, "T_")) {
MaybeAppend(state, "?"); // We don't support template substitutions.
return true;
}
State copy = *state;
- if (ParseChar(state, 'T') && ParseNumber(state) &&
- ParseChar(state, '_')) {
+ if (ParseOneCharToken(state, 'T') && ParseNumber(state, NULL) &&
+ ParseOneCharToken(state, '_')) {
MaybeAppend(state, "?"); // We don't support template substitutions.
return true;
}
@@ -1032,9 +1079,9 @@ static bool ParseTemplateTemplateParam(State *state) {
static bool ParseTemplateArgs(State *state) {
State copy = *state;
DisableAppend(state);
- if (ParseChar(state, 'I') &&
+ if (ParseOneCharToken(state, 'I') &&
OneOrMore(ParseTemplateArg, state) &&
- ParseChar(state, 'E')) {
+ ParseOneCharToken(state, 'E')) {
RestoreAppend(state, copy.append);
MaybeAppend(state, "<>");
return true;
@@ -1045,16 +1092,25 @@ static bool ParseTemplateArgs(State *state) {
// <template-arg> ::= <type>
// ::= <expr-primary>
+// ::= I <template-arg>* E # argument pack
// ::= X <expression> E
static bool ParseTemplateArg(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'I') &&
+ ZeroOrMore(ParseTemplateArg, state) &&
+ ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+
if (ParseType(state) ||
ParseExprPrimary(state)) {
return true;
}
+ *state = copy;
- State copy = *state;
- if (ParseChar(state, 'X') && ParseExpression(state) &&
- ParseChar(state, 'E')) {
+ if (ParseOneCharToken(state, 'X') && ParseExpression(state) &&
+ ParseOneCharToken(state, 'E')) {
return true;
}
*state = copy;
@@ -1097,19 +1153,19 @@ static bool ParseExpression(State *state) {
}
*state = copy;
- if (ParseTwoChar(state, "st") && ParseType(state)) {
+ if (ParseTwoCharToken(state, "st") && ParseType(state)) {
return true;
}
*state = copy;
- if (ParseTwoChar(state, "sr") && ParseType(state) &&
+ if (ParseTwoCharToken(state, "sr") && ParseType(state) &&
ParseUnqualifiedName(state) &&
ParseTemplateArgs(state)) {
return true;
}
*state = copy;
- if (ParseTwoChar(state, "sr") && ParseType(state) &&
+ if (ParseTwoCharToken(state, "sr") && ParseType(state) &&
ParseUnqualifiedName(state)) {
return true;
}
@@ -1124,28 +1180,28 @@ static bool ParseExpression(State *state) {
// ::= LZ <encoding> E
static bool ParseExprPrimary(State *state) {
State copy = *state;
- if (ParseChar(state, 'L') && ParseType(state) &&
- ParseNumber(state) &&
- ParseChar(state, 'E')) {
+ if (ParseOneCharToken(state, 'L') && ParseType(state) &&
+ ParseNumber(state, NULL) &&
+ ParseOneCharToken(state, 'E')) {
return true;
}
*state = copy;
- if (ParseChar(state, 'L') && ParseType(state) &&
+ if (ParseOneCharToken(state, 'L') && ParseType(state) &&
ParseFloatNumber(state) &&
- ParseChar(state, 'E')) {
+ ParseOneCharToken(state, 'E')) {
return true;
}
*state = copy;
- if (ParseChar(state, 'L') && ParseMangledName(state) &&
- ParseChar(state, 'E')) {
+ if (ParseOneCharToken(state, 'L') && ParseMangledName(state) &&
+ ParseOneCharToken(state, 'E')) {
return true;
}
*state = copy;
- if (ParseTwoChar(state, "LZ") && ParseEncoding(state) &&
- ParseChar(state, 'E')) {
+ if (ParseTwoCharToken(state, "LZ") && ParseEncoding(state) &&
+ ParseOneCharToken(state, 'E')) {
return true;
}
*state = copy;
@@ -1158,15 +1214,15 @@ static bool ParseExprPrimary(State *state) {
// := Z <(function) encoding> E s [<discriminator>]
static bool ParseLocalName(State *state) {
State copy = *state;
- if (ParseChar(state, 'Z') && ParseEncoding(state) &&
- ParseChar(state, 'E') && MaybeAppend(state, "::") &&
+ if (ParseOneCharToken(state, 'Z') && ParseEncoding(state) &&
+ ParseOneCharToken(state, 'E') && MaybeAppend(state, "::") &&
ParseName(state) && Optional(ParseDiscriminator(state))) {
return true;
}
*state = copy;
- if (ParseChar(state, 'Z') && ParseEncoding(state) &&
- ParseTwoChar(state, "Es") && Optional(ParseDiscriminator(state))) {
+ if (ParseOneCharToken(state, 'Z') && ParseEncoding(state) &&
+ ParseTwoCharToken(state, "Es") && Optional(ParseDiscriminator(state))) {
return true;
}
*state = copy;
@@ -1176,7 +1232,7 @@ static bool ParseLocalName(State *state) {
// <discriminator> := _ <(non-negative) number>
static bool ParseDiscriminator(State *state) {
State copy = *state;
- if (ParseChar(state, '_') && ParseNumber(state)) {
+ if (ParseOneCharToken(state, '_') && ParseNumber(state, NULL)) {
return true;
}
*state = copy;
@@ -1187,21 +1243,21 @@ static bool ParseDiscriminator(State *state) {
// ::= S <seq-id> _
// ::= St, etc.
static bool ParseSubstitution(State *state) {
- if (ParseTwoChar(state, "S_")) {
+ if (ParseTwoCharToken(state, "S_")) {
MaybeAppend(state, "?"); // We don't support substitutions.
return true;
}
State copy = *state;
- if (ParseChar(state, 'S') && ParseSeqId(state) &&
- ParseChar(state, '_')) {
+ if (ParseOneCharToken(state, 'S') && ParseSeqId(state) &&
+ ParseOneCharToken(state, '_')) {
MaybeAppend(state, "?"); // We don't support substitutions.
return true;
}
*state = copy;
// Expand abbreviations like "St" => "std".
- if (ParseChar(state, 'S')) {
+ if (ParseOneCharToken(state, 'S')) {
const AbbrevPair *p;
for (p = kSubstitutionList; p->abbrev != NULL; ++p) {
if (state->mangled_cur[0] == p->abbrev[1]) {
@@ -1210,7 +1266,7 @@ static bool ParseSubstitution(State *state) {
MaybeAppend(state, "::");
MaybeAppend(state, p->real_name);
}
- state->mangled_cur += 1;
+ ++state->mangled_cur;
return true;
}
}
@@ -1219,13 +1275,33 @@ static bool ParseSubstitution(State *state) {
return false;
}
+// Parse <mangled-name>, optionally followed by either a function-clone suffix
+// or version suffix. Returns true only if all of "mangled_cur" was consumed.
+static bool ParseTopLevelMangledName(State *state) {
+ if (ParseMangledName(state)) {
+ if (state->mangled_cur[0] != '\0') {
+ // Drop trailing function clone suffix, if any.
+ if (IsFunctionCloneSuffix(state->mangled_cur)) {
+ return true;
+ }
+ // Append trailing version suffix if any.
+ // ex. _Z3foo@@GLIBCXX_3.4
+ if (state->mangled_cur[0] == '@') {
+ MaybeAppend(state, state->mangled_cur);
+ return true;
+ }
+ return false; // Unconsumed suffix.
+ }
+ return true;
+ }
+ return false;
+}
+
// The demangler entry point.
bool Demangle(const char *mangled, char *out, int out_size) {
State state;
InitState(&state, mangled, out, out_size);
- return (ParseMangledName(&state) &&
- state.overflowed == false &&
- RemainingLength(&state) == 0);
+ return ParseTopLevelMangledName(&state) && !state.overflowed;
}
_END_GOOGLE_NAMESPACE_
diff --git a/extern/libmv/third_party/glog/src/glog/log_severity.h b/extern/libmv/third_party/glog/src/glog/log_severity.h
index 17805fbadd4..99945a426da 100644
--- a/extern/libmv/third_party/glog/src/glog/log_severity.h
+++ b/extern/libmv/third_party/glog/src/glog/log_severity.h
@@ -44,7 +44,15 @@
// you ever need to change their values or add a new severity.
typedef int LogSeverity;
-const int INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
+const int GLOG_INFO = 0, GLOG_WARNING = 1, GLOG_ERROR = 2, GLOG_FATAL = 3,
+ NUM_SEVERITIES = 4;
+#ifndef GLOG_NO_ABBREVIATED_SEVERITIES
+# ifdef ERROR
+# error ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail.
+# endif
+const int INFO = GLOG_INFO, WARNING = GLOG_WARNING,
+ ERROR = GLOG_ERROR, FATAL = GLOG_FATAL;
+#endif
// DFATAL is FATAL in debug mode, ERROR in normal mode
#ifdef NDEBUG
diff --git a/extern/libmv/third_party/glog/src/glog/logging.h b/extern/libmv/third_party/glog/src/glog/logging.h
index a58d478ab17..005649c17c2 100644
--- a/extern/libmv/third_party/glog/src/glog/logging.h
+++ b/extern/libmv/third_party/glog/src/glog/logging.h
@@ -33,7 +33,6 @@
// Pretty much everybody needs to #include this file so that they can
// log various happenings.
//
-
#ifndef _LOGGING_H_
#define _LOGGING_H_
@@ -80,7 +79,7 @@
#endif
#if 1
-#include "third_party/gflags/gflags.h"
+#include "third_party/gflags/gflags/gflags.h"
#endif
namespace google {
@@ -153,21 +152,21 @@ typedef unsigned __int64 uint64;
// You can also do occasional logging (log every n'th occurrence of an
// event):
//
-// LOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie";
+// LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
//
// The above will cause log messages to be output on the 1st, 11th, 21st, ...
-// times it is executed. Note that the special COUNTER value is used to
-// identify which repetition is happening.
+// times it is executed. Note that the special google::COUNTER value is used
+// to identify which repetition is happening.
//
// You can also do occasional conditional logging (log every n'th
// occurrence of an event, when condition is satisfied):
//
-// LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << COUNTER
+// LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
// << "th big cookie";
//
// You can log messages the first N times your code executes a line. E.g.
//
-// LOG_FIRST_N(INFO, 20) << "Got the " << COUNTER << "th cookie";
+// LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie";
//
// Outputs log messages for the first 20 times it is executed.
//
@@ -184,7 +183,7 @@ typedef unsigned __int64 uint64;
//
// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
//
-// DLOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie";
+// DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
//
// All "debug mode" logging is compiled away to nothing for non-debug mode
// compiles.
@@ -228,11 +227,11 @@ typedef unsigned __int64 uint64;
// "program with --v=1 or more";
// VLOG_EVERY_N(1, 10)
// << "I'm printed every 10th occurrence, and when you run the program "
-// "with --v=1 or more. Present occurence is " << COUNTER;
+// "with --v=1 or more. Present occurence is " << google::COUNTER;
// VLOG_IF_EVERY_N(1, (size > 1024), 10)
// << "I'm printed on every 10th occurence of case when size is more "
// " than 1024, when you run the program with --v=1 or more. ";
-// "Present occurence is " << COUNTER;
+// "Present occurence is " << google::COUNTER;
//
// The supported severity levels for macros that allow you to specify one
// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
@@ -369,7 +368,7 @@ DECLARE_bool(stop_logging_if_full_disk);
#define COMPACT_GOOGLE_LOG_INFO google::LogMessage( \
__FILE__, __LINE__)
#define LOG_TO_STRING_INFO(message) google::LogMessage( \
- __FILE__, __LINE__, google::INFO, message)
+ __FILE__, __LINE__, google::GLOG_INFO, message)
#else
#define COMPACT_GOOGLE_LOG_INFO google::NullStream()
#define LOG_TO_STRING_INFO(message) google::NullStream()
@@ -377,9 +376,9 @@ DECLARE_bool(stop_logging_if_full_disk);
#if GOOGLE_STRIP_LOG <= 1
#define COMPACT_GOOGLE_LOG_WARNING google::LogMessage( \
- __FILE__, __LINE__, google::WARNING)
+ __FILE__, __LINE__, google::GLOG_WARNING)
#define LOG_TO_STRING_WARNING(message) google::LogMessage( \
- __FILE__, __LINE__, google::WARNING, message)
+ __FILE__, __LINE__, google::GLOG_WARNING, message)
#else
#define COMPACT_GOOGLE_LOG_WARNING google::NullStream()
#define LOG_TO_STRING_WARNING(message) google::NullStream()
@@ -387,9 +386,9 @@ DECLARE_bool(stop_logging_if_full_disk);
#if GOOGLE_STRIP_LOG <= 2
#define COMPACT_GOOGLE_LOG_ERROR google::LogMessage( \
- __FILE__, __LINE__, google::ERROR)
+ __FILE__, __LINE__, google::GLOG_ERROR)
#define LOG_TO_STRING_ERROR(message) google::LogMessage( \
- __FILE__, __LINE__, google::ERROR, message)
+ __FILE__, __LINE__, google::GLOG_ERROR, message)
#else
#define COMPACT_GOOGLE_LOG_ERROR google::NullStream()
#define LOG_TO_STRING_ERROR(message) google::NullStream()
@@ -399,7 +398,7 @@ DECLARE_bool(stop_logging_if_full_disk);
#define COMPACT_GOOGLE_LOG_FATAL google::LogMessageFatal( \
__FILE__, __LINE__)
#define LOG_TO_STRING_FATAL(message) google::LogMessage( \
- __FILE__, __LINE__, google::FATAL, message)
+ __FILE__, __LINE__, google::GLOG_FATAL, message)
#else
#define COMPACT_GOOGLE_LOG_FATAL google::NullStreamFatal()
#define LOG_TO_STRING_FATAL(message) google::NullStreamFatal()
@@ -411,32 +410,32 @@ DECLARE_bool(stop_logging_if_full_disk);
#define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_ERROR
#elif GOOGLE_STRIP_LOG <= 3
#define COMPACT_GOOGLE_LOG_DFATAL google::LogMessage( \
- __FILE__, __LINE__, google::FATAL)
+ __FILE__, __LINE__, google::GLOG_FATAL)
#else
#define COMPACT_GOOGLE_LOG_DFATAL google::NullStreamFatal()
#endif
-#define GOOGLE_LOG_INFO(counter) google::LogMessage(__FILE__, __LINE__, google::INFO, counter, &google::LogMessage::SendToLog)
+#define GOOGLE_LOG_INFO(counter) google::LogMessage(__FILE__, __LINE__, google::GLOG_INFO, counter, &google::LogMessage::SendToLog)
#define SYSLOG_INFO(counter) \
- google::LogMessage(__FILE__, __LINE__, google::INFO, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_INFO, counter, \
&google::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_WARNING(counter) \
- google::LogMessage(__FILE__, __LINE__, google::WARNING, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_WARNING, counter, \
&google::LogMessage::SendToLog)
#define SYSLOG_WARNING(counter) \
- google::LogMessage(__FILE__, __LINE__, google::WARNING, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_WARNING, counter, \
&google::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_ERROR(counter) \
- google::LogMessage(__FILE__, __LINE__, google::ERROR, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, counter, \
&google::LogMessage::SendToLog)
#define SYSLOG_ERROR(counter) \
- google::LogMessage(__FILE__, __LINE__, google::ERROR, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, counter, \
&google::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_FATAL(counter) \
- google::LogMessage(__FILE__, __LINE__, google::FATAL, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_FATAL, counter, \
&google::LogMessage::SendToLog)
#define SYSLOG_FATAL(counter) \
- google::LogMessage(__FILE__, __LINE__, google::FATAL, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_FATAL, counter, \
&google::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_DFATAL(counter) \
google::LogMessage(__FILE__, __LINE__, google::DFATAL_LEVEL, counter, \
@@ -455,7 +454,7 @@ DECLARE_bool(stop_logging_if_full_disk);
FORMAT_MESSAGE_FROM_SYSTEM, \
0, result, 0, msg, 100, NULL); \
if (message_length > 0) { \
- google::LogMessage(__FILE__, __LINE__, ERROR, 0, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, 0, \
&google::LogMessage::SendToLog).stream() << message; \
LocalFree(message); \
} \
@@ -502,12 +501,12 @@ class LogSink; // defined below
#define LOG_TO_SINK(sink, severity) \
google::LogMessage( \
__FILE__, __LINE__, \
- google::severity, \
+ google::GLOG_ ## severity, \
static_cast<google::LogSink*>(sink), true).stream()
#define LOG_TO_SINK_BUT_NOT_TO_LOGFILE(sink, severity) \
google::LogMessage( \
__FILE__, __LINE__, \
- google::severity, \
+ google::GLOG_ ## severity, \
static_cast<google::LogSink*>(sink), false).stream()
// If a non-NULL string pointer is given, we write this message to that string.
@@ -772,7 +771,7 @@ DECLARE_CHECK_STROP_IMPL(strcasecmp, false)
#define GOOGLE_PLOG(severity, counter) \
google::ErrnoLogMessage( \
- __FILE__, __LINE__, google::severity, counter, \
+ __FILE__, __LINE__, google::GLOG_ ## severity, counter, \
&google::LogMessage::SendToLog)
#define PLOG_IF(severity, condition) \
@@ -811,7 +810,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \
if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
if (LOG_OCCURRENCES_MOD_N == 1) \
google::LogMessage( \
- __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
#define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
@@ -820,7 +819,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \
if (condition && \
((LOG_OCCURRENCES_MOD_N=(LOG_OCCURRENCES_MOD_N + 1) % n) == (1 % n))) \
google::LogMessage( \
- __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
#define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
@@ -829,7 +828,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \
if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
if (LOG_OCCURRENCES_MOD_N == 1) \
google::ErrnoLogMessage( \
- __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
#define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
@@ -838,7 +837,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \
++LOG_OCCURRENCES; \
if (LOG_OCCURRENCES <= n) \
google::LogMessage( \
- __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
namespace glog_internal_namespace_ {
@@ -852,7 +851,7 @@ struct CrashReason;
typedef google::glog_internal_namespace_::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
#define LOG_EVERY_N(severity, n) \
- GOOGLE_GLOG_COMPILE_ASSERT(google::severity < \
+ 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)
@@ -872,6 +871,27 @@ struct CrashReason;
// We want the special COUNTER value available for LOG_EVERY_X()'ed messages
enum PRIVATE_Counter {COUNTER};
+#ifdef GLOG_NO_ABBREVIATED_SEVERITIES
+// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
+// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
+// to keep using this syntax, we define this macro to do the same thing
+// as COMPACT_GOOGLE_LOG_ERROR.
+#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR
+#define SYSLOG_0 SYSLOG_ERROR
+#define LOG_TO_STRING_0 LOG_TO_STRING_ERROR
+// Needed for LOG_IS_ON(ERROR).
+const LogSeverity GLOG_0 = GLOG_ERROR;
+#else
+// Users may include windows.h after logging.h without
+// GLOG_NO_ABBREVIATED_SEVERITIES nor WIN32_LEAN_AND_MEAN.
+// For this case, we cannot detect if ERROR is defined before users
+// actually use ERROR. Let's make an undefined symbol to warn users.
+# define GLOG_ERROR_MSG ERROR_macro_is_defined_Define_GLOG_NO_ABBREVIATED_SEVERITIES_before_including_logging_h_See_the_document_for_detail
+# define COMPACT_GOOGLE_LOG_0 GLOG_ERROR_MSG
+# define SYSLOG_0 GLOG_ERROR_MSG
+# define LOG_TO_STRING_0 GLOG_ERROR_MSG
+# define GLOG_0 GLOG_ERROR_MSG
+#endif
// Plus some debug-logging macros that get compiled to nothing for production
@@ -1016,14 +1036,14 @@ public:
# pragma warning(default: 4275)
#endif
public:
- LogStream(char *buf, int len, int ctr)
+ LogStream(char *buf, int len, int ctr_in)
: ostrstream(buf, len),
- ctr_(ctr) {
+ ctr_(ctr_in) {
self_ = this;
}
int ctr() const { return ctr_; }
- void set_ctr(int ctr) { ctr_ = ctr; }
+ void set_ctr(int ctr_in) { ctr_ = ctr_in; }
LogStream* self() const { return self_; }
private:
@@ -1465,7 +1485,7 @@ class GOOGLE_GLOG_DLL_DECL NullStream : public LogMessage::LogStream {
// converted to LogStream and the message will be computed and then
// quietly discarded.
template<class T>
-inline NullStream& operator<<(NullStream &str, const T &value) { return str; }
+inline NullStream& operator<<(NullStream &str, const T &) { return str; }
// Similar to NullStream, but aborts the program (without stack
// trace), like LogMessageFatal.
diff --git a/extern/libmv/third_party/glog/src/glog/raw_logging.h b/extern/libmv/third_party/glog/src/glog/raw_logging.h
index 9e9b3772f3b..65278f62803 100644
--- a/extern/libmv/third_party/glog/src/glog/raw_logging.h
+++ b/extern/libmv/third_party/glog/src/glog/raw_logging.h
@@ -68,7 +68,7 @@ namespace google {
// I0821 211317 file.cc:142] RAW: status is 20
#define RAW_LOG(severity, ...) \
do { \
- switch (google::severity) { \
+ switch (google::GLOG_ ## severity) { \
case 0: \
RAW_LOG_INFO(__VA_ARGS__); \
break; \
@@ -100,28 +100,28 @@ namespace google {
#endif // STRIP_LOG == 0
#if STRIP_LOG == 0
-#define RAW_LOG_INFO(...) google::RawLog__(google::INFO, \
+#define RAW_LOG_INFO(...) google::RawLog__(google::GLOG_INFO, \
__FILE__, __LINE__, __VA_ARGS__)
#else
#define RAW_LOG_INFO(...) google::RawLogStub__(0, __VA_ARGS__)
#endif // STRIP_LOG == 0
#if STRIP_LOG <= 1
-#define RAW_LOG_WARNING(...) google::RawLog__(google::WARNING, \
+#define RAW_LOG_WARNING(...) google::RawLog__(google::GLOG_WARNING, \
__FILE__, __LINE__, __VA_ARGS__)
#else
#define RAW_LOG_WARNING(...) google::RawLogStub__(0, __VA_ARGS__)
#endif // STRIP_LOG <= 1
#if STRIP_LOG <= 2
-#define RAW_LOG_ERROR(...) google::RawLog__(google::ERROR, \
+#define RAW_LOG_ERROR(...) google::RawLog__(google::GLOG_ERROR, \
__FILE__, __LINE__, __VA_ARGS__)
#else
#define RAW_LOG_ERROR(...) google::RawLogStub__(0, __VA_ARGS__)
#endif // STRIP_LOG <= 2
#if STRIP_LOG <= 3
-#define RAW_LOG_FATAL(...) google::RawLog__(google::FATAL, \
+#define RAW_LOG_FATAL(...) google::RawLog__(google::GLOG_FATAL, \
__FILE__, __LINE__, __VA_ARGS__)
#else
#define RAW_LOG_FATAL(...) \
@@ -162,7 +162,7 @@ namespace google {
// Stub log function used to work around for unused variable warnings when
// building with STRIP_LOG > 0.
-static inline void RawLogStub__(int ignored, ...) {
+static inline void RawLogStub__(int /* ignored */, ...) {
}
// Helper function to implement RAW_LOG and RAW_VLOG
diff --git a/extern/libmv/third_party/glog/src/logging.cc b/extern/libmv/third_party/glog/src/logging.cc
index 1bb3867aa10..bf4d85be5b3 100644
--- a/extern/libmv/third_party/glog/src/logging.cc
+++ b/extern/libmv/third_party/glog/src/logging.cc
@@ -111,7 +111,7 @@ _END_GOOGLE_NAMESPACE_
// The default is ERROR instead of FATAL so that users can see problems
// when they run a program without having to look in another file.
DEFINE_int32(stderrthreshold,
- GOOGLE_NAMESPACE::ERROR,
+ GOOGLE_NAMESPACE::GLOG_ERROR,
"log messages at or above this level are copied to stderr in "
"addition to logfiles. This flag obsoletes --alsologtostderr.");
@@ -311,8 +311,10 @@ class LogDestination {
static const int kNetworkBytes = 1400;
static const string& hostname();
- private:
+ static void DeleteLogDestinations();
+
+ private:
LogDestination(LogSeverity severity, const char* base_filename);
~LogDestination() { }
@@ -503,7 +505,7 @@ inline void LogDestination::SetEmailLogging(LogSeverity min_severity,
static void WriteToStderr(const char* message, size_t len) {
// Avoid using cerr from this module since we may get called during
// exit code, and cerr may be partially or fully destroyed by then.
- write(STDERR_FILENO, message, len);
+ fwrite(message, len, 1, stderr);
}
inline void LogDestination::MaybeLogToStderr(LogSeverity severity,
@@ -607,6 +609,13 @@ inline LogDestination* LogDestination::log_destination(LogSeverity severity) {
return log_destinations_[severity];
}
+void LogDestination::DeleteLogDestinations() {
+ for (int severity = 0; severity < NUM_SEVERITIES; ++severity) {
+ delete log_destinations_[severity];
+ log_destinations_[severity] = NULL;
+ }
+}
+
namespace {
LogFileObject::LogFileObject(LogSeverity severity,
@@ -719,14 +728,18 @@ bool LogFileObject::CreateLogfile(const char* time_pid_string) {
// Make the symlink be relative (in the same dir) so that if the
// entire log directory gets relocated the link is still valid.
const char *linkdest = slash ? (slash + 1) : filename;
- symlink(linkdest, linkpath.c_str()); // silently ignore failures
+ if (symlink(linkdest, linkpath.c_str()) != 0) {
+ // silently ignore failures
+ }
// Make an additional link to the log file in a place specified by
// FLAGS_log_link, if indicated
if (!FLAGS_log_link.empty()) {
linkpath = FLAGS_log_link + "/" + linkname;
unlink(linkpath.c_str()); // delete old one if it exists
- symlink(filename, linkpath.c_str()); // silently ignore failures
+ if (symlink(filename, linkpath.c_str()) != 0) {
+ // silently ignore failures
+ }
}
#endif
}
@@ -745,7 +758,8 @@ void LogFileObject::Write(bool force_flush,
return;
}
- if (static_cast<int>(file_length_ >> 20) >= MaxLogSize()) {
+ if (static_cast<int>(file_length_ >> 20) >= MaxLogSize() ||
+ PidHasChanged()) {
if (file_ != NULL) fclose(file_);
file_ = NULL;
file_length_ = bytes_since_flush_ = 0;
@@ -936,12 +950,12 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
LogMessage::LogMessage(const char* file, int line,
const CheckOpString& result) {
- Init(file, line, FATAL, &LogMessage::SendToLog);
+ Init(file, line, GLOG_FATAL, &LogMessage::SendToLog);
stream() << "Check failed: " << (*result.str_) << " ";
}
LogMessage::LogMessage(const char* file, int line) {
- Init(file, line, INFO, &LogMessage::SendToLog);
+ Init(file, line, GLOG_INFO, &LogMessage::SendToLog);
}
LogMessage::LogMessage(const char* file, int line, LogSeverity severity) {
@@ -972,7 +986,7 @@ void LogMessage::Init(const char* file,
LogSeverity severity,
void (LogMessage::*send_method)()) {
allocated_ = NULL;
- if (severity != FATAL || !exit_on_dfatal) {
+ if (severity != GLOG_FATAL || !exit_on_dfatal) {
allocated_ = new LogMessageData();
data_ = allocated_;
data_->buf_ = new char[kMaxLogMessageLen+1];
@@ -1123,7 +1137,7 @@ void ReprintFatalMessage() {
// Also write to stderr
WriteToStderr(fatal_message, n);
}
- LogDestination::LogToAllLogfiles(ERROR, fatal_time, fatal_message, n);
+ LogDestination::LogToAllLogfiles(GLOG_ERROR, fatal_time, fatal_message, n);
}
}
@@ -1181,7 +1195,7 @@ void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
// If we log a FATAL message, flush all the log destinations, then toss
// a signal for others to catch. We leave the logs in a state that
// someone else can use them (as long as they flush afterwards)
- if (data_->severity_ == FATAL && exit_on_dfatal) {
+ if (data_->severity_ == GLOG_FATAL && exit_on_dfatal) {
if (data_->first_fatal_) {
// Store crash information so that it is accessible from within signal
// handlers that may be invoked later.
@@ -1212,7 +1226,9 @@ void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
LogDestination::WaitForSinks(data_);
const char* message = "*** Check failure stack trace: ***\n";
- write(STDERR_FILENO, message, strlen(message));
+ if (write(STDERR_FILENO, message, strlen(message)) < 0) {
+ // Ignore errors.
+ }
Fail();
}
}
@@ -1231,27 +1247,31 @@ void LogMessage::RecordCrashReason(
#endif
}
+#ifdef HAVE___ATTRIBUTE__
+# define ATTRIBUTE_NORETURN __attribute__((noreturn))
+#else
+# define ATTRIBUTE_NORETURN
+#endif
+
+static void logging_fail() ATTRIBUTE_NORETURN;
+
static void logging_fail() {
-// #if defined(_DEBUG) && defined(_MSC_VER)
-// doesn't work for my laptop (sergey)
-#if 0
+#if defined(_DEBUG) && defined(_MSC_VER)
// When debugging on windows, avoid the obnoxious dialog and make
// it possible to continue past a LOG(FATAL) in the debugger
- _asm int 3
+ __debugbreak();
#else
abort();
#endif
}
-#ifdef HAVE___ATTRIBUTE__
+typedef void (*logging_fail_func_t)() ATTRIBUTE_NORETURN;
+
GOOGLE_GLOG_DLL_DECL
-void (*g_logging_fail_func)() __attribute__((noreturn)) = &logging_fail;
-#else
-GOOGLE_GLOG_DLL_DECL void (*g_logging_fail_func)() = &logging_fail;
-#endif
+logging_fail_func_t g_logging_fail_func = &logging_fail;
void InstallFailureFunction(void (*fail_func)()) {
- g_logging_fail_func = fail_func;
+ g_logging_fail_func = (logging_fail_func_t)fail_func;
}
void LogMessage::Fail() {
@@ -1544,7 +1564,7 @@ static void GetTempDirectories(vector<string>* list) {
"/tmp",
};
- for (int i = 0; i < ARRAYSIZE(candidates); i++) {
+ for (size_t i = 0; i < ARRAYSIZE(candidates); i++) {
const char *d = candidates[i];
if (!d) continue; // Empty env var
@@ -1631,9 +1651,9 @@ void TruncateLogFile(const char *path, int64 limit, int64 keep) {
// rather scary.
// Instead just truncate the file to something we can manage
if (truncate(path, 0) == -1) {
- PLOG(ERROR) << "Unable to truncate " << path;
+ PLOG(ERROR) << "Unable to truncate " << path;
} else {
- LOG(ERROR) << "Truncated " << path << " due to EFBIG error";
+ LOG(ERROR) << "Truncated " << path << " due to EFBIG error";
}
} else {
PLOG(ERROR) << "Unable to open " << path;
@@ -1769,7 +1789,7 @@ int posix_strerror_r(int err, char *buf, size_t len) {
}
LogMessageFatal::LogMessageFatal(const char* file, int line) :
- LogMessage(file, line, FATAL) {}
+ LogMessage(file, line, GLOG_FATAL) {}
LogMessageFatal::LogMessageFatal(const char* file, int line,
const CheckOpString& result) :
@@ -1780,4 +1800,15 @@ LogMessageFatal::~LogMessageFatal() {
LogMessage::Fail();
}
+void InitGoogleLogging(const char* argv0) {
+ glog_internal_namespace_::InitGoogleLoggingUtilities(argv0);
+}
+
+void ShutdownGoogleLogging() {
+ glog_internal_namespace_::ShutdownGoogleLoggingUtilities();
+ LogDestination::DeleteLogDestinations();
+ delete logging_directories_list;
+ logging_directories_list = NULL;
+}
+
_END_GOOGLE_NAMESPACE_
diff --git a/extern/libmv/third_party/glog/src/raw_logging.cc b/extern/libmv/third_party/glog/src/raw_logging.cc
index b179a1eded4..42676cba5de 100644
--- a/extern/libmv/third_party/glog/src/raw_logging.cc
+++ b/extern/libmv/third_party/glog/src/raw_logging.cc
@@ -151,7 +151,7 @@ void RawLog__(LogSeverity severity, const char* file, int line,
// libc (to side-step any libc interception).
// We write just once to avoid races with other invocations of RawLog__.
safe_write(STDERR_FILENO, buffer, strlen(buffer));
- if (severity == FATAL) {
+ if (severity == GLOG_FATAL) {
if (!sync_val_compare_and_swap(&crashed, false, true)) {
crash_reason.filename = file;
crash_reason.line_number = line;
diff --git a/extern/libmv/third_party/glog/src/signalhandler.cc b/extern/libmv/third_party/glog/src/signalhandler.cc
index 9fc91b3390d..e95e9e97274 100644
--- a/extern/libmv/third_party/glog/src/signalhandler.cc
+++ b/extern/libmv/third_party/glog/src/signalhandler.cc
@@ -34,7 +34,7 @@
#include "utilities.h"
#include "stacktrace.h"
#include "symbolize.h"
-#include "glog/logging.h"
+#include <glog/logging.h>
#include <signal.h>
#include <time.h>
@@ -142,7 +142,9 @@ class MinimalFormatter {
// Writes the given data with the size to the standard error.
void WriteToStderr(const char* data, int size) {
- write(STDERR_FILENO, data, size);
+ if (write(STDERR_FILENO, data, size) < 0) {
+ // Ignore errors.
+ }
}
// The writer function can be changed by InstallFailureWriter().
@@ -167,7 +169,7 @@ void DumpTimeInfo() {
void DumpSignalInfo(int signal_number, siginfo_t *siginfo) {
// Get the signal name.
const char* signal_name = NULL;
- for (int i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
+ for (size_t i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
if (signal_number == kFailureSignals[i].number) {
signal_name = kFailureSignals[i].name;
}
@@ -336,7 +338,7 @@ void InstallFailureSignalHandler() {
sig_action.sa_flags |= SA_SIGINFO;
sig_action.sa_sigaction = &FailureSignalHandler;
- for (int i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
+ for (size_t i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
CHECK_ERR(sigaction(kFailureSignals[i].number, &sig_action, NULL));
}
}
diff --git a/extern/libmv/third_party/glog/src/stacktrace_libunwind-inl.h b/extern/libmv/third_party/glog/src/stacktrace_libunwind-inl.h
index 0dc14c6506e..46002c1b019 100644
--- a/extern/libmv/third_party/glog/src/stacktrace_libunwind-inl.h
+++ b/extern/libmv/third_party/glog/src/stacktrace_libunwind-inl.h
@@ -37,7 +37,7 @@ extern "C" {
#define UNW_LOCAL_ONLY
#include <libunwind.h>
}
-#include "glog/raw_logging.h"
+#include <glog/raw_logging.h>
#include "stacktrace.h"
_START_GOOGLE_NAMESPACE_
diff --git a/extern/libmv/third_party/glog/src/stacktrace_x86_64-inl.h b/extern/libmv/third_party/glog/src/stacktrace_x86_64-inl.h
index e3729e1fd39..f7d1dca85bc 100644
--- a/extern/libmv/third_party/glog/src/stacktrace_x86_64-inl.h
+++ b/extern/libmv/third_party/glog/src/stacktrace_x86_64-inl.h
@@ -33,10 +33,6 @@
extern "C" {
#include <stdlib.h> // for NULL
-#if defined(__FreeBSD__)
-/* devel/libunwind only includes _Unwind_Backtrace if this is set */
-#define _GNU_SOURCE 1
-#endif
#include <unwind.h> // ABI defined unwinder
}
#include "stacktrace.h"
diff --git a/extern/libmv/third_party/glog/src/symbolize.cc b/extern/libmv/third_party/glog/src/symbolize.cc
index 3465de6c6fe..d1831e4ea79 100644
--- a/extern/libmv/third_party/glog/src/symbolize.cc
+++ b/extern/libmv/third_party/glog/src/symbolize.cc
@@ -82,8 +82,8 @@ static ATTRIBUTE_NOINLINE void DemangleInplace(char *out, int out_size) {
char demangled[256]; // Big enough for sane demangled symbols.
if (Demangle(out, demangled, sizeof(demangled))) {
// Demangling succeeded. Copy to out if the space allows.
- int len = strlen(demangled);
- if (len + 1 <= out_size) { // +1 for '\0'.
+ size_t len = strlen(demangled);
+ if (len + 1 <= (size_t)out_size) { // +1 for '\0'.
SAFE_ASSERT(len < sizeof(demangled));
memmove(out, demangled, len + 1);
}
@@ -111,7 +111,7 @@ _END_GOOGLE_NAMESPACE_
#include "symbolize.h"
#include "config.h"
-#include "glog/raw_logging.h"
+#include <glog/raw_logging.h>
// Re-runs fn until it doesn't cause EINTR.
#define NO_INTR(fn) do {} while ((fn) < 0 && errno == EINTR)
@@ -637,7 +637,7 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
int out_size) {
Dl_info info;
if (dladdr(pc, &info)) {
- if (strlen(info.dli_sname) < out_size) {
+ if ((int)strlen(info.dli_sname) < out_size) {
strcpy(out, info.dli_sname);
// Symbolization succeeded. Now we try to demangle the symbol.
DemangleInplace(out, out_size);
diff --git a/extern/libmv/third_party/glog/src/symbolize.h b/extern/libmv/third_party/glog/src/symbolize.h
index 1ebe4dd94a2..04e482bc315 100644
--- a/extern/libmv/third_party/glog/src/symbolize.h
+++ b/extern/libmv/third_party/glog/src/symbolize.h
@@ -56,7 +56,7 @@
#include "utilities.h"
#include "config.h"
-#include "glog/logging.h"
+#include <glog/logging.h>
#ifdef HAVE_SYMBOLIZE
diff --git a/extern/libmv/third_party/glog/src/utilities.cc b/extern/libmv/third_party/glog/src/utilities.cc
index 6d64b923703..27b2a905055 100644
--- a/extern/libmv/third_party/glog/src/utilities.cc
+++ b/extern/libmv/third_party/glog/src/utilities.cc
@@ -77,9 +77,11 @@ typedef void DebugWriter(const char*, void*);
// For some environments, add two extra bytes for the leading "0x".
static const int kPrintfPointerFieldWidth = 2 + 2 * sizeof(void*);
-static void DebugWriteToStderr(const char* data, void *unused) {
+static void DebugWriteToStderr(const char* data, void *) {
// This one is signal-safe.
- write(STDERR_FILENO, data, strlen(data));
+ if (write(STDERR_FILENO, data, strlen(data)) < 0) {
+ // Ignore errors.
+ }
}
void DebugWriteToString(const char* data, void *arg) {
@@ -221,9 +223,18 @@ int32 GetMainThreadPid() {
return g_main_thread_pid;
}
+bool PidHasChanged() {
+ int32 pid = getpid();
+ if (g_main_thread_pid == pid) {
+ return false;
+ }
+ g_main_thread_pid = pid;
+ return true;
+}
+
pid_t GetTID() {
// On Linux and FreeBSD, we try to use gettid().
-#if defined OS_LINUX || defined OS_MACOSX
+#if defined OS_LINUX || defined OS_FREEBSD || defined OS_MACOSX
#ifndef __NR_gettid
#ifdef OS_MACOSX
#define __NR_gettid SYS_gettid
@@ -302,9 +313,7 @@ void SetCrashReason(const CrashReason* r) {
r);
}
-} // namespace glog_internal_namespace_
-
-void InitGoogleLogging(const char* argv0) {
+void InitGoogleLoggingUtilities(const char* argv0) {
CHECK(!IsGoogleLoggingInitialized())
<< "You called InitGoogleLogging() twice!";
const char* slash = strrchr(argv0, '/');
@@ -319,14 +328,16 @@ void InitGoogleLogging(const char* argv0) {
#endif
}
-void ShutdownGoogleLogging() {
+void ShutdownGoogleLoggingUtilities() {
CHECK(IsGoogleLoggingInitialized())
- << "You called ShutdownGoogleLogging() without InitGoogleLogging() first!";
+ << "You called ShutdownGoogleLogging() without calling InitGoogleLogging() first!";
#ifdef HAVE_SYSLOG_H
closelog();
#endif
}
+} // namespace glog_internal_namespace_
+
_END_GOOGLE_NAMESPACE_
// Make an implementation of stacktrace compiled.
diff --git a/extern/libmv/third_party/glog/src/utilities.h b/extern/libmv/third_party/glog/src/utilities.h
index bbb0eb0746c..c8215b73f33 100644
--- a/extern/libmv/third_party/glog/src/utilities.h
+++ b/extern/libmv/third_party/glog/src/utilities.h
@@ -161,6 +161,7 @@ typedef double WallTime;
WallTime WallTime_Now();
int32 GetMainThreadPid();
+bool PidHasChanged();
pid_t GetTID();
@@ -215,6 +216,9 @@ struct CrashReason {
void SetCrashReason(const CrashReason* r);
+void InitGoogleLoggingUtilities(const char* argv0);
+void ShutdownGoogleLoggingUtilities();
+
} // namespace glog_internal_namespace_
_END_GOOGLE_NAMESPACE_
diff --git a/extern/libmv/third_party/glog/src/vlog_is_on.cc b/extern/libmv/third_party/glog/src/vlog_is_on.cc
index ed88514dce5..5eefc96324a 100644
--- a/extern/libmv/third_party/glog/src/vlog_is_on.cc
+++ b/extern/libmv/third_party/glog/src/vlog_is_on.cc
@@ -70,8 +70,8 @@ GOOGLE_GLOG_DLL_DECL bool SafeFNMatch_(const char* pattern,
size_t patt_len,
const char* str,
size_t str_len) {
- int p = 0;
- int s = 0;
+ size_t p = 0;
+ size_t s = 0;
while (1) {
if (p == patt_len && s == str_len) return true;
if (p == patt_len) return false;
@@ -211,7 +211,7 @@ bool InitVLOG3__(int32** site_flag, int32* site_default,
const char* base = strrchr(fname, '/');
base = base ? (base+1) : fname;
const char* base_end = strchr(base, '.');
- size_t base_length = base_end ? (base_end - base) : strlen(base);
+ size_t base_length = base_end ? size_t(base_end - base) : strlen(base);
// Trim out trailing "-inl" if any
if (base_length >= 4 && (memcmp(base+base_length-4, "-inl", 4) == 0)) {
diff --git a/extern/libmv/third_party/glog/src/windows/glog/log_severity.h b/extern/libmv/third_party/glog/src/windows/glog/log_severity.h
index 5e7d09effb2..22a4191ab8b 100644
--- a/extern/libmv/third_party/glog/src/windows/glog/log_severity.h
+++ b/extern/libmv/third_party/glog/src/windows/glog/log_severity.h
@@ -48,7 +48,15 @@
// you ever need to change their values or add a new severity.
typedef int LogSeverity;
-const int INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
+const int GLOG_INFO = 0, GLOG_WARNING = 1, GLOG_ERROR = 2, GLOG_FATAL = 3,
+ NUM_SEVERITIES = 4;
+#ifndef GLOG_NO_ABBREVIATED_SEVERITIES
+# ifdef ERROR
+# error ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail.
+# endif
+const int INFO = GLOG_INFO, WARNING = GLOG_WARNING,
+ ERROR = GLOG_ERROR, FATAL = GLOG_FATAL;
+#endif
// DFATAL is FATAL in debug mode, ERROR in normal mode
#ifdef NDEBUG
diff --git a/extern/libmv/third_party/glog/src/windows/glog/logging.h b/extern/libmv/third_party/glog/src/windows/glog/logging.h
index 2f41681edbe..f623cd9e793 100644
--- a/extern/libmv/third_party/glog/src/windows/glog/logging.h
+++ b/extern/libmv/third_party/glog/src/windows/glog/logging.h
@@ -83,7 +83,7 @@
#endif
#if 1
-#include "third_party/gflags/gflags.h"
+#include "third_party/gflags/gflags/gflags.h"
#endif
#ifdef __MINGW32__
@@ -170,21 +170,21 @@ typedef uint64_t uint64;
// You can also do occasional logging (log every n'th occurrence of an
// event):
//
-// LOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie";
+// LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
//
// The above will cause log messages to be output on the 1st, 11th, 21st, ...
-// times it is executed. Note that the special COUNTER value is used to
-// identify which repetition is happening.
+// times it is executed. Note that the special google::COUNTER value is used
+// to identify which repetition is happening.
//
// You can also do occasional conditional logging (log every n'th
// occurrence of an event, when condition is satisfied):
//
-// LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << COUNTER
+// LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
// << "th big cookie";
//
// You can log messages the first N times your code executes a line. E.g.
//
-// LOG_FIRST_N(INFO, 20) << "Got the " << COUNTER << "th cookie";
+// LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie";
//
// Outputs log messages for the first 20 times it is executed.
//
@@ -201,7 +201,7 @@ typedef uint64_t uint64;
//
// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
//
-// DLOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie";
+// DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
//
// All "debug mode" logging is compiled away to nothing for non-debug mode
// compiles.
@@ -245,11 +245,11 @@ typedef uint64_t uint64;
// "program with --v=1 or more";
// VLOG_EVERY_N(1, 10)
// << "I'm printed every 10th occurrence, and when you run the program "
-// "with --v=1 or more. Present occurence is " << COUNTER;
+// "with --v=1 or more. Present occurence is " << google::COUNTER;
// VLOG_IF_EVERY_N(1, (size > 1024), 10)
// << "I'm printed on every 10th occurence of case when size is more "
// " than 1024, when you run the program with --v=1 or more. ";
-// "Present occurence is " << COUNTER;
+// "Present occurence is " << google::COUNTER;
//
// The supported severity levels for macros that allow you to specify one
// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
@@ -386,7 +386,7 @@ DECLARE_bool(stop_logging_if_full_disk);
#define COMPACT_GOOGLE_LOG_INFO google::LogMessage( \
__FILE__, __LINE__)
#define LOG_TO_STRING_INFO(message) google::LogMessage( \
- __FILE__, __LINE__, google::INFO, message)
+ __FILE__, __LINE__, google::GLOG_INFO, message)
#else
#define COMPACT_GOOGLE_LOG_INFO google::NullStream()
#define LOG_TO_STRING_INFO(message) google::NullStream()
@@ -394,9 +394,9 @@ DECLARE_bool(stop_logging_if_full_disk);
#if GOOGLE_STRIP_LOG <= 1
#define COMPACT_GOOGLE_LOG_WARNING google::LogMessage( \
- __FILE__, __LINE__, google::WARNING)
+ __FILE__, __LINE__, google::GLOG_WARNING)
#define LOG_TO_STRING_WARNING(message) google::LogMessage( \
- __FILE__, __LINE__, google::WARNING, message)
+ __FILE__, __LINE__, google::GLOG_WARNING, message)
#else
#define COMPACT_GOOGLE_LOG_WARNING google::NullStream()
#define LOG_TO_STRING_WARNING(message) google::NullStream()
@@ -404,9 +404,9 @@ DECLARE_bool(stop_logging_if_full_disk);
#if GOOGLE_STRIP_LOG <= 2
#define COMPACT_GOOGLE_LOG_ERROR google::LogMessage( \
- __FILE__, __LINE__, google::ERROR)
+ __FILE__, __LINE__, google::GLOG_ERROR)
#define LOG_TO_STRING_ERROR(message) google::LogMessage( \
- __FILE__, __LINE__, google::ERROR, message)
+ __FILE__, __LINE__, google::GLOG_ERROR, message)
#else
#define COMPACT_GOOGLE_LOG_ERROR google::NullStream()
#define LOG_TO_STRING_ERROR(message) google::NullStream()
@@ -416,7 +416,7 @@ DECLARE_bool(stop_logging_if_full_disk);
#define COMPACT_GOOGLE_LOG_FATAL google::LogMessageFatal( \
__FILE__, __LINE__)
#define LOG_TO_STRING_FATAL(message) google::LogMessage( \
- __FILE__, __LINE__, google::FATAL, message)
+ __FILE__, __LINE__, google::GLOG_FATAL, message)
#else
#define COMPACT_GOOGLE_LOG_FATAL google::NullStreamFatal()
#define LOG_TO_STRING_FATAL(message) google::NullStreamFatal()
@@ -428,32 +428,32 @@ DECLARE_bool(stop_logging_if_full_disk);
#define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_ERROR
#elif GOOGLE_STRIP_LOG <= 3
#define COMPACT_GOOGLE_LOG_DFATAL google::LogMessage( \
- __FILE__, __LINE__, google::FATAL)
+ __FILE__, __LINE__, google::GLOG_FATAL)
#else
#define COMPACT_GOOGLE_LOG_DFATAL google::NullStreamFatal()
#endif
-#define GOOGLE_LOG_INFO(counter) google::LogMessage(__FILE__, __LINE__, google::INFO, counter, &google::LogMessage::SendToLog)
+#define GOOGLE_LOG_INFO(counter) google::LogMessage(__FILE__, __LINE__, google::GLOG_INFO, counter, &google::LogMessage::SendToLog)
#define SYSLOG_INFO(counter) \
- google::LogMessage(__FILE__, __LINE__, google::INFO, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_INFO, counter, \
&google::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_WARNING(counter) \
- google::LogMessage(__FILE__, __LINE__, google::WARNING, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_WARNING, counter, \
&google::LogMessage::SendToLog)
#define SYSLOG_WARNING(counter) \
- google::LogMessage(__FILE__, __LINE__, google::WARNING, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_WARNING, counter, \
&google::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_ERROR(counter) \
- google::LogMessage(__FILE__, __LINE__, google::ERROR, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, counter, \
&google::LogMessage::SendToLog)
#define SYSLOG_ERROR(counter) \
- google::LogMessage(__FILE__, __LINE__, google::ERROR, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, counter, \
&google::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_FATAL(counter) \
- google::LogMessage(__FILE__, __LINE__, google::FATAL, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_FATAL, counter, \
&google::LogMessage::SendToLog)
#define SYSLOG_FATAL(counter) \
- google::LogMessage(__FILE__, __LINE__, google::FATAL, counter, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_FATAL, counter, \
&google::LogMessage::SendToSyslogAndLog)
#define GOOGLE_LOG_DFATAL(counter) \
google::LogMessage(__FILE__, __LINE__, google::DFATAL_LEVEL, counter, \
@@ -472,7 +472,7 @@ DECLARE_bool(stop_logging_if_full_disk);
FORMAT_MESSAGE_FROM_SYSTEM, \
0, result, 0, msg, 100, NULL); \
if (message_length > 0) { \
- google::LogMessage(__FILE__, __LINE__, ERROR, 0, \
+ google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, 0, \
&google::LogMessage::SendToLog).stream() << message; \
LocalFree(message); \
} \
@@ -519,12 +519,12 @@ class LogSink; // defined below
#define LOG_TO_SINK(sink, severity) \
google::LogMessage( \
__FILE__, __LINE__, \
- google::severity, \
+ google::GLOG_ ## severity, \
static_cast<google::LogSink*>(sink), true).stream()
#define LOG_TO_SINK_BUT_NOT_TO_LOGFILE(sink, severity) \
google::LogMessage( \
__FILE__, __LINE__, \
- google::severity, \
+ google::GLOG_ ## severity, \
static_cast<google::LogSink*>(sink), false).stream()
// If a non-NULL string pointer is given, we write this message to that string.
@@ -789,7 +789,7 @@ DECLARE_CHECK_STROP_IMPL(strcasecmp, false)
#define GOOGLE_PLOG(severity, counter) \
google::ErrnoLogMessage( \
- __FILE__, __LINE__, google::severity, counter, \
+ __FILE__, __LINE__, google::GLOG_ ## severity, counter, \
&google::LogMessage::SendToLog)
#define PLOG_IF(severity, condition) \
@@ -828,7 +828,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \
if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
if (LOG_OCCURRENCES_MOD_N == 1) \
google::LogMessage( \
- __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
#define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
@@ -837,7 +837,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \
if (condition && \
((LOG_OCCURRENCES_MOD_N=(LOG_OCCURRENCES_MOD_N + 1) % n) == (1 % n))) \
google::LogMessage( \
- __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
#define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
@@ -846,7 +846,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \
if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
if (LOG_OCCURRENCES_MOD_N == 1) \
google::ErrnoLogMessage( \
- __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
#define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
@@ -855,7 +855,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \
++LOG_OCCURRENCES; \
if (LOG_OCCURRENCES <= n) \
google::LogMessage( \
- __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+ __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
&what_to_do).stream()
namespace glog_internal_namespace_ {
@@ -869,7 +869,7 @@ struct CrashReason;
typedef google::glog_internal_namespace_::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
#define LOG_EVERY_N(severity, n) \
- GOOGLE_GLOG_COMPILE_ASSERT(google::severity < \
+ 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)
@@ -889,6 +889,27 @@ struct CrashReason;
// We want the special COUNTER value available for LOG_EVERY_X()'ed messages
enum PRIVATE_Counter {COUNTER};
+#ifdef GLOG_NO_ABBREVIATED_SEVERITIES
+// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
+// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
+// to keep using this syntax, we define this macro to do the same thing
+// as COMPACT_GOOGLE_LOG_ERROR.
+#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR
+#define SYSLOG_0 SYSLOG_ERROR
+#define LOG_TO_STRING_0 LOG_TO_STRING_ERROR
+// Needed for LOG_IS_ON(ERROR).
+const LogSeverity GLOG_0 = GLOG_ERROR;
+#else
+// Users may include windows.h after logging.h without
+// GLOG_NO_ABBREVIATED_SEVERITIES nor WIN32_LEAN_AND_MEAN.
+// For this case, we cannot detect if ERROR is defined before users
+// actually use ERROR. Let's make an undefined symbol to warn users.
+# define GLOG_ERROR_MSG ERROR_macro_is_defined_Define_GLOG_NO_ABBREVIATED_SEVERITIES_before_including_logging_h_See_the_document_for_detail
+# define COMPACT_GOOGLE_LOG_0 GLOG_ERROR_MSG
+# define SYSLOG_0 GLOG_ERROR_MSG
+# define LOG_TO_STRING_0 GLOG_ERROR_MSG
+# define GLOG_0 GLOG_ERROR_MSG
+#endif
// Plus some debug-logging macros that get compiled to nothing for production
@@ -1033,14 +1054,14 @@ public:
# pragma warning(default: 4275)
#endif
public:
- LogStream(char *buf, int len, int ctr)
+ LogStream(char *buf, int len, int ctr_in)
: ostrstream(buf, len),
- ctr_(ctr) {
+ ctr_(ctr_in) {
self_ = this;
}
int ctr() const { return ctr_; }
- void set_ctr(int ctr) { ctr_ = ctr; }
+ void set_ctr(int ctr_in) { ctr_ = ctr_in; }
LogStream* self() const { return self_; }
private:
@@ -1482,7 +1503,7 @@ class GOOGLE_GLOG_DLL_DECL NullStream : public LogMessage::LogStream {
// converted to LogStream and the message will be computed and then
// quietly discarded.
template<class T>
-inline NullStream& operator<<(NullStream &str, const T &value) { return str; }
+inline NullStream& operator<<(NullStream &str, const T &) { return str; }
// Similar to NullStream, but aborts the program (without stack
// trace), like LogMessageFatal.
diff --git a/extern/libmv/third_party/glog/src/windows/glog/raw_logging.h b/extern/libmv/third_party/glog/src/windows/glog/raw_logging.h
index c81e67bf99c..4757a719db7 100644
--- a/extern/libmv/third_party/glog/src/windows/glog/raw_logging.h
+++ b/extern/libmv/third_party/glog/src/windows/glog/raw_logging.h
@@ -72,7 +72,7 @@ namespace google {
// I0821 211317 file.cc:142] RAW: status is 20
#define RAW_LOG(severity, ...) \
do { \
- switch (google::severity) { \
+ switch (google::GLOG_ ## severity) { \
case 0: \
RAW_LOG_INFO(__VA_ARGS__); \
break; \
@@ -104,28 +104,28 @@ namespace google {
#endif // STRIP_LOG == 0
#if STRIP_LOG == 0
-#define RAW_LOG_INFO(...) google::RawLog__(google::INFO, \
+#define RAW_LOG_INFO(...) google::RawLog__(google::GLOG_INFO, \
__FILE__, __LINE__, __VA_ARGS__)
#else
#define RAW_LOG_INFO(...) google::RawLogStub__(0, __VA_ARGS__)
#endif // STRIP_LOG == 0
#if STRIP_LOG <= 1
-#define RAW_LOG_WARNING(...) google::RawLog__(google::WARNING, \
+#define RAW_LOG_WARNING(...) google::RawLog__(google::GLOG_WARNING, \
__FILE__, __LINE__, __VA_ARGS__)
#else
#define RAW_LOG_WARNING(...) google::RawLogStub__(0, __VA_ARGS__)
#endif // STRIP_LOG <= 1
#if STRIP_LOG <= 2
-#define RAW_LOG_ERROR(...) google::RawLog__(google::ERROR, \
+#define RAW_LOG_ERROR(...) google::RawLog__(google::GLOG_ERROR, \
__FILE__, __LINE__, __VA_ARGS__)
#else
#define RAW_LOG_ERROR(...) google::RawLogStub__(0, __VA_ARGS__)
#endif // STRIP_LOG <= 2
#if STRIP_LOG <= 3
-#define RAW_LOG_FATAL(...) google::RawLog__(google::FATAL, \
+#define RAW_LOG_FATAL(...) google::RawLog__(google::GLOG_FATAL, \
__FILE__, __LINE__, __VA_ARGS__)
#else
#define RAW_LOG_FATAL(...) \
@@ -166,7 +166,7 @@ namespace google {
// Stub log function used to work around for unused variable warnings when
// building with STRIP_LOG > 0.
-static inline void RawLogStub__(int ignored, ...) {
+static inline void RawLogStub__(int /* ignored */, ...) {
}
// Helper function to implement RAW_LOG and RAW_VLOG
diff --git a/extern/libmv/third_party/glog/src/windows/port.h b/extern/libmv/third_party/glog/src/windows/port.h
index d5078120009..abfcf65384c 100644
--- a/extern/libmv/third_party/glog/src/windows/port.h
+++ b/extern/libmv/third_party/glog/src/windows/port.h
@@ -59,16 +59,14 @@
* used by both C and C++ code, so we put all the C++ together.
*/
-#if _MSC_VER
- /* 4244: otherwise we get problems when substracting two size_t's to an int
- * 4251: it's complaining about a private struct I've chosen not to dllexport
- * 4355: we use this in a constructor, but we do it safely
- * 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()
- */
-# pragma warning(disable:4244 4251 4355 4715 4800 4996)
-#endif
+/* 4244: otherwise we get problems when substracting two size_t's to an int
+ * 4251: it's complaining about a private struct I've chosen not to dllexport
+ * 4355: we use this in a constructor, but we do it safely
+ * 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()
+ */
+#pragma warning(disable:4244 4251 4355 4715 4800 4996)
/* file I/O */
#define PATH_MAX 1024
diff --git a/extern/libmv/third_party/glog/src/windows/preprocess.sh b/extern/libmv/third_party/glog/src/windows/preprocess.sh
index ea4352e8e3a..ea4352e8e3a 100755..100644
--- a/extern/libmv/third_party/glog/src/windows/preprocess.sh
+++ b/extern/libmv/third_party/glog/src/windows/preprocess.sh