Initial windows support. Now we don't have the stacktrace and several unittests.

git-svn-id: https://google-glog.googlecode.com/svn/trunk@23 eb4d4688-79bd-11dd-afb4-1d65580434c0
This commit is contained in:
2008-12-19 15:20:40 +00:00
parent c54c735616
commit afd586a5d5
31 changed files with 4389 additions and 368 deletions

60
INSTALL
View File

@ -7,66 +7,6 @@ Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Glog-Specific Install Notes
================================
*** NOTE FOR 64-BIT LINUX SYSTEMS
The glibc built-in stack-unwinder on 64-bit systems has some problems
with the glog libraries. (In particular, if you are using
InstallFailureSignalHandler(), the signal may be raised in the middle
of malloc, holding some malloc-related locks when they invoke the
stack unwinder. The built-in stack unwinder may call malloc
recursively, which may require the thread to acquire a lock it already
holds: deadlock.)
For that reason, if you use a 64-bit system and you need
InstallFailureSignalHandler(), we strongly recommend you install
libunwind before trying to configure or install google glog.
libunwind can be found at
http://download.savannah.nongnu.org/releases/libunwind/libunwind-snap-070410.tar.gz
Even if you already have libunwind installed, you will probably still
need to install from the snapshot to get the latest version.
CAUTION: if you install libunwind from the URL above, be aware that
you may have trouble if you try to statically link your binary with
glog: that is, if you link with 'gcc -static -lgcc_eh ...'. This
is because both libunwind and libgcc implement the same C++ exception
handling APIs, but they implement them differently on some platforms.
This is not likely to be a problem on ia64, but may be on x86-64.
Also, if you link binaries statically, make sure that you add
-Wl,--eh-frame-hdr to your linker options. This is required so that
libunwind can find the information generated by the compiler required
for stack unwinding.
Using -static is rare, though, so unless you know this will affect you
it probably won't.
If you cannot or do not wish to install libunwind, you can still try
to use two kinds of stack-unwinder: 1. glibc built-in stack-unwinder
and 2. frame pointer based stack-unwinder.
1. As we already mentioned, glibc's unwinder has a deadlock issue.
However, if you don't use InstallFailureSignalHandler() or you don't
worry about the rare possibilities of deadlocks, you can use this
stack-unwinder. If you specify no options and libunwind isn't
detected on your system, the configure script chooses this unwinder by
default.
2. The frame pointer based stack unwinder requires that your
application, the glog library, and system libraries like libc, all be
compiled with a frame pointer. This is *not* the default for x86-64.
If you are on x86-64 system, know that you have a set of system
libraries with frame-pointers enabled, and compile all your
applications with -fno-omit-frame-pointer, then you can enable the
frame pointer based stack unwinder by passing the
--enable-frame-pointers flag to configure.
Basic Installation
==================

View File

@ -28,7 +28,11 @@ endif
glogincludedir = $(includedir)/glog
## The .h files you want to install (that is, .h files that people
## who install this package can include in their own applications.)
gloginclude_HEADERS = src/glog/log_severity.h src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h
## We have to include both the .h and .h.in forms. The latter we
## put in noinst_HEADERS.
gloginclude_HEADERS = src/glog/log_severity.h
nodist_gloginclude_HEADERS = src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h
noinst_HEADERS = src/glog/logging.h.in src/glog/raw_logging.h.in src/glog/vlog_is_on.h.in src/glog/stl_logging.h.in
docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
## This is for HTML and other documentation you want to install.
@ -56,8 +60,10 @@ noinst_SCRIPTS =
TEST_BINARIES =
TESTS += logging_unittest
logging_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
src/logging_unittest.cc
logging_unittest_SOURCES = $(gloginclude_HEADERS) \
src/logging_unittest.cc \
src/config_for_unittests.h
nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
logging_unittest_LDADD = libglog.la $(COMMON_LIBS)
@ -81,64 +87,73 @@ signalhandler_unittest_sh: signalhandler_unittest
$(top_srcdir)/src/signalhandler_unittest.sh
TEST_BINARIES += logging_striptest0
logging_striptest0_SOURCES = $(gloginclude_HEADERS) src/config.h \
logging_striptest0_SOURCES = $(gloginclude_HEADERS) \
src/logging_striptest_main.cc
nodist_logging_striptest0_SOURCES = $(nodist_gloginclude_HEADERS)
logging_striptest0_CXXFLAGS = $(PTHREAD_CFLAGS)
logging_striptest0_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest0_LDADD = libglog.la $(COMMON_LIBS)
TEST_BINARIES += logging_striptest2
logging_striptest2_SOURCES = $(gloginclude_HEADERS) src/config.h \
logging_striptest2_SOURCES = $(gloginclude_HEADERS) \
src/logging_striptest2.cc
nodist_logging_striptest2_SOURCES = $(nodist_gloginclude_HEADERS)
logging_striptest2_CXXFLAGS = $(PTHREAD_CFLAGS)
logging_striptest2_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest2_LDADD = libglog.la $(COMMON_LIBS)
TEST_BINARIES += logging_striptest10
logging_striptest10_SOURCES = $(gloginclude_HEADERS) src/config.h \
logging_striptest10_SOURCES = $(gloginclude_HEADERS) \
src/logging_striptest10.cc
nodist_logging_striptest10_SOURCES = $(nodist_gloginclude_HEADERS)
logging_striptest10_CXXFLAGS = $(PTHREAD_CFLAGS)
logging_striptest10_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest10_LDADD = libglog.la $(COMMON_LIBS)
TESTS += demangle_unittest
demangle_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
demangle_unittest_SOURCES = $(gloginclude_HEADERS) \
src/demangle_unittest.cc
nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
demangle_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
demangle_unittest_LDADD = libglog.la $(COMMON_LIBS)
TESTS += stacktrace_unittest
stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \
src/stacktrace_unittest.cc
nodist_stacktrace_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
stacktrace_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
stacktrace_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
stacktrace_unittest_LDADD = libglog.la $(COMMON_LIBS)
TESTS += symbolize_unittest
symbolize_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \
src/symbolize_unittest.cc
nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
symbolize_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS)
TESTS += stl_logging_unittest
stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \
src/stl_logging_unittest.cc
nodist_stl_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
stl_logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
stl_logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
stl_logging_unittest_LDADD = libglog.la $(COMMON_LIBS)
TEST_BINARIES += signalhandler_unittest
signalhandler_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
signalhandler_unittest_SOURCES = $(gloginclude_HEADERS) \
src/signalhandler_unittest.cc
nodist_signalhandler_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
signalhandler_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
signalhandler_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
signalhandler_unittest_LDADD = libglog.la $(COMMON_LIBS)
TESTS += utilities_unittest
utilities_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
utilities_unittest_SOURCES = $(gloginclude_HEADERS) \
src/utilities_unittest.cc
nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
utilities_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
utilities_unittest_LDADD = libglog.la $(COMMON_LIBS)
@ -146,7 +161,7 @@ utilities_unittest_LDADD = libglog.la $(COMMON_LIBS)
## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
lib_LTLIBRARIES += libglog.la
libglog_la_SOURCES = $(gloginclude_HEADERS) src/config.h \
libglog_la_SOURCES = $(gloginclude_HEADERS) \
src/logging.cc src/raw_logging.cc src/vlog_is_on.cc \
src/utilities.cc src/utilities.h \
src/demangle.cc src/demangle.h \
@ -160,11 +175,17 @@ libglog_la_SOURCES = $(gloginclude_HEADERS) src/config.h \
src/signalhandler.cc \
src/base/mutex.h src/base/googleinit.h \
src/base/commandlineflags.h src/googletest.h
nodist_libglog_la_SOURCES = $(nodist_gloginclude_HEADERS)
libglog_la_CXXFLAGS = $(PTRHEAD_CFLAGS) -DNDEBUG
libglog_la_LDFLAGS = $(PTRHEAD_CFLAGS)
libglog_la_LIBADD = $(COMMON_LIBS)
## The location of the windows project file for each binary we make
WINDOWS_PROJECTS = google-glog.sln
WINDOWS_PROJECTS += vsprojects/libglog/libglog.vcproj
WINDOWS_PROJECTS += vsprojects/logging_unittest/logging_unittest.vcproj
## ^^^^ END OF RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
@ -178,13 +199,19 @@ rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
deb: dist-gzip packages/deb.sh packages/deb/*
@cd packages && ./deb.sh ${PACKAGE} ${VERSION}
# TODO(hamaji): We don't support Visual Studio for now.
## Windows wants write permission to .vcproj files and maybe even sln files.
#dist-hook:
# test -e "$(distdir)/vsprojects" \
# && chmod -R u+w $(distdir)/*.sln $(distdir)/vsprojects/
# Windows wants write permission to .vcproj files and maybe even sln files.
dist-hook:
test -e "$(distdir)/vsprojects" \
&& chmod -R u+w $(distdir)/*.sln $(distdir)/vsprojects/
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec packages/deb.sh packages/deb \
$(SCRIPTS) src/logging_unittest.err src/demangle_unittest.txt
$(SCRIPTS) src/logging_unittest.err src/demangle_unittest.txt \
src/windows/config.h src/windows/port.h src/windows/port.cc \
src/windows/preprocess.sh \
src/windows/glog/log_severity.h src/windows/glog/logging.h \
src/windows/glog/raw_logging.h src/windows/glog/stl_logging.h \
src/windows/glog/vlog_is_on.h \
$(WINDOWS_PROJECTS)

View File

@ -49,7 +49,7 @@ TESTS = logging_unittest$(EXEEXT) demangle_unittest$(EXEEXT) \
noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
$(gloginclude_HEADERS) $(srcdir)/Makefile.am \
$(gloginclude_HEADERS) $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/configure \
$(top_srcdir)/src/config.h.in \
$(top_srcdir)/src/glog/logging.h.in \
@ -82,7 +82,7 @@ am__vpath_adj = case $$p in \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(docdir)" \
"$(DESTDIR)$(glogincludedir)"
"$(DESTDIR)$(glogincludedir)" "$(DESTDIR)$(glogincludedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
@ -94,7 +94,9 @@ am_libglog_la_OBJECTS = $(am__objects_1) libglog_la-logging.lo \
libglog_la-raw_logging.lo libglog_la-vlog_is_on.lo \
libglog_la-utilities.lo libglog_la-demangle.lo \
libglog_la-symbolize.lo libglog_la-signalhandler.lo
libglog_la_OBJECTS = $(am_libglog_la_OBJECTS)
nodist_libglog_la_OBJECTS = $(am__objects_1)
libglog_la_OBJECTS = $(am_libglog_la_OBJECTS) \
$(nodist_libglog_la_OBJECTS)
libglog_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libglog_la_CXXFLAGS) \
$(CXXFLAGS) $(libglog_la_LDFLAGS) $(LDFLAGS) -o $@
@ -106,7 +108,9 @@ am__EXEEXT_2 = logging_striptest0$(EXEEXT) logging_striptest2$(EXEEXT) \
PROGRAMS = $(noinst_PROGRAMS)
am_demangle_unittest_OBJECTS = $(am__objects_1) \
demangle_unittest-demangle_unittest.$(OBJEXT)
demangle_unittest_OBJECTS = $(am_demangle_unittest_OBJECTS)
nodist_demangle_unittest_OBJECTS = $(am__objects_1)
demangle_unittest_OBJECTS = $(am_demangle_unittest_OBJECTS) \
$(nodist_demangle_unittest_OBJECTS)
demangle_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
demangle_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@ -114,7 +118,9 @@ demangle_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(demangle_unittest_LDFLAGS) $(LDFLAGS) -o $@
am_logging_striptest0_OBJECTS = $(am__objects_1) \
logging_striptest0-logging_striptest_main.$(OBJEXT)
logging_striptest0_OBJECTS = $(am_logging_striptest0_OBJECTS)
nodist_logging_striptest0_OBJECTS = $(am__objects_1)
logging_striptest0_OBJECTS = $(am_logging_striptest0_OBJECTS) \
$(nodist_logging_striptest0_OBJECTS)
logging_striptest0_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
logging_striptest0_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@ -122,7 +128,9 @@ logging_striptest0_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(logging_striptest0_LDFLAGS) $(LDFLAGS) -o $@
am_logging_striptest10_OBJECTS = $(am__objects_1) \
logging_striptest10-logging_striptest10.$(OBJEXT)
logging_striptest10_OBJECTS = $(am_logging_striptest10_OBJECTS)
nodist_logging_striptest10_OBJECTS = $(am__objects_1)
logging_striptest10_OBJECTS = $(am_logging_striptest10_OBJECTS) \
$(nodist_logging_striptest10_OBJECTS)
logging_striptest10_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
logging_striptest10_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@ -130,7 +138,9 @@ logging_striptest10_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(logging_striptest10_LDFLAGS) $(LDFLAGS) -o $@
am_logging_striptest2_OBJECTS = $(am__objects_1) \
logging_striptest2-logging_striptest2.$(OBJEXT)
logging_striptest2_OBJECTS = $(am_logging_striptest2_OBJECTS)
nodist_logging_striptest2_OBJECTS = $(am__objects_1)
logging_striptest2_OBJECTS = $(am_logging_striptest2_OBJECTS) \
$(nodist_logging_striptest2_OBJECTS)
logging_striptest2_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
logging_striptest2_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@ -138,7 +148,9 @@ logging_striptest2_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(logging_striptest2_LDFLAGS) $(LDFLAGS) -o $@
am_logging_unittest_OBJECTS = $(am__objects_1) \
logging_unittest-logging_unittest.$(OBJEXT)
logging_unittest_OBJECTS = $(am_logging_unittest_OBJECTS)
nodist_logging_unittest_OBJECTS = $(am__objects_1)
logging_unittest_OBJECTS = $(am_logging_unittest_OBJECTS) \
$(nodist_logging_unittest_OBJECTS)
logging_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
logging_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@ -146,7 +158,9 @@ logging_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(logging_unittest_LDFLAGS) $(LDFLAGS) -o $@
am_signalhandler_unittest_OBJECTS = $(am__objects_1) \
signalhandler_unittest-signalhandler_unittest.$(OBJEXT)
signalhandler_unittest_OBJECTS = $(am_signalhandler_unittest_OBJECTS)
nodist_signalhandler_unittest_OBJECTS = $(am__objects_1)
signalhandler_unittest_OBJECTS = $(am_signalhandler_unittest_OBJECTS) \
$(nodist_signalhandler_unittest_OBJECTS)
signalhandler_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
signalhandler_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@ -154,7 +168,9 @@ signalhandler_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(signalhandler_unittest_LDFLAGS) $(LDFLAGS) -o $@
am_stacktrace_unittest_OBJECTS = $(am__objects_1) \
stacktrace_unittest-stacktrace_unittest.$(OBJEXT)
stacktrace_unittest_OBJECTS = $(am_stacktrace_unittest_OBJECTS)
nodist_stacktrace_unittest_OBJECTS = $(am__objects_1)
stacktrace_unittest_OBJECTS = $(am_stacktrace_unittest_OBJECTS) \
$(nodist_stacktrace_unittest_OBJECTS)
stacktrace_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
stacktrace_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@ -162,7 +178,9 @@ stacktrace_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(stacktrace_unittest_LDFLAGS) $(LDFLAGS) -o $@
am_stl_logging_unittest_OBJECTS = $(am__objects_1) \
stl_logging_unittest-stl_logging_unittest.$(OBJEXT)
stl_logging_unittest_OBJECTS = $(am_stl_logging_unittest_OBJECTS)
nodist_stl_logging_unittest_OBJECTS = $(am__objects_1)
stl_logging_unittest_OBJECTS = $(am_stl_logging_unittest_OBJECTS) \
$(nodist_stl_logging_unittest_OBJECTS)
stl_logging_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
stl_logging_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@ -170,7 +188,9 @@ stl_logging_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(stl_logging_unittest_LDFLAGS) $(LDFLAGS) -o $@
am_symbolize_unittest_OBJECTS = $(am__objects_1) \
symbolize_unittest-symbolize_unittest.$(OBJEXT)
symbolize_unittest_OBJECTS = $(am_symbolize_unittest_OBJECTS)
nodist_symbolize_unittest_OBJECTS = $(am__objects_1)
symbolize_unittest_OBJECTS = $(am_symbolize_unittest_OBJECTS) \
$(nodist_symbolize_unittest_OBJECTS)
symbolize_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
symbolize_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@ -178,7 +198,9 @@ symbolize_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(symbolize_unittest_LDFLAGS) $(LDFLAGS) -o $@
am_utilities_unittest_OBJECTS = $(am__objects_1) \
utilities_unittest-utilities_unittest.$(OBJEXT)
utilities_unittest_OBJECTS = $(am_utilities_unittest_OBJECTS)
nodist_utilities_unittest_OBJECTS = $(am__objects_1)
utilities_unittest_OBJECTS = $(am_utilities_unittest_OBJECTS) \
$(nodist_utilities_unittest_OBJECTS)
utilities_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
utilities_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
@ -206,12 +228,26 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libglog_la_SOURCES) $(demangle_unittest_SOURCES) \
$(logging_striptest0_SOURCES) $(logging_striptest10_SOURCES) \
$(logging_striptest2_SOURCES) $(logging_unittest_SOURCES) \
SOURCES = $(libglog_la_SOURCES) $(nodist_libglog_la_SOURCES) \
$(demangle_unittest_SOURCES) \
$(nodist_demangle_unittest_SOURCES) \
$(logging_striptest0_SOURCES) \
$(nodist_logging_striptest0_SOURCES) \
$(logging_striptest10_SOURCES) \
$(nodist_logging_striptest10_SOURCES) \
$(logging_striptest2_SOURCES) \
$(nodist_logging_striptest2_SOURCES) \
$(logging_unittest_SOURCES) $(nodist_logging_unittest_SOURCES) \
$(signalhandler_unittest_SOURCES) \
$(stacktrace_unittest_SOURCES) $(stl_logging_unittest_SOURCES) \
$(symbolize_unittest_SOURCES) $(utilities_unittest_SOURCES)
$(nodist_signalhandler_unittest_SOURCES) \
$(stacktrace_unittest_SOURCES) \
$(nodist_stacktrace_unittest_SOURCES) \
$(stl_logging_unittest_SOURCES) \
$(nodist_stl_logging_unittest_SOURCES) \
$(symbolize_unittest_SOURCES) \
$(nodist_symbolize_unittest_SOURCES) \
$(utilities_unittest_SOURCES) \
$(nodist_utilities_unittest_SOURCES)
DIST_SOURCES = $(libglog_la_SOURCES) $(demangle_unittest_SOURCES) \
$(logging_striptest0_SOURCES) $(logging_striptest10_SOURCES) \
$(logging_striptest2_SOURCES) $(logging_unittest_SOURCES) \
@ -221,7 +257,9 @@ DIST_SOURCES = $(libglog_la_SOURCES) $(demangle_unittest_SOURCES) \
dist_docDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_doc_DATA)
glogincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(gloginclude_HEADERS)
nodist_glogincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(gloginclude_HEADERS) $(nodist_gloginclude_HEADERS) \
$(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -316,6 +354,7 @@ ac_cv_have_stdint_h = @ac_cv_have_stdint_h@
ac_cv_have_systypes_h = @ac_cv_have_systypes_h@
ac_cv_have_u_int16_t = @ac_cv_have_u_int16_t@
ac_cv_have_uint16_t = @ac_cv_have_uint16_t@
ac_cv_have_unistd_h = @ac_cv_have_unistd_h@
ac_google_end_namespace = @ac_google_end_namespace@
ac_google_namespace = @ac_google_namespace@
ac_google_start_namespace = @ac_google_start_namespace@
@ -374,7 +413,9 @@ AM_CPPFLAGS = -I$(top_srcdir)/src
# This is mostly based on configure options
AM_CXXFLAGS = $(am__append_1) $(am__append_2) $(am__append_3)
glogincludedir = $(includedir)/glog
gloginclude_HEADERS = src/glog/log_severity.h src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h
gloginclude_HEADERS = src/glog/log_severity.h
nodist_gloginclude_HEADERS = src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h
noinst_HEADERS = src/glog/logging.h.in src/glog/raw_logging.h.in src/glog/vlog_is_on.h.in src/glog/stl_logging.h.in
dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \
doc/designstyle.css doc/glog.html
@ -391,67 +432,78 @@ noinst_SCRIPTS = src/logging_striplog_test.sh src/demangle_unittest.sh \
# Binaries used for script-based unittests.
TEST_BINARIES = logging_striptest0 logging_striptest2 \
logging_striptest10 signalhandler_unittest
logging_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
src/logging_unittest.cc
logging_unittest_SOURCES = $(gloginclude_HEADERS) \
src/logging_unittest.cc \
src/config_for_unittests.h
nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
logging_unittest_LDADD = libglog.la $(COMMON_LIBS)
logging_striptest0_SOURCES = $(gloginclude_HEADERS) src/config.h \
logging_striptest0_SOURCES = $(gloginclude_HEADERS) \
src/logging_striptest_main.cc
nodist_logging_striptest0_SOURCES = $(nodist_gloginclude_HEADERS)
logging_striptest0_CXXFLAGS = $(PTHREAD_CFLAGS)
logging_striptest0_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest0_LDADD = libglog.la $(COMMON_LIBS)
logging_striptest2_SOURCES = $(gloginclude_HEADERS) src/config.h \
logging_striptest2_SOURCES = $(gloginclude_HEADERS) \
src/logging_striptest2.cc
nodist_logging_striptest2_SOURCES = $(nodist_gloginclude_HEADERS)
logging_striptest2_CXXFLAGS = $(PTHREAD_CFLAGS)
logging_striptest2_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest2_LDADD = libglog.la $(COMMON_LIBS)
logging_striptest10_SOURCES = $(gloginclude_HEADERS) src/config.h \
logging_striptest10_SOURCES = $(gloginclude_HEADERS) \
src/logging_striptest10.cc
nodist_logging_striptest10_SOURCES = $(nodist_gloginclude_HEADERS)
logging_striptest10_CXXFLAGS = $(PTHREAD_CFLAGS)
logging_striptest10_LDFLAGS = $(PTHREAD_CFLAGS)
logging_striptest10_LDADD = libglog.la $(COMMON_LIBS)
demangle_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
demangle_unittest_SOURCES = $(gloginclude_HEADERS) \
src/demangle_unittest.cc
nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
demangle_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
demangle_unittest_LDADD = libglog.la $(COMMON_LIBS)
stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \
src/stacktrace_unittest.cc
nodist_stacktrace_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
stacktrace_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
stacktrace_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
stacktrace_unittest_LDADD = libglog.la $(COMMON_LIBS)
symbolize_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \
src/symbolize_unittest.cc
nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
symbolize_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS)
stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \
src/stl_logging_unittest.cc
nodist_stl_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
stl_logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
stl_logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
stl_logging_unittest_LDADD = libglog.la $(COMMON_LIBS)
signalhandler_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
signalhandler_unittest_SOURCES = $(gloginclude_HEADERS) \
src/signalhandler_unittest.cc
nodist_signalhandler_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
signalhandler_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
signalhandler_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
signalhandler_unittest_LDADD = libglog.la $(COMMON_LIBS)
utilities_unittest_SOURCES = $(gloginclude_HEADERS) src/config.h \
utilities_unittest_SOURCES = $(gloginclude_HEADERS) \
src/utilities_unittest.cc
nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
utilities_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
utilities_unittest_LDADD = libglog.la $(COMMON_LIBS)
libglog_la_SOURCES = $(gloginclude_HEADERS) src/config.h \
libglog_la_SOURCES = $(gloginclude_HEADERS) \
src/logging.cc src/raw_logging.cc src/vlog_is_on.cc \
src/utilities.cc src/utilities.h \
src/demangle.cc src/demangle.h \
@ -466,11 +518,20 @@ libglog_la_SOURCES = $(gloginclude_HEADERS) src/config.h \
src/base/mutex.h src/base/googleinit.h \
src/base/commandlineflags.h src/googletest.h
nodist_libglog_la_SOURCES = $(nodist_gloginclude_HEADERS)
libglog_la_CXXFLAGS = $(PTRHEAD_CFLAGS) -DNDEBUG
libglog_la_LDFLAGS = $(PTRHEAD_CFLAGS)
libglog_la_LIBADD = $(COMMON_LIBS)
WINDOWS_PROJECTS = google-glog.sln vsprojects/libglog/libglog.vcproj \
vsprojects/logging_unittest/logging_unittest.vcproj
EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec packages/deb.sh packages/deb \
$(SCRIPTS) src/logging_unittest.err src/demangle_unittest.txt
$(SCRIPTS) src/logging_unittest.err src/demangle_unittest.txt \
src/windows/config.h src/windows/port.h src/windows/port.cc \
src/windows/preprocess.sh \
src/windows/glog/log_severity.h src/windows/glog/logging.h \
src/windows/glog/raw_logging.h src/windows/glog/stl_logging.h \
src/windows/glog/vlog_is_on.h \
$(WINDOWS_PROJECTS)
all: all-am
@ -877,6 +938,23 @@ uninstall-glogincludeHEADERS:
echo " rm -f '$(DESTDIR)$(glogincludedir)/$$f'"; \
rm -f "$(DESTDIR)$(glogincludedir)/$$f"; \
done
install-nodist_glogincludeHEADERS: $(nodist_gloginclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(glogincludedir)" || $(MKDIR_P) "$(DESTDIR)$(glogincludedir)"
@list='$(nodist_gloginclude_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(nodist_glogincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(glogincludedir)/$$f'"; \
$(nodist_glogincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(glogincludedir)/$$f"; \
done
uninstall-nodist_glogincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(nodist_gloginclude_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(glogincludedir)/$$f'"; \
rm -f "$(DESTDIR)$(glogincludedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@ -1026,6 +1104,9 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
@ -1136,7 +1217,7 @@ check: check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \
$(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(glogincludedir)"; do \
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(glogincludedir)" "$(DESTDIR)$(glogincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@ -1185,7 +1266,8 @@ info: info-am
info-am:
install-data-am: install-dist_docDATA install-glogincludeHEADERS
install-data-am: install-dist_docDATA install-glogincludeHEADERS \
install-nodist_glogincludeHEADERS
install-dvi: install-dvi-am
@ -1224,28 +1306,30 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-dist_docDATA uninstall-glogincludeHEADERS \
uninstall-libLTLIBRARIES
uninstall-libLTLIBRARIES uninstall-nodist_glogincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \
clean clean-generic clean-libLTLIBRARIES clean-libtool \
clean-noinstPROGRAMS ctags dist dist-all dist-bzip2 dist-gzip \
dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
dist-hook dist-lzma dist-shar dist-tarZ dist-zip distcheck \
distclean distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
install-dist_docDATA install-dvi install-dvi-am install-exec \
install-exec-am install-glogincludeHEADERS install-html \
install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-libLTLIBRARIES install-man \
install-nodist_glogincludeHEADERS install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-dist_docDATA \
uninstall-glogincludeHEADERS uninstall-libLTLIBRARIES
uninstall-glogincludeHEADERS uninstall-libLTLIBRARIES \
uninstall-nodist_glogincludeHEADERS
@ENABLE_FRAME_POINTERS_FALSE@@X86_64_TRUE@ # TODO(csilvers): check if -fomit-frame-pointer might be in $(CXXFLAGS),
@ENABLE_FRAME_POINTERS_FALSE@@X86_64_TRUE@ # before setting this.
@ -1265,10 +1349,10 @@ rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
deb: dist-gzip packages/deb.sh packages/deb/*
@cd packages && ./deb.sh ${PACKAGE} ${VERSION}
# TODO(hamaji): We don't support Visual Studio for now.
#dist-hook:
# test -e "$(distdir)/vsprojects" \
# && chmod -R u+w $(distdir)/*.sln $(distdir)/vsprojects/
# Windows wants write permission to .vcproj files and maybe even sln files.
dist-hook:
test -e "$(distdir)/vsprojects" \
&& chmod -R u+w $(distdir)/*.sln $(distdir)/vsprojects/
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck

1016
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -28,13 +28,19 @@ AC_HEADER_STDC
AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0)
AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0)
AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0)
AC_CHECK_HEADERS(unistd.h, ac_cv_have_unistd_h=1, ac_cv_have_unistd_h=0)
AC_CHECK_HEADERS(syscall.h)
AC_CHECK_HEADERS(sys/syscall.h)
# For backtrace with glibc.
AC_CHECK_HEADERS(execinfo.h)
# For backtrace with libunwind.
AC_CHECK_HEADERS(libunwind.h, ac_cv_have_libunwind_h=1, ac_cv_have_libunwind_h=0)
AC_CHECK_HEADERS(libunwind.h)
AC_CHECK_HEADERS(ucontext.h)
AC_CHECK_HEADERS(sys/utsname.h)
AC_CHECK_HEADERS(pwd.h)
AC_CHECK_HEADERS(syslog.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(glob.h)
AC_CHECK_SIZEOF(void *)
@ -50,6 +56,9 @@ AC_CHECK_FUNC(sigaltstack,
AC_CHECK_FUNC(dladdr,
AC_DEFINE(HAVE_DLADDR, 1,
[Define if you have the `dladdr' function]))
AC_CHECK_FUNC(fcntl,
AC_DEFINE(HAVE_FCNTL, 1,
[Define if you have the `fcntl' function]))
AX_C___ATTRIBUTE__
# We only care about these two attributes.
@ -168,6 +177,7 @@ AC_SUBST(ac_cv_have___builtin_expect)
AC_SUBST(ac_cv_have_stdint_h)
AC_SUBST(ac_cv_have_systypes_h)
AC_SUBST(ac_cv_have_inttypes_h)
AC_SUBST(ac_cv_have_unistd_h)
AC_SUBST(ac_cv_have_uint16_t)
AC_SUBST(ac_cv_have_u_int16_t)
AC_SUBST(ac_cv_have___uint16)

29
google-glog.sln Executable file
View File

@ -0,0 +1,29 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libglog", "vsprojects\libglog\libglog.vcproj", "{34BD04BD-BC1D-4BFC-AAFC-ED02D9E960F1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logging_unittest", "vsprojects\logging_unittest\logging_unittest.vcproj", "{DD0690AA-5E09-46B5-83FD-4B28604CABA8}"
ProjectSection(ProjectDependencies) = postProject
{34BD04BD-BC1D-4BFC-AAFC-ED02D9E960F1} = {34BD04BD-BC1D-4BFC-AAFC-ED02D9E960F1}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{34BD04BD-BC1D-4BFC-AAFC-ED02D9E960F1}.Debug|Win32.ActiveCfg = Debug|Win32
{34BD04BD-BC1D-4BFC-AAFC-ED02D9E960F1}.Debug|Win32.Build.0 = Debug|Win32
{34BD04BD-BC1D-4BFC-AAFC-ED02D9E960F1}.Release|Win32.ActiveCfg = Release|Win32
{34BD04BD-BC1D-4BFC-AAFC-ED02D9E960F1}.Release|Win32.Build.0 = Release|Win32
{DD0690AA-5E09-46B5-83FD-4B28604CABA8}.Debug|Win32.ActiveCfg = Debug|Win32
{DD0690AA-5E09-46B5-83FD-4B28604CABA8}.Debug|Win32.Build.0 = Debug|Win32
{DD0690AA-5E09-46B5-83FD-4B28604CABA8}.Release|Win32.ActiveCfg = Release|Win32
{DD0690AA-5E09-46B5-83FD-4B28604CABA8}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -63,12 +63,12 @@
#define DECLARE_VARIABLE(type, name, tn) \
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead { \
extern type FLAGS_##name; \
extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
} \
using FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead::FLAGS_##name
#define DEFINE_VARIABLE(type, name, value, meaning, tn) \
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead { \
type FLAGS_##name(value); \
GOOGLE_GLOG_DLL_DECL type FLAGS_##name(value); \
char FLAGS_no##name; \
} \
using FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead::FLAGS_##name
@ -90,12 +90,13 @@
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
#define DECLARE_string(name) \
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead { \
extern std::string FLAGS_##name; \
extern GOOGLE_GLOG_DLL_DECL std::string FLAGS_##name; \
} \
using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_##name
#define DEFINE_string(name, value, meaning) \
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead { \
std::string FLAGS_##name(EnvToString("GLOG_" #name, value)); \
GOOGLE_GLOG_DLL_DECL std::string \
FLAGS_##name(EnvToString("GLOG_" #name, value)); \
char FLAGS_no##name; \
} \
using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_##name

View File

@ -12,6 +12,12 @@
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
/* Define if you have the `fcntl' function */
#undef HAVE_FCNTL
/* Define to 1 if you have the <glob.h> header file. */
#undef HAVE_GLOB_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@ -36,6 +42,9 @@
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* define if the compiler implements pthread_rwlock_* */
#undef HAVE_RWLOCK
@ -57,15 +66,24 @@
/* Define to 1 if you have the <syscall.h> header file. */
#undef HAVE_SYSCALL_H
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_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/time.h> header file. */
#undef HAVE_SYS_TIME_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 <sys/utsname.h> header file. */
#undef HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <ucontext.h> header file. */
#undef HAVE_UCONTEXT_H

View File

@ -0,0 +1,66 @@
// 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.
// ---
// All Rights Reserved.
//
// Author: Craig Silverstein
// Copied from google-perftools and modified by Shinichiro Hamaji
//
// This file is needed for windows -- unittests are not part of the
// glog dll, but still want to include config.h just like the
// dll does, so they can use internal tools and APIs for testing.
//
// The problem is that config.h declares GOOGLE_GLOG_DLL_DECL to be
// for exporting symbols, but the unittest needs to *import* symbols
// (since it's not the dll).
//
// The solution is to have this file, which is just like config.h but
// sets GOOGLE_GLOG_DLL_DECL to do a dllimport instead of a dllexport.
//
// The reason we need this extra GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS
// variable is in case people want to set GOOGLE_GLOG_DLL_DECL explicitly
// to something other than __declspec(dllexport). In that case, they
// may want to use something other than __declspec(dllimport) for the
// unittest case. For that, we allow folks to define both
// GOOGLE_GLOG_DLL_DECL and GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS explicitly.
//
// NOTE: This file is equivalent to config.h on non-windows systems,
// which never defined GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS and always
// define GOOGLE_GLOG_DLL_DECL to the empty string.
#include "config.h"
#undef GOOGLE_GLOG_DLL_DECL
#ifdef GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS
# define GOOGLE_GLOG_DLL_DECL GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS
#else
// if DLL_DECL_FOR_UNITTESTS isn't defined, use ""
# define GOOGLE_GLOG_DLL_DECL
#endif

View File

@ -3,6 +3,15 @@
#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
# ifdef _WIN32
# 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.
@ -17,7 +26,7 @@ const int INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
#define DFATAL_LEVEL FATAL
#endif
extern const char* const LogSeverityNames[NUM_SEVERITIES];
extern GOOGLE_GLOG_DLL_DECL const char* const LogSeverityNames[NUM_SEVERITIES];
// NDEBUG usage helpers related to (RAW_)DCHECK:
//

View File

@ -14,7 +14,9 @@
#include <string.h>
#include <time.h>
#include <string>
#include <unistd.h>
#if @ac_cv_have_unistd_h@
# include <unistd.h>
#endif
#ifdef __DEPRECATED
// Make GCC quiet.
# undef __DEPRECATED
@ -25,6 +27,15 @@
#endif
#include <vector>
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
# ifdef _WIN32
# 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.
@ -59,9 +70,9 @@ typedef int64_t int64;
typedef u_int64_t uint64;
#elif @ac_cv_have___uint16@ // the windows (vc7) format
typedef __int32 int32;
typedef __uint32 uint32;
typedef unsigned __int32 uint32;
typedef __int64 int64;
typedef __uint64 uint64;
typedef unsigned __int64 uint64;
#else
#error Do not know how to define a 32-bit integer quantity on your system
#endif
@ -222,7 +233,7 @@ typedef __uint64 uint64;
#define MUST_UNDEF_GFLAGS_DECLARE_MACROS
#define DECLARE_VARIABLE(type, name, tn) \
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead { \
extern type FLAGS_##name; \
extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
} \
using FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead::FLAGS_##name
@ -238,7 +249,7 @@ typedef __uint64 uint64;
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
#define DECLARE_string(name) \
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead { \
extern std::string FLAGS_##name; \
extern GOOGLE_GLOG_DLL_DECL std::string FLAGS_##name; \
} \
using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_##name
#endif
@ -376,10 +387,10 @@ DECLARE_bool(alsologtostderr);
// Initialize google's logging library. You will see the program name
// specified by argv0 in log outputs.
void InitGoogleLogging(const char* argv0);
GOOGLE_GLOG_DLL_DECL void InitGoogleLogging(const char* argv0);
// Install a function which will be called after LOG(FATAL).
void InstallFailureFunction(void (*fail_func)());
GOOGLE_GLOG_DLL_DECL void InstallFailureFunction(void (*fail_func)());
class LogSink; // defined below
@ -581,8 +592,8 @@ typedef std::string _Check_string;
// Helper functions for string comparisons.
// To avoid bloat, the definitions are in logging.cc.
#define DECLARE_CHECK_STROP_IMPL(func, expected) \
std::string* Check##func##expected##Impl(const char* s1, const char* s2, \
const char* names);
GOOGLE_GLOG_DLL_DECL std::string* Check##func##expected##Impl( \
const char* s1, const char* s2, const char* names);
DECLARE_CHECK_STROP_IMPL(strcmp, true)
DECLARE_CHECK_STROP_IMPL(strcmp, false)
DECLARE_CHECK_STROP_IMPL(strcasecmp, true)
@ -833,7 +844,7 @@ enum PRIVATE_Counter {COUNTER};
// You shouldn't actually use LogMessage's constructor to log things,
// though. You should use the LOG() macro (and variants thereof)
// above.
class LogMessage {
class GOOGLE_GLOG_DLL_DECL LogMessage {
public:
enum {
// Passing kNoLogPrefix for the line number disables the
@ -844,7 +855,19 @@ public:
kNoLogPrefix = -1
};
class LogStream : public std::ostrstream {
// LogStream inherit from non-DLL-exported class (std::ostrstream)
// and VC++ produces a warning for this situation.
// However, MSDN says "C4275 can be ignored in Microsoft Visual C++
// 2005 if you are deriving from a type in the Standard C++ Library"
// http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx
// Let's just ignore the warning.
#ifdef _MSC_VER
# pragma warning(disable: 4275)
#endif
class GOOGLE_GLOG_DLL_DECL LogStream : public std::ostrstream {
#ifdef _MSC_VER
# pragma warning(default: 4275)
#endif
public:
LogStream(char *buf, int len, int ctr)
: ostrstream(buf, len),
@ -940,11 +963,9 @@ private:
// Counts of messages sent at each priority:
static int64 num_messages_[NUM_SEVERITIES]; // under log_mutex
static LogMessageData fatal_message_data_;
// We keep the data in a separate struct so that each instance of
// LogMessage uses less stack space.
struct LogMessageData {
struct GOOGLE_GLOG_DLL_DECL LogMessageData {
// ORDER DEPENDENCY: preserved_errno_ comes before buf_ comes before
// message_text_ comes before stream_
int preserved_errno_; // preserved errno
@ -978,6 +999,8 @@ private:
void operator=(const LogMessageData&);
};
static LogMessageData fatal_message_data_;
LogMessageData* allocated_;
LogMessageData* data_;
@ -990,7 +1013,7 @@ private:
// This class happens to be thread-hostile because all instances share
// a single data buffer, but since it can only be created just before
// the process dies, we don't worry so much.
class LogMessageFatal : public LogMessage {
class GOOGLE_GLOG_DLL_DECL LogMessageFatal : public LogMessage {
public:
LogMessageFatal(const char* file, int line);
LogMessageFatal(const char* file, int line, const CheckOpString& result);
@ -1015,11 +1038,12 @@ T* CheckNotNull(const char *file, int line, const char *names, T* t) {
// Allow folks to put a counter in the LOG_EVERY_X()'ed messages. This
// only works if ostream is a LogStream. If the ostream is not a
// LogStream you'll get an assert saying as much at runtime.
std::ostream& operator<<(std::ostream &os, const PRIVATE_Counter&);
GOOGLE_GLOG_DLL_DECL std::ostream& operator<<(std::ostream &os,
const PRIVATE_Counter&);
// Derived class for PLOG*() above.
class ErrnoLogMessage : public LogMessage {
class GOOGLE_GLOG_DLL_DECL ErrnoLogMessage : public LogMessage {
public:
ErrnoLogMessage(const char* file, int line, LogSeverity severity, int ctr,
@ -1038,7 +1062,7 @@ class ErrnoLogMessage : public LogMessage {
// logging macros. This avoids compiler warnings like "value computed
// is not used" and "statement has no effect".
class LogMessageVoidify {
class GOOGLE_GLOG_DLL_DECL LogMessageVoidify {
public:
LogMessageVoidify() { }
// This has to be an operator with a precedence lower than << but
@ -1049,19 +1073,20 @@ class LogMessageVoidify {
// Flushes all log files that contains messages that are at least of
// the specified severity level. Thread-safe.
void FlushLogFiles(LogSeverity min_severity);
GOOGLE_GLOG_DLL_DECL void FlushLogFiles(LogSeverity min_severity);
// Flushes all log files that contains messages that are at least of
// the specified severity level. Thread-hostile because it ignores
// locking -- used for catastrophic failures.
void FlushLogFilesUnsafe(LogSeverity min_severity);
GOOGLE_GLOG_DLL_DECL void FlushLogFilesUnsafe(LogSeverity min_severity);
//
// Set the destination to which a particular severity level of log
// messages is sent. If base_filename is "", it means "don't log this
// severity". Thread-safe.
//
void SetLogDestination(LogSeverity severity, const char* base_filename);
GOOGLE_GLOG_DLL_DECL void SetLogDestination(LogSeverity severity,
const char* base_filename);
//
// Set the basename of the symlink to the latest log file at a given
@ -1069,14 +1094,15 @@ void SetLogDestination(LogSeverity severity, const char* base_filename);
// you don't call this function, the symlink basename is the
// invocation name of the program. Thread-safe.
//
void SetLogSymlink(LogSeverity severity, const char* symlink_basename);
GOOGLE_GLOG_DLL_DECL void SetLogSymlink(LogSeverity severity,
const char* symlink_basename);
//
// Used to send logs to some other kind of destination
// Users should subclass LogSink and override send to do whatever they want.
// Implementations must be thread-safe because a shared instance will
// be called from whichever thread ran the LOG(XXX) line.
class LogSink {
class GOOGLE_GLOG_DLL_DECL LogSink {
public:
virtual ~LogSink();
@ -1111,8 +1137,8 @@ class LogSink {
};
// Add or remove a LogSink as a consumer of logging data. Thread-safe.
void AddLogSink(LogSink *destination);
void RemoveLogSink(LogSink *destination);
GOOGLE_GLOG_DLL_DECL void AddLogSink(LogSink *destination);
GOOGLE_GLOG_DLL_DECL void RemoveLogSink(LogSink *destination);
//
// Specify an "extension" added to the filename specified via
@ -1120,19 +1146,20 @@ void RemoveLogSink(LogSink *destination);
// often used to append the port we're listening on to the logfile
// name. Thread-safe.
//
void SetLogFilenameExtension(const char* filename_extension);
GOOGLE_GLOG_DLL_DECL void SetLogFilenameExtension(
const char* filename_extension);
//
// Make it so that all log messages of at least a particular severity
// are logged to stderr (in addition to logging to the usual log
// file(s)). Thread-safe.
//
void SetStderrLogging(LogSeverity min_severity);
GOOGLE_GLOG_DLL_DECL void SetStderrLogging(LogSeverity min_severity);
//
// Make it so that all log messages go only to stderr. Thread-safe.
//
void LogToStderr();
GOOGLE_GLOG_DLL_DECL void LogToStderr();
//
// Make it so that all log messages of at least a particular severity are
@ -1140,13 +1167,15 @@ void LogToStderr();
// usual log file(s)). The list of addresses is just a string containing
// the email addresses to send to (separated by spaces, say). Thread-safe.
//
void SetEmailLogging(LogSeverity min_severity, const char* addresses);
GOOGLE_GLOG_DLL_DECL void SetEmailLogging(LogSeverity min_severity,
const char* addresses);
// A simple function that sends email. dest is a commma-separated
// list of addressess. Thread-safe.
bool SendEmail(const char*dest, const char *subject, const char*body);
GOOGLE_GLOG_DLL_DECL bool SendEmail(const char *dest,
const char *subject, const char *body);
const std::vector<std::string>& GetLoggingDirectories();
GOOGLE_GLOG_DLL_DECL const std::vector<std::string>& GetLoggingDirectories();
// For tests only: Clear the internal [cached] list of logging directories to
// force a refresh the next time GetLoggingDirectories is called.
@ -1156,12 +1185,13 @@ void TestOnly_ClearLoggingDirectoriesList();
// Returns a set of existing temporary directories, which will be a
// subset of the directories returned by GetLogginDirectories().
// Thread-safe.
void GetExistingTempDirectories(std::vector<std::string>* list);
GOOGLE_GLOG_DLL_DECL void GetExistingTempDirectories(
std::vector<std::string>* list);
// Print any fatal message again -- useful to call from signal handler
// so that the last thing in the output is the fatal message.
// Thread-hostile, but a race is unlikely.
void ReprintFatalMessage();
GOOGLE_GLOG_DLL_DECL void ReprintFatalMessage();
// Truncate a log file that may be the append-only output of multiple
// processes and hence can't simply be renamed/reopened (typically a
@ -1170,16 +1200,17 @@ void ReprintFatalMessage();
// be racing with other writers, this approach has the potential to
// lose very small amounts of data. For security, only follow symlinks
// if the path is /proc/self/fd/*
void TruncateLogFile(const char *path, int64 limit, int64 keep);
GOOGLE_GLOG_DLL_DECL void TruncateLogFile(const char *path,
int64 limit, int64 keep);
// Truncate stdout and stderr if they are over the value specified by
// --max_log_size; keep the final 1MB. This function has the same
// race condition as TruncateLogFile.
void TruncateStdoutStderr();
GOOGLE_GLOG_DLL_DECL void TruncateStdoutStderr();
// Return the string representation of the provided LogSeverity level.
// Thread-safe.
const char* GetLogSeverityName(LogSeverity severity);
GOOGLE_GLOG_DLL_DECL const char* GetLogSeverityName(LogSeverity severity);
// ---------------------------------------------------------------------
// Implementation details that are not useful to most clients
@ -1194,7 +1225,7 @@ const char* GetLogSeverityName(LogSeverity severity);
namespace base {
class Logger {
class GOOGLE_GLOG_DLL_DECL Logger {
public:
virtual ~Logger();
@ -1223,12 +1254,12 @@ class Logger {
// Get the logger for the specified severity level. The logger
// remains the property of the logging module and should not be
// deleted by the caller. Thread-safe.
extern Logger* GetLogger(LogSeverity level);
extern GOOGLE_GLOG_DLL_DECL Logger* GetLogger(LogSeverity level);
// Set the logger for the specified severity level. The logger
// becomes the property of the logging module and should not
// be deleted by the caller. Thread-safe.
extern void SetLogger(LogSeverity level, Logger* logger);
extern GOOGLE_GLOG_DLL_DECL void SetLogger(LogSeverity level, Logger* logger);
}
@ -1242,11 +1273,11 @@ extern void SetLogger(LogSeverity level, Logger* logger);
// be set to an empty string, if this function failed. This means, in most
// cases, you do not need to check the error code and you can directly
// use the value of "buf". It will never have an undefined value.
int posix_strerror_r(int err, char *buf, size_t len);
GOOGLE_GLOG_DLL_DECL int posix_strerror_r(int err, char *buf, size_t len);
// A class for which we define operator<<, which does nothing.
class NullStream : public LogMessage::LogStream {
class GOOGLE_GLOG_DLL_DECL NullStream : public LogMessage::LogStream {
public:
// Initialize the LogStream so the messages can be written somewhere
// (they'll never be actually displayed). This will be needed if a
@ -1272,7 +1303,7 @@ inline NullStream& operator<<(NullStream &str, const T &value) { return str; }
// Similar to NullStream, but aborts the program (without stack
// trace), like LogMessageFatal.
class NullStreamFatal : public NullStream {
class GOOGLE_GLOG_DLL_DECL NullStreamFatal : public NullStream {
public:
@ac_cv___attribute___noreturn@ ~NullStreamFatal() { _exit(1); }
};
@ -1293,13 +1324,14 @@ class NullStreamFatal : public NullStream {
// to use the failure signal handler for all threads. The stack trace
// will be shown only for the thread that receives the signal. In other
// words, stack traces of other threads won't be shown.
void InstallFailureSignalHandler();
GOOGLE_GLOG_DLL_DECL void InstallFailureSignalHandler();
// Installs a function that is used for writing the failure dump. "data"
// is the pointer to the beginning of a message to be written, and "size"
// is the size of the message. You should not expect the data is
// terminated with '\0'.
void InstallFailureWriter(void (*writer)(const char* data, int size));
GOOGLE_GLOG_DLL_DECL void InstallFailureWriter(
void (*writer)(const char* data, int size));
@ac_google_end_namespace@

View File

@ -13,6 +13,15 @@
#include "glog/log_severity.h"
#include "glog/vlog_is_on.h"
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
# ifdef _WIN32
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
# endif
#endif
// This is similar to LOG(severity) << format... and VLOG(level) << format..,
// but
// * it is to be used ONLY by low-level modules that can't use normal LOG()
@ -72,15 +81,17 @@
// Logs format... at "severity" level, reporting it
// as called from file:line.
// This does not allocate memory or acquire locks.
void RawLog__(LogSeverity severity, const char* file, int line,
const char* format, ...)
GOOGLE_GLOG_DLL_DECL void RawLog__(LogSeverity severity,
const char* file,
int line,
const char* format, ...)
@ac_cv___attribute___printf_4_5@;
// Hack to propagate time information into this module so that
// this module does not have to directly call localtime_r(),
// which could allocate memory.
extern "C" struct ::tm;
void RawLog__SetLastTime(const struct ::tm& t);
GOOGLE_GLOG_DLL_DECL void RawLog__SetLastTime(const struct ::tm& t);
@ac_google_end_namespace@

View File

@ -35,6 +35,15 @@
#include "glog/log_severity.h"
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
# ifdef _WIN32
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
# endif
#endif
#if defined(__GNUC__)
// We emit an anonymous static int* variable at every VLOG_IS_ON(n) site.
// (Normally) the first time every VLOG_IS_ON(n) site is hit,
@ -63,7 +72,8 @@
// one needs to supply the exact --vmodule pattern that applied to them.
// (If no --vmodule pattern applied to them
// the value of FLAGS_v will continue to control them.)
extern int SetVLOGLevel(const char* module_pattern, int log_level);
extern GOOGLE_GLOG_DLL_DECL int SetVLOGLevel(const char* module_pattern,
int log_level);
// Various declarations needed for VLOG_IS_ON above: =========================
@ -81,9 +91,10 @@ extern @ac_google_namespace@::int32 kLogSiteUninitialized;
// verbose_level is the argument to VLOG_IS_ON
// We will return the return value for VLOG_IS_ON
// and if possible set *site_flag appropriately.
extern bool InitVLOG3__(@ac_google_namespace@::int32** site_flag,
@ac_google_namespace@::int32* site_default,
const char* fname,
@ac_google_namespace@::int32 verbose_level);
extern GOOGLE_GLOG_DLL_DECL bool InitVLOG3__(
@ac_google_namespace@::int32** site_flag,
@ac_google_namespace@::int32* site_default,
const char* fname,
@ac_google_namespace@::int32 verbose_level);
#endif // BASE_VLOG_IS_ON_H_

View File

@ -15,7 +15,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "base/commandlineflags.h"
@ -23,14 +25,43 @@ using std::map;
using std::string;
using std::vector;
DEFINE_string(test_tmpdir, "/tmp", "Dir we use for temp files");
DEFINE_string(test_srcdir, ".",
"Source-dir root, needed to find glog_unittest_flagfile");
DEFINE_int32(benchmark_iters, 100000000, "Number of iterations per benchmark");
_START_GOOGLE_NAMESPACE_
extern void (*g_logging_fail_func)();
extern GOOGLE_GLOG_DLL_DECL void (*g_logging_fail_func)();
_END_GOOGLE_NAMESPACE_
#undef GOOGLE_GLOG_DLL_DECL
#define GOOGLE_GLOG_DLL_DECL
static string GetTempDir() {
#ifndef OS_WINDOWS
return "/tmp";
#else
char tmp[MAX_PATH];
GetTempPathA(MAX_PATH, tmp);
return tmp;
#endif
}
#ifdef OS_WINDOWS
// The test will run in glog/vsproject/<project name>
// (e.g., glog/vsproject/logging_unittest).
static const char TEST_SRC_DIR[] = "../..";
#else
static const char TEST_SRC_DIR[] = ".";
#endif
DEFINE_string(test_tmpdir, GetTempDir(), "Dir we use for temp files");
DEFINE_string(test_srcdir, TEST_SRC_DIR,
"Source-dir root, needed to find glog_unittest_flagfile");
#ifdef NDEBUG
DEFINE_int32(benchmark_iters, 100000000, "Number of iterations per benchmark");
#else
DEFINE_int32(benchmark_iters, 1000000, "Number of iterations per benchmark");
#endif
_START_GOOGLE_NAMESPACE_
// The following is some bare-bones testing infrastructure
@ -96,6 +127,10 @@ static void CalledAbort() {
longjmp(g_jmp_buf, 1);
}
#ifdef OS_WINDOWS
// TODO(hamaji): Death test somehow doesn't work in Windows.
#define ASSERT_DEATH(fn, msg)
#else
#define ASSERT_DEATH(fn, msg) \
do { \
g_called_abort = false; \
@ -110,6 +145,7 @@ static void CalledAbort() {
exit(1); \
} \
} while (0)
#endif
#ifdef NDEBUG
#define ASSERT_DEBUG_DEATH(fn, msg)
@ -307,11 +343,10 @@ static string MungeLine(const string& line) {
iss >> logcode_date;
while (!IsLoggingPrefix(logcode_date)) {
before += " " + logcode_date;
if (iss.eof()) {
if (!(iss >> logcode_date)) {
// We cannot find the header of log output.
return before;
}
iss >> logcode_date;
}
if (!before.empty()) before += " ";
iss >> time;
@ -354,6 +389,8 @@ static string Munge(const string& filename) {
char null_str[256];
sprintf(null_str, "%p", NULL);
StringReplace(&line, "__NULLP__", null_str);
// Remove 0x prefix produced by %p. VC++ doesn't put the prefix.
StringReplace(&line, " 0x", " ");
char errmsg_buf[100];
posix_strerror_r(0, errmsg_buf, sizeof(errmsg_buf));
@ -429,16 +466,32 @@ struct FlagSaver {
};
#endif
// TODO(hamaji): Make it portable.
class Thread {
public:
void SetJoinable(bool joinable) {}
#if defined(HAVE_PTHREAD)
void Start() {
pthread_create(&th_, NULL, &Thread::InvokeThread, this);
}
void Join() {
pthread_join(th_, NULL);
}
#elif defined(OS_WINDOWS)
void Start() {
handle_ = CreateThread(NULL,
0,
(LPTHREAD_START_ROUTINE)&Thread::InvokeThread,
(LPVOID)this,
0,
&th_);
CHECK(handle_) << "CreateThread";
}
void Join() {
WaitForSingleObject(handle_, INFINITE);
}
#else
# error No thread implementation.
#endif
protected:
virtual void Run() = 0;
@ -450,11 +503,17 @@ class Thread {
}
pthread_t th_;
#ifdef OS_WINDOWS
HANDLE handle_;
#endif
};
// TODO(hamaji): Make it portable.
static void SleepForMilliseconds(int t) {
#ifndef OS_WINDOWS
usleep(t * 1000);
#else
Sleep(t);
#endif
}
// Add hook for operator new to ensure there are no memory allocation.

View File

@ -3,21 +3,28 @@
#include "utilities.h"
#include <assert.h>
#include <pthread.h>
#include <iomanip>
#include <string>
#include <unistd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h> // For _exit.
#endif
#include <climits>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/utsname.h>
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h> // For uname.
#endif
#include <fcntl.h>
#include <cstdio>
#include <iostream>
#include <stdarg.h>
#include <stdlib.h>
#include <pwd.h>
#include <syslog.h>
#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
#ifdef HAVE_SYSLOG_H
# include <syslog.h>
#endif
#include <vector>
#include <errno.h> // for errno
#include <sstream>
@ -101,6 +108,28 @@ DEFINE_bool(stop_logging_if_full_disk, false,
// TODO(hamaji): consider windows
#define PATH_SEPARATOR '/'
static void GetHostName(string* hostname) {
#if defined(HAVE_SYS_UTSNAME_H)
struct utsname buf;
if (0 != uname(&buf)) {
// ensure null termination on failure
*buf.nodename = '\0';
}
*hostname = buf.nodename;
#elif defined(OS_WINDOWS)
char buf[256];
DWORD len;
if (GetComputerNameA(buf, &len)) {
*hostname = buf;
} else {
hostname->clear();
}
#else
# warning There is no way to retrieve the host name.
*hostname = "(unknown)";
#endif
}
_START_GOOGLE_NAMESPACE_
// A mutex that allows only one thread to log at a time, to keep things from
@ -130,6 +159,8 @@ static bool SendEmailInternal(const char*dest, const char *subject,
base::Logger::~Logger() {
}
namespace {
// Encapsulates all file-system related state
class LogFileObject : public base::Logger {
public:
@ -182,61 +213,7 @@ class LogFileObject : public base::Logger {
bool CreateLogfile(const char* time_pid_string);
};
LogFileObject::LogFileObject(LogSeverity severity,
const char* base_filename)
: base_filename_selected_(base_filename != NULL),
base_filename_((base_filename != NULL) ? base_filename : ""),
symlink_basename_(ProgramInvocationShortName()),
filename_extension_(),
file_(NULL),
severity_(severity),
bytes_since_flush_(0),
file_length_(0),
rollover_attempt_(kRolloverAttemptFrequency-1),
next_flush_time_(0) {
assert(severity >= 0);
assert(severity < NUM_SEVERITIES);
}
LogFileObject::~LogFileObject() {
MutexLock l(&lock_);
if (file_ != NULL) {
fclose(file_);
file_ = NULL;
}
}
void LogFileObject::SetBasename(const char* basename) {
MutexLock l(&lock_);
base_filename_selected_ = true;
if (base_filename_ != basename) {
// Get rid of old log file since we are changing names
if (file_ != NULL) {
fclose(file_);
file_ = NULL;
rollover_attempt_ = kRolloverAttemptFrequency-1;
}
base_filename_ = basename;
}
}
void LogFileObject::SetExtension(const char* ext) {
MutexLock l(&lock_);
if (filename_extension_ != ext) {
// Get rid of old log file since we are changing names
if (file_ != NULL) {
fclose(file_);
file_ = NULL;
rollover_attempt_ = kRolloverAttemptFrequency-1;
}
filename_extension_ = ext;
}
}
void LogFileObject::SetSymlinkBasename(const char* symlink_basename) {
MutexLock l(&lock_);
symlink_basename_ = symlink_basename;
}
} // namespace
class LogDestination {
public:
@ -339,10 +316,8 @@ Mutex LogDestination::sink_mutex_;
/* static */
const string& LogDestination::hostname() {
if (hostname_.empty()) {
struct utsname buf;
if (0 == uname(&buf)) {
hostname_ = buf.nodename;
} else {
GetHostName(&hostname_);
if (hostname_.empty()) {
hostname_ = "(unknown)";
}
}
@ -355,22 +330,6 @@ LogDestination::LogDestination(LogSeverity severity,
logger_(&fileobject_) {
}
void LogFileObject::Flush() {
MutexLock l(&lock_);
FlushUnlocked();
}
void LogFileObject::FlushUnlocked(){
if (file_ != NULL) {
fflush(file_);
bytes_since_flush_ = 0;
}
// Figure out when we are due for another flush.
const int64 next = (FLAGS_logbufsecs
* static_cast<int64>(1000000)); // in usec
next_flush_time_ = CycleClock_Now() + UsecToCycles(next);
}
inline void LogDestination::FlushLogFilesUnsafe(int min_severity) {
// assume we have the log_mutex or we simply don't care
// about it
@ -476,7 +435,7 @@ inline void LogDestination::SetEmailLogging(LogSeverity min_severity,
static void WriteToStderr(const char* message, size_t len) {
// Avoid using cerr from this module since we may get called during
// exit code, and cerr may be partially or fully destroyed by then.
fwrite(message, len, 1, stderr);
write(STDERR_FILENO, message, len);
}
inline void LogDestination::MaybeLogToStderr(LogSeverity severity,
@ -568,14 +527,100 @@ inline void LogDestination::WaitForSinks(LogMessage::LogMessageData* data) {
}
}
LogDestination* LogDestination::log_destinations_[NUM_SEVERITIES];
inline LogDestination* LogDestination::log_destination(LogSeverity severity) {
assert(severity >=0 && severity < NUM_SEVERITIES);
if (!log_destinations_[severity]) {
log_destinations_[severity] = new LogDestination(severity, NULL);
}
return log_destinations_[severity];
}
namespace {
LogFileObject::LogFileObject(LogSeverity severity,
const char* base_filename)
: base_filename_selected_(base_filename != NULL),
base_filename_((base_filename != NULL) ? base_filename : ""),
symlink_basename_(ProgramInvocationShortName()),
filename_extension_(),
file_(NULL),
severity_(severity),
bytes_since_flush_(0),
file_length_(0),
rollover_attempt_(kRolloverAttemptFrequency-1),
next_flush_time_(0) {
assert(severity >= 0);
assert(severity < NUM_SEVERITIES);
}
LogFileObject::~LogFileObject() {
MutexLock l(&lock_);
if (file_ != NULL) {
fclose(file_);
file_ = NULL;
}
}
void LogFileObject::SetBasename(const char* basename) {
MutexLock l(&lock_);
base_filename_selected_ = true;
if (base_filename_ != basename) {
// Get rid of old log file since we are changing names
if (file_ != NULL) {
fclose(file_);
file_ = NULL;
rollover_attempt_ = kRolloverAttemptFrequency-1;
}
base_filename_ = basename;
}
}
void LogFileObject::SetExtension(const char* ext) {
MutexLock l(&lock_);
if (filename_extension_ != ext) {
// Get rid of old log file since we are changing names
if (file_ != NULL) {
fclose(file_);
file_ = NULL;
rollover_attempt_ = kRolloverAttemptFrequency-1;
}
filename_extension_ = ext;
}
}
void LogFileObject::SetSymlinkBasename(const char* symlink_basename) {
MutexLock l(&lock_);
symlink_basename_ = symlink_basename;
}
void LogFileObject::Flush() {
MutexLock l(&lock_);
FlushUnlocked();
}
void LogFileObject::FlushUnlocked(){
if (file_ != NULL) {
fflush(file_);
bytes_since_flush_ = 0;
}
// Figure out when we are due for another flush.
const int64 next = (FLAGS_logbufsecs
* static_cast<int64>(1000000)); // in usec
next_flush_time_ = CycleClock_Now() + UsecToCycles(next);
}
bool LogFileObject::CreateLogfile(const char* 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);
if (fd == -1) return false;
#ifdef HAVE_FCNTL
// Mark the file close-on-exec. We don't really care if this fails
fcntl(fd, F_SETFD, FD_CLOEXEC);
#endif
file_ = fdopen(fd, "a"); // Make a FILE*.
if (file_ == NULL) { // Man, we're screwed!
@ -599,6 +644,8 @@ bool LogFileObject::CreateLogfile(const char* time_pid_string) {
linkpath += linkname;
unlink(linkpath.c_str()); // delete old one if it exists
// We must have unistd.h.
#ifdef HAVE_UNISTD_H
// Make the symlink be relative (in the same dir) so that if the
// entire log directory gets relocated the link is still valid.
const char *linkdest = slash ? (slash + 1) : filename;
@ -611,6 +658,7 @@ bool LogFileObject::CreateLogfile(const char* time_pid_string) {
unlink(linkpath.c_str()); // delete old one if it exists
symlink(filename, linkpath.c_str()); // silently ignore failures
}
#endif
}
return true; // Everything worked
@ -627,7 +675,7 @@ void LogFileObject::Write(bool force_flush,
return;
}
if ((file_length_ >> 20) >= FLAGS_max_log_size) {
if (static_cast<int>(file_length_ >> 20) >= FLAGS_max_log_size) {
fclose(file_);
file_ = NULL;
file_length_ = bytes_since_flush_ = 0;
@ -679,10 +727,8 @@ void LogFileObject::Write(bool force_flush,
// Where does the file get put? Successively try the directories
// "/tmp", and "."
string stripped_filename(ProgramInvocationShortName()); // in cmdlineflag
struct utsname buf;
if (0 != uname(&buf)) {
*buf.nodename = '\0'; // ensure null termination on failure
}
string hostname;
GetHostName(&hostname);
string uidname = MyUserName();
// We should not call CHECK() here because this function can be
@ -691,7 +737,7 @@ void LogFileObject::Write(bool force_flush,
// deadlock. Simply use a name like invalid-user.
if (uidname.empty()) uidname = "invalid-user";
stripped_filename = stripped_filename+'.'+buf.nodename+'.'
stripped_filename = stripped_filename+'.'+hostname+'.'
+uidname+".log."
+LogSeverityNames[severity_]+'.';
// We're going to (potentially) try to put logs in several different dirs
@ -771,26 +817,7 @@ void LogFileObject::Write(bool force_flush,
}
}
LogDestination* LogDestination::log_destinations_[NUM_SEVERITIES];
inline LogDestination* LogDestination::log_destination(LogSeverity severity) {
assert(severity >=0 && severity < NUM_SEVERITIES);
if (!log_destinations_[severity]) {
log_destinations_[severity] = new LogDestination(severity, NULL);
}
return log_destinations_[severity];
}
// Get the part of filepath after the last path separator.
// (Doesn't modify filepath, contrary to basename() in libgen.h.)
static 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;
}
} // namespace
//
// LogMessage's constructor starts each message with a string like:
@ -1098,7 +1125,7 @@ void LogMessage::SendToLog() {
}
static void logging_fail() {
#if defined _DEBUG && defined COMPILER_MSVC
#if defined(_DEBUG) && defined(_MSC_VER)
// When debugging on windows, avoid the obnoxious dialog and make
// it possible to continue past a LOG(FATAL) in the debugger
_asm int 3
@ -1108,9 +1135,10 @@ static void logging_fail() {
}
#ifdef HAVE___ATTRIBUTE__
GOOGLE_GLOG_DLL_DECL
void (*g_logging_fail_func)() __attribute__((noreturn)) = &logging_fail;
#else
void (*g_logging_fail_func)() = &logging_fail;
GOOGLE_GLOG_DLL_DECL void (*g_logging_fail_func)() = &logging_fail;
#endif
void InstallFailureFunction(void (*fail_func)()) {
@ -1151,6 +1179,7 @@ void LogMessage::SaveOrSendToLog() {
// L >= log_mutex (callers must hold the log_mutex).
void LogMessage::SendToSyslogAndLog() {
#ifdef HAVE_SYSLOG_H
// Before any calls to syslog(), make a single call to openlog()
static bool openlog_already_called = false;
if (!openlog_already_called) {
@ -1165,6 +1194,9 @@ void LogMessage::SendToSyslogAndLog() {
int(data_->num_chars_to_syslog_),
data_->message_text_ + data_->num_prefix_chars_);
SendToLog();
#else
LOG(ERROR) << "No syslog support: message=" << data_->message_text_;
#endif
}
base::Logger* base::GetLogger(LogSeverity severity) {
@ -1333,7 +1365,7 @@ bool SendEmail(const char*dest, const char *subject, const char*body){
return SendEmailInternal(dest, subject, body, true);
}
void GetTempDirectories(vector<string>* list) {
static void GetTempDirectories(vector<string>* list) {
list->clear();
#ifdef OS_WINDOWS
// On windows we'll try to find a directory in this order:
@ -1429,7 +1461,7 @@ void GetExistingTempDirectories(vector<string>* list) {
}
void TruncateLogFile(const char *path, int64 limit, int64 keep) {
#ifdef HAVE_UNISTD_H
struct stat statbuf;
const int kCopyBlockSize = 8 << 10;
char copybuf[kCopyBlockSize];
@ -1498,28 +1530,36 @@ void TruncateLogFile(const char *path, int64 limit, int64 keep) {
out_close_fd:
close(fd);
#else
LOG(ERROR) << "No log truncation support.";
#endif
}
void TruncateStdoutStderr() {
#ifdef HAVE_UNISTD_H
int64 limit = FLAGS_max_log_size << 20;
int64 keep = 1 << 20;
TruncateLogFile("/proc/self/fd/1", limit, keep);
TruncateLogFile("/proc/self/fd/2", limit, keep);
#else
LOG(ERROR) << "No log truncation support.";
#endif
}
// Helper functions for string comparisons.
#define DEFINE_CHECK_STROP_IMPL(name, func, expected) \
string* Check##func##expected##Impl(const char* s1, const char* s2, \
const char* names) { \
bool equal = s1 == s2 || (s1 && s2 && !func(s1, s2)); \
if (equal == expected) return NULL; \
else { \
strstream ss; \
#define DEFINE_CHECK_STROP_IMPL(name, func, expected) \
string* Check##func##expected##Impl(const char* s1, const char* s2, \
const char* names) { \
bool equal = s1 == s2 || (s1 && s2 && !func(s1, s2)); \
if (equal == expected) return NULL; \
else { \
strstream ss; \
if (!s1) s1 = ""; \
if (!s2) s2 = ""; \
ss << #name " failed: " << names << " (" << s1 << " vs. " << s2 << ")"; \
return new string(ss.str(), ss.pcount()); \
} \
return new string(ss.str(), ss.pcount()); \
} \
}
DEFINE_CHECK_STROP_IMPL(CHECK_STREQ, strcmp, true)
DEFINE_CHECK_STROP_IMPL(CHECK_STRNE, strcmp, false)

View File

@ -4,12 +4,17 @@
//
// Author: Ray Sidney
#include "config_for_unittests.h"
#include "utilities.h"
#include <fcntl.h>
#include <glob.h>
#ifdef HAVE_GLOB_H
# include <glob.h>
#endif
#include <sys/stat.h>
#include <unistd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <iomanip>
#include <iostream>
@ -356,7 +361,7 @@ void TestLogString() {
LOG_STRING(WARNING, no_errors) << "LOG_STRING: " << "reported warning";
LOG_STRING(ERROR, NULL) << "LOG_STRING: " << "reported error";
for (int i = 0; i < errors.size(); ++i) {
for (size_t i = 0; i < errors.size(); ++i) {
LOG(INFO) << "Captured by LOG_STRING: " << errors[i];
}
}
@ -386,7 +391,7 @@ void TestLogSink() {
LOG_TO_SINK(NULL, ERROR) << "LOG_TO_SINK: " << "reported error";
LOG(INFO) << "Captured by LOG_TO_SINK:";
for (int i = 0; i < sink.errors.size(); ++i) {
for (size_t i = 0; i < sink.errors.size(); ++i) {
LogMessage("foo", LogMessage::kNoLogPrefix, INFO).stream()
<< sink.errors[i];
}
@ -481,6 +486,7 @@ TEST(DeathCheckNN, Simple) {
// Get list of file names that match pattern
static void GetFiles(const string& pattern, vector<string>* files) {
files->clear();
#if defined(HAVE_GLOB_H)
glob_t g;
const int r = glob(pattern.c_str(), 0, NULL, &g);
CHECK((r == 0) || (r == GLOB_NOMATCH)) << ": error matching " << pattern;
@ -488,13 +494,32 @@ static void GetFiles(const string& pattern, vector<string>* files) {
files->push_back(string(g.gl_pathv[i]));
}
globfree(&g);
#elif defined(OS_WINDOWS)
WIN32_FIND_DATAA data;
HANDLE handle = FindFirstFileA(pattern.c_str(), &data);
size_t index = pattern.rfind('\\');
if (index == string::npos) {
LOG(FATAL) << "No directory separator.";
}
const string dirname = pattern.substr(0, index + 1);
if (FAILED(handle)) {
// Finding no files is OK.
return;
}
do {
files->push_back(dirname + data.cFileName);
} while (FindNextFileA(handle, &data));
LOG_SYSRESULT(FindClose(handle));
#else
# error There is no way to do glob.
#endif
}
// Delete files patching pattern
static void DeleteFiles(const string& pattern) {
vector<string> files;
GetFiles(pattern, &files);
for (int i = 0; i < files.size(); i++) {
for (size_t i = 0; i < files.size(); i++) {
CHECK(unlink(files[i].c_str()) == 0) << ": " << strerror(errno);
}
}
@ -519,18 +544,22 @@ static void CheckFile(const string& name, const string& expected_string) {
static void TestBasename() {
fprintf(stderr, "==== Test setting log file basename\n");
string dest = FLAGS_test_tmpdir + "/logging_test_basename";
const string dest = FLAGS_test_tmpdir + "/logging_test_basename";
DeleteFiles(dest + "*");
SetLogDestination(INFO, dest.c_str());
LOG(INFO) << "message to new base";
FlushLogFiles(INFO);
CheckFile(dest, "message to new base");
// Release file handle for the destination file to unlock the file in Windows.
LogToStderr();
DeleteFiles(dest + "*");
}
static void TestSymlink() {
#ifndef OS_WINDOWS
fprintf(stderr, "==== Test setting log file symlink\n");
string dest = FLAGS_test_tmpdir + "/logging_test_symlink";
string sym = FLAGS_test_tmpdir + "/symlinkbase";
@ -545,6 +574,7 @@ static void TestSymlink() {
DeleteFiles(dest + "*");
DeleteFiles(sym + "*");
#endif
}
static void TestExtension() {
@ -564,6 +594,8 @@ static void TestExtension() {
CHECK_EQ(filenames.size(), 1);
CHECK(strstr(filenames[0].c_str(), "specialextension") != NULL);
// Release file handle for the destination file to unlock the file in Windows.
LogToStderr();
DeleteFiles(dest + "*");
}
@ -633,9 +665,10 @@ static void TestOneTruncate(const char *path, int64 limit, int64 keep,
CHECK_ERR(lseek(fd, 0, SEEK_SET));
// File should contain the suffix of the original file
char buf[statbuf.st_size + 1];
int buf_size = statbuf.st_size + 1;
char* buf = new char[buf_size];
memset(buf, 0, sizeof(buf));
CHECK_ERR(read(fd, buf, sizeof(buf)));
CHECK_ERR(read(fd, buf, buf_size));
const char *p = buf;
int64 checked = 0;
@ -645,9 +678,11 @@ static void TestOneTruncate(const char *path, int64 limit, int64 keep,
checked += bytes;
}
close(fd);
delete[] buf;
}
static void TestTruncate() {
#ifdef HAVE_UNISTD_H
fprintf(stderr, "==== Test log truncation\n");
string path = FLAGS_test_tmpdir + "/truncatefile";
@ -663,8 +698,10 @@ static void TestTruncate() {
TestOneTruncate(path.c_str(), 10, 50, 0, 10, 10);
TestOneTruncate(path.c_str(), 50, 100, 0, 30, 30);
// MacOSX 10.4 doesn't fail in this case. Let's just ignore this test.
#if !defined(OS_MACOSX)
// MacOSX 10.4 doesn't fail in this case.
// Windows doesn't have symlink.
// Let's just ignore this test for these cases.
#if !defined(OS_MACOSX) && !defined(OS_WINDOWS)
// Through a symlink should fail to truncate
string linkname = path + ".link";
unlink(linkname.c_str());
@ -681,12 +718,17 @@ static void TestTruncate() {
snprintf(fdpath, sizeof(fdpath), "/proc/self/fd/%d", fd);
TestOneTruncate(fdpath, 10, 10, 10, 10, 10);
#endif
#endif
}
_START_GOOGLE_NAMESPACE_
namespace glog_internal_namespace_ {
extern // in logging.cc
bool SafeFNMatch_(const char* pattern, size_t patt_len,
const char* str, size_t str_len);
} // namespace glog_internal_namespace_
using glog_internal_namespace_::SafeFNMatch_;
_END_GOOGLE_NAMESPACE_
static bool WrapSafeFNMatch(string pattern, string str) {
@ -865,7 +907,7 @@ static void TestLogSinkWaitTillSent() {
LOG(WARNING) << "Message 3";
SleepForMilliseconds(60);
}
for (int i = 0; i < global_messages.size(); ++i) {
for (size_t i = 0; i < global_messages.size(); ++i) {
LOG(INFO) << "Sink capture: " << global_messages[i];
}
CHECK_EQ(global_messages.size(), 3);
@ -874,12 +916,13 @@ static void TestLogSinkWaitTillSent() {
TEST(Strerror, logging) {
int errcode = EINTR;
char *msg = strdup(strerror(errcode));
char buf[strlen(msg) + 1];
int buf_size = strlen(msg) + 1;
char *buf = new char[buf_size];
CHECK_EQ(posix_strerror_r(errcode, NULL, 0), -1);
buf[0] = 'A';
CHECK_EQ(posix_strerror_r(errcode, buf, 0), -1);
CHECK_EQ(buf[0], 'A');
CHECK_EQ(posix_strerror_r(errcode, NULL, sizeof(buf)), -1);
CHECK_EQ(posix_strerror_r(errcode, NULL, buf_size), -1);
#if defined(OS_MACOSX) || defined(OS_FREEBSD)
// MacOSX or FreeBSD considers this case is an error since there is
// no enough space.
@ -888,9 +931,10 @@ TEST(Strerror, logging) {
CHECK_EQ(posix_strerror_r(errcode, buf, 1), 0);
#endif
CHECK_STREQ(buf, "");
CHECK_EQ(posix_strerror_r(errcode, buf, sizeof(buf)), 0);
CHECK_EQ(posix_strerror_r(errcode, buf, buf_size), 0);
CHECK_STREQ(buf, msg);
free(msg);
delete[] buf;
}
// Simple routines to look at the sizes of generated code for LOG(FATAL) and

View File

@ -17,15 +17,9 @@
#elif defined(HAVE_SYS_SYSCALL_H)
#include <sys/syscall.h> // for syscall()
#endif
#include <unistd.h>
#if defined(OS_MACOSX)
#ifndef __DARWIN_UNIX03
#define __DARWIN_UNIX03 // tells libgen.h to define basename()
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#endif // OS_MACOSX
#include <libgen.h> // basename()
_START_GOOGLE_NAMESPACE_
@ -82,13 +76,13 @@ void RawLog__(LogSeverity severity, const char* file, int line,
DoRawLog(&buf, &size, "%c%02d%02d %02d%02d%02d %s:%d] RAW: ",
LogSeverityNames[severity][0],
1 + t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec,
basename(const_cast<char *>(file)), line);
const_basename(const_cast<char *>(file)), line);
} else {
DoRawLog(&buf, &size, "%c%02d%02d %02d%02d%02d %08x %s:%d] RAW: ",
LogSeverityNames[severity][0],
1 + t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec,
int(pthread_self()),
basename(const_cast<char *>(file)), line);
const_basename(const_cast<char *>(file)), line);
}
va_list ap;
va_start(ap, format);

View File

@ -4,7 +4,9 @@
#include "utilities.h"
#include <signal.h>
#include <sys/time.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <time.h>
#include "base/googleinit.h"
@ -138,9 +140,17 @@ bool is_default_thread() {
int64 CycleClock_Now() {
// TODO(hamaji): temporary impementation - it might be too slow.
#ifdef OS_WINDOWS
SYSTEMTIME now;
GetSystemTime(&now);
return (static_cast<int64>(now.wSecond) * 1000000 +
static_cast<int64>(now.wMilliseconds) * 1000);
#else
// 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;
#endif
}
int64 UsecToCycles(int64 usec) {
@ -152,6 +162,15 @@ int32 GetMainThreadPid() {
return g_main_thread_pid;
}
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;

View File

@ -40,6 +40,10 @@
#include <string>
#ifdef OS_WINDOWS
# include "port.h"
#endif
#include "config.h"
#include "glog/logging.h"
@ -116,6 +120,10 @@ int32 GetMainThreadPid();
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

View File

@ -8,7 +8,6 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <fnmatch.h> // fnmatch() is used in obsolete _InitVLOG
#include <cstdio>
#include <string>
#include "base/commandlineflags.h"
@ -32,12 +31,16 @@ DEFINE_string(vmodule, "", "per-module verbose level."
_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.
bool SafeFNMatch_(const char* pattern, size_t patt_len,
const char* str, size_t str_len) {
GOOGLE_GLOG_DLL_DECL bool SafeFNMatch_(const char* pattern,
size_t patt_len,
const char* str,
size_t str_len) {
int p = 0;
int s = 0;
while (1) {
@ -63,6 +66,10 @@ bool SafeFNMatch_(const char* pattern, size_t patt_len,
}
}
} // namespace glog_internal_namespace_
using glog_internal_namespace_::SafeFNMatch_;
int32 kLogSiteUninitialized = 1000;
// List of per-module log levels from FLAGS_vmodule.

136
src/windows/config.h Executable file
View File

@ -0,0 +1,136 @@
/* 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

View File

@ -0,0 +1,61 @@
// This file is automatically generated from src/glog/log_severity.h
// using src/windows/preprocess.sh.
// DO NOT EDIT!
// Copyright 2007 Google Inc. All Rights Reserved.
#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
# ifdef _WIN32
# 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 INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
// 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__

1342
src/windows/glog/logging.h Executable file

File diff suppressed because it is too large Load Diff

102
src/windows/glog/raw_logging.h Executable file
View File

@ -0,0 +1,102 @@
// This file is automatically generated from src/glog/raw_logging.h.in
// using src/windows/preprocess.sh.
// DO NOT EDIT!
// Copyright 2006 Google Inc. All Rights Reserved.
// Author: Maxim Lifantsev
//
// Logging routines that do not allocate any memory and acquire any
// locks, and can therefore be used by low-level memory allocation
// and synchronization code.
#ifndef BASE_RAW_LOGGING_H__
#define BASE_RAW_LOGGING_H__
namespace google {
#include "glog/log_severity.h"
#include "glog/vlog_is_on.h"
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
# ifdef _WIN32
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
# endif
#endif
// This is similar to LOG(severity) << format... and VLOG(level) << format..,
// but
// * it is to be used ONLY by low-level modules that can't use normal LOG()
// * it is desiged to be a low-level logger that does not allocate any
// memory and does not need any locks, hence:
// * it logs straight and ONLY to STDERR w/o buffering
// * it uses an explicit format and arguments list
// * it will silently chop off really long message strings
// Usage example:
// RAW_LOG(ERROR, "Failed foo with %i: %s", status, error);
// RAW_VLOG(3, "status is %i", status);
// These will print an almost standard log lines like this to stderr only:
// E0821 211317 file.cc:123] RAW: Failed foo with 22: bad_file
// I0821 211317 file.cc:142] RAW: status is 20
#define RAW_LOG(severity, ...) \
do { \
google::RawLog__(google::severity, __FILE__, __LINE__, __VA_ARGS__); \
} while (0)
#define RAW_VLOG(verboselevel, ...) \
do { \
if (VLOG_IS_ON(verboselevel)) { \
google::RawLog__(google::INFO, __FILE__, __LINE__, __VA_ARGS__); \
} \
} while (0)
// Similar to CHECK(condition) << message,
// but for low-level modules: we use only RAW_LOG that does not allocate memory.
// We do not want to provide args list here to encourage this usage:
// if (!cond) RAW_LOG(FATAL, "foo ...", hard_to_compute_args);
// so that the args are not computed when not needed.
#define RAW_CHECK(condition, message) \
do { \
if (!(condition)) { \
RAW_LOG(FATAL, "Check %s failed: %s", #condition, message); \
} \
} while (0)
// Debug versions of RAW_LOG and RAW_CHECK
#ifndef NDEBUG
#define RAW_DLOG(severity, ...) RAW_LOG(severity, __VA_ARGS__)
#define RAW_DCHECK(condition, message) RAW_CHECK(condition, message)
#else // NDEBUG
#define RAW_DLOG(severity, ...) \
while (false) \
RAW_LOG(severity, __VA_ARGS__)
#define RAW_DCHECK(condition, message) \
while (false) \
RAW_CHECK(condition, message)
#endif // NDEBUG
// Helper function to implement RAW_LOG and RAW_VLOG
// Logs format... at "severity" level, reporting it
// as called from file:line.
// This does not allocate memory or acquire locks.
GOOGLE_GLOG_DLL_DECL void RawLog__(LogSeverity severity,
const char* file,
int line,
const char* format, ...)
;
// Hack to propagate time information into this module so that
// this module does not have to directly call localtime_r(),
// which could allocate memory.
extern "C" struct ::tm;
GOOGLE_GLOG_DLL_DECL void RawLog__SetLastTime(const struct ::tm& t);
}
#endif // BASE_RAW_LOGGING_H__

132
src/windows/glog/stl_logging.h Executable file
View File

@ -0,0 +1,132 @@
// This file is automatically generated from src/glog/stl_logging.h.in
// using src/windows/preprocess.sh.
// DO NOT EDIT!
// Copyright 2003 Google, Inc.
// All Rights Reserved.
//
// Stream output operators for STL containers; to be used for logging *only*.
// Inclusion of this file lets you do:
//
// list<string> x;
// LOG(INFO) << "data: " << x;
// vector<int> v1, v2;
// CHECK_EQ(v1, v2);
//
// Note that if you want to use these operators from the non-global namespace,
// you may get an error since they are not in namespace std (and they are not
// in namespace std since that would result in undefined behavior). You may
// need to write
//
// using ::operator<<;
//
// to fix these errors.
#ifndef UTIL_GTL_STL_LOGGING_INL_H_
#define UTIL_GTL_STL_LOGGING_INL_H_
#if !1
# error We do not support stl_logging for this compiler
#endif
#include <deque>
#include <list>
#include <map>
#include <ostream>
#include <set>
#include <utility>
#include <vector>
#ifdef __GNUC__
# include <ext/hash_set>
# include <ext/hash_map>
# include <ext/slist>
#endif
template<class First, class Second>
inline std::ostream& operator<<(std::ostream& out,
const std::pair<First, Second>& p) {
out << '(' << p.first << ", " << p.second << ')';
return out;
}
namespace google {
template<class Iter>
inline void PrintSequence(std::ostream& out, Iter begin, Iter end) {
using ::operator<<;
// Output at most 100 elements -- appropriate if used for logging.
for (int i = 0; begin != end && i < 100; ++i, ++begin) {
if (i > 0) out << ' ';
out << *begin;
}
if (begin != end) {
out << " ...";
}
}
}
#define OUTPUT_TWO_ARG_CONTAINER(Sequence) \
template<class T1, class T2> \
inline std::ostream& operator<<(std::ostream& out, \
const Sequence<T1, T2>& seq) { \
google::PrintSequence(out, seq.begin(), seq.end()); \
return out; \
}
OUTPUT_TWO_ARG_CONTAINER(std::vector)
OUTPUT_TWO_ARG_CONTAINER(std::deque)
OUTPUT_TWO_ARG_CONTAINER(std::list)
#ifdef __GNUC__
OUTPUT_TWO_ARG_CONTAINER(__gnu_cxx::slist)
#endif
#undef OUTPUT_TWO_ARG_CONTAINER
#define OUTPUT_THREE_ARG_CONTAINER(Sequence) \
template<class T1, class T2, class T3> \
inline std::ostream& operator<<(std::ostream& out, \
const Sequence<T1, T2, T3>& seq) { \
google::PrintSequence(out, seq.begin(), seq.end()); \
return out; \
}
OUTPUT_THREE_ARG_CONTAINER(std::set)
OUTPUT_THREE_ARG_CONTAINER(std::multiset)
#undef OUTPUT_THREE_ARG_CONTAINER
#define OUTPUT_FOUR_ARG_CONTAINER(Sequence) \
template<class T1, class T2, class T3, class T4> \
inline std::ostream& operator<<(std::ostream& out, \
const Sequence<T1, T2, T3, T4>& seq) { \
google::PrintSequence(out, seq.begin(), seq.end()); \
return out; \
}
OUTPUT_FOUR_ARG_CONTAINER(std::map)
OUTPUT_FOUR_ARG_CONTAINER(std::multimap)
#ifdef __GNUC__
OUTPUT_FOUR_ARG_CONTAINER(__gnu_cxx::hash_set)
OUTPUT_FOUR_ARG_CONTAINER(__gnu_cxx::hash_multiset)
#endif
#undef OUTPUT_FOUR_ARG_CONTAINER
#define OUTPUT_FIVE_ARG_CONTAINER(Sequence) \
template<class T1, class T2, class T3, class T4, class T5> \
inline std::ostream& operator<<(std::ostream& out, \
const Sequence<T1, T2, T3, T4, T5>& seq) { \
google::PrintSequence(out, seq.begin(), seq.end()); \
return out; \
}
#ifdef __GNUC__
OUTPUT_FIVE_ARG_CONTAINER(__gnu_cxx::hash_map)
OUTPUT_FIVE_ARG_CONTAINER(__gnu_cxx::hash_multimap)
#endif
#undef OUTPUT_FIVE_ARG_CONTAINER
#endif // UTIL_GTL_STL_LOGGING_INL_H_

104
src/windows/glog/vlog_is_on.h Executable file
View File

@ -0,0 +1,104 @@
// This file is automatically generated from src/glog/vlog_is_on.h.in
// using src/windows/preprocess.sh.
// DO NOT EDIT!
// Copyright 1999, 2007 Google Inc. All Rights Reserved.
// Author: Ray Sidney and many others
//
// Defines the VLOG_IS_ON macro that controls the variable-verbosity
// conditional logging.
//
// It's used by VLOG and VLOG_IF in logging.h
// and by RAW_VLOG in raw_logging.h to trigger the logging.
//
// It can also be used directly e.g. like this:
// if (VLOG_IS_ON(2)) {
// // do some logging preparation and logging
// // that can't be accomplished e.g. via just VLOG(2) << ...;
// }
//
// The truth value that VLOG_IS_ON(level) returns is determined by
// the three verbosity level flags:
// --v=<n> Gives the default maximal active V-logging level;
// 0 is the default.
// Normally positive values are used for V-logging levels.
// --vmodule=<str> Gives the per-module maximal V-logging levels to override
// the value given by --v.
// E.g. "my_module=2,foo*=3" would change the logging level
// for all code in source files "my_module.*" and "foo*.*"
// ("-inl" suffixes are also disregarded for this matching).
//
// SetVLOGLevel helper function is provided to do limited dynamic control over
// V-logging by overriding the per-module settings given via --vmodule flag.
//
// CAVEAT: --vmodule functionality is not available in non gcc compilers.
//
#ifndef BASE_VLOG_IS_ON_H_
#define BASE_VLOG_IS_ON_H_
#include "glog/log_severity.h"
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
# ifdef _WIN32
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
# endif
#endif
#if defined(__GNUC__)
// We emit an anonymous static int* variable at every VLOG_IS_ON(n) site.
// (Normally) the first time every VLOG_IS_ON(n) site is hit,
// we determine what variable will dynamically control logging at this site:
// it's either FLAGS_v or an appropriate internal variable
// matching the current source file that represents results of
// parsing of --vmodule flag and/or SetVLOGLevel calls.
#define VLOG_IS_ON(verboselevel) \
({ static google::int32* vlocal__ = &google::kLogSiteUninitialized; \
google::int32 verbose_level__ = (verboselevel); \
(*vlocal__ >= verbose_level__) && \
((vlocal__ != &google::kLogSiteUninitialized) || \
(google::InitVLOG3__(&vlocal__, &FLAGS_v, \
__FILE__, verbose_level__))); })
#else
// GNU extensions not available, so we do not support --vmodule.
// Dynamic value of FLAGS_v always controls the logging level.
#define VLOG_IS_ON(verboselevel) (FLAGS_v >= (verboselevel))
#endif
// Set VLOG(_IS_ON) level for module_pattern to log_level.
// This lets us dynamically control what is normally set by the --vmodule flag.
// Returns the level that previously applied to module_pattern.
// NOTE: To change the log level for VLOG(_IS_ON) sites
// that have already executed after/during InitGoogleLogging,
// one needs to supply the exact --vmodule pattern that applied to them.
// (If no --vmodule pattern applied to them
// the value of FLAGS_v will continue to control them.)
extern GOOGLE_GLOG_DLL_DECL int SetVLOGLevel(const char* module_pattern,
int log_level);
// Various declarations needed for VLOG_IS_ON above: =========================
// Special value used to indicate that a VLOG_IS_ON site has not been
// initialized. We make this a large value, so the common-case check
// of "*vlocal__ >= verbose_level__" in VLOG_IS_ON definition
// passes in such cases and InitVLOG3__ is then triggered.
extern google::int32 kLogSiteUninitialized;
// Helper routine which determines the logging info for a particalur VLOG site.
// site_flag is the address of the site-local pointer to the controlling
// verbosity level
// site_default is the default to use for *site_flag
// fname is the current source file name
// verbose_level is the argument to VLOG_IS_ON
// We will return the return value for VLOG_IS_ON
// and if possible set *site_flag appropriately.
extern GOOGLE_GLOG_DLL_DECL bool InitVLOG3__(
google::int32** site_flag,
google::int32* site_default,
const char* fname,
google::int32 verbose_level);
#endif // BASE_VLOG_IS_ON_H_

64
src/windows/port.cc Executable file
View File

@ -0,0 +1,64 @@
/* 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: Craig Silverstein
* Copied from google-perftools and modified by Shinichiro Hamaji
*/
#ifndef _WIN32
# error You should only be including windows/port.cc in a windows environment!
#endif
#include "config.h"
#include <stdarg.h> // for va_list, va_start, va_end
#include <string.h> // for strstr()
#include <assert.h>
#include <string>
#include <vector>
#include "port.h"
using std::string;
using std::vector;
// These call the windows _vsnprintf, but always NUL-terminate.
int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
if (size == 0) // not even room for a \0?
return -1; // not what C99 says to do, but what windows does
str[size-1] = '\0';
return _vsnprintf(str, size-1, format, ap);
}
int snprintf(char *str, size_t size, const char *format, ...) {
va_list ap;
va_start(ap, format);
const int r = vsnprintf(str, size, format, ap);
va_end(ap);
return r;
}

149
src/windows/port.h Executable file
View File

@ -0,0 +1,149 @@
/* 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: Craig Silverstein
* Copied from google-perftools and modified by Shinichiro Hamaji
*
* These are some portability typedefs and defines to make it a bit
* easier to compile this code under VC++.
*
* Several of these are taken from glib:
* http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html
*/
#ifndef CTEMPLATE_WINDOWS_PORT_H_
#define CTEMPLATE_WINDOWS_PORT_H_
#include "config.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN /* We always want minimal includes */
#include <windows.h>
#include <winsock.h> /* for gethostname */
#include <io.h> /* because we so often use open/close/etc */
#include <direct.h> /* for _getcwd() */
#include <process.h> /* for _getpid() */
#include <stdio.h> /* read in vsnprintf decl. before redifining it */
#include <stdarg.h> /* template_dictionary.cc uses va_copy */
#include <string.h> /* for _strnicmp(), strerror_s() */
#include <time.h> /* for localtime_s() */
/* Note: the C++ #includes are all together at the bottom. This file is
* used by both C and C++ code, so we put all the C++ together.
*/
/* 4244: otherwise we get problems when substracting two size_t's to an int
* 4251: it's complaining about a private struct I've chosen not to dllexport
* 4355: we use this in a constructor, but we do it safely
* 4715: for some reason VC++ stopped realizing you can't return after abort()
* 4800: we know we're casting ints/char*'s to bools, and we're ok with that
* 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
*/
#pragma warning(disable:4244 4251 4355 4715 4800 4996)
/* file I/O */
#define PATH_MAX 1024
#define access _access
#define getcwd _getcwd
#define open _open
#define read _read
#define write _write
#define lseek _lseek
#define close _close
#define popen _popen
#define pclose _pclose
#define R_OK 04 /* read-only (for access()) */
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#ifndef __MINGW32__
enum { STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2 };
#endif
#define S_IRUSR S_IREAD
#define S_IWUSR S_IWRITE
/* Not quite as lightweight as a hard-link, but more than good enough for us. */
#define link(oldpath, newpath) CopyFileA(oldpath, newpath, false)
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
/* In windows-land, hash<> is called hash_compare<> (from xhash.h) */
#define hash hash_compare
/* Sleep is in ms, on windows */
#define sleep(secs) Sleep((secs) * 1000)
/* We can't just use _vsnprintf and _snprintf as drop-in-replacements,
* 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,
const char *format, ...);
extern int 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)
#define va_copy(dst, src) (dst) = (src)
/* Windows doesn't support specifying the number of buckets as a
* hash_map constructor arg, so we leave this blank.
*/
#define CTEMPLATE_SMALL_HASHTABLE
#define DEFAULT_TEMPLATE_ROOTDIR ".."
// ----------------------------------- SYSTEM/PROCESS
typedef int pid_t;
#define getpid _getpid
// ----------------------------------- THREADS
typedef DWORD pthread_t;
typedef DWORD pthread_key_t;
typedef LONG pthread_once_t;
enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock
#define pthread_self GetCurrentThreadId
#define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2))
inline struct tm* localtime_r(const time_t* timep, struct tm* result) {
localtime_s(result, timep);
return result;
}
inline char* strerror_r(int errnum, char* buf, size_t buflen) {
strerror_s(buf, buflen, errnum);
return buf;
}
#ifndef __cplusplus
/* I don't see how to get inlining for C code in MSVC. Ah well. */
#define inline
#endif
#endif /* _WIN32 */
#endif /* CTEMPLATE_WINDOWS_PORT_H_ */

118
src/windows/preprocess.sh Executable file
View File

@ -0,0 +1,118 @@
#!/bin/sh
# 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: Craig Silverstein
# Copied from google-perftools and modified by Shinichiro Hamaji
#
# This script is meant to be run at distribution-generation time, for
# instance by autogen.sh. It does some of the work configure would
# normally do, for windows systems. In particular, it expands all the
# @...@ variables found in .in files, and puts them here, in the windows
# directory.
#
# This script should be run before any new release.
if [ -z "$1" ]; then
echo "USAGE: $0 <src/ directory>"
exit 1
fi
DLLDEF_MACRO_NAME="GLOG_DLL_DECL"
# The text we put in every .h files we create. As a courtesy, we'll
# include a helpful comment for windows users as to how to use
# GLOG_DLL_DECL. Apparently sed expands \n into a newline. Good!
DLLDEF_DEFINES="\
// NOTE: if you are statically linking the template library into your binary\n\
// (rather than using the template .dll), set '/D $DLLDEF_MACRO_NAME='\n\
// as a compiler flag in your project file to turn off the dllimports.\n\
#ifndef $DLLDEF_MACRO_NAME\n\
# define $DLLDEF_MACRO_NAME __declspec(dllimport)\n\
#endif"
# Read all the windows config info into variables
# In order for the 'set' to take, this requires putting all in a subshell.
(
while read define varname value; do
[ "$define" != "#define" ] && continue
eval "$varname='$value'"
done
# Process all the .in files in the "glog" subdirectory
mkdir -p "$1/windows/glog"
for file in `echo "$1"/glog/*.in`; do
echo "Processing $file"
outfile="$1/windows/glog/`basename $file .in`"
echo "\
// This file is automatically generated from $file
// using src/windows/preprocess.sh.
// DO NOT EDIT!
" > "$outfile"
# Besides replacing @...@, we also need to turn on dllimport
# We also need to replace hash by hash_compare (annoying we hard-code :-( )
sed -e "s!@ac_windows_dllexport@!$DLLDEF_MACRO_NAME!g" \
-e "s!@ac_windows_dllexport_defines@!$DLLDEF_DEFINES!g" \
-e "s!@ac_cv_cxx_hash_map@!$HASH_MAP_H!g" \
-e "s!@ac_cv_cxx_hash_namespace@!$HASH_NAMESPACE!g" \
-e "s!@ac_cv_cxx_hash_set@!$HASH_SET_H!g" \
-e "s!@ac_cv_have_stdint_h@!0!g" \
-e "s!@ac_cv_have_systypes_h@!0!g" \
-e "s!@ac_cv_have_inttypes_h@!0!g" \
-e "s!@ac_cv_have_unistd_h@!0!g" \
-e "s!@ac_cv_have_uint16_t@!0!g" \
-e "s!@ac_cv_have_u_int16_t@!0!g" \
-e "s!@ac_cv_have___uint16@!1!g" \
-e "s!@ac_cv_have_libgflags@!0!g" \
-e "s!@ac_cv_have___builtin_expect@!0!g" \
-e "s!@ac_cv_cxx_using_operator@!1!g" \
-e "s!@ac_cv___attribute___noreturn@!!g" \
-e "s!@ac_cv___attribute___printf_4_5@!!g" \
-e "s!@ac_google_attribute@!${HAVE___ATTRIBUTE__:-0}!g" \
-e "s!@ac_google_end_namespace@!$_END_GOOGLE_NAMESPACE_!g" \
-e "s!@ac_google_namespace@!$GOOGLE_NAMESPACE!g" \
-e "s!@ac_google_start_namespace@!$_START_GOOGLE_NAMESPACE_!g" \
-e "s!@ac_htmlparser_namespace@!$HTMLPARSER_NAMESPACE!g" \
-e "s!\\bhash\\b!hash_compare!g" \
"$file" >> "$outfile"
done
) < "$1/windows/config.h"
# log_severity.h isn't a .in file.
echo "\
// This file is automatically generated from $1/glog/log_severity.h
// using src/windows/preprocess.sh.
// DO NOT EDIT!
" > "$1/windows/glog/log_severity.h"
cat "$1/glog/log_severity.h" >> "$1/windows/glog/log_severity.h"
echo "DONE"

249
vsprojects/libglog/libglog.vcproj Executable file
View File

@ -0,0 +1,249 @@
<?xml version="1.0" encoding="shift_jis"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="libglog"
ProjectGUID="{34BD04BD-BC1D-4BFC-AAFC-ED02D9E960F1}"
RootNamespace="libglog"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\src\windows"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGLOG_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\src\windows"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGLOG_EXPORTS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\logging.cc"
>
</File>
<File
RelativePath="..\..\src\windows\port.cc"
>
</File>
<File
RelativePath="..\..\src\raw_logging.cc"
>
</File>
<File
RelativePath="..\..\src\utilities.cc"
>
</File>
<File
RelativePath="..\..\src\vlog_is_on.cc"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\src\base\commandlineflags.h"
>
</File>
<File
RelativePath="..\..\src\windows\config.h"
>
</File>
<File
RelativePath="..\..\src\base\googleinit.h"
>
</File>
<File
RelativePath="..\..\src\windows\glog\log_severity.h"
>
</File>
<File
RelativePath="..\..\src\windows\glog\logging.h"
>
</File>
<File
RelativePath="..\..\src\base\mutex.h"
>
</File>
<File
RelativePath="..\..\src\windows\port.h"
>
</File>
<File
RelativePath="..\..\src\windows\glog\raw_logging.h"
>
</File>
<File
RelativePath="..\..\src\windows\glog\stl_logging.h"
>
</File>
<File
RelativePath="..\..\src\utilities.h"
>
</File>
<File
RelativePath="..\..\src\windows\glog\vlog_is_on.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="utf-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="logging_unittest"
ProjectGUID="{DD0690AA-5E09-46B5-83FD-4B28604CABA8}"
RootNamespace="logging_unittest"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\src\windows"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\src\windows"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\logging_unittest.cc"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\src\googletest.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>