Commit 67914687 authored by Craig Silverstein's avatar Craig Silverstein

Tue Aug 19 16:15:48 2008 Google Inc. <opensource@google.com>

	* google-gflags: version 1.0rc1
	* Move #include files from google/ to gflags/ (csilvers)
	* Small optimizations to reduce binary (library) size (jyrki)
	* BUGFIX: forgot a std:: in one of the .h files (csilvers)
	* Speed up locking by making sure calls are inlined (ajenjo)
	* 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers)
	* PORTABILITY: fix Makefile to work with Cygwin (ajenjo)
	* PORTABILITY: fix code to compile under Visual Studio (ajenjo)
	* PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers)


git-svn-id: https://gflags.googlecode.com/svn/trunk@25 6586e3c6-dcc4-952a-343f-ff74eb82781d
parent c79c32d9
Tue Aug 19 16:15:48 2008 Google Inc. <opensource@google.com>
* google-gflags: version 1.0rc1
* Move #include files from google/ to gflags/ (csilvers)
* Small optimizations to reduce binary (library) size (jyrki)
* BUGFIX: forgot a std:: in one of the .h files (csilvers)
* Speed up locking by making sure calls are inlined (ajenjo)
* 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers)
* PORTABILITY: fix Makefile to work with Cygwin (ajenjo)
* PORTABILITY: fix code to compile under Visual Studio (ajenjo)
* PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers)
Mon Jul 21 23:01:38 2008 Google Inc. <opensource@google.com> Mon Jul 21 23:01:38 2008 Google Inc. <opensource@google.com>
* google-gflags: version 0.9 * google-gflags: version 0.9
......
## This is a boilerplate file for Google opensource projects.
## To make it useful, replace <<TEXT>> with actual text for your project.
## Also, look at comments with "## double hashes" to see if any are worth
## uncommenting or modifying.
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
# Make sure that when we re-make ./configure, we get the macros we need # Make sure that when we re-make ./configure, we get the macros we need
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
# This is so we can #include <google/foo> # This is so we can #include <gflags/foo>
AM_CPPFLAGS = -I$(top_srcdir)/src AM_CPPFLAGS = -I$(top_srcdir)/src
# This is mostly based on configure options # This is mostly based on configure options
...@@ -19,9 +14,13 @@ if GCC ...@@ -19,9 +14,13 @@ if GCC
AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
endif endif
googleincludedir = $(includedir)/google gflagsincludedir = $(includedir)/gflags
## The .h files you want to install (that is, .h files that people ## The .h files you want to install (that is, .h files that people
## who install this package can include in their own applications.) ## who install this package can include in their own applications.)
gflagsinclude_HEADERS = src/gflags/gflags.h src/gflags/gflags_completions.h
# This is for backwards compatibility only.
googleincludedir = $(includedir)/google
googleinclude_HEADERS = src/google/gflags.h src/google/gflags_completions.h googleinclude_HEADERS = src/google/gflags.h src/google/gflags_completions.h
bin_SCRIPTS = src/gflags_completions.sh bin_SCRIPTS = src/gflags_completions.sh
...@@ -51,30 +50,30 @@ CLEANFILES = ...@@ -51,30 +50,30 @@ CLEANFILES =
## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS ## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
lib_LTLIBRARIES += libgflags.la lib_LTLIBRARIES += libgflags.la
libgflags_la_SOURCES = $(googleinclude_HEADERS) src/config.h \ libgflags_la_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags.cc src/gflags_reporting.cc \ src/gflags.cc src/gflags_reporting.cc \
src/gflags_completions.cc src/gflags_completions.cc
libgflags_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG libgflags_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG
libgflags_la_LDFLAGS = $(PTHREAD_CFLAGS) libgflags_la_LDFLAGS = $(PTHREAD_CFLAGS)
libgflags_la_LIBADD = $(PTHREAD_LIBS) libgflags_la_LIBADD = $(PTHREAD_LIBS)
TESTS += gflags_unittest TESTS += gflags_unittest$(EXEEXT)
gflags_unittest_SOURCES = $(googleinclude_HEADERS) src/config.h \ gflags_unittest_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags_unittest.cc src/gflags_unittest.cc
gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS) gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
gflags_unittest_LDADD = libgflags.la $(PTHREAD_LIBS) gflags_unittest_LDADD = libgflags.la $(PTHREAD_LIBS)
# Also make sure this works when we don't link in pthreads # Also make sure this works when we don't link in pthreads
TESTS += gflags_nothreads_unittest TESTS += gflags_nothreads_unittest$(EXEEXT)
gflags_nothreads_unittest_SOURCES = $(gflags_unittest_SOURCES) gflags_nothreads_unittest_SOURCES = $(gflags_unittest_SOURCES)
gflags_nothreads_unittest_LDADD = libgflags.la gflags_nothreads_unittest_LDADD = libgflags.la
# We also want to test that things work properly when the file that # We also want to test that things work properly when the file that
# holds main() has a name ending with -main or _main. To keep the # holds main() has a name ending with -main or _main. To keep the
# Makefile small :-), we test the no-threads version of these. # Makefile small :-), we test the no-threads version of these.
TESTS += gflags_unittest2 TESTS += gflags_unittest2$(EXEEXT)
gflags_unittest2_SOURCES = $(googleinclude_HEADERS) src/config.h \ gflags_unittest2_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags_unittest-main.cc src/gflags_unittest-main.cc
gflags_unittest2_LDADD = libgflags.la gflags_unittest2_LDADD = libgflags.la
src/gflags_unittest-main.cc: src/gflags_unittest.cc src/gflags_unittest-main.cc: src/gflags_unittest.cc
...@@ -82,8 +81,8 @@ src/gflags_unittest-main.cc: src/gflags_unittest.cc ...@@ -82,8 +81,8 @@ src/gflags_unittest-main.cc: src/gflags_unittest.cc
cp -p src/gflags_unittest.cc src/gflags_unittest-main.cc cp -p src/gflags_unittest.cc src/gflags_unittest-main.cc
CLEANFILES += src/gflags_unittest-main.cc CLEANFILES += src/gflags_unittest-main.cc
TESTS += gflags_unittest3 TESTS += gflags_unittest3$(EXEEXT)
gflags_unittest3_SOURCES = $(googleinclude_HEADERS) src/config.h \ gflags_unittest3_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags_unittest_main.cc src/gflags_unittest_main.cc
gflags_unittest3_LDADD = libgflags.la gflags_unittest3_LDADD = libgflags.la
src/gflags_unittest_main.cc: src/gflags_unittest.cc src/gflags_unittest_main.cc: src/gflags_unittest.cc
...@@ -91,12 +90,18 @@ src/gflags_unittest_main.cc: src/gflags_unittest.cc ...@@ -91,12 +90,18 @@ src/gflags_unittest_main.cc: src/gflags_unittest.cc
cp -p src/gflags_unittest.cc src/gflags_unittest_main.cc cp -p src/gflags_unittest.cc src/gflags_unittest_main.cc
CLEANFILES += src/gflags_unittest_main.cc CLEANFILES += src/gflags_unittest_main.cc
# Some buggy sh's ignore "" instead of treating it as a positional
# parameter. Since we use "" in this script, we prefer bash if we
# can. If there's no bash, we fall back to sh.
check_SCRIPTS += gflags_unittest_sh check_SCRIPTS += gflags_unittest_sh
noinst_SCRIPTS += src/gflags_unittest.sh noinst_SCRIPTS += src/gflags_unittest.sh
dist_noinst_DATA = $(top_srcdir)/src/gflags_unittest_flagfile dist_noinst_DATA = src/gflags_unittest_flagfile
gflags_unittest_sh: gflags_unittest gflags_unittest2 gflags_unittest3 gflags_unittest_sh: gflags_unittest$(EXEEXT) \
$(top_srcdir)/src/gflags_unittest.sh $(PWD)/$< $(top_srcdir) gflags_unittest2$(EXEEXT) \
gflags_unittest3$(EXEEXT)
bash --version >/dev/null && export SH=bash || export SH=sh; \
$$SH "$(top_srcdir)/src/gflags_unittest.sh" "$(PWD)/gflags_unittest" \
"$(top_srcdir)"
# These aren't part of the c++ source, but we want them to be distributed # These aren't part of the c++ source, but we want them to be distributed
PYTHON = python/setup.py \ PYTHON = python/setup.py \
......
This diff is collapsed.
...@@ -15,11 +15,41 @@ ...@@ -15,11 +15,41 @@
set -ex set -ex
rm -rf autom4te.cache rm -rf autom4te.cache
aclocal --force -I m4 trap 'rm -f aclocal.m4.tmp' EXIT
grep -q LIBTOOL configure.ac && libtoolize -c -f
# Use version 1.9 of aclocal and automake if available.
ACLOCAL=aclocal-1.9
if test -z `which "$ACLOCAL"`; then
ACLOCAL=aclocal
fi
AUTOMAKE=automake-1.9
if test -z `which "$AUTOMAKE"`; then
AUTOMAKE=automake
fi
# glibtoolize is used for Mac OS X
LIBTOOLIZE=libtoolize
if test -z `which "$LIBTOOLIZE"`; then
LIBTOOLIZE=glibtoolize
fi
# aclocal tries to overwrite aclocal.m4 even if the contents haven't
# changed, which is annoying when the file is not open for edit (in
# p4). We work around this by writing to a temp file and just
# updating the timestamp if the file hasn't change.
"$ACLOCAL" --force -I m4 --output=aclocal.m4.tmp
if cmp aclocal.m4.tmp aclocal.m4; then
touch aclocal.m4 # pretend that we regenerated the file
rm -f aclocal.m4.tmp
else
mv aclocal.m4.tmp aclocal.m4 # we did set -e above, so we die if this fails
fi
grep -q LIBTOOL configure.ac && "$LIBTOOLIZE" -c -f
autoconf -f -W all,no-obsolete autoconf -f -W all,no-obsolete
autoheader -f -W all autoheader -f -W all
automake -a -c -f -W all "$AUTOMAKE" -a -c -f -W all
rm -rf autom4te.cache rm -rf autom4te.cache
exit 0 exit 0
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# make sure we're interpreted by some minimal autoconf # make sure we're interpreted by some minimal autoconf
AC_PREREQ(2.57) AC_PREREQ(2.57)
AC_INIT(gflags, 0.9, opensource@google.com) AC_INIT(gflags, 1.0rc1, opensource@google.com)
# The argument here is just something that should be in the current directory # The argument here is just something that should be in the current directory
# (for sanity checking) # (for sanity checking)
AC_CONFIG_SRCDIR(README) AC_CONFIG_SRCDIR(README)
...@@ -28,15 +28,17 @@ AC_HEADER_STDC ...@@ -28,15 +28,17 @@ AC_HEADER_STDC
AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0) 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(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_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0)
AC_CHECK_HEADERS([fnmatch.h windows.h])
# These are the types I need. We look for them in either stdint.h, # These are the types I need. We look for them in either stdint.h,
# sys/types.h, or inttypes.h, all of which are part of the default-includes. # sys/types.h, or inttypes.h, all of which are part of the default-includes.
AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0) AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0)
AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0) AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0)
AC_CHECK_TYPE(__uint16, ac_cv_have___uint16=1, ac_cv_have___uint16=0) AC_CHECK_TYPE(__int16, ac_cv_have___int16=1, ac_cv_have___int16=0)
AC_CHECK_FUNCS(strtoll) AC_CHECK_FUNCS([InitializeCriticalSection])
AC_CHECK_FUNCS(strtoq) AC_CHECK_FUNCS([InterlockedCompareExchange])
AC_CHECK_FUNCS([strtoll strtoq])
AX_C___ATTRIBUTE__ AX_C___ATTRIBUTE__
# We only care about __attribute__ ((unused)) # We only care about __attribute__ ((unused))
...@@ -63,10 +65,10 @@ AC_SUBST(ac_cv_have_systypes_h) ...@@ -63,10 +65,10 @@ AC_SUBST(ac_cv_have_systypes_h)
AC_SUBST(ac_cv_have_inttypes_h) AC_SUBST(ac_cv_have_inttypes_h)
AC_SUBST(ac_cv_have_uint16_t) AC_SUBST(ac_cv_have_uint16_t)
AC_SUBST(ac_cv_have_u_int16_t) AC_SUBST(ac_cv_have_u_int16_t)
AC_SUBST(ac_cv_have___uint16) AC_SUBST(ac_cv_have___int16)
## Check out ../autoconf/ for other macros you can call to do useful stuff ## Check out ../autoconf/ for other macros you can call to do useful stuff
# Write generated configuration file, and also .h files # Write generated configuration file, and also .h files
AC_CONFIG_FILES([Makefile src/google/gflags.h src/google/gflags_completions.h]) AC_CONFIG_FILES([Makefile src/gflags/gflags.h src/gflags/gflags_completions.h])
AC_OUTPUT AC_OUTPUT
The list of files here isn't complete. For a step-by-step guide on
how to set this package up correctly, check out
http://www.debian.org/doc/maint-guide/
Most of the files that are in this directory are boilerplate.
However, you may need to change the list of binary-arch dependencies
in 'rules'.
google-gflags (1.0rc1-1) unstable; urgency=low
* New upstream release.
-- Google Inc. <opensource@google.com> Tue, 19 Aug 2008 16:15:48 -0700
google-gflags (0.9-1) unstable; urgency=low google-gflags (0.9-1) unstable; urgency=low
* New upstream release. * New upstream release.
......
usr/lib usr/lib
usr/include usr/include
usr/include/google usr/include/google
usr/include/gflags
usr/include/google/* usr/include/google/*
usr/include/gflags/*
usr/lib/lib*.so usr/lib/lib*.so
usr/lib/lib*.a usr/lib/lib*.a
usr/lib/*.la usr/lib/*.la
debian/tmp/usr/include/google/* debian/tmp/usr/include/google/*
debian/tmp/usr/include/gflags/*
debian/tmp/usr/lib/lib*.so debian/tmp/usr/lib/lib*.so
debian/tmp/usr/lib/lib*.a debian/tmp/usr/lib/lib*.a
debian/tmp/usr/lib/*.la debian/tmp/usr/lib/*.la
...@@ -52,7 +52,13 @@ rm -rf $RPM_BUILD_ROOT ...@@ -52,7 +52,13 @@ rm -rf $RPM_BUILD_ROOT
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README doc/designstyle.css doc/gflags.html ## Mark all installed files within /usr/share/doc/{package name} as
## documentation. This depends on the following two lines appearing in
## Makefile.am:
## docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
## dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README
%docdir %{prefix}/share/doc/%{NAME}-%{VERSION}
%{prefix}/share/doc/%{NAME}-%{VERSION}/*
%{prefix}/lib/libgflags.so.0 %{prefix}/lib/libgflags.so.0
%{prefix}/lib/libgflags.so.0.0.0 %{prefix}/lib/libgflags.so.0.0.0
...@@ -62,6 +68,7 @@ rm -rf $RPM_BUILD_ROOT ...@@ -62,6 +68,7 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root) %defattr(-,root,root)
%{prefix}/include/google %{prefix}/include/google
%{prefix}/include/gflags
%{prefix}/lib/libgflags.a %{prefix}/lib/libgflags.a
%{prefix}/lib/libgflags.la %{prefix}/lib/libgflags.la
%{prefix}/lib/libgflags.so %{prefix}/lib/libgflags.so
...@@ -6,6 +6,15 @@ ...@@ -6,6 +6,15 @@
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H #undef HAVE_DLFCN_H
/* Define to 1 if you have the <fnmatch.h> header file. */
#undef HAVE_FNMATCH_H
/* Define to 1 if you have the `InitializeCriticalSection' function. */
#undef HAVE_INITIALIZECRITICALSECTION
/* Define to 1 if you have the `InterlockedCompareExchange' function. */
#undef HAVE_INTERLOCKEDCOMPAREEXCHANGE
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
...@@ -45,6 +54,9 @@ ...@@ -45,6 +54,9 @@
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
/* define if your compiler has __attribute__ */ /* define if your compiler has __attribute__ */
#undef HAVE___ATTRIBUTE__ #undef HAVE___ATTRIBUTE__
......
This diff is collapsed.
...@@ -103,11 +103,11 @@ typedef int32_t int32; ...@@ -103,11 +103,11 @@ typedef int32_t int32;
typedef u_int32_t uint32; typedef u_int32_t uint32;
typedef int64_t int64; typedef int64_t int64;
typedef u_int64_t uint64; typedef u_int64_t uint64;
#elif @ac_cv_have___uint16@ // the windows (vc7) format #elif @ac_cv_have___int16@ // the windows (vc7) format
typedef __int32 int32; typedef __int32 int32;
typedef __uint32 uint32; typedef unsigned __int32 uint32;
typedef __int64 int64; typedef __int64 int64;
typedef __uint64 uint64; typedef unsigned __int64 uint64;
#else #else
#error Do not know how to define a 32-bit integer quantity on your system #error Do not know how to define a 32-bit integer quantity on your system
#endif #endif
...@@ -504,7 +504,7 @@ extern bool FlagsTypeWarn(const char *name); ...@@ -504,7 +504,7 @@ extern bool FlagsTypeWarn(const char *name);
#define DEFINE_string(name, val, txt) \ #define DEFINE_string(name, val, txt) \
namespace fLS { \ namespace fLS { \
static union { void* align; char s[sizeof(std::string)]; } s_##name[2]; \ static union { void* align; char s[sizeof(std::string)]; } s_##name[2]; \
const string* const FLAGS_no##name = new (s_##name[0].s) std::string(val); \ const std::string* const FLAGS_no##name = new (s_##name[0].s) std::string(val); \
static @ac_google_namespace@::FlagRegisterer o_##name( \ static @ac_google_namespace@::FlagRegisterer o_##name( \
#name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \ #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \
s_##name[0].s, new (s_##name[1].s) std::string(*FLAGS_no##name)); \ s_##name[0].s, new (s_##name[1].s) std::string(*FLAGS_no##name)); \
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "google/gflags.h" #include "gflags/gflags.h"
using std::set; using std::set;
using std::string; using std::string;
...@@ -145,7 +145,7 @@ static void OutputSingleGroupWithLimit( ...@@ -145,7 +145,7 @@ static void OutputSingleGroupWithLimit(
const string &footer, const string &footer,
bool long_output_format, bool long_output_format,
int *remaining_line_limit, int *remaining_line_limit,
int *completion_elements_added, size_t *completion_elements_added,
vector<string> *completions); vector<string> *completions);
// (helpers for #5) // (helpers for #5)
...@@ -424,7 +424,7 @@ static void CategorizeAllMatchingFlags( ...@@ -424,7 +424,7 @@ static void CategorizeAllMatchingFlags(
all_matches.begin(); all_matches.begin();
it != all_matches.end(); it != all_matches.end();
++it) { ++it) {
//VLOG(2) << "Examinging match '" << (*it)->name << "'"; //VLOG(2) << "Examining match '" << (*it)->name << "'";
//VLOG(7) << " filename: '" << (*it)->filename << "'"; //VLOG(7) << " filename: '" << (*it)->filename << "'";
string::size_type pos = string::npos; string::size_type pos = string::npos;
if (!package_dir.empty()) if (!package_dir.empty())
...@@ -507,6 +507,17 @@ struct DisplayInfoGroup { ...@@ -507,6 +507,17 @@ struct DisplayInfoGroup {
string header; string header;
string footer; string footer;
set<const CommandLineFlagInfo *> *group; set<const CommandLineFlagInfo *> *group;
int SizeInLines() const {
int size_in_lines = static_cast<int>(group->size()) + 1;
if (!header.empty()) {
size_in_lines++;
}
if (!footer.empty()) {
size_in_lines++;
}
return size_in_lines;
}
}; };
// 4) Finalize and trim output flag set // 4) Finalize and trim output flag set
...@@ -533,45 +544,47 @@ static void FinalizeCompletionOutput( ...@@ -533,45 +544,47 @@ static void FinalizeCompletionOutput(
if (lines_so_far < max_desired_lines && if (lines_so_far < max_desired_lines &&
!notable_flags->perfect_match_flag.empty()) { !notable_flags->perfect_match_flag.empty()) {
perfect_match_found = true; perfect_match_found = true;
lines_so_far += notable_flags->perfect_match_flag.size() + 2; // no header
DisplayInfoGroup group = DisplayInfoGroup group =
{ "", "==========", &notable_flags->perfect_match_flag }; { string(),
"==========",
&notable_flags->perfect_match_flag };
lines_so_far += group.SizeInLines();
output_groups.push_back(group); output_groups.push_back(group);
} }
if (lines_so_far < max_desired_lines && if (lines_so_far < max_desired_lines &&
!notable_flags->module_flags.empty()) { !notable_flags->module_flags.empty()) {
lines_so_far += notable_flags->module_flags.size() + 3;
DisplayInfoGroup group = { DisplayInfoGroup group = {
"-* Matching module flags *-", "-* Matching module flags *-",
"===========================", "===========================",
&notable_flags->module_flags }; &notable_flags->module_flags };
lines_so_far += group.SizeInLines();
output_groups.push_back(group); output_groups.push_back(group);
} }
if (lines_so_far < max_desired_lines && if (lines_so_far < max_desired_lines &&
!notable_flags->package_flags.empty()) { !notable_flags->package_flags.empty()) {
lines_so_far += notable_flags->package_flags.size() + 3;
DisplayInfoGroup group = { DisplayInfoGroup group = {
"-* Matching package flags *-", "-* Matching package flags *-",
"============================", "============================",
&notable_flags->package_flags }; &notable_flags->package_flags };
lines_so_far += group.SizeInLines();
output_groups.push_back(group); output_groups.push_back(group);
} }
if (lines_so_far < max_desired_lines && if (lines_so_far < max_desired_lines &&
!notable_flags->most_common_flags.empty()) { !notable_flags->most_common_flags.empty()) {
lines_so_far += notable_flags->most_common_flags.size() + 3;
DisplayInfoGroup group = { DisplayInfoGroup group = {
"-* Commonly used flags *-", "-* Commonly used flags *-",
"=========================", "=========================",
&notable_flags->most_common_flags }; &notable_flags->most_common_flags };
lines_so_far += group.SizeInLines();
output_groups.push_back(group); output_groups.push_back(group);
} }
if (lines_so_far < max_desired_lines && if (lines_so_far < max_desired_lines &&
!notable_flags->subpackage_flags.empty()) { !notable_flags->subpackage_flags.empty()) {
lines_so_far += notable_flags->subpackage_flags.size() + 3;
DisplayInfoGroup group = { DisplayInfoGroup group = {
"-* Matching sub-package flags *-", "-* Matching sub-package flags *-",
"================================", "================================",
&notable_flags->subpackage_flags }; &notable_flags->subpackage_flags };
lines_so_far += group.SizeInLines();
output_groups.push_back(group); output_groups.push_back(group);
} }
...@@ -579,11 +592,11 @@ static void FinalizeCompletionOutput( ...@@ -579,11 +592,11 @@ static void FinalizeCompletionOutput(
if (lines_so_far < max_desired_lines) { if (lines_so_far < max_desired_lines) {
RetrieveUnusedFlags(matching_flags, *notable_flags, &obscure_flags); RetrieveUnusedFlags(matching_flags, *notable_flags, &obscure_flags);
if (!obscure_flags.empty()) { if (!obscure_flags.empty()) {
lines_so_far += obscure_flags.size() + 2; // no footer
DisplayInfoGroup group = { DisplayInfoGroup group = {
"-* Other flags *-", "-* Other flags *-",
"", string(),
&obscure_flags }; &obscure_flags };
lines_so_far += group.SizeInLines();
output_groups.push_back(group); output_groups.push_back(group);
} }
} }
...@@ -591,8 +604,8 @@ static void FinalizeCompletionOutput( ...@@ -591,8 +604,8 @@ static void FinalizeCompletionOutput(
// Second, go through each of the chosen output groups and output // Second, go through each of the chosen output groups and output
// as many of those flags as we can, while remaining below our limit // as many of those flags as we can, while remaining below our limit
int remaining_lines = max_desired_lines; int remaining_lines = max_desired_lines;
int completions_output = 0; size_t completions_output = 0;
int indent = output_groups.size() - 1; int indent = static_cast<int>(output_groups.size()) - 1;
for (vector<DisplayInfoGroup>::const_iterator it = for (vector<DisplayInfoGroup>::const_iterator it =
output_groups.begin(); output_groups.begin();
it != output_groups.end(); it != output_groups.end();
...@@ -646,7 +659,7 @@ static void OutputSingleGroupWithLimit( ...@@ -646,7 +659,7 @@ static void OutputSingleGroupWithLimit(
const string &footer, const string &footer,
bool long_output_format, bool long_output_format,
int *remaining_line_limit, int *remaining_line_limit,
int *completion_elements_output, size_t *completion_elements_output,
vector<string> *completions) { vector<string> *completions) {
if (group.empty()) return; if (group.empty()) return;
if (!header.empty()) { if (!header.empty()) {
...@@ -681,11 +694,12 @@ static string GetShortFlagLine( ...@@ -681,11 +694,12 @@ static string GetShortFlagLine(
("'" + info.default_value + "'") : ("'" + info.default_value + "'") :
info.default_value) info.default_value)
+ "] "; + "] ";
int remainder = FLAGS_tab_completion_columns - prefix.size(); int remainder =
string suffix = ""; FLAGS_tab_completion_columns - static_cast<int>(prefix.size());
string suffix;
if (remainder > 0) if (remainder > 0)
suffix = suffix =
(info.description.size() > remainder ? (static_cast<int>(info.description.size()) > remainder ?
(info.description.substr(0, remainder - 3) + "...").c_str() : (info.description.substr(0, remainder - 3) + "...").c_str() :
info.description.c_str()); info.description.c_str());
return prefix + suffix; return prefix + suffix;
...@@ -726,7 +740,7 @@ static string GetLongFlagLine( ...@@ -726,7 +740,7 @@ static string GetLongFlagLine(
for (string::size_type newline = output.find('\n'); for (string::size_type newline = output.find('\n');
newline != string::npos; newline != string::npos;
newline = output.find('\n')) { newline = output.find('\n')) {
int newline_pos = newline % FLAGS_tab_completion_columns; int newline_pos = static_cast<int>(newline) % FLAGS_tab_completion_columns;
int missing_spaces = FLAGS_tab_completion_columns - newline_pos; int missing_spaces = FLAGS_tab_completion_columns - newline_pos;
output.replace(newline, 1, line_of_spaces, 1, missing_spaces); output.replace(newline, 1, line_of_spaces, 1, missing_spaces);
} }
......
...@@ -55,8 +55,8 @@ ...@@ -55,8 +55,8 @@
#include <assert.h> #include <assert.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include "google/gflags.h" #include "gflags/gflags.h"
#include "google/gflags_completions.h" #include "gflags/gflags_completions.h"
#ifndef PATH_SEPARATOR #ifndef PATH_SEPARATOR
#define PATH_SEPARATOR '/' #define PATH_SEPARATOR '/'
...@@ -97,7 +97,7 @@ static const int kLineLength = 80; ...@@ -97,7 +97,7 @@ static const int kLineLength = 80;
static void AddString(const string& s, static void AddString(const string& s,
string* final_string, int* chars_in_line) { string* final_string, int* chars_in_line) {
const int slen = s.length(); const int slen = static_cast<int>(s.length());
if (*chars_in_line + 1 + slen >= kLineLength) { // < 80 chars/line if (*chars_in_line + 1 + slen >= kLineLength) { // < 80 chars/line
*final_string += "\n "; *final_string += "\n ";
*chars_in_line = 6; *chars_in_line = 6;
...@@ -115,7 +115,7 @@ string DescribeOneFlag(const CommandLineFlagInfo& flag) { ...@@ -115,7 +115,7 @@ string DescribeOneFlag(const CommandLineFlagInfo& flag) {
string main_part = (string(" -") + flag.name + string main_part = (string(" -") + flag.name +
" (" + flag.description + ')'); " (" + flag.description + ')');
const char* c_string = main_part.c_str(); const char* c_string = main_part.c_str();
int chars_left = main_part.length(); int chars_left = static_cast<int>(main_part.length());
string final_string = ""; string final_string = "";
int chars_in_line = 0; // how many chars in current line so far? int chars_in_line = 0; // how many chars in current line so far?
while (1) { while (1) {
...@@ -128,7 +128,7 @@ string DescribeOneFlag(const CommandLineFlagInfo& flag) { ...@@ -128,7 +128,7 @@ string DescribeOneFlag(const CommandLineFlagInfo& flag) {
break; break;
} }
if (newline != NULL && newline - c_string < kLineLength - chars_in_line) { if (newline != NULL && newline - c_string < kLineLength - chars_in_line) {
int n = newline - c_string; int n = static_cast<int>(newline - c_string);
final_string.append(c_string, n); final_string.append(c_string, n);
chars_left -= n + 1; chars_left -= n + 1;
c_string += n + 1; c_string += n + 1;
...@@ -185,9 +185,9 @@ string DescribeOneFlag(const CommandLineFlagInfo& flag) { ...@@ -185,9 +185,9 @@ string DescribeOneFlag(const CommandLineFlagInfo& flag) {
// Simple routine to xml-escape a string: escape & and < only. // Simple routine to xml-escape a string: escape & and < only.
static string XMLText(const string& txt) { static string XMLText(const string& txt) {
string ans = txt; string ans = txt;
for (string::size_type pos = 0; (pos=ans.find("&", pos)) != string::npos; ) for (string::size_type pos = 0; (pos = ans.find("&", pos)) != string::npos; )
ans.replace(pos++, 1, "&amp;"); ans.replace(pos++, 1, "&amp;");
for (string::size_type pos = 0; (pos=ans.find("<", pos)) != string::npos; ) for (string::size_type pos = 0; (pos = ans.find("<", pos)) != string::npos; )
ans.replace(pos++, 1, "&lt;"); ans.replace(pos++, 1, "&lt;");
return ans; return ans;
} }
...@@ -244,7 +244,7 @@ static bool FileMatchesSubstring(const string& filename, ...@@ -244,7 +244,7 @@ static bool FileMatchesSubstring(const string& filename,
// Show help for every filename which matches any of the target substrings. // Show help for every filename which matches any of the target substrings.
// If substrings is empty, shows help for every file. If a flag's help message // If substrings is empty, shows help for every file. If a flag's help message
// has been stripped (e.g. by adding '#define STRIP_FLAG_HELP 1' before // has been stripped (e.g. by adding '#define STRIP_FLAG_HELP 1' before
// including google/gflags.h), then this flag will not be displayed by // including gflags/gflags.h), then this flag will not be displayed by
// '--help' and its variants. // '--help' and its variants.
static void ShowUsageWithFlagsMatching(const char *argv0, static void ShowUsageWithFlagsMatching(const char *argv0,
const vector<string> &substrings) { const vector<string> &substrings) {
...@@ -253,7 +253,7 @@ static void ShowUsageWithFlagsMatching(const char *argv0, ...@@ -253,7 +253,7 @@ static void ShowUsageWithFlagsMatching(const char *argv0,
vector<CommandLineFlagInfo> flags; vector<CommandLineFlagInfo> flags;
GetAllFlags(&flags); // flags are sorted by filename, then flagname GetAllFlags(&flags); // flags are sorted by filename, then flagname
string last_filename = ""; // so we know when we're at a new file string last_filename; // so we know when we're at a new file
bool first_directory = true; // controls blank lines between dirs bool first_directory = true; // controls blank lines between dirs
bool found_match = false; // stays false iff no dir matches restrict bool found_match = false; // stays false iff no dir matches restrict
for (vector<CommandLineFlagInfo>::const_iterator flag = flags.begin(); for (vector<CommandLineFlagInfo>::const_iterator flag = flags.begin();
...@@ -384,7 +384,7 @@ void HandleCommandLineHelpFlags() { ...@@ -384,7 +384,7 @@ void HandleCommandLineHelpFlags() {
substrings.push_back(string("/") + progname + "."); substrings.push_back(string("/") + progname + ".");
substrings.push_back(string("/") + progname + "-main."); substrings.push_back(string("/") + progname + "-main.");
substrings.push_back(string("/") + progname + "_main."); substrings.push_back(string("/") + progname + "_main.");
string last_package = ""; string last_package;
for (vector<CommandLineFlagInfo>::const_iterator flag = flags.begin(); for (vector<CommandLineFlagInfo>::const_iterator flag = flags.begin();
flag != flags.end(); flag != flags.end();
++flag) { ++flag) {
...@@ -393,14 +393,14 @@ void HandleCommandLineHelpFlags() { ...@@ -393,14 +393,14 @@ void HandleCommandLineHelpFlags() {
const string package = Dirname(flag->filename) + "/"; const string package = Dirname(flag->filename) + "/";
if (package != last_package) { if (package != last_package) {
ShowUsageWithFlagsRestrict(progname, package.c_str()); ShowUsageWithFlagsRestrict(progname, package.c_str());
if (last_package != "") { // means this isn't our first pkg if (!last_package.empty()) { // means this isn't our first pkg
fprintf(stderr, "WARNING: Multiple packages contain a file=%s\n", fprintf(stderr, "WARNING: Multiple packages contain a file=%s\n",
progname); progname);
} }
last_package = package; last_package = package;
} }
} }
if (last_package == "") { // never found a package to print if (last_package.empty()) { // never found a package to print
fprintf(stderr, "WARNING: Unable to find a package for file=%s\n", fprintf(stderr, "WARNING: Unable to find a package for file=%s\n",
progname); progname);
} }
......
...@@ -42,7 +42,12 @@ ...@@ -42,7 +42,12 @@
#include <math.h> // for isinf() and isnan() #include <math.h> // for isinf() and isnan()
#include <vector> #include <vector>
#include <string> #include <string>
#include "google/gflags.h" #include "gflags/gflags.h"
// I don't actually use this header file, but #include it under the
// old location to make sure that the include-header-forwarding
// works.
#include "google/gflags_completions.h"
void (*unused_fn)() = &GOOGLE_NAMESPACE::HandleCommandLineCompletions;
using std::vector; using std::vector;
using std::string; using std::string;
...@@ -151,6 +156,11 @@ _START_GOOGLE_NAMESPACE_ ...@@ -151,6 +156,11 @@ _START_GOOGLE_NAMESPACE_
#define EXPECT_GT(val1, val2) EXPECT_OP(>, val1, val2) #define EXPECT_GT(val1, val2) EXPECT_OP(>, val1, val2)
#define EXPECT_LT(val1, val2) EXPECT_OP(<, val1, val2) #define EXPECT_LT(val1, val2) EXPECT_OP(<, val1, val2)
// C99 declares isnan and isinf should be macros, so the #ifdef test
// should be reliable everywhere. Of course, it's not, but these
// are testing pertty marginal functionality anyway, so it's ok to
// not-run them even in situations they might, with effort, be made to work.
#ifdef isnan // Some compilers, like sun's for Solaris 10, don't define this
#define EXPECT_NAN(arg) \ #define EXPECT_NAN(arg) \
do { \ do { \
if (!isnan(arg)) { \ if (!isnan(arg)) { \
...@@ -158,7 +168,11 @@ _START_GOOGLE_NAMESPACE_ ...@@ -158,7 +168,11 @@ _START_GOOGLE_NAMESPACE_
exit(1); \ exit(1); \
} \ } \
} while (0) } while (0)
#else
#define EXPECT_NAN(arg)
#endif
#ifdef isinf // Some compilers, like sun's for Solaris 10, don't define this
#define EXPECT_INF(arg) \ #define EXPECT_INF(arg) \
do { \ do { \
if (!isinf(arg)) { \ if (!isinf(arg)) { \
...@@ -166,6 +180,9 @@ _START_GOOGLE_NAMESPACE_ ...@@ -166,6 +180,9 @@ _START_GOOGLE_NAMESPACE_
exit(1); \ exit(1); \
} \ } \
} while (0) } while (0)
#else
#define EXPECT_INF(arg)
#endif
#define EXPECT_DOUBLE_EQ(val1, val2) \ #define EXPECT_DOUBLE_EQ(val1, val2) \
do { \ do { \
...@@ -497,6 +514,7 @@ TEST(SetFlagValueTest, OrdinaryValues) { ...@@ -497,6 +514,7 @@ TEST(SetFlagValueTest, OrdinaryValues) {
// Tests that flags can be set to exceptional values. // Tests that flags can be set to exceptional values.
TEST(SetFlagValueTest, ExceptionalValues) { TEST(SetFlagValueTest, ExceptionalValues) {
#ifdef isinf // on systems without isinf, inf stuff may not work at all
EXPECT_EQ("test_double set to inf\n", EXPECT_EQ("test_double set to inf\n",
SetCommandLineOption("test_double", "inf")); SetCommandLineOption("test_double", "inf"));
EXPECT_INF(FLAGS_test_double); EXPECT_INF(FLAGS_test_double);
...@@ -504,6 +522,7 @@ TEST(SetFlagValueTest, ExceptionalValues) { ...@@ -504,6 +522,7 @@ TEST(SetFlagValueTest, ExceptionalValues) {
EXPECT_EQ("test_double set to inf\n", EXPECT_EQ("test_double set to inf\n",
SetCommandLineOption("test_double", "INF")); SetCommandLineOption("test_double", "INF"));
EXPECT_INF(FLAGS_test_double); EXPECT_INF(FLAGS_test_double);
#endif
// set some bad values // set some bad values
EXPECT_EQ("", EXPECT_EQ("",
...@@ -512,14 +531,18 @@ TEST(SetFlagValueTest, ExceptionalValues) { ...@@ -512,14 +531,18 @@ TEST(SetFlagValueTest, ExceptionalValues) {
SetCommandLineOption("test_double", " ")); SetCommandLineOption("test_double", " "));
EXPECT_EQ("", EXPECT_EQ("",
SetCommandLineOption("test_double", "")); SetCommandLineOption("test_double", ""));
#ifdef isinf
EXPECT_EQ("test_double set to -inf\n", EXPECT_EQ("test_double set to -inf\n",
SetCommandLineOption("test_double", "-inf")); SetCommandLineOption("test_double", "-inf"));
EXPECT_INF(FLAGS_test_double); EXPECT_INF(FLAGS_test_double);
EXPECT_GT(0, FLAGS_test_double); EXPECT_GT(0, FLAGS_test_double);
#endif
#ifdef isnan
EXPECT_EQ("test_double set to nan\n", EXPECT_EQ("test_double set to nan\n",
SetCommandLineOption("test_double", "NaN")); SetCommandLineOption("test_double", "NaN"));
EXPECT_NAN(FLAGS_test_double); EXPECT_NAN(FLAGS_test_double);
#endif
} }
// Tests that integer flags can be specified in many ways // Tests that integer flags can be specified in many ways
......
...@@ -42,13 +42,13 @@ then ...@@ -42,13 +42,13 @@ then
exit 1 exit 1
fi fi
EXE=$1 EXE="$1"
SRCDIR=${2:-./} SRCDIR="${2:-./}"
TMPDIR=${3:-/tmp/gflags} TMPDIR="${3:-/tmp/gflags}"
# Executables built with the main source file suffixed with "-main" and "_main". # Executables built with the main source file suffixed with "-main" and "_main".
EXE2=${EXE}2 # eg, gflags_unittest2 EXE2="${EXE}2" # eg, gflags_unittest2
EXE3=${EXE}3 # eg, gflags_unittest3 EXE3="${EXE}3" # eg, gflags_unittest3
# $1: executable # $1: executable
# $2: line-number $3: expected return code. $4: substring of expected output. # $2: line-number $3: expected return code. $4: substring of expected output.
...@@ -66,7 +66,7 @@ ExpectExe() { ...@@ -66,7 +66,7 @@ ExpectExe() {
shift shift
# We always add --srcdir=$SRCDIR because it's needed for correctness # We always add --srcdir=$SRCDIR because it's needed for correctness
$executable --srcdir="$SRCDIR" "$@" > "$TMPDIR/test.$line_number" 2>&1 "$executable" --srcdir="$SRCDIR" "$@" > "$TMPDIR/test.$line_number" 2>&1
local actual_rc=$? local actual_rc=$?
if [ $actual_rc != $expected_rc ]; then if [ $actual_rc != $expected_rc ]; then
echo "Test on line $line_number failed:" \ echo "Test on line $line_number failed:" \
...@@ -74,13 +74,13 @@ ExpectExe() { ...@@ -74,13 +74,13 @@ ExpectExe() {
exit 1; exit 1;
fi fi
if [ -n "$expected_output" ] && if [ -n "$expected_output" ] &&
! fgrep -q -- "$expected_output" "$TMPDIR/test.$line_number"; then ! fgrep -e "$expected_output" "$TMPDIR/test.$line_number" >/dev/null; then
echo "Test on line $line_number failed:" \ echo "Test on line $line_number failed:" \
"did not find expected substring '$expected_output'" "did not find expected substring '$expected_output'"
exit 1; exit 1;
fi fi
if [ -n "$unexpected_output" ] && if [ -n "$unexpected_output" ] &&
fgrep -q -- "$unexpected_output" "$TMPDIR/test.$line_number"; then fgrep -e "$unexpected_output" "$TMPDIR/test.$line_number" >/dev/null; then
echo "Test line $line_number failed:" \ echo "Test line $line_number failed:" \
"found unexpected substring '$unexpected_output'" "found unexpected substring '$unexpected_output'"
exit 1; exit 1;
...@@ -90,17 +90,17 @@ ExpectExe() { ...@@ -90,17 +90,17 @@ ExpectExe() {
# $1: line-number $2: expected return code. $3: substring of expected output. # $1: line-number $2: expected return code. $3: substring of expected output.
# $4: a substring you *don't* expect to find in the output. $5+ flags # $4: a substring you *don't* expect to find in the output. $5+ flags
Expect() { Expect() {
ExpectExe $EXE "$@" ExpectExe "$EXE" "$@"
} }
rm -rf $TMPDIR rm -rf "$TMPDIR"
mkdir $TMPDIR || exit 2 mkdir "$TMPDIR" || exit 2
# Create a few flagfiles we can use later # Create a few flagfiles we can use later
echo "--version" > $TMPDIR/flagfile.1 echo "--version" > "$TMPDIR/flagfile.1"
echo "--foo=bar" > $TMPDIR/flagfile.2 echo "--foo=bar" > "$TMPDIR/flagfile.2"
echo "--nounused_bool" >> $TMPDIR/flagfile.2 echo "--nounused_bool" >> "$TMPDIR/flagfile.2"
echo "--flagfile=$TMPDIR/flagfile.2" > $TMPDIR/flagfile.3 echo "--flagfile=$TMPDIR/flagfile.2" > "$TMPDIR/flagfile.3"
# Set a few environment variables (useful for --tryfromenv) # Set a few environment variables (useful for --tryfromenv)
export FLAGS_undefok=foo,bar export FLAGS_undefok=foo,bar
...@@ -131,13 +131,15 @@ Expect $LINENO 1 "/gflags_reporting.cc" "" -helpfull ...@@ -131,13 +131,15 @@ Expect $LINENO 1 "/gflags_reporting.cc" "" -helpfull
Expect $LINENO 1 "/gflags_unittest.cc" "/gflags_reporting.cc" --helpshort Expect $LINENO 1 "/gflags_unittest.cc" "/gflags_reporting.cc" --helpshort
# --helpshort should work if the main source file is suffixed with [_-]main # --helpshort should work if the main source file is suffixed with [_-]main
ExpectExe $EXE2 $LINENO 1 "/gflags_unittest-main.cc" "/gflags_reporting.cc" \ ExpectExe "$EXE2" $LINENO 1 "/gflags_unittest-main.cc" "/gflags_reporting.cc" \
--helpshort --helpshort
ExpectExe $EXE3 $LINENO 1 "/gflags_unittest_main.cc" "/gflags_reporting.cc" \ ExpectExe "$EXE3" $LINENO 1 "/gflags_unittest_main.cc" "/gflags_reporting.cc" \
--helpshort --helpshort
# --helpon needs an argument # --helpon needs an argument
Expect $LINENO 1 "'--helpon' is missing its argument" "" --helpon Expect $LINENO 1 \
"'--helpon' is missing its argument; flag description: show help on" \
"" --helpon
# --helpon argument indicates what file we'll show args from # --helpon argument indicates what file we'll show args from
Expect $LINENO 1 "/gflags.cc" "/gflags_unittest.cc" --helpon=gflags Expect $LINENO 1 "/gflags.cc" "/gflags_unittest.cc" --helpon=gflags
...@@ -183,9 +185,9 @@ Expect $LINENO 1 "unknown command line flag 'foo'" "" --undefok=foot --foo --unu ...@@ -183,9 +185,9 @@ Expect $LINENO 1 "unknown command line flag 'foo'" "" --undefok=foot --foo --unu
# See if we can successfully load our flags from the flagfile # See if we can successfully load our flags from the flagfile
Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" \ Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" \
--flagfile=$TMPDIR/flagfile.1 --flagfile="$TMPDIR/flagfile.1"
Expect $LINENO 0 "PASS" "" --flagfile=$TMPDIR/flagfile.2 Expect $LINENO 0 "PASS" "" --flagfile="$TMPDIR/flagfile.2"
Expect $LINENO 0 "PASS" "" --flagfile=$TMPDIR/flagfile.3 Expect $LINENO 0 "PASS" "" --flagfile="$TMPDIR/flagfile.3"
# Also try to load flags from the environment # Also try to load flags from the environment
Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" --fromenv=version Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" --fromenv=version
......
// Copyright (c) 2006, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Header files have moved from the google directory to the gflags
// directory. This forwarding file is provided only for backwards
// compatibility. Use gflags/gflags.h in all new code.
#include <gflags/gflags.h>
// 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.
// Header files have moved from the google directory to the gflags
// directory. This forwarding file is provided only for backwards
// compatibility. Use gflags/gflags_completions.h in all new code.
#include <gflags/gflags_completions.h>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment