You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by ji...@apache.org on 2018/02/26 19:16:11 UTC
[30/46] incubator-quickstep git commit: Remove glog source code from
third party
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/symbolize.h
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/symbolize.h b/third_party/src/glog/src/symbolize.h
deleted file mode 100644
index 1ebe4dd..0000000
--- a/third_party/src/glog/src/symbolize.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) 2006, 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: Satoru Takabayashi
-//
-// This library provides Symbolize() function that symbolizes program
-// counters to their corresponding symbol names on linux platforms.
-// This library has a minimal implementation of an ELF symbol table
-// reader (i.e. it doesn't depend on libelf, etc.).
-//
-// The algorithm used in Symbolize() is as follows.
-//
-// 1. Go through a list of maps in /proc/self/maps and find the map
-// containing the program counter.
-//
-// 2. Open the mapped file and find a regular symbol table inside.
-// Iterate over symbols in the symbol table and look for the symbol
-// containing the program counter. If such a symbol is found,
-// obtain the symbol name, and demangle the symbol if possible.
-// If the symbol isn't found in the regular symbol table (binary is
-// stripped), try the same thing with a dynamic symbol table.
-//
-// Note that Symbolize() is originally implemented to be used in
-// FailureSignalHandler() in base/google.cc. Hence it doesn't use
-// malloc() and other unsafe operations. It should be both
-// thread-safe and async-signal-safe.
-
-#ifndef BASE_SYMBOLIZE_H_
-#define BASE_SYMBOLIZE_H_
-
-#include "utilities.h"
-#include "config.h"
-#include "glog/logging.h"
-
-#ifdef HAVE_SYMBOLIZE
-
-#if defined(__ELF__) // defined by gcc on Linux
-#include <elf.h>
-#include <link.h> // For ElfW() macro.
-
-// If there is no ElfW macro, let's define it by ourself.
-#ifndef ElfW
-# if SIZEOF_VOID_P == 4
-# define ElfW(type) Elf32_##type
-# elif SIZEOF_VOID_P == 8
-# define ElfW(type) Elf64_##type
-# else
-# error "Unknown sizeof(void *)"
-# endif
-#endif
-
-_START_GOOGLE_NAMESPACE_
-
-// Gets the section header for the given name, if it exists. Returns true on
-// success. Otherwise, returns false.
-bool GetSectionHeaderByName(int fd, const char *name, size_t name_len,
- ElfW(Shdr) *out);
-
-_END_GOOGLE_NAMESPACE_
-
-#endif /* __ELF__ */
-
-_START_GOOGLE_NAMESPACE_
-
-// Installs a callback function, which will be called right before a symbol name
-// is printed. The callback is intended to be used for showing a file name and a
-// line number preceding a symbol name.
-// "fd" is a file descriptor of the object file containing the program
-// counter "pc". The callback function should write output to "out"
-// and return the size of the output written. On error, the callback
-// function should return -1.
-typedef int (*SymbolizeCallback)(int fd, void *pc, char *out, size_t out_size,
- uint64 relocation);
-void InstallSymbolizeCallback(SymbolizeCallback callback);
-
-_END_GOOGLE_NAMESPACE_
-
-#endif
-
-_START_GOOGLE_NAMESPACE_
-
-// Symbolizes a program counter. On success, returns true and write the
-// symbol name to "out". The symbol name is demangled if possible
-// (supports symbols generated by GCC 3.x or newer). Otherwise,
-// returns false.
-bool Symbolize(void *pc, char *out, int out_size);
-
-_END_GOOGLE_NAMESPACE_
-
-#endif // BASE_SYMBOLIZE_H_
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/symbolize_unittest.cc
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/symbolize_unittest.cc b/third_party/src/glog/src/symbolize_unittest.cc
deleted file mode 100644
index f25909d..0000000
--- a/third_party/src/glog/src/symbolize_unittest.cc
+++ /dev/null
@@ -1,365 +0,0 @@
-// Copyright (c) 2006, 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: Satoru Takabayashi
-//
-// Unit tests for functions in symbolize.cc.
-
-#include "utilities.h"
-
-#include <signal.h>
-#include <iostream>
-
-#include "glog/logging.h"
-#include "symbolize.h"
-#include "googletest.h"
-#include "config.h"
-
-using namespace std;
-using namespace GOOGLE_NAMESPACE;
-
-#if defined(HAVE_STACKTRACE) && defined(__ELF__)
-
-#define always_inline
-
-// This unit tests make sense only with GCC.
-// Uses lots of GCC specific features.
-#if defined(__GNUC__) && !defined(__OPENCC__)
-# if __GNUC__ >= 4
-# define TEST_WITH_MODERN_GCC
-# if __i386__ // always_inline isn't supported for x86_64 with GCC 4.1.0.
-# undef always_inline
-# define always_inline __attribute__((always_inline))
-# define HAVE_ALWAYS_INLINE
-# endif // __i386__
-# else
-# endif // __GNUC__ >= 4
-# if defined(__i386__) || defined(__x86_64__)
-# define TEST_X86_32_AND_64 1
-# endif // defined(__i386__) || defined(__x86_64__)
-#endif
-
-// A wrapper function for Symbolize() to make the unit test simple.
-static const char *TrySymbolize(void *pc) {
- static char symbol[4096];
- if (Symbolize(pc, symbol, sizeof(symbol))) {
- return symbol;
- } else {
- return NULL;
- }
-}
-
-// Make them C linkage to avoid mangled names.
-extern "C" {
-void nonstatic_func() {
- volatile int a = 0;
- ++a;
-}
-
-static void static_func() {
- volatile int a = 0;
- ++a;
-}
-}
-
-TEST(Symbolize, Symbolize) {
- // We do C-style cast since GCC 2.95.3 doesn't allow
- // reinterpret_cast<void *>(&func).
-
- // Compilers should give us pointers to them.
- EXPECT_STREQ("nonstatic_func", TrySymbolize((void *)(&nonstatic_func)));
- EXPECT_STREQ("static_func", TrySymbolize((void *)(&static_func)));
-
- EXPECT_TRUE(NULL == TrySymbolize(NULL));
-}
-
-struct Foo {
- static void func(int x);
-};
-
-void ATTRIBUTE_NOINLINE Foo::func(int x) {
- volatile int a = x;
- ++a;
-}
-
-// With a modern GCC, Symbolize() should return demangled symbol
-// names. Function parameters should be omitted.
-#ifdef TEST_WITH_MODERN_GCC
-TEST(Symbolize, SymbolizeWithDemangling) {
- Foo::func(100);
- EXPECT_STREQ("Foo::func()", TrySymbolize((void *)(&Foo::func)));
-}
-#endif
-
-// Tests that verify that Symbolize footprint is within some limit.
-
-// To measure the stack footprint of the Symbolize function, we create
-// a signal handler (for SIGUSR1 say) that calls the Symbolize function
-// on an alternate stack. This alternate stack is initialized to some
-// known pattern (0x55, 0x55, 0x55, ...). We then self-send this signal,
-// and after the signal handler returns, look at the alternate stack
-// buffer to see what portion has been touched.
-//
-// This trick gives us the the stack footprint of the signal handler.
-// But the signal handler, even before the call to Symbolize, consumes
-// some stack already. We however only want the stack usage of the
-// Symbolize function. To measure this accurately, we install two signal
-// handlers: one that does nothing and just returns, and another that
-// calls Symbolize. The difference between the stack consumption of these
-// two signals handlers should give us the Symbolize stack foorprint.
-
-static void *g_pc_to_symbolize;
-static char g_symbolize_buffer[4096];
-static char *g_symbolize_result;
-
-static void EmptySignalHandler(int signo) {}
-
-static void SymbolizeSignalHandler(int signo) {
- if (Symbolize(g_pc_to_symbolize, g_symbolize_buffer,
- sizeof(g_symbolize_buffer))) {
- g_symbolize_result = g_symbolize_buffer;
- } else {
- g_symbolize_result = NULL;
- }
-}
-
-const int kAlternateStackSize = 8096;
-const char kAlternateStackFillValue = 0x55;
-
-// These helper functions look at the alternate stack buffer, and figure
-// out what portion of this buffer has been touched - this is the stack
-// consumption of the signal handler running on this alternate stack.
-static ATTRIBUTE_NOINLINE bool StackGrowsDown(int *x) {
- int y;
- return &y < x;
-}
-static int GetStackConsumption(const char* alt_stack) {
- int x;
- if (StackGrowsDown(&x)) {
- for (int i = 0; i < kAlternateStackSize; i++) {
- if (alt_stack[i] != kAlternateStackFillValue) {
- return (kAlternateStackSize - i);
- }
- }
- } else {
- for (int i = (kAlternateStackSize - 1); i >= 0; i--) {
- if (alt_stack[i] != kAlternateStackFillValue) {
- return i;
- }
- }
- }
- return -1;
-}
-
-#ifdef HAVE_SIGALTSTACK
-
-// Call Symbolize and figure out the stack footprint of this call.
-static const char *SymbolizeStackConsumption(void *pc, int *stack_consumed) {
-
- g_pc_to_symbolize = pc;
-
- // The alt-signal-stack cannot be heap allocated because there is a
- // bug in glibc-2.2 where some signal handler setup code looks at the
- // current stack pointer to figure out what thread is currently running.
- // Therefore, the alternate stack must be allocated from the main stack
- // itself.
- char altstack[kAlternateStackSize];
- memset(altstack, kAlternateStackFillValue, kAlternateStackSize);
-
- // Set up the alt-signal-stack (and save the older one).
- stack_t sigstk;
- memset(&sigstk, 0, sizeof(stack_t));
- stack_t old_sigstk;
- sigstk.ss_sp = altstack;
- sigstk.ss_size = kAlternateStackSize;
- sigstk.ss_flags = 0;
- CHECK_ERR(sigaltstack(&sigstk, &old_sigstk));
-
- // Set up SIGUSR1 and SIGUSR2 signal handlers (and save the older ones).
- struct sigaction sa;
- memset(&sa, 0, sizeof(struct sigaction));
- struct sigaction old_sa1, old_sa2;
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = SA_ONSTACK;
-
- // SIGUSR1 maps to EmptySignalHandler.
- sa.sa_handler = EmptySignalHandler;
- CHECK_ERR(sigaction(SIGUSR1, &sa, &old_sa1));
-
- // SIGUSR2 maps to SymbolizeSignalHanlder.
- sa.sa_handler = SymbolizeSignalHandler;
- CHECK_ERR(sigaction(SIGUSR2, &sa, &old_sa2));
-
- // Send SIGUSR1 signal and measure the stack consumption of the empty
- // signal handler.
- CHECK_ERR(kill(getpid(), SIGUSR1));
- int stack_consumption1 = GetStackConsumption(altstack);
-
- // Send SIGUSR2 signal and measure the stack consumption of the symbolize
- // signal handler.
- CHECK_ERR(kill(getpid(), SIGUSR2));
- int stack_consumption2 = GetStackConsumption(altstack);
-
- // The difference between the two stack consumption values is the
- // stack footprint of the Symbolize function.
- if (stack_consumption1 != -1 && stack_consumption2 != -1) {
- *stack_consumed = stack_consumption2 - stack_consumption1;
- } else {
- *stack_consumed = -1;
- }
-
- // Log the stack consumption values.
- LOG(INFO) << "Stack consumption of empty signal handler: "
- << stack_consumption1;
- LOG(INFO) << "Stack consumption of symbolize signal handler: "
- << stack_consumption2;
- LOG(INFO) << "Stack consumption of Symbolize: " << *stack_consumed;
-
- // Now restore the old alt-signal-stack and signal handlers.
- CHECK_ERR(sigaltstack(&old_sigstk, NULL));
- CHECK_ERR(sigaction(SIGUSR1, &old_sa1, NULL));
- CHECK_ERR(sigaction(SIGUSR2, &old_sa2, NULL));
-
- return g_symbolize_result;
-}
-
-// Symbolize stack consumption should be within 2kB.
-const int kStackConsumptionUpperLimit = 2048;
-
-TEST(Symbolize, SymbolizeStackConsumption) {
- int stack_consumed;
- const char* symbol;
-
- symbol = SymbolizeStackConsumption((void *)(&nonstatic_func),
- &stack_consumed);
- EXPECT_STREQ("nonstatic_func", symbol);
- EXPECT_GT(stack_consumed, 0);
- EXPECT_LT(stack_consumed, kStackConsumptionUpperLimit);
-
- symbol = SymbolizeStackConsumption((void *)(&static_func),
- &stack_consumed);
- EXPECT_STREQ("static_func", symbol);
- EXPECT_GT(stack_consumed, 0);
- EXPECT_LT(stack_consumed, kStackConsumptionUpperLimit);
-}
-
-#ifdef TEST_WITH_MODERN_GCC
-TEST(Symbolize, SymbolizeWithDemanglingStackConsumption) {
- Foo::func(100);
- int stack_consumed;
- const char* symbol;
-
- symbol = SymbolizeStackConsumption((void *)(&Foo::func), &stack_consumed);
-
- EXPECT_STREQ("Foo::func()", symbol);
- EXPECT_GT(stack_consumed, 0);
- EXPECT_LT(stack_consumed, kStackConsumptionUpperLimit);
-}
-#endif
-
-#endif // HAVE_SIGALTSTACK
-
-// x86 specific tests. Uses some inline assembler.
-extern "C" {
-inline void* always_inline inline_func() {
- register void *pc = NULL;
-#ifdef TEST_X86_32_AND_64
- __asm__ __volatile__("call 1f; 1: pop %0" : "=r"(pc));
-#endif
- return pc;
-}
-
-void* ATTRIBUTE_NOINLINE non_inline_func() {
- register void *pc = NULL;
-#ifdef TEST_X86_32_AND_64
- __asm__ __volatile__("call 1f; 1: pop %0" : "=r"(pc));
-#endif
- return pc;
-}
-
-void ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() {
-#if defined(TEST_X86_32_AND_64) && defined(HAVE_ATTRIBUTE_NOINLINE)
- void *pc = non_inline_func();
- const char *symbol = TrySymbolize(pc);
- CHECK(symbol != NULL);
- CHECK_STREQ(symbol, "non_inline_func");
- cout << "Test case TestWithPCInsideNonInlineFunction passed." << endl;
-#endif
-}
-
-void ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() {
-#if defined(TEST_X86_32_AND_64) && defined(HAVE_ALWAYS_INLINE)
- void *pc = inline_func(); // Must be inlined.
- const char *symbol = TrySymbolize(pc);
- CHECK(symbol != NULL);
- CHECK_STREQ(symbol, __FUNCTION__);
- cout << "Test case TestWithPCInsideInlineFunction passed." << endl;
-#endif
-}
-}
-
-// Test with a return address.
-void ATTRIBUTE_NOINLINE TestWithReturnAddress() {
-#if defined(HAVE_ATTRIBUTE_NOINLINE)
- void *return_address = __builtin_return_address(0);
- const char *symbol = TrySymbolize(return_address);
- CHECK(symbol != NULL);
- CHECK_STREQ(symbol, "main");
- cout << "Test case TestWithReturnAddress passed." << endl;
-#endif
-}
-
-int main(int argc, char **argv) {
- FLAGS_logtostderr = true;
- InitGoogleLogging(argv[0]);
- InitGoogleTest(&argc, argv);
-#ifdef HAVE_SYMBOLIZE
- // We don't want to get affected by the callback interface, that may be
- // used to install some callback function at InitGoogle() time.
- InstallSymbolizeCallback(NULL);
-
- TestWithPCInsideInlineFunction();
- TestWithPCInsideNonInlineFunction();
- TestWithReturnAddress();
- return RUN_ALL_TESTS();
-#else
- return 0;
-#endif
-}
-
-#else
-int main() {
-#ifdef HAVE_SYMBOLIZE
- printf("PASS (no symbolize_unittest support)\n");
-#else
- printf("PASS (no symbolize support)\n");
-#endif
- return 0;
-}
-#endif // HAVE_STACKTRACE
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/utilities.cc
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/utilities.cc b/third_party/src/glog/src/utilities.cc
deleted file mode 100644
index 8ec69d3..0000000
--- a/third_party/src/glog/src/utilities.cc
+++ /dev/null
@@ -1,347 +0,0 @@
-// 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
-
-#include "utilities.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <signal.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#include <time.h>
-#if defined(HAVE_SYSCALL_H)
-#include <syscall.h> // for syscall()
-#elif defined(HAVE_SYS_SYSCALL_H)
-#include <sys/syscall.h> // for syscall()
-#endif
-#ifdef HAVE_SYSLOG_H
-# include <syslog.h>
-#endif
-
-#include "base/googleinit.h"
-
-using std::string;
-
-_START_GOOGLE_NAMESPACE_
-
-static const char* g_program_invocation_short_name = NULL;
-static pthread_t g_main_thread_id;
-
-_END_GOOGLE_NAMESPACE_
-
-// The following APIs are all internal.
-#ifdef HAVE_STACKTRACE
-
-#include "stacktrace.h"
-#include "symbolize.h"
-#include "base/commandlineflags.h"
-
-GLOG_DEFINE_bool(symbolize_stacktrace, true,
- "Symbolize the stack trace in the tombstone");
-
-_START_GOOGLE_NAMESPACE_
-
-typedef void DebugWriter(const char*, void*);
-
-// The %p field width for printf() functions is two characters per byte.
-// 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 *) {
- // This one is signal-safe.
- if (write(STDERR_FILENO, data, strlen(data)) < 0) {
- // Ignore errors.
- }
-}
-
-void DebugWriteToString(const char* data, void *arg) {
- reinterpret_cast<string*>(arg)->append(data);
-}
-
-#ifdef HAVE_SYMBOLIZE
-// Print a program counter and its symbol name.
-static void DumpPCAndSymbol(DebugWriter *writerfn, void *arg, void *pc,
- const char * const prefix) {
- char tmp[1024];
- const char *symbol = "(unknown)";
- // Symbolizes the previous address of pc because pc may be in the
- // next function. The overrun happens when the function ends with
- // a call to a function annotated noreturn (e.g. CHECK).
- if (Symbolize(reinterpret_cast<char *>(pc) - 1, tmp, sizeof(tmp))) {
- symbol = tmp;
- }
- char buf[1024];
- snprintf(buf, sizeof(buf), "%s@ %*p %s\n",
- prefix, kPrintfPointerFieldWidth, pc, symbol);
- writerfn(buf, arg);
-}
-#endif
-
-static void DumpPC(DebugWriter *writerfn, void *arg, void *pc,
- const char * const prefix) {
- char buf[100];
- snprintf(buf, sizeof(buf), "%s@ %*p\n",
- prefix, kPrintfPointerFieldWidth, pc);
- writerfn(buf, arg);
-}
-
-// Dump current stack trace as directed by writerfn
-static void DumpStackTrace(int skip_count, DebugWriter *writerfn, void *arg) {
- // Print stack trace
- void* stack[32];
- int depth = GetStackTrace(stack, ARRAYSIZE(stack), skip_count+1);
- for (int i = 0; i < depth; i++) {
-#if defined(HAVE_SYMBOLIZE)
- if (FLAGS_symbolize_stacktrace) {
- DumpPCAndSymbol(writerfn, arg, stack[i], " ");
- } else {
- DumpPC(writerfn, arg, stack[i], " ");
- }
-#else
- DumpPC(writerfn, arg, stack[i], " ");
-#endif
- }
-}
-
-static void DumpStackTraceAndExit() {
- DumpStackTrace(1, DebugWriteToStderr, NULL);
-
- // Set the default signal handler for SIGABRT, to avoid invoking our
- // own signal handler installed by InstallFailedSignalHandler().
- struct sigaction sig_action;
- memset(&sig_action, 0, sizeof(sig_action));
- sigemptyset(&sig_action.sa_mask);
- sig_action.sa_handler = SIG_DFL;
- sigaction(SIGABRT, &sig_action, NULL);
-
- abort();
-}
-
-_END_GOOGLE_NAMESPACE_
-
-#endif // HAVE_STACKTRACE
-
-_START_GOOGLE_NAMESPACE_
-
-namespace glog_internal_namespace_ {
-
-const char* ProgramInvocationShortName() {
- if (g_program_invocation_short_name != NULL) {
- return g_program_invocation_short_name;
- } else {
- // TODO(hamaji): Use /proc/self/cmdline and so?
- return "UNKNOWN";
- }
-}
-
-bool IsGoogleLoggingInitialized() {
- return g_program_invocation_short_name != NULL;
-}
-
-bool is_default_thread() {
- if (g_program_invocation_short_name == NULL) {
- // InitGoogleLogging() not yet called, so unlikely to be in a different
- // thread
- return true;
- } else {
- return pthread_equal(pthread_self(), g_main_thread_id);
- }
-}
-
-#ifdef OS_WINDOWS
-struct timeval {
- long tv_sec, tv_usec;
-};
-
-// Based on: http://www.google.com/codesearch/p?hl=en#dR3YEbitojA/os_win32.c&q=GetSystemTimeAsFileTime%20license:bsd
-// See COPYING for copyright information.
-static int gettimeofday(struct timeval *tv, void* tz) {
-#define EPOCHFILETIME (116444736000000000ULL)
- FILETIME ft;
- LARGE_INTEGER li;
- uint64 tt;
-
- GetSystemTimeAsFileTime(&ft);
- li.LowPart = ft.dwLowDateTime;
- li.HighPart = ft.dwHighDateTime;
- tt = (li.QuadPart - EPOCHFILETIME) / 10;
- tv->tv_sec = tt / 1000000;
- tv->tv_usec = tt % 1000000;
-
- return 0;
-}
-#endif
-
-int64 CycleClock_Now() {
- // TODO(hamaji): temporary impementation - it might be too slow.
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return static_cast<int64>(tv.tv_sec) * 1000000 + tv.tv_usec;
-}
-
-int64 UsecToCycles(int64 usec) {
- return usec;
-}
-
-WallTime WallTime_Now() {
- // Now, cycle clock is retuning microseconds since the epoch.
- return CycleClock_Now() * 0.000001;
-}
-
-static int32 g_main_thread_pid = getpid();
-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 MacOSX, we try to use gettid().
-#if defined OS_LINUX || defined OS_MACOSX
-#ifndef __NR_gettid
-#ifdef OS_MACOSX
-#define __NR_gettid SYS_gettid
-#elif ! defined __i386__
-#error "Must define __NR_gettid for non-x86 platforms"
-#else
-#define __NR_gettid 224
-#endif
-#endif
- static bool lacks_gettid = false;
- if (!lacks_gettid) {
- pid_t tid = syscall(__NR_gettid);
- if (tid != -1) {
- return tid;
- }
- // Technically, this variable has to be volatile, but there is a small
- // performance penalty in accessing volatile variables and there should
- // not be any serious adverse effect if a thread does not immediately see
- // the value change to "true".
- lacks_gettid = true;
- }
-#endif // OS_LINUX || OS_MACOSX
-
- // If gettid() could not be used, we use one of the following.
-#if defined OS_LINUX
- return getpid(); // Linux: getpid returns thread ID when gettid is absent
-#elif defined OS_WINDOWS || defined OS_CYGWIN
- return GetCurrentThreadId();
-#else
- // If none of the techniques above worked, we use pthread_self().
- return (pid_t)(uintptr_t)pthread_self();
-#endif
-}
-
-const char* const_basename(const char* filepath) {
- const char* base = strrchr(filepath, '/');
-#ifdef OS_WINDOWS // Look for either path separator in Windows
- if (!base)
- base = strrchr(filepath, '\\');
-#endif
- return base ? (base+1) : filepath;
-}
-
-static string g_my_user_name;
-const string& MyUserName() {
- return g_my_user_name;
-}
-static void MyUserNameInitializer() {
- // TODO(hamaji): Probably this is not portable.
-#if defined(OS_WINDOWS)
- const char* user = getenv("USERNAME");
-#else
- const char* user = getenv("USER");
-#endif
- if (user != NULL) {
- g_my_user_name = user;
- } else {
- g_my_user_name = "invalid-user";
- }
-}
-REGISTER_MODULE_INITIALIZER(utilities, MyUserNameInitializer())
-
-#ifdef HAVE_STACKTRACE
-void DumpStackTraceToString(string* stacktrace) {
- DumpStackTrace(1, DebugWriteToString, stacktrace);
-}
-#endif
-
-// We use an atomic operation to prevent problems with calling CrashReason
-// from inside the Mutex implementation (potentially through RAW_CHECK).
-static const CrashReason* g_reason = 0;
-
-void SetCrashReason(const CrashReason* r) {
- sync_val_compare_and_swap(&g_reason,
- reinterpret_cast<const CrashReason*>(0),
- r);
-}
-
-void InitGoogleLoggingUtilities(const char* argv0) {
- CHECK(!IsGoogleLoggingInitialized())
- << "You called InitGoogleLogging() twice!";
- const char* slash = strrchr(argv0, '/');
-#ifdef OS_WINDOWS
- if (!slash) slash = strrchr(argv0, '\\');
-#endif
- g_program_invocation_short_name = slash ? slash + 1 : argv0;
- g_main_thread_id = pthread_self();
-
-#ifdef HAVE_STACKTRACE
- InstallFailureFunction(&DumpStackTraceAndExit);
-#endif
-}
-
-void ShutdownGoogleLoggingUtilities() {
- CHECK(IsGoogleLoggingInitialized())
- << "You called ShutdownGoogleLogging() without calling InitGoogleLogging() first!";
- g_program_invocation_short_name = NULL;
-#ifdef HAVE_SYSLOG_H
- closelog();
-#endif
-}
-
-} // namespace glog_internal_namespace_
-
-_END_GOOGLE_NAMESPACE_
-
-// Make an implementation of stacktrace compiled.
-#ifdef STACKTRACE_H
-# include STACKTRACE_H
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/utilities.h
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/utilities.h b/third_party/src/glog/src/utilities.h
deleted file mode 100644
index 5f79968..0000000
--- a/third_party/src/glog/src/utilities.h
+++ /dev/null
@@ -1,226 +0,0 @@
-// 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
-//
-// Define utilties for glog internal usage.
-
-#ifndef UTILITIES_H__
-#define UTILITIES_H__
-
-#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
-# define OS_WINDOWS
-#elif defined(__CYGWIN__) || defined(__CYGWIN32__)
-# define OS_CYGWIN
-#elif defined(linux) || defined(__linux) || defined(__linux__)
-# define OS_LINUX
-#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
-# define OS_MACOSX
-#elif defined(__FreeBSD__)
-# define OS_FREEBSD
-#elif defined(__NetBSD__)
-# define OS_NETBSD
-#elif defined(__OpenBSD__)
-# define OS_OPENBSD
-#else
-// TODO(hamaji): Add other platforms.
-#endif
-
-// printf macros for size_t, in the style of inttypes.h
-#ifdef _LP64
-#define __PRIS_PREFIX "z"
-#else
-#define __PRIS_PREFIX
-#endif
-
-// Use these macros after a % in a printf format string
-// to get correct 32/64 bit behavior, like this:
-// size_t size = records.size();
-// printf("%"PRIuS"\n", size);
-
-#define PRIdS __PRIS_PREFIX "d"
-#define PRIxS __PRIS_PREFIX "x"
-#define PRIuS __PRIS_PREFIX "u"
-#define PRIXS __PRIS_PREFIX "X"
-#define PRIoS __PRIS_PREFIX "o"
-
-#include "base/mutex.h" // This must go first so we get _XOPEN_SOURCE
-
-#include <string>
-
-#if defined(OS_WINDOWS)
-# include "port.h"
-#endif
-
-#include "config.h"
-#include "glog/logging.h"
-
-// There are three different ways we can try to get the stack trace:
-//
-// 1) The libunwind library. This is still in development, and as a
-// separate library adds a new dependency, but doesn't need a frame
-// pointer. It also doesn't call malloc.
-//
-// 2) Our hand-coded stack-unwinder. This depends on a certain stack
-// layout, which is used by gcc (and those systems using a
-// gcc-compatible ABI) on x86 systems, at least since gcc 2.95.
-// It uses the frame pointer to do its work.
-//
-// 3) The gdb unwinder -- also the one used by the c++ exception code.
-// It's obviously well-tested, but has a fatal flaw: it can call
-// malloc() from the unwinder. This is a problem because we're
-// trying to use the unwinder to instrument malloc().
-//
-// Note: if you add a new implementation here, make sure it works
-// correctly when GetStackTrace() is called with max_depth == 0.
-// Some code may do that.
-
-#if defined(HAVE_LIB_UNWIND)
-# define STACKTRACE_H "stacktrace_libunwind-inl.h"
-#elif !defined(NO_FRAME_POINTER)
-# if defined(__i386__) && __GNUC__ >= 2
-# define STACKTRACE_H "stacktrace_x86-inl.h"
-# elif defined(__x86_64__) && __GNUC__ >= 2 && HAVE_UNWIND_H
-# define STACKTRACE_H "stacktrace_x86_64-inl.h"
-# elif (defined(__ppc__) || defined(__PPC__)) && __GNUC__ >= 2
-# define STACKTRACE_H "stacktrace_powerpc-inl.h"
-# endif
-#endif
-
-#if !defined(STACKTRACE_H) && defined(HAVE_EXECINFO_H)
-# define STACKTRACE_H "stacktrace_generic-inl.h"
-#endif
-
-#if defined(STACKTRACE_H)
-# define HAVE_STACKTRACE
-#endif
-
-// defined by gcc
-#if defined(__ELF__) && defined(OS_LINUX)
-# define HAVE_SYMBOLIZE
-#elif defined(OS_MACOSX) && defined(HAVE_DLADDR)
-// Use dladdr to symbolize.
-# define HAVE_SYMBOLIZE
-#endif
-
-#ifndef ARRAYSIZE
-// There is a better way, but this is good enough for our purpose.
-# define ARRAYSIZE(a) (sizeof(a) / sizeof(*(a)))
-#endif
-
-_START_GOOGLE_NAMESPACE_
-
-namespace glog_internal_namespace_ {
-
-#ifdef HAVE___ATTRIBUTE__
-# define ATTRIBUTE_NOINLINE __attribute__ ((noinline))
-# define HAVE_ATTRIBUTE_NOINLINE
-#else
-# define ATTRIBUTE_NOINLINE
-#endif
-
-const char* ProgramInvocationShortName();
-
-bool IsGoogleLoggingInitialized();
-
-bool is_default_thread();
-
-int64 CycleClock_Now();
-
-int64 UsecToCycles(int64 usec);
-
-typedef double WallTime;
-WallTime WallTime_Now();
-
-int32 GetMainThreadPid();
-bool PidHasChanged();
-
-pid_t GetTID();
-
-const std::string& MyUserName();
-
-// Get the part of filepath after the last path separator.
-// (Doesn't modify filepath, contrary to basename() in libgen.h.)
-const char* const_basename(const char* filepath);
-
-// Wrapper of __sync_val_compare_and_swap. If the GCC extension isn't
-// defined, we try the CPU specific logics (we only support x86 and
-// x86_64 for now) first, then use a naive implementation, which has a
-// race condition.
-template<typename T>
-inline T sync_val_compare_and_swap(T* ptr, T oldval, T newval) {
-#if defined(HAVE___SYNC_VAL_COMPARE_AND_SWAP)
- return __sync_val_compare_and_swap(ptr, oldval, newval);
-#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
- T ret;
- __asm__ __volatile__("lock; cmpxchg %1, (%2);"
- :"=a"(ret)
- // GCC may produces %sil or %dil for
- // constraint "r", but some of apple's gas
- // dosn't know the 8 bit registers.
- // We use "q" to avoid these registers.
- :"q"(newval), "q"(ptr), "a"(oldval)
- :"memory", "cc");
- return ret;
-#else
- T ret = *ptr;
- if (ret == oldval) {
- *ptr = newval;
- }
- return ret;
-#endif
-}
-
-void DumpStackTraceToString(std::string* stacktrace);
-
-struct CrashReason {
- CrashReason() : filename(0), line_number(0), message(0), depth(0) {}
-
- const char* filename;
- int line_number;
- const char* message;
-
- // We'll also store a bit of stack trace context at the time of crash as
- // it may not be available later on.
- void* stack[32];
- int depth;
-};
-
-void SetCrashReason(const CrashReason* r);
-
-void InitGoogleLoggingUtilities(const char* argv0);
-void ShutdownGoogleLoggingUtilities();
-
-} // namespace glog_internal_namespace_
-
-_END_GOOGLE_NAMESPACE_
-
-using namespace GOOGLE_NAMESPACE::glog_internal_namespace_;
-
-#endif // UTILITIES_H__
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/utilities_unittest.cc
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/utilities_unittest.cc b/third_party/src/glog/src/utilities_unittest.cc
deleted file mode 100644
index 7b79619..0000000
--- a/third_party/src/glog/src/utilities_unittest.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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
-
-#include "utilities.h"
-#include "googletest.h"
-#include "glog/logging.h"
-
-using namespace GOOGLE_NAMESPACE;
-
-TEST(utilities, sync_val_compare_and_swap) {
- bool now_entering = false;
- EXPECT_FALSE(sync_val_compare_and_swap(&now_entering, false, true));
- EXPECT_TRUE(sync_val_compare_and_swap(&now_entering, false, true));
- EXPECT_TRUE(sync_val_compare_and_swap(&now_entering, false, true));
-}
-
-TEST(utilities, InitGoogleLoggingDeathTest) {
- ASSERT_DEATH(InitGoogleLogging("foobar"), "");
-}
-
-int main(int argc, char **argv) {
- InitGoogleLogging(argv[0]);
- InitGoogleTest(&argc, argv);
-
- CHECK_EQ(RUN_ALL_TESTS(), 0);
-}
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/vlog_is_on.cc
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/vlog_is_on.cc b/third_party/src/glog/src/vlog_is_on.cc
deleted file mode 100644
index 8a79df5..0000000
--- a/third_party/src/glog/src/vlog_is_on.cc
+++ /dev/null
@@ -1,249 +0,0 @@
-// Copyright (c) 1999, 2007, 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: Ray Sidney and many others
-//
-// Broken out from logging.cc by Soren Lassen
-// logging_unittest.cc covers the functionality herein
-
-#include "utilities.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <cstdio>
-#include <string>
-#include "base/commandlineflags.h"
-#include "glog/logging.h"
-#include "glog/raw_logging.h"
-#include "base/googleinit.h"
-
-// glog doesn't have annotation
-#define ANNOTATE_BENIGN_RACE(address, description)
-
-using std::string;
-
-GLOG_DEFINE_int32(v, 0, "Show all VLOG(m) messages for m <= this."
-" Overridable by --vmodule.");
-
-GLOG_DEFINE_string(vmodule, "", "per-module verbose level."
-" Argument is a comma-separated list of <module name>=<log level>."
-" <module name> is a glob pattern, matched against the filename base"
-" (that is, name ignoring .cc/.h./-inl.h)."
-" <log level> overrides any value given by --v.");
-
-_START_GOOGLE_NAMESPACE_
-
-namespace glog_internal_namespace_ {
-
-// Implementation of fnmatch that does not need 0-termination
-// of arguments and does not allocate any memory,
-// but we only support "*" and "?" wildcards, not the "[...]" patterns.
-// It's not a static function for the unittest.
-GOOGLE_GLOG_DLL_DECL bool SafeFNMatch_(const char* pattern,
- size_t patt_len,
- const char* str,
- size_t str_len) {
- 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;
- if (s == str_len) return p+1 == patt_len && pattern[p] == '*';
- if (pattern[p] == str[s] || pattern[p] == '?') {
- p += 1;
- s += 1;
- continue;
- }
- if (pattern[p] == '*') {
- if (p+1 == patt_len) return true;
- do {
- if (SafeFNMatch_(pattern+(p+1), patt_len-(p+1), str+s, str_len-s)) {
- return true;
- }
- s += 1;
- } while (s != str_len);
- return false;
- }
- return false;
- }
-}
-
-} // namespace glog_internal_namespace_
-
-using glog_internal_namespace_::SafeFNMatch_;
-
-int32 kLogSiteUninitialized = 1000;
-
-// List of per-module log levels from FLAGS_vmodule.
-// Once created each element is never deleted/modified
-// except for the vlog_level: other threads will read VModuleInfo blobs
-// w/o locks and we'll store pointers to vlog_level at VLOG locations
-// that will never go away.
-// We can't use an STL struct here as we wouldn't know
-// when it's safe to delete/update it: other threads need to use it w/o locks.
-struct VModuleInfo {
- string module_pattern;
- mutable int32 vlog_level; // Conceptually this is an AtomicWord, but it's
- // too much work to use AtomicWord type here
- // w/o much actual benefit.
- const VModuleInfo* next;
-};
-
-// This protects the following global variables.
-static Mutex vmodule_lock;
-// Pointer to head of the VModuleInfo list.
-// It's a map from module pattern to logging level for those module(s).
-static VModuleInfo* vmodule_list = 0;
-// Boolean initialization flag.
-static bool inited_vmodule = false;
-
-// L >= vmodule_lock.
-static void VLOG2Initializer() {
- vmodule_lock.AssertHeld();
- // Can now parse --vmodule flag and initialize mapping of module-specific
- // logging levels.
- inited_vmodule = false;
- const char* vmodule = FLAGS_vmodule.c_str();
- const char* sep;
- VModuleInfo* head = NULL;
- VModuleInfo* tail = NULL;
- while ((sep = strchr(vmodule, '=')) != NULL) {
- string pattern(vmodule, sep - vmodule);
- int module_level;
- if (sscanf(sep, "=%d", &module_level) == 1) {
- VModuleInfo* info = new VModuleInfo;
- info->module_pattern = pattern;
- info->vlog_level = module_level;
- if (head) tail->next = info;
- else head = info;
- tail = info;
- }
- // Skip past this entry
- vmodule = strchr(sep, ',');
- if (vmodule == NULL) break;
- vmodule++; // Skip past ","
- }
- if (head) { // Put them into the list at the head:
- tail->next = vmodule_list;
- vmodule_list = head;
- }
- inited_vmodule = true;
-}
-
-// This can be called very early, so we use SpinLock and RAW_VLOG here.
-int SetVLOGLevel(const char* module_pattern, int log_level) {
- int result = FLAGS_v;
- int const pattern_len = strlen(module_pattern);
- bool found = false;
- MutexLock l(&vmodule_lock); // protect whole read-modify-write
- for (const VModuleInfo* info = vmodule_list;
- info != NULL; info = info->next) {
- if (info->module_pattern == module_pattern) {
- if (!found) {
- result = info->vlog_level;
- found = true;
- }
- info->vlog_level = log_level;
- } else if (!found &&
- SafeFNMatch_(info->module_pattern.c_str(),
- info->module_pattern.size(),
- module_pattern, pattern_len)) {
- result = info->vlog_level;
- found = true;
- }
- }
- if (!found) {
- VModuleInfo* info = new VModuleInfo;
- info->module_pattern = module_pattern;
- info->vlog_level = log_level;
- info->next = vmodule_list;
- vmodule_list = info;
- }
- RAW_VLOG(1, "Set VLOG level for \"%s\" to %d", module_pattern, log_level);
- return result;
-}
-
-// NOTE: Individual VLOG statements cache the integer log level pointers.
-// NOTE: This function must not allocate memory or require any locks.
-bool InitVLOG3__(int32** site_flag, int32* site_default,
- const char* fname, int32 verbose_level) {
- MutexLock l(&vmodule_lock);
- bool read_vmodule_flag = inited_vmodule;
- if (!read_vmodule_flag) {
- VLOG2Initializer();
- }
-
- // protect the errno global in case someone writes:
- // VLOG(..) << "The last error was " << strerror(errno)
- int old_errno = errno;
-
- // site_default normally points to FLAGS_v
- int32* site_flag_value = site_default;
-
- // Get basename for file
- const char* base = strrchr(fname, '/');
- base = base ? (base+1) : fname;
- const char* base_end = strchr(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)) {
- base_length -= 4;
- }
-
- // TODO: Trim out _unittest suffix? Perhaps it is better to have
- // the extra control and just leave it there.
-
- // find target in vector of modules, replace site_flag_value with
- // a module-specific verbose level, if any.
- for (const VModuleInfo* info = vmodule_list;
- info != NULL; info = info->next) {
- if (SafeFNMatch_(info->module_pattern.c_str(), info->module_pattern.size(),
- base, base_length)) {
- site_flag_value = &info->vlog_level;
- // value at info->vlog_level is now what controls
- // the VLOG at the caller site forever
- break;
- }
- }
-
- // Cache the vlog value pointer if --vmodule flag has been parsed.
- ANNOTATE_BENIGN_RACE(site_flag,
- "*site_flag may be written by several threads,"
- " but the value will be the same");
- if (read_vmodule_flag) *site_flag = site_flag_value;
-
- // restore the errno in case something recoverable went wrong during
- // the initialization of the VLOG mechanism (see above note "protect the..")
- errno = old_errno;
- return *site_flag_value >= verbose_level;
-}
-
-_END_GOOGLE_NAMESPACE_
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/windows/base/commandlineflags.h
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/windows/base/commandlineflags.h b/third_party/src/glog/src/windows/base/commandlineflags.h
deleted file mode 100644
index c8d5089..0000000
--- a/third_party/src/glog/src/windows/base/commandlineflags.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// 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.
-
-// ---
-// This file is a compatibility layer that defines Google's version of
-// command line flags that are used for configuration.
-//
-// We put flags into their own namespace. It is purposefully
-// named in an opaque way that people should have trouble typing
-// directly. The idea is that DEFINE puts the flag in the weird
-// namespace, and DECLARE imports the flag from there into the
-// current namespace. The net result is to force people to use
-// DECLARE to get access to a flag, rather than saying
-// extern bool FLAGS_logtostderr;
-// or some such instead. We want this so we can put extra
-// functionality (like sanity-checking) in DECLARE if we want,
-// and make sure it is picked up everywhere.
-//
-// We also put the type of the variable in the namespace, so that
-// people can't DECLARE_int32 something that they DEFINE_bool'd
-// elsewhere.
-#ifndef BASE_COMMANDLINEFLAGS_H__
-#define BASE_COMMANDLINEFLAGS_H__
-
-#include "config.h"
-#include <string>
-#include <string.h> // for memchr
-#include <stdlib.h> // for getenv
-
-#ifdef HAVE_LIB_GFLAGS
-
-#include <gflags/gflags.h>
-
-#else
-
-#include "glog/logging.h"
-
-#define DECLARE_VARIABLE(type, shorttype, name, tn) \
- namespace fL##shorttype { \
- extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
- } \
- using fL##shorttype::FLAGS_##name
-#define DEFINE_VARIABLE(type, shorttype, name, value, meaning, tn) \
- namespace fL##shorttype { \
- GOOGLE_GLOG_DLL_DECL type FLAGS_##name(value); \
- char FLAGS_no##name; \
- } \
- using fL##shorttype::FLAGS_##name
-
-// bool specialization
-#define DECLARE_bool(name) \
- DECLARE_VARIABLE(bool, B, name, bool)
-#define DEFINE_bool(name, value, meaning) \
- DEFINE_VARIABLE(bool, B, name, value, meaning, bool)
-
-// int32 specialization
-#define DECLARE_int32(name) \
- DECLARE_VARIABLE(GOOGLE_NAMESPACE::int32, I, name, int32)
-#define DEFINE_int32(name, value, meaning) \
- DEFINE_VARIABLE(GOOGLE_NAMESPACE::int32, I, name, value, meaning, int32)
-
-// 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; \
- } \
- using fLS::FLAGS_##name
-#define DEFINE_string(name, value, meaning) \
- namespace fLS { \
- std::string FLAGS_##name##_buf(value); \
- GOOGLE_GLOG_DLL_DECL std::string& FLAGS_##name = FLAGS_##name##_buf; \
- char FLAGS_no##name; \
- } \
- using fLS::FLAGS_##name
-
-#endif // HAVE_LIB_GFLAGS
-
-// Define GLOG_DEFINE_* using DEFINE_* . By using these macros, we
-// have GLOG_* environ variables even if we have gflags installed.
-//
-// If both an environment variable and a flag are specified, the value
-// specified by a flag wins. E.g., if GLOG_v=0 and --v=1, the
-// verbosity will be 1, not 0.
-
-#define GLOG_DEFINE_bool(name, value, meaning) \
- DEFINE_bool(name, EnvToBool("GLOG_" #name, value), meaning)
-
-#define GLOG_DEFINE_int32(name, value, meaning) \
- DEFINE_int32(name, EnvToInt("GLOG_" #name, value), meaning)
-
-#define GLOG_DEFINE_string(name, value, meaning) \
- DEFINE_string(name, EnvToString("GLOG_" #name, value), meaning)
-
-// These macros (could be functions, but I don't want to bother with a .cc
-// file), make it easier to initialize flags from the environment.
-
-#define EnvToString(envname, dflt) \
- (!getenv(envname) ? (dflt) : getenv(envname))
-
-#define EnvToBool(envname, dflt) \
- (!getenv(envname) ? (dflt) : memchr("tTyY1\0", getenv(envname)[0], 6) != NULL)
-
-#define EnvToInt(envname, dflt) \
- (!getenv(envname) ? (dflt) : strtol(getenv(envname), NULL, 10))
-
-#endif // BASE_COMMANDLINEFLAGS_H__
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/windows/base/googleinit.h
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/windows/base/googleinit.h b/third_party/src/glog/src/windows/base/googleinit.h
deleted file mode 100644
index 5a8b515..0000000
--- a/third_party/src/glog/src/windows/base/googleinit.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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: Jacob Hoffman-Andrews
-
-#ifndef _GOOGLEINIT_H
-#define _GOOGLEINIT_H
-
-class GoogleInitializer {
- public:
- typedef void (*void_function)(void);
- GoogleInitializer(const char*, void_function f) {
- f();
- }
-};
-
-#define REGISTER_MODULE_INITIALIZER(name, body) \
- namespace { \
- static void google_init_module_##name () { body; } \
- GoogleInitializer google_initializer_module_##name(#name, \
- google_init_module_##name); \
- }
-
-#endif /* _GOOGLEINIT_H */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/windows/base/mutex.h
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/windows/base/mutex.h b/third_party/src/glog/src/windows/base/mutex.h
deleted file mode 100644
index 37527d5..0000000
--- a/third_party/src/glog/src/windows/base/mutex.h
+++ /dev/null
@@ -1,331 +0,0 @@
-// Copyright (c) 2007, 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: Craig Silverstein.
-//
-// A simple mutex wrapper, supporting locks and read-write locks.
-// You should assume the locks are *not* re-entrant.
-//
-// To use: you should define the following macros in your configure.ac:
-// ACX_PTHREAD
-// AC_RWLOCK
-// The latter is defined in ../autoconf.
-//
-// This class is meant to be internal-only and should be wrapped by an
-// internal namespace. Before you use this module, please give the
-// name of your internal namespace for this module. Or, if you want
-// to expose it, you'll want to move it to the Google namespace. We
-// cannot put this class in global namespace because there can be some
-// problems when we have multiple versions of Mutex in each shared object.
-//
-// NOTE: by default, we have #ifdef'ed out the TryLock() method.
-// This is for two reasons:
-// 1) TryLock() under Windows is a bit annoying (it requires a
-// #define to be defined very early).
-// 2) TryLock() is broken for NO_THREADS mode, at least in NDEBUG
-// mode.
-// If you need TryLock(), and either these two caveats are not a
-// problem for you, or you're willing to work around them, then
-// feel free to #define GMUTEX_TRYLOCK, or to remove the #ifdefs
-// in the code below.
-//
-// CYGWIN NOTE: Cygwin support for rwlock seems to be buggy:
-// http://www.cygwin.com/ml/cygwin/2008-12/msg00017.html
-// Because of that, we might as well use windows locks for
-// cygwin. They seem to be more reliable than the cygwin pthreads layer.
-//
-// TRICKY IMPLEMENTATION NOTE:
-// This class is designed to be safe to use during
-// dynamic-initialization -- that is, by global constructors that are
-// run before main() starts. The issue in this case is that
-// dynamic-initialization happens in an unpredictable order, and it
-// could be that someone else's dynamic initializer could call a
-// function that tries to acquire this mutex -- but that all happens
-// before this mutex's constructor has run. (This can happen even if
-// the mutex and the function that uses the mutex are in the same .cc
-// file.) Basically, because Mutex does non-trivial work in its
-// constructor, it's not, in the naive implementation, safe to use
-// before dynamic initialization has run on it.
-//
-// The solution used here is to pair the actual mutex primitive with a
-// bool that is set to true when the mutex is dynamically initialized.
-// (Before that it's false.) Then we modify all mutex routines to
-// look at the bool, and not try to lock/unlock until the bool makes
-// it to true (which happens after the Mutex constructor has run.)
-//
-// This works because before main() starts -- particularly, during
-// dynamic initialization -- there are no threads, so a) it's ok that
-// the mutex operations are a no-op, since we don't need locking then
-// anyway; and b) we can be quite confident our bool won't change
-// state between a call to Lock() and a call to Unlock() (that would
-// require a global constructor in one translation unit to call Lock()
-// and another global constructor in another translation unit to call
-// Unlock() later, which is pretty perverse).
-//
-// That said, it's tricky, and can conceivably fail; it's safest to
-// avoid trying to acquire a mutex in a global constructor, if you
-// can. One way it can fail is that a really smart compiler might
-// initialize the bool to true at static-initialization time (too
-// early) rather than at dynamic-initialization time. To discourage
-// that, we set is_safe_ to true in code (not the constructor
-// colon-initializer) and set it to true via a function that always
-// evaluates to true, but that the compiler can't know always
-// evaluates to true. This should be good enough.
-
-#ifndef GOOGLE_MUTEX_H_
-#define GOOGLE_MUTEX_H_
-
-#include "config.h" // to figure out pthreads support
-
-#if defined(NO_THREADS)
- typedef int MutexType; // to keep a lock-count
-#elif defined(_WIN32) || defined(__CYGWIN32__) || defined(__CYGWIN64__)
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN // We only need minimal includes
-# endif
-# ifdef GMUTEX_TRYLOCK
- // We need Windows NT or later for TryEnterCriticalSection(). If you
- // don't need that functionality, you can remove these _WIN32_WINNT
- // lines, and change TryLock() to assert(0) or something.
-# ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x0400
-# endif
-# endif
-// To avoid macro definition of ERROR.
-# ifndef NOGDI
-# define NOGDI
-# endif
-// To avoid macro definition of min/max.
-# ifndef NOMINMAX
-# define NOMINMAX
-# endif
-# include <windows.h>
- typedef CRITICAL_SECTION MutexType;
-#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK)
- // Needed for pthread_rwlock_*. If it causes problems, you could take it
- // out, but then you'd have to unset HAVE_RWLOCK (at least on linux -- it
- // *does* cause problems for FreeBSD, or MacOSX, but isn't needed
- // for locking there.)
-# ifdef __linux__
-# define _XOPEN_SOURCE 500 // may be needed to get the rwlock calls
-# endif
-# include <pthread.h>
- typedef pthread_rwlock_t MutexType;
-#elif defined(HAVE_PTHREAD)
-# include <pthread.h>
- typedef pthread_mutex_t MutexType;
-#else
-# error Need to implement mutex.h for your architecture, or #define NO_THREADS
-#endif
-
-// We need to include these header files after defining _XOPEN_SOURCE
-// as they may define the _XOPEN_SOURCE macro.
-#include <assert.h>
-#include <stdlib.h> // for abort()
-
-#define MUTEX_NAMESPACE glog_internal_namespace_
-
-namespace MUTEX_NAMESPACE {
-
-class Mutex {
- public:
- // Create a Mutex that is not held by anybody. This constructor is
- // typically used for Mutexes allocated on the heap or the stack.
- // See below for a recommendation for constructing global Mutex
- // objects.
- inline Mutex();
-
- // Destructor
- inline ~Mutex();
-
- inline void Lock(); // Block if needed until free then acquire exclusively
- inline void Unlock(); // Release a lock acquired via Lock()
-#ifdef GMUTEX_TRYLOCK
- inline bool TryLock(); // If free, Lock() and return true, else return false
-#endif
- // Note that on systems that don't support read-write locks, these may
- // be implemented as synonyms to Lock() and Unlock(). So you can use
- // these for efficiency, but don't use them anyplace where being able
- // to do shared reads is necessary to avoid deadlock.
- inline void ReaderLock(); // Block until free or shared then acquire a share
- inline void ReaderUnlock(); // Release a read share of this Mutex
- inline void WriterLock() { Lock(); } // Acquire an exclusive lock
- inline void WriterUnlock() { Unlock(); } // Release a lock from WriterLock()
-
- // TODO(hamaji): Do nothing, implement correctly.
- inline void AssertHeld() {}
-
- private:
- MutexType mutex_;
- // We want to make sure that the compiler sets is_safe_ to true only
- // when we tell it to, and never makes assumptions is_safe_ is
- // always true. volatile is the most reliable way to do that.
- volatile bool is_safe_;
-
- inline void SetIsSafe() { is_safe_ = true; }
-
- // Catch the error of writing Mutex when intending MutexLock.
- Mutex(Mutex* /*ignored*/) {}
- // Disallow "evil" constructors
- Mutex(const Mutex&);
- void operator=(const Mutex&);
-};
-
-// Now the implementation of Mutex for various systems
-#if defined(NO_THREADS)
-
-// When we don't have threads, we can be either reading or writing,
-// but not both. We can have lots of readers at once (in no-threads
-// mode, that's most likely to happen in recursive function calls),
-// but only one writer. We represent this by having mutex_ be -1 when
-// writing and a number > 0 when reading (and 0 when no lock is held).
-//
-// In debug mode, we assert these invariants, while in non-debug mode
-// we do nothing, for efficiency. That's why everything is in an
-// assert.
-
-Mutex::Mutex() : mutex_(0) { }
-Mutex::~Mutex() { assert(mutex_ == 0); }
-void Mutex::Lock() { assert(--mutex_ == -1); }
-void Mutex::Unlock() { assert(mutex_++ == -1); }
-#ifdef GMUTEX_TRYLOCK
-bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; }
-#endif
-void Mutex::ReaderLock() { assert(++mutex_ > 0); }
-void Mutex::ReaderUnlock() { assert(mutex_-- > 0); }
-
-#elif defined(_WIN32) || defined(__CYGWIN32__) || defined(__CYGWIN64__)
-
-Mutex::Mutex() { InitializeCriticalSection(&mutex_); SetIsSafe(); }
-Mutex::~Mutex() { DeleteCriticalSection(&mutex_); }
-void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); }
-void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); }
-#ifdef GMUTEX_TRYLOCK
-bool Mutex::TryLock() { return is_safe_ ?
- TryEnterCriticalSection(&mutex_) != 0 : true; }
-#endif
-void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks
-void Mutex::ReaderUnlock() { Unlock(); }
-
-#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK)
-
-#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \
- if (is_safe_ && fncall(&mutex_) != 0) abort(); \
-} while (0)
-
-Mutex::Mutex() {
- SetIsSafe();
- if (is_safe_ && pthread_rwlock_init(&mutex_, NULL) != 0) abort();
-}
-Mutex::~Mutex() { SAFE_PTHREAD(pthread_rwlock_destroy); }
-void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock); }
-void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock); }
-#ifdef GMUTEX_TRYLOCK
-bool Mutex::TryLock() { return is_safe_ ?
- pthread_rwlock_trywrlock(&mutex_) == 0 :
- true; }
-#endif
-void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock); }
-void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock); }
-#undef SAFE_PTHREAD
-
-#elif defined(HAVE_PTHREAD)
-
-#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \
- if (is_safe_ && fncall(&mutex_) != 0) abort(); \
-} while (0)
-
-Mutex::Mutex() {
- SetIsSafe();
- if (is_safe_ && pthread_mutex_init(&mutex_, NULL) != 0) abort();
-}
-Mutex::~Mutex() { SAFE_PTHREAD(pthread_mutex_destroy); }
-void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock); }
-void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock); }
-#ifdef GMUTEX_TRYLOCK
-bool Mutex::TryLock() { return is_safe_ ?
- pthread_mutex_trylock(&mutex_) == 0 : true; }
-#endif
-void Mutex::ReaderLock() { Lock(); }
-void Mutex::ReaderUnlock() { Unlock(); }
-#undef SAFE_PTHREAD
-
-#endif
-
-// --------------------------------------------------------------------------
-// Some helper classes
-
-// MutexLock(mu) acquires mu when constructed and releases it when destroyed.
-class MutexLock {
- public:
- explicit MutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); }
- ~MutexLock() { mu_->Unlock(); }
- private:
- Mutex * const mu_;
- // Disallow "evil" constructors
- MutexLock(const MutexLock&);
- void operator=(const MutexLock&);
-};
-
-// ReaderMutexLock and WriterMutexLock do the same, for rwlocks
-class ReaderMutexLock {
- public:
- explicit ReaderMutexLock(Mutex *mu) : mu_(mu) { mu_->ReaderLock(); }
- ~ReaderMutexLock() { mu_->ReaderUnlock(); }
- private:
- Mutex * const mu_;
- // Disallow "evil" constructors
- ReaderMutexLock(const ReaderMutexLock&);
- void operator=(const ReaderMutexLock&);
-};
-
-class WriterMutexLock {
- public:
- explicit WriterMutexLock(Mutex *mu) : mu_(mu) { mu_->WriterLock(); }
- ~WriterMutexLock() { mu_->WriterUnlock(); }
- private:
- Mutex * const mu_;
- // Disallow "evil" constructors
- WriterMutexLock(const WriterMutexLock&);
- void operator=(const WriterMutexLock&);
-};
-
-// Catch bug where variable name is omitted, e.g. MutexLock (&mu);
-#define MutexLock(x) COMPILE_ASSERT(0, mutex_lock_decl_missing_var_name)
-#define ReaderMutexLock(x) COMPILE_ASSERT(0, rmutex_lock_decl_missing_var_name)
-#define WriterMutexLock(x) COMPILE_ASSERT(0, wmutex_lock_decl_missing_var_name)
-
-} // namespace MUTEX_NAMESPACE
-
-using namespace MUTEX_NAMESPACE;
-
-#undef MUTEX_NAMESPACE
-
-#endif /* #define GOOGLE_MUTEX_H__ */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/windows/config_cmake.h.in
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/windows/config_cmake.h.in b/third_party/src/glog/src/windows/config_cmake.h.in
deleted file mode 100644
index e5468d8..0000000
--- a/third_party/src/glog/src/windows/config_cmake.h.in
+++ /dev/null
@@ -1,142 +0,0 @@
-/* src/config.h.in. Generated from configure.ac by autoheader. */
-
-/* Namespace for Google classes */
-#define GOOGLE_NAMESPACE google
-
-/* Define if you have the `dladdr' function */
-#undef HAVE_DLADDR
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the <execinfo.h> header file. */
-#undef HAVE_EXECINFO_H
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <libunwind.h> header file. */
-#undef HAVE_LIBUNWIND_H
-
-/* define if you have google gflags library */
-#undef HAVE_LIB_GFLAGS
-
-/* define if you have libunwind */
-#undef HAVE_LIB_UNWIND
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* define if the compiler implements namespaces */
-#undef HAVE_NAMESPACES
-
-/* Define if you have POSIX threads libraries and header files. */
-#undef HAVE_PTHREAD
-
-/* define if the compiler implements pthread_rwlock_* */
-#undef HAVE_RWLOCK
-
-/* Define if you have the `sigaltstack' function */
-#undef HAVE_SIGALTSTACK
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <syscall.h> header file. */
-#undef HAVE_SYSCALL_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/syscall.h> header file. */
-#undef HAVE_SYS_SYSCALL_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <ucontext.h> header file. */
-#undef HAVE_UCONTEXT_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* define if the compiler supports using expression for operator */
-#undef HAVE_USING_OPERATOR
-
-/* define if your compiler has __attribute__ */
-#undef HAVE___ATTRIBUTE__
-
-/* define if your compiler has __builtin_expect */
-#undef HAVE___BUILTIN_EXPECT
-
-/* define if your compiler has __sync_val_compare_and_swap */
-#undef HAVE___SYNC_VAL_COMPARE_AND_SWAP
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* How to access the PC from a struct ucontext */
-#undef PC_FROM_UCONTEXT
-
-/* Define to necessary symbol if this constant uses a non-standard name on
- your system. */
-#undef PTHREAD_CREATE_JOINABLE
-
-/* The size of `void *', as computed by sizeof. */
-#undef SIZEOF_VOID_P
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* the namespace where STL code like vector<> is defined */
-#undef STL_NAMESPACE
-
-/* Version number of package */
-#undef VERSION
-
-/* 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 {
-
-/* Always the empty-string on non-windows systems. On windows, should be
- "__declspec(dllexport)". This way, when we compile the dll, we export our
- functions/classes. It's safe to define this here because config.h is only
- used internally, to compile the DLL, and every DLL source file #includes
- "config.h" before anything else. */
-#ifndef GOOGLE_GLOG_DLL_DECL
-# define GOOGLE_GLOG_IS_A_DLL 1 /* not set if you're statically linking */
-# define GOOGLE_GLOG_DLL_DECL __declspec(dllexport)
-# define GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS __declspec(dllimport)
-#endif
-
-/* Whether snprintf exists in stdio.h */
-#cmakedefine HAVE_SNPRINTF 1
-
-/* Whether pid_t exists in process.h */
-#cmakedefine HAVE_PID_T 1
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c43107d1/third_party/src/glog/src/windows/glog/log_severity.h
----------------------------------------------------------------------
diff --git a/third_party/src/glog/src/windows/glog/log_severity.h b/third_party/src/glog/src/windows/glog/log_severity.h
deleted file mode 100644
index 22a4191..0000000
--- a/third_party/src/glog/src/windows/glog/log_severity.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// This file is automatically generated from src/glog/log_severity.h
-// using src/windows/preprocess.sh.
-// DO NOT EDIT!
-
-// Copyright (c) 2007, 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.
-
-#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
-
-// Variables of type LogSeverity are widely taken to lie in the range
-// [0, NUM_SEVERITIES-1]. Be careful to preserve this assumption if
-// you ever need to change their values or add a new severity.
-typedef int LogSeverity;
-
-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
-#define DFATAL_LEVEL ERROR
-#else
-#define DFATAL_LEVEL FATAL
-#endif
-
-extern GOOGLE_GLOG_DLL_DECL const char* const LogSeverityNames[NUM_SEVERITIES];
-
-// NDEBUG usage helpers related to (RAW_)DCHECK:
-//
-// DEBUG_MODE is for small !NDEBUG uses like
-// if (DEBUG_MODE) foo.CheckThatFoo();
-// instead of substantially more verbose
-// #ifndef NDEBUG
-// foo.CheckThatFoo();
-// #endif
-//
-// IF_DEBUG_MODE is for small !NDEBUG uses like
-// IF_DEBUG_MODE( string error; )
-// DCHECK(Foo(&error)) << error;
-// instead of substantially more verbose
-// #ifndef NDEBUG
-// string error;
-// DCHECK(Foo(&error)) << error;
-// #endif
-//
-#ifdef NDEBUG
-enum { DEBUG_MODE = 0 };
-#define IF_DEBUG_MODE(x)
-#else
-enum { DEBUG_MODE = 1 };
-#define IF_DEBUG_MODE(x) x
-#endif
-
-#endif // BASE_LOG_SEVERITY_H__