Libmv: Update to the latest upstream version

Main reason is to bring up new Glog which should have MSVC 2015
support.
This commit is contained in:
Sergey Sharybin 2015-12-30 16:51:21 +05:00
parent 2583cc88de
commit 6b7ead4fe8
23 changed files with 466 additions and 406 deletions

186
extern/libmv/ChangeLog vendored

@ -1,3 +1,85 @@
commit d249280fdf7c937fd6ebbc465508843a70aafd4c
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed Dec 30 16:59:28 2015 +0500
Tweaks to Glog to support building on all platforms
This makes it possible to compile Libmv on all platforms,
amount of hacks is lower, which could bring some warnings
up, but those are better be addressed via upstream which
is now rather active.
commit 86c57750ddb857643fb5dd2c83b4953da83dd57d
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed Dec 30 16:15:47 2015 +0500
Enable explicit Schur complement matrix by default
Gives up to 2x speed up of camera solving process in average scene.
In the really huge one it might be slower, but that we need to investigate.
commit d6c52a70b5a0664b7c74bda68f59a895fe8aa235
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed Dec 30 16:13:03 2015 +0500
Fix one frame memory leak when tracking last frame
commit 6e2ac41d25d5923b2a62c96d27d919a36eff9b48
Author: Brecht Van Lommel <brechtvanlommel@gmail.com>
Date: Wed Dec 30 16:11:24 2015 +0500
Motion tracking not workig with Xcode 7 on OS X.
Caused by use of the uninitialized shape_ variable in Resize().
commit fc72ae06fb4ae559ac37d14d1b34d6669505cc86
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed Dec 30 15:56:40 2015 +0500
Update GLog to latest upstream
Should fix issues building with MSVC2015.
commit d4b2d15bd3d195074b074331354de96a1b51042f
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed Dec 30 16:01:10 2015 +0500
Fix wrong README file reference
commit 2b4aa0b7720cae9a408284834559bea9960157ee
Author: Keir Mierle <mierle@gmail.com>
Date: Mon May 11 02:16:53 2015 -0700
Make README more informative for GitHub viewers
Reviewers: sergey
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D1295
commit 514e4491aea655d20be047ed87f002fb7854d5c9
Author: Keir Mierle <mierle@gmail.com>
Date: Mon May 11 01:54:09 2015 -0700
Simplify the modal solver Ceres cost function
Fix test by flipping the quaternion.
Reviewers: sergey
Reviewed By: sergey
Projects: #libmv
Differential Revision: https://developer.blender.org/D756
commit e55fafd31f7d53d42af7c6b7df2eebe3c2568da9
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed Dec 31 19:05:51 2014 +0500
Synchronize MSVC compilation fixes from Blender
commit 7d6020d2ec42c6cb2749bc891186b4880d26d40b
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed Dec 31 15:32:07 2014 +0500
@ -601,107 +683,3 @@ Date: Wed Mar 26 17:44:09 2014 +0600
Fix bad memory write in BA code when having zero-weighted tracks
Issue was really stupid and caused by the wrong vector initialization.
commit d14a372dfe09c7339f267c4904a541fbe2efec43
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Fri Mar 21 16:02:41 2014 +0600
Attempt to fix compilation error with msvc2013
commit 933531580b4dc4b65601d785cedc16506d615d7b
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Mar 20 23:07:34 2014 +0600
Compilation fixes for MinGW
Many thanks to Antony Riakiotakis for the patch!
commit f1aefcbf58fe04ea2967434f39f703bb486777c8
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Feb 27 16:21:19 2014 +0600
Implement separate BA step for tracks which have constant zero weight
This is needed to minimize their reprojection error over the footage.
Without this extra step positions of such tracks were calculated by
algebraic intersection code only, which doesn't give best precision.
commit bcf7f9470b2ea33cf89a31a72037ec03be631637
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Feb 27 14:16:42 2014 +0600
Avoid zero-sized problem when doing euclidean intersection
Zero-sized problem might occur when intersecting track with
constant zero weight. For such tracks we'll just use result
of algebraic intersection.
TODO: We probably need to have a separate BA step to adjust
positions of tracks with constant zero weight.
commit f884bb20a93189b8210639f3de939c64177d66b3
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed Feb 26 18:00:40 2014 +0600
Ignore zero weighted markers in keyframe selection
It doesn't make sense to use zero-weighted tracks as a correspondences
in keyframe selection.
Such tracks are not guaranteed to be tracked accurately because their
purpose is to add reference points in 3D space without affecting the
solution.
commit 74db5175cdbcabe673b82eef59c88fb7f342c43f
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed Feb 26 13:23:02 2014 +0600
Tweaks to make bundling into Blender warning-less
Mainly issue i caused by conflicts in include directories,
so glog used to include config.h from gflags. It might be
fixed by splitting gflags/glog from Libmv in Blender build
system but that's not something fun to work on. Fixed by
making include directories bit more explicit.
Also solved no-previous-prototype warnings.
commit bc4bc66af0115069562b79e837ccf4fd95c8f97e
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Fri Feb 21 14:55:13 2014 +0600
Raise epsilon used for model solver test
It was too much small leading to false failure triggering
caused simply by precision issues.
commit bf750590a6af4af3622c01fd1004c44da60484a7
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Tue Feb 18 23:35:52 2014 +0600
Made it possible to link against Ceres installed on the system
Main purpose of this is to get away from bundled Ceres library
which is not so trivial to re-bundle and takes some to do this
(not talking about CMake options conflicts and pollution).
Enabled by setting WITH_SYSTEM_CERES=ON. Default paths to search
Ceres library:
- /usr/local
- /sw
- /opt/local
- /opt/csw
- /opt/lib/ceres
You might also specify Ceres root directory using CERES_ROOT_DIR
variable (both CMake and environment variables are supported).
If your Ceres is build statically, you're to control all additional
libraries needed to link against using CMAKE_EXE_LINKER_FLAGS.
commit c9156fbf80c86853806844b754b1e48f45c5ec11
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Tue Feb 18 19:38:22 2014 +0600
Remove .orig file which was added by accident

@ -1,5 +1,3 @@
#!/usr/bin/python
# NOTE: This file is automatically generated by bundle.sh script
# If you're doing changes in this file, please update template
# in that script too

@ -179,12 +179,8 @@ void GetNormalizedPoints(const Mat &original_points,
class HomographySymmetricGeometricCostFunctor {
public:
HomographySymmetricGeometricCostFunctor(const Vec2 &x,
const Vec2 &y) {
xx_ = x(0);
xy_ = x(1);
yx_ = y(0);
yy_ = y(1);
}
const Vec2 &y)
: x_(x), y_(y) { }
template<typename T>
bool operator()(const T *homography_parameters, T *residuals) const {
@ -193,8 +189,8 @@ class HomographySymmetricGeometricCostFunctor {
Mat3 H(homography_parameters);
Vec3 x(T(xx_), T(xy_), T(1.0));
Vec3 y(T(yx_), T(yy_), T(1.0));
Vec3 x(T(x_(0)), T(x_(1)), T(1.0));
Vec3 y(T(y_(0)), T(y_(1)), T(1.0));
Vec3 H_x = H * x;
Vec3 Hinv_y = H.inverse() * y;
@ -203,19 +199,18 @@ class HomographySymmetricGeometricCostFunctor {
Hinv_y /= Hinv_y(2);
// This is a forward error.
residuals[0] = H_x(0) - T(yx_);
residuals[1] = H_x(1) - T(yy_);
residuals[0] = H_x(0) - T(y_(0));
residuals[1] = H_x(1) - T(y_(1));
// This is a backward error.
residuals[2] = Hinv_y(0) - T(xx_);
residuals[3] = Hinv_y(1) - T(xy_);
residuals[2] = Hinv_y(0) - T(x_(0));
residuals[3] = Hinv_y(1) - T(x_(1));
return true;
}
// TODO(sergey): Think of better naming.
double xx_, xy_;
double yx_, yy_;
const Vec2 x_;
const Vec2 y_;
};
// Termination checking callback used for homography estimation.

@ -197,7 +197,7 @@ class CameraIntrinsics {
double *normalized_x,
double *normalized_y) const = 0;
// Distort an image using the current camera intrinsics
// Distort an image using the current camera instrinsics
//
// The distorted image is computed in output_buffer using samples from
// input_buffer. Both buffers should be width x height x channels sized.
@ -226,7 +226,7 @@ class CameraIntrinsics {
int channels,
PixelType *output_buffer);
// Undistort an image using the current camera intrinsics
// Undistort an image using the current camera instrinsics
//
// The undistorted image is computed in output_buffer using samples from
// input_buffer. Both buffers should be width x height x channels sized.

@ -1,4 +1,4 @@
// Copyright (c) 2012 libmv authors.
// Copyright (c) 2015 libmv authors.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
@ -62,32 +62,32 @@ struct ModalReprojectionError {
: observed_x_(observed_x), observed_y_(observed_y),
weight_(weight), bundle_(bundle) { }
// TODO(keir): This should support bundling focal length as well.
template <typename T>
bool operator()(const T* quaternion, // Rotation quaternion
T* residuals) const {
T R[9];
ceres::QuaternionToRotation(quaternion, R);
bool operator()(const T* quaternion, T* residuals) const {
// Convert bundle position from double to T.
T X[3];
X[0] = T(bundle_(0));
X[1] = T(bundle_(1));
X[2] = T(bundle_(2));
T X[3] = { T(bundle_(0)), T(bundle_(1)), T(bundle_(2)) };
// Compute projective coordinates: x = RX.
// Compute the point position in camera coordinates: x = RX.
T x[3];
x[0] = R[0]*X[0] + R[3]*X[1] + R[6]*X[2];
x[1] = R[1]*X[0] + R[4]*X[1] + R[7]*X[2];
x[2] = R[2]*X[0] + R[5]*X[1] + R[8]*X[2];
// Compute normalized coordinates: x /= x[2].
// This flips the sense of the quaternion, to adhere to Blender conventions.
T quaternion_inverse[4] = {
quaternion[0],
-quaternion[1],
-quaternion[2],
-quaternion[3],
};
ceres::QuaternionRotatePoint(quaternion_inverse, X, x);
// Compute normalized coordinates by dividing out the depth.
T xn = x[0] / x[2];
T yn = x[1] / x[2];
// The error is the difference between reprojected
// and observed marker position.
residuals[0] = xn - T(observed_x_);
residuals[1] = yn - T(observed_y_);
// The error is the difference between reprojected and observed marker
// positions, weighted by the passed in weight.
residuals[0] = T(weight_) * (xn - T(observed_x_));
residuals[1] = T(weight_) * (yn - T(observed_y_));
return true;
}

@ -1,9 +1,7 @@
Project: Google Logging
URL: http://code.google.com/p/google-glog/
License: New BSD
Upstream version: 0.3.3, r143
Upstream version: 0.3.4, 4d391fe
Local modifications:
* Added per-platform config.h files so no configuration-time
checks for functions and so are needed.
* See glog_tweaks.patch to see other tweaks which are done
against glog upstream.

@ -134,7 +134,9 @@
// *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
# ifndef _XOPEN_SOURCE // Some other header might have already set it for us.
# define _XOPEN_SOURCE 500 // may be needed to get the rwlock calls
# endif
# endif
# include <pthread.h>
typedef pthread_rwlock_t MutexType;

@ -1,5 +1,5 @@
/* src/config.h. Generated from config.h.in by configure. */
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* define if glog doesn't use RTTI */
/* #undef DISABLE_RTTI */
/* Namespace for Google classes */
#define GOOGLE_NAMESPACE google
@ -7,29 +7,32 @@
/* Define if you have the `dladdr' function */
/* #undef HAVE_DLADDR */
/* Define if you have the `snprintf' function */
#define HAVE_SNPRINTF
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
#define HAVE_DLFCN_H
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
#define HAVE_EXECINFO_H
/* Define if you have the `fcntl' function */
#define HAVE_FCNTL 1
#define HAVE_FCNTL
/* Define to 1 if you have the <glob.h> header file. */
#define HAVE_GLOB_H 1
#define HAVE_GLOB_H
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1
/* #undef HAVE_LIBPTHREAD */
/* Define to 1 if you have the <libunwind.h> header file. */
/* #undef HAVE_LIBUNWIND_H */
#define HAVE_LIBUNWIND_H
/* define if you have google gflags library */
#define HAVE_LIB_GFLAGS 1
#define HAVE_LIB_GFLAGS
/* define if you have google gmock library */
/* #undef HAVE_LIB_GMOCK */
@ -41,103 +44,119 @@
/* #undef HAVE_LIB_UNWIND */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
#define HAVE_MEMORY_H
/* define to disable multithreading support. */
/* #undef NO_THREADS */
/* define if the compiler implements namespaces */
#define HAVE_NAMESPACES 1
#define HAVE_NAMESPACES
/* Define if you have the 'pread' function */
#define HAVE_PREAD 1
#define HAVE_PREAD
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1
#define HAVE_PTHREAD
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
#define HAVE_PWD_H
/* Define if you have the 'pwrite' function */
#define HAVE_PWRITE 1
#define HAVE_PWRITE
/* define if the compiler implements pthread_rwlock_* */
#define HAVE_RWLOCK 1
/* #undef HAVE_RWLOCK */
/* Define if you have the 'sigaction' function */
#define HAVE_SIGACTION
/* Define if you have the `sigaltstack' function */
#define HAVE_SIGALTSTACK 1
/* #undef HAVE_SIGALTSTACK */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
#define HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
#define HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
#define HAVE_STRING_H
/* Define to 1 if you have the <syscall.h> header file. */
/* #undef HAVE_SYSCALL_H */
#define HAVE_SYSCALL_H
/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1
#define HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
#define HAVE_SYS_SYSCALL_H 1
#define HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/ucontext.h> header file. */
#define HAVE_SYS_UCONTEXT_H 1
/* #undef HAVE_SYS_UCONTEXT_H */
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
#define HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <ucontext.h> header file. */
#define HAVE_UCONTEXT_H 1
#define HAVE_UCONTEXT_H
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <unwind.h> header file. */
#define HAVE_UNWIND_H 1
/* define if the compiler supports using expression for operator */
#define HAVE_USING_OPERATOR 1
#define HAVE_USING_OPERATOR
/* define if your compiler has __attribute__ */
#define HAVE___ATTRIBUTE__ 1
#define HAVE___ATTRIBUTE__
/* define if your compiler has __builtin_expect */
#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
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
/* #undef LT_OBJDIR */
/* Name of package */
#define PACKAGE "glog"
/* #undef PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "opensource@google.com"
/* #undef PACKAGE_BUGREPORT */
/* Define to the full name of this package. */
#define PACKAGE_NAME "glog"
/* #undef PACKAGE_NAME */
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "glog 0.3.2"
/* #undef PACKAGE_STRING */
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "glog"
/* #undef PACKAGE_TARNAME */
/* Define to the home page for this package. */
/* #undef PACKAGE_URL */
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.3.2"
/* #undef PACKAGE_VERSION */
/* How to access the PC from a struct ucontext */
/* #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP] */
/* #undef PC_FROM_UCONTEXT */
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
@ -149,7 +168,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,7 +175,7 @@
#define TEST_SRC_DIR "."
/* Version number of package */
#define VERSION "0.3.2"
/* #undef VERSION */
/* Stops putting the code inside the Google namespace */
#define _END_GOOGLE_NAMESPACE_ }
@ -165,8 +183,4 @@
/* 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
#define GOOGLE_GLOG_DLL_DECL

@ -1,5 +1,5 @@
/* src/config.h. Generated from config.h.in by configure. */
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* define if glog doesn't use RTTI */
/* #undef DISABLE_RTTI */
/* Namespace for Google classes */
#define GOOGLE_NAMESPACE google
@ -7,29 +7,32 @@
/* Define if you have the `dladdr' function */
/* #undef HAVE_DLADDR */
/* Define if you have the `snprintf' function */
#define HAVE_SNPRINTF
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
#define HAVE_DLFCN_H
/* Define to 1 if you have the <execinfo.h> header file. */
#define HAVE_EXECINFO_H 1
#define HAVE_EXECINFO_H
/* Define if you have the `fcntl' function */
#define HAVE_FCNTL 1
#define HAVE_FCNTL
/* Define to 1 if you have the <glob.h> header file. */
#define HAVE_GLOB_H 1
#define HAVE_GLOB_H
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1
/* #undef HAVE_LIBPTHREAD */
/* Define to 1 if you have the <libunwind.h> header file. */
/* #undef HAVE_LIBUNWIND_H */
#define HAVE_LIBUNWIND_H
/* define if you have google gflags library */
#define HAVE_LIB_GFLAGS 1
#define HAVE_LIB_GFLAGS
/* define if you have google gmock library */
/* #undef HAVE_LIB_GMOCK */
@ -41,100 +44,116 @@
/* #undef HAVE_LIB_UNWIND */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
#define HAVE_MEMORY_H
/* define to disable multithreading support. */
/* #undef NO_THREADS */
/* define if the compiler implements namespaces */
#define HAVE_NAMESPACES 1
#define HAVE_NAMESPACES
/* Define if you have the 'pread' function */
#define HAVE_PREAD 1
#define HAVE_PREAD
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1
#define HAVE_PTHREAD
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
#define HAVE_PWD_H
/* Define if you have the 'pwrite' function */
#define HAVE_PWRITE 1
#define HAVE_PWRITE
/* define if the compiler implements pthread_rwlock_* */
#define HAVE_RWLOCK 1
/* #undef HAVE_RWLOCK */
/* Define if you have the 'sigaction' function */
#define HAVE_SIGACTION
/* Define if you have the `sigaltstack' function */
#define HAVE_SIGALTSTACK 1
/* #undef HAVE_SIGALTSTACK */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
#define HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
#define HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
#define HAVE_STRING_H
/* Define to 1 if you have the <syscall.h> header file. */
/* #undef HAVE_SYSCALL_H */
#define HAVE_SYSCALL_H
/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1
#define HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
/* #undef HAVE_SYS_SYSCALL_H */
#define HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/ucontext.h> header file. */
#define HAVE_SYS_UCONTEXT_H 1
/* #undef HAVE_SYS_UCONTEXT_H */
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
#define HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <ucontext.h> header file. */
#define HAVE_UCONTEXT_H 1
#define HAVE_UCONTEXT_H
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <unwind.h> header file. */
#define HAVE_UNWIND_H 1
/* define if the compiler supports using expression for operator */
#define HAVE_USING_OPERATOR 1
#define HAVE_USING_OPERATOR
/* define if your compiler has __attribute__ */
#define HAVE___ATTRIBUTE__ 1
#define HAVE___ATTRIBUTE__
/* define if your compiler has __builtin_expect */
#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
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
/* #undef LT_OBJDIR */
/* Name of package */
#define PACKAGE "glog"
/* #undef PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "opensource@google.com"
/* #undef PACKAGE_BUGREPORT */
/* Define to the full name of this package. */
#define PACKAGE_NAME "glog"
/* #undef PACKAGE_NAME */
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "glog 0.3.1"
/* #undef PACKAGE_STRING */
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "glog"
/* #undef PACKAGE_TARNAME */
/* Define to the home page for this package. */
/* #undef PACKAGE_URL */
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.3.1"
/* #undef PACKAGE_VERSION */
/* How to access the PC from a struct ucontext */
#if defined(_M_X64) || defined(__amd64__) || defined(__x86_64__)
@ -155,7 +174,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
@ -163,10 +181,12 @@
#define TEST_SRC_DIR "."
/* Version number of package */
#define VERSION "0.3.1"
/* #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 {
#define GOOGLE_GLOG_DLL_DECL

@ -1,5 +1,5 @@
/* src/config.h. Generated from config.h.in by configure. */
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* define if glog doesn't use RTTI */
/* #undef DISABLE_RTTI */
/* Namespace for Google classes */
#define GOOGLE_NAMESPACE google
@ -7,29 +7,32 @@
/* Define if you have the `dladdr' function */
/* #undef HAVE_DLADDR */
/* Define if you have the `snprintf' function */
#define HAVE_SNPRINTF
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
#define HAVE_DLFCN_H
/* Define to 1 if you have the <execinfo.h> header file. */
#define HAVE_EXECINFO_H 1
#define HAVE_EXECINFO_H
/* Define if you have the `fcntl' function */
#define HAVE_FCNTL 1
#define HAVE_FCNTL
/* Define to 1 if you have the <glob.h> header file. */
#define HAVE_GLOB_H 1
#define HAVE_GLOB_H
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1
/* #undef HAVE_LIBPTHREAD */
/* Define to 1 if you have the <libunwind.h> header file. */
/* #undef HAVE_LIBUNWIND_H */
#define HAVE_LIBUNWIND_H
/* define if you have google gflags library */
#define HAVE_LIB_GFLAGS 1
#define HAVE_LIB_GFLAGS
/* define if you have google gmock library */
/* #undef HAVE_LIB_GMOCK */
@ -41,107 +44,116 @@
/* #undef HAVE_LIB_UNWIND */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
#define HAVE_MEMORY_H
/* define to disable multithreading support. */
/* #undef NO_THREADS */
/* define if the compiler implements namespaces */
#define HAVE_NAMESPACES 1
#define HAVE_NAMESPACES
/* Define if you have the 'pread' function */
#define HAVE_PREAD 1
#define HAVE_PREAD
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1
#define HAVE_PTHREAD
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
#define HAVE_PWD_H
/* Define if you have the 'pwrite' function */
#define HAVE_PWRITE 1
#define HAVE_PWRITE
/* define if the compiler implements pthread_rwlock_* */
#define HAVE_RWLOCK 1
/* #undef HAVE_RWLOCK */
/* Define if you have the 'sigaction' function */
#define HAVE_SIGACTION
/* Define if you have the `sigaltstack' function */
#define HAVE_SIGALTSTACK 1
/* #undef HAVE_SIGALTSTACK */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
#define HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
#define HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
#define HAVE_STRING_H
/* Define to 1 if you have the <syscall.h> header file. */
#define HAVE_SYSCALL_H 1
#define HAVE_SYSCALL_H
/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1
#define HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
#define HAVE_SYS_SYSCALL_H 1
#define HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/ucontext.h> header file. */
#define HAVE_SYS_UCONTEXT_H 1
/* #undef HAVE_SYS_UCONTEXT_H */
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
#define HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <ucontext.h> header file. */
#define HAVE_UCONTEXT_H 1
#define HAVE_UCONTEXT_H
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <unwind.h> header file. */
#define HAVE_UNWIND_H 1
/* define if the compiler supports using expression for operator */
#define HAVE_USING_OPERATOR 1
#define HAVE_USING_OPERATOR
/* define if your compiler has __attribute__ */
#define HAVE___ATTRIBUTE__ 1
#define HAVE___ATTRIBUTE__
/* define if your compiler has __builtin_expect */
#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
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* #undef LT_OBJDIR */
/* Name of package */
#define PACKAGE "glog"
/* #undef PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "opensource@google.com"
/* #undef PACKAGE_BUGREPORT */
/* Define to the full name of this package. */
#define PACKAGE_NAME "glog"
/* #undef PACKAGE_NAME */
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "glog 0.3.2"
/* #undef PACKAGE_STRING */
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "glog"
/* #undef PACKAGE_TARNAME */
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* #undef PACKAGE_URL */
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.3.2"
/* #undef PACKAGE_VERSION */
/* How to access the PC from a struct ucontext */
#if defined(_M_X64) || defined(__amd64__) || defined(__x86_64__)
@ -162,7 +174,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
@ -170,7 +181,7 @@
#define TEST_SRC_DIR "."
/* Version number of package */
#define VERSION "0.3.2"
/* #undef VERSION */
/* Stops putting the code inside the Google namespace */
#define _END_GOOGLE_NAMESPACE_ }
@ -178,8 +189,4 @@
/* 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
#define GOOGLE_GLOG_DLL_DECL

@ -1,143 +1,162 @@
/* src/config.h. Generated from config.h.in by configure. */
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* define if glog doesn't use RTTI */
/* #undef DISABLE_RTTI */
/* Namespace for Google classes */
#define GOOGLE_NAMESPACE google
/* Define if you have the `dladdr' function */
#define HAVE_DLADDR 1
/* #undef HAVE_DLADDR */
/* Define if you have the `snprintf' function */
#define HAVE_SNPRINTF
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
#define HAVE_DLFCN_H
/* Define to 1 if you have the <execinfo.h> header file. */
#define HAVE_EXECINFO_H 1
#define HAVE_EXECINFO_H
/* Define if you have the `fcntl' function */
#define HAVE_FCNTL 1
#define HAVE_FCNTL
/* Define to 1 if you have the <glob.h> header file. */
#define HAVE_GLOB_H 1
#define HAVE_GLOB_H
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1
/* #undef HAVE_LIBPTHREAD */
/* Define to 1 if you have the <libunwind.h> header file. */
#define HAVE_LIBUNWIND_H 1
#define HAVE_LIBUNWIND_H
/* define if you have google gflags library */
#define HAVE_LIB_GFLAGS 1
#define HAVE_LIB_GFLAGS
/* define if you have google gmock library */
/* #undef HAVE_LIB_GMOCK */
/* define if you have google gtest library */
//#define HAVE_LIB_GTEST 1
/* #undef HAVE_LIB_GTEST */
/* define if you have libunwind */
/* #undef HAVE_LIB_UNWIND */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
#define HAVE_MEMORY_H
/* define to disable multithreading support. */
/* #undef NO_THREADS */
/* define if the compiler implements namespaces */
#define HAVE_NAMESPACES 1
#define HAVE_NAMESPACES
/* Define if you have the 'pread' function */
#define HAVE_PREAD 1
#define HAVE_PREAD
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1
#define HAVE_PTHREAD
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
#define HAVE_PWD_H
/* Define if you have the 'pwrite' function */
#define HAVE_PWRITE 1
#define HAVE_PWRITE
/* define if the compiler implements pthread_rwlock_* */
#define HAVE_RWLOCK 1
/* #undef HAVE_RWLOCK */
/* Define if you have the 'sigaction' function */
#define HAVE_SIGACTION
/* Define if you have the `sigaltstack' function */
#define HAVE_SIGALTSTACK 1
/* #undef HAVE_SIGALTSTACK */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
#define HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
#define HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
#define HAVE_STRING_H
/* Define to 1 if you have the <syscall.h> header file. */
/* #undef HAVE_SYSCALL_H */
#define HAVE_SYSCALL_H
/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1
#define HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
#define HAVE_SYS_SYSCALL_H 1
#define HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/ucontext.h> header file. */
#define HAVE_SYS_UCONTEXT_H 1
/* #undef HAVE_SYS_UCONTEXT_H */
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
#define HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <ucontext.h> header file. */
/* #undef HAVE_UCONTEXT_H */
#define HAVE_UCONTEXT_H
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <unwind.h> header file. */
#define HAVE_UNWIND_H 1
/* define if the compiler supports using expression for operator */
#define HAVE_USING_OPERATOR 1
#define HAVE_USING_OPERATOR
/* define if your compiler has __attribute__ */
#define HAVE___ATTRIBUTE__ 1
#define HAVE___ATTRIBUTE__
/* define if your compiler has __builtin_expect */
#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
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
/* #undef LT_OBJDIR */
/* Name of package */
#define PACKAGE "glog"
/* #undef PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "opensource@google.com"
/* #undef PACKAGE_BUGREPORT */
/* Define to the full name of this package. */
#define PACKAGE_NAME "glog"
/* #undef PACKAGE_NAME */
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "glog 0.3.2"
/* #undef PACKAGE_STRING */
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "glog"
/* #undef PACKAGE_TARNAME */
/* Define to the home page for this package. */
/* #undef PACKAGE_URL */
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.3.2"
/* #undef PACKAGE_VERSION */
/* How to access the PC from a struct ucontext */
#undef PC_FROM_UCONTEXT
/* #undef PC_FROM_UCONTEXT */
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
@ -156,7 +175,7 @@
#define TEST_SRC_DIR "."
/* Version number of package */
#define VERSION "0.3.2"
/* #undef VERSION */
/* Stops putting the code inside the Google namespace */
#define _END_GOOGLE_NAMESPACE_ }
@ -164,8 +183,4 @@
/* 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
#define GOOGLE_GLOG_DLL_DECL

@ -77,7 +77,7 @@ _START_GOOGLE_NAMESPACE_
// Demangle "mangled". On success, return true and write the
// demangled symbol name to "out". Otherwise, return false.
// "out" is modified even if demangling is unsuccessful.
bool Demangle(const char *mangled, char *out, int out_size);
bool GOOGLE_GLOG_DLL_DECL Demangle(const char *mangled, char *out, int out_size);
_END_GOOGLE_NAMESPACE_

@ -52,14 +52,6 @@
#endif
#include <vector>
// 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
#if defined(_MSC_VER)
#define GLOG_MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \
__pragma(warning(disable:n))
@ -69,6 +61,15 @@
#define GLOG_MSVC_POP_WARNING()
#endif
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
# if defined(_WIN32) && !defined(__CYGWIN__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
# endif
#endif
// We care a lot about number of bits things take up. Unfortunately,
// systems define their bit-specific ints in a lot of different ways.
// We use our own way, and have a typedef to get there.
@ -133,15 +134,28 @@ typedef unsigned __int64 uint64;
#ifndef GOOGLE_PREDICT_BRANCH_NOT_TAKEN
#if 1
#define GOOGLE_PREDICT_BRANCH_NOT_TAKEN(x) (__builtin_expect(x, 0))
#define GOOGLE_PREDICT_FALSE(x) (__builtin_expect(x, 0))
#define GOOGLE_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
#else
#define GOOGLE_PREDICT_BRANCH_NOT_TAKEN(x) x
#endif
#endif
#ifndef GOOGLE_PREDICT_FALSE
#if 1
#define GOOGLE_PREDICT_FALSE(x) (__builtin_expect(x, 0))
#else
#define GOOGLE_PREDICT_FALSE(x) x
#endif
#endif
#ifndef GOOGLE_PREDICT_TRUE
#if 1
#define GOOGLE_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
#else
#define GOOGLE_PREDICT_TRUE(x) x
#endif
#endif
// Make a bunch of macros for logging. The way to log things is to stream
// things to LOG(<a particular severity level>). E.g.,
//
@ -351,6 +365,9 @@ DECLARE_int32(minloglevel);
// default logging directory.
DECLARE_string(log_dir);
// Set the log file mode.
DECLARE_int32(logfile_mode);
// Sets the path of the directory into which to put additional links
// to the log files.
DECLARE_string(log_link);
@ -546,7 +563,7 @@ class LogSink; // defined below
// vector<string> *outvec;
// The cast is to disambiguate NULL arguments.
#define LOG_STRING(severity, outvec) \
LOG_TO_STRING_##severity(static_cast<vector<string>*>(outvec)).stream()
LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream()
#define LOG_IF(severity, condition) \
!(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
@ -631,7 +648,7 @@ void MakeCheckOpValueString(std::ostream* os, const unsigned char& v);
// Build the error message string. Specify no inlining for code size.
template <typename T1, typename T2>
std::string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext)
__attribute__ ((noinline));
__attribute__((noinline));
namespace base {
namespace internal {
@ -714,10 +731,10 @@ DEFINE_CHECK_OP_IMPL(Check_GT, > )
// to reduce the overhead of CHECK statments by 2x.
// Real DCHECK-heavy tests have seen 1.5x speedups.
// The meaning of "string" might be different between now and
// The meaning of "string" might be different between now and
// when this macro gets invoked (e.g., if someone is experimenting
// with other string implementations that get defined after this
// file is included). Save the current meaning now and use it
// file is included). Save the current meaning now and use it
// in the macro.
typedef std::string _Check_string;
#define CHECK_OP_LOG(name, op, val1, val2, log) \
@ -910,6 +927,9 @@ template <bool>
struct CompileAssert {
};
struct CrashReason;
// Returns true if FailureSignalHandler is installed.
bool IsFailureSignalHandlerInstalled();
} // namespace glog_internal_namespace_
#define GOOGLE_GLOG_COMPILE_ASSERT(expr, msg) \
@ -1155,6 +1175,8 @@ public:
char* str() const { return pbase(); }
private:
LogStream(const LogStream&);
LogStream& operator=(const LogStream&);
base_logging::LogStreamBuf streambuf_;
int ctr_; // Counter hack (for the LOG_EVERY_X() macro)
LogStream *self_; // Consistency check hack
@ -1222,7 +1244,7 @@ public:
void SendToSyslogAndLog(); // Actually dispatch to syslog and the logs
// Call abort() or similar to perform LOG(FATAL) crash.
static void Fail() __attribute__ ((noreturn));
static void __attribute__((noreturn)) Fail();
std::ostream& stream();
@ -1270,7 +1292,7 @@ class GOOGLE_GLOG_DLL_DECL LogMessageFatal : public LogMessage {
public:
LogMessageFatal(const char* file, int line);
LogMessageFatal(const char* file, int line, const CheckOpString& result);
~LogMessageFatal() __attribute__ ((noreturn));
__attribute__((noreturn)) ~LogMessageFatal();
};
// A non-macro interface to the log facility; (useful
@ -1574,7 +1596,7 @@ class GOOGLE_GLOG_DLL_DECL NullStreamFatal : public NullStream {
NullStreamFatal() { }
NullStreamFatal(const char* file, int line, const CheckOpString& result) :
NullStream(file, line, result) { }
__attribute__ ((noreturn)) ~NullStreamFatal() { _exit(1); }
__attribute__((noreturn)) ~NullStreamFatal() throw () { _exit(1); }
};
// Install a signal handler that will dump signal information and a stack

@ -32,7 +32,6 @@
// Thread-safe logging routines that do not allocate any memory or
// acquire any locks, and can therefore be used by low-level memory
// allocation and synchronization code.
#ifdef WIN32
# include "windows/glog/raw_logging.h"
#else // WIN32
@ -177,7 +176,7 @@ GOOGLE_GLOG_DLL_DECL void RawLog__(LogSeverity severity,
const char* file,
int line,
const char* format, ...)
__attribute__((__format__ (__printf__, 4, 5)));
;
// Hack to propagate time information into this module so that
// this module does not have to directly call localtime_r(),

@ -35,7 +35,6 @@
#include <assert.h>
#include <iomanip>
#include <string>
#include <algorithm>
#ifdef HAVE_UNISTD_H
# include <unistd.h> // For _exit.
#endif
@ -89,6 +88,10 @@ using std::perror;
using std::fdopen;
#endif
#ifdef _WIN32
#define fdopen _fdopen
#endif
// There is no thread annotation support.
#define EXCLUSIVE_LOCKS_REQUIRED(mu)
@ -162,6 +165,8 @@ static const char* DefaultLogDir() {
return "";
}
GLOG_DEFINE_int32(logfile_mode, 0664, "Log file mode/permissions.");
GLOG_DEFINE_string(log_dir, DefaultLogDir(),
"If specified, logfiles are written into this directory instead "
"of the default logging directory.");
@ -254,6 +259,7 @@ static bool TerminalSupportsColor() {
!strcmp(term, "xterm") ||
!strcmp(term, "xterm-color") ||
!strcmp(term, "xterm-256color") ||
!strcmp(term, "screen-256color") ||
!strcmp(term, "screen") ||
!strcmp(term, "linux") ||
!strcmp(term, "cygwin");
@ -307,7 +313,7 @@ WORD GetColorAttribute(GLogColor color) {
#else
// Returns the ANSI color code for the given color.
static const char* GetAnsiColorCode(GLogColor color) {
const char* GetAnsiColorCode(GLogColor color) {
switch (color) {
case COLOR_RED: return "1";
case COLOR_GREEN: return "2";
@ -570,7 +576,7 @@ inline void LogDestination::FlushLogFilesUnsafe(int min_severity) {
// assume we have the log_mutex or we simply don't care
// about it
for (int i = min_severity; i < NUM_SEVERITIES; i++) {
LogDestination* log = log_destination(i);
LogDestination* log = log_destinations_[i];
if (log != NULL) {
// Flush the base fileobject_ logger directly instead of going
// through any wrappers to reduce chance of deadlock.
@ -817,6 +823,8 @@ void LogDestination::DeleteLogDestinations() {
delete log_destinations_[severity];
log_destinations_[severity] = NULL;
}
MutexLock l(&sink_mutex_);
delete sinks_;
}
namespace {
@ -897,7 +905,7 @@ bool LogFileObject::CreateLogfile(const string& time_pid_string) {
string string_filename = base_filename_+filename_extension_+
time_pid_string;
const char* filename = string_filename.c_str();
int fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0664);
int fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, FLAGS_logfile_mode);
if (fd == -1) return false;
#ifdef HAVE_FCNTL
// Mark the file close-on-exec. We don't really care if this fails
@ -1669,8 +1677,6 @@ void LogToStderr() {
namespace base {
namespace internal {
namespace {
bool GetExitOnDFatal() {
MutexLock l(&log_mutex);
return exit_on_dfatal;
@ -1691,8 +1697,6 @@ void SetExitOnDFatal(bool value) {
exit_on_dfatal = value;
}
} // namespace
} // namespace internal
} // namespace base

@ -335,6 +335,22 @@ void FailureSignalHandler(int signal_number,
#endif // HAVE_SIGACTION
namespace glog_internal_namespace_ {
bool IsFailureSignalHandlerInstalled() {
#ifdef HAVE_SIGACTION
struct sigaction sig_action;
memset(&sig_action, 0, sizeof(sig_action));
sigemptyset(&sig_action.sa_mask);
sigaction(SIGABRT, NULL, &sig_action);
if (sig_action.sa_sigaction == &FailureSignalHandler)
return true;
#endif // HAVE_SIGACTION
return false;
}
} // namespace glog_internal_namespace_
void InstallFailureSignalHandler() {
#ifdef HAVE_SIGACTION
// Build the sigaction struct.

@ -84,7 +84,7 @@ static void DebugWriteToStderr(const char* data, void *) {
}
}
static void DebugWriteToString(const char* data, void *arg) {
void DebugWriteToString(const char* data, void *arg) {
reinterpret_cast<string*>(arg)->append(data);
}
@ -138,13 +138,15 @@ static void DumpStackTraceAndExit() {
// TOOD(hamaji): Use signal instead of sigaction?
#ifdef HAVE_SIGACTION
// 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);
if (IsFailureSignalHandlerInstalled()) {
// Set the default signal handler for SIGABRT, to avoid invoking our
// own signal handler installed by InstallFailureSignalHandler().
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);
}
#endif // HAVE_SIGACTION
abort();

@ -62,8 +62,6 @@ _START_GOOGLE_NAMESPACE_
namespace glog_internal_namespace_ {
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.
@ -97,8 +95,6 @@ GOOGLE_GLOG_DLL_DECL bool SafeFNMatch_(const char* pattern,
}
}
} // namespace
} // namespace glog_internal_namespace_
using glog_internal_namespace_::SafeFNMatch_;
@ -166,29 +162,31 @@ 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) {
{
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;
}
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;
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;

@ -12,6 +12,10 @@
/* Puts following code inside the Google namespace */
#define _START_GOOGLE_NAMESPACE_ namespace google {
#ifdef __MINGW32__
# define HAVE_SNPRINTF
#endif
/* 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

@ -919,6 +919,9 @@ template <bool>
struct CompileAssert {
};
struct CrashReason;
// Returns true if FailureSignalHandler is installed.
bool IsFailureSignalHandlerInstalled();
} // namespace glog_internal_namespace_
#define GOOGLE_GLOG_COMPILE_ASSERT(expr, msg) \

@ -36,7 +36,7 @@
# error You should only be including windows/port.cc in a windows environment!
#endif
#include "config.h"
#include "../config.h"
#include <stdarg.h> // for va_list, va_start, va_end
#include <string.h> // for strstr()
#include <assert.h>
@ -55,7 +55,7 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
return _vsnprintf(str, size-1, format, ap);
}
#ifndef __MINGW64__
#ifndef HAVE_SNPRINTF
int snprintf(char *str, size_t size, const char *format, ...) {
va_list ap;
va_start(ap, format);

@ -41,7 +41,7 @@
#ifndef CTEMPLATE_WINDOWS_PORT_H_
#define CTEMPLATE_WINDOWS_PORT_H_
#include "config.h"
#include "../config.h"
#ifdef _WIN32
@ -111,12 +111,16 @@ enum { STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2 };
* because they don't always NUL-terminate. :-( We also can't use the
* name vsnprintf, since windows defines that (but not snprintf (!)).
*/
extern int snprintf(char *str, size_t size,
#ifndef HAVE_SNPRINTF
extern int GOOGLE_GLOG_DLL_DECL snprintf(char *str, size_t size,
const char *format, ...);
extern int safe_vsnprintf(char *str, size_t size,
#endif
extern int GOOGLE_GLOG_DLL_DECL safe_vsnprintf(char *str, size_t size,
const char *format, va_list ap);
#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
#ifndef va_copy
#define va_copy(dst, src) (dst) = (src)
#endif
/* Windows doesn't support specifying the number of buckets as a
* hash_map constructor arg, so we leave this blank.
@ -129,9 +133,6 @@ extern int safe_vsnprintf(char *str, size_t size,
typedef int pid_t;
#define getpid _getpid
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif // _MSC_VER
// ----------------------------------- THREADS
@ -143,30 +144,13 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock
#define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2))
inline struct tm* localtime_r(const time_t* timep, struct tm* result) {
#if __MINGW32__
struct tm *local_result;
local_result = localtime (timep);
if (local_result == NULL || result == NULL)
return NULL;
memcpy (result, local_result, sizeof (result));
return result;
#else
localtime_s(result, timep);
return result;
#endif
}
inline char* strerror_r(int errnum, char* buf, size_t buflen) {
#if __MINGW32__
strncpy(buf, "Not implemented yet", buflen);
return buf;
#else
strerror_s(buf, buflen, errnum);
return buf;
#endif
}
#ifndef __cplusplus

@ -96,6 +96,7 @@ DLLDEF_DEFINES="\
-e "s!@ac_cv_have___builtin_expect@!0!g" \
-e "s!@ac_cv_cxx_using_operator@!1!g" \
-e "s!@ac_cv___attribute___noreturn@!!g" \
-e "s!@ac_cv___attribute___noinline@!!g" \
-e "s!@ac_cv___attribute___printf_4_5@!!g" \
-e "s!@ac_google_attribute@!${HAVE___ATTRIBUTE__:-0}!g" \
-e "s!@ac_google_end_namespace@!$_END_GOOGLE_NAMESPACE_!g" \