Commit 690172b4 authored by Craig Silverstein's avatar Craig Silverstein

Thu Apr 19 15:15:07 2007 Google Inc. <opensource@google.com>

	* google-gflags: version 0.4
	* Remove is_default from GetCommandLineFlagInfo (csilvers)
	* Portability fixes: includes, strtoll, gcc4.3 errors (csilvers)
	* A few doc typo cleanups (csilvers)


git-svn-id: https://gflags.googlecode.com/svn/trunk@13 6586e3c6-dcc4-952a-343f-ff74eb82781d
parent 290da389
...@@ -20,3 +20,10 @@ Wed Mar 28 12:15:56 2007 Google Inc. <opensource@google.com> ...@@ -20,3 +20,10 @@ Wed Mar 28 12:15:56 2007 Google Inc. <opensource@google.com>
* Add is_default to CommandLineFlagInfo (pchien) * Add is_default to CommandLineFlagInfo (pchien)
* Make docs a bit prettier (csilvers) * Make docs a bit prettier (csilvers)
* Actually include the python files in the distribution! :-/ (csilvers) * Actually include the python files in the distribution! :-/ (csilvers)
Thu Apr 19 15:15:07 2007 Google Inc. <opensource@google.com>
* google-gflags: version 0.4
* Remove is_default from GetCommandLineFlagInfo (csilvers)
* Portability fixes: includes, strtoll, gcc4.3 errors (csilvers)
* A few doc typo cleanups (csilvers)
...@@ -21,7 +21,7 @@ docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION) ...@@ -21,7 +21,7 @@ docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
## Add your documentation files (in doc/) in addition to these ## Add your documentation files (in doc/) in addition to these
## top-level boilerplate files. Also add a TODO file if you have one. ## top-level boilerplate files. Also add a TODO file if you have one.
dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \ dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \
doc/gflags.html doc/designstyle.css doc/gflags.html
## The libraries (.so's) you want to install ## The libraries (.so's) you want to install
lib_LTLIBRARIES = lib_LTLIBRARIES =
......
...@@ -240,7 +240,7 @@ googleincludedir = $(includedir)/google ...@@ -240,7 +240,7 @@ googleincludedir = $(includedir)/google
googleinclude_HEADERS = src/google/gflags.h googleinclude_HEADERS = src/google/gflags.h
docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION) docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \ dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \
doc/gflags.html doc/designstyle.css doc/gflags.html
lib_LTLIBRARIES = libgflags.la lib_LTLIBRARIES = libgflags.la
TESTS = gflags_unittest TESTS = gflags_unittest
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
timestamp='2006-01-30' timestamp='2005-08-03'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
...@@ -106,7 +106,7 @@ set_cc_for_build=' ...@@ -106,7 +106,7 @@ set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ; : ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
...@@ -206,9 +206,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -206,9 +206,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:ekkoBSD:*:*) *:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;; exit ;;
*:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
exit ;;
macppc:MirBSD:*:*) macppc:MirBSD:*:*)
echo powerppc-unknown-mirbsd${UNAME_RELEASE} echo powerppc-unknown-mirbsd${UNAME_RELEASE}
exit ;; exit ;;
...@@ -767,12 +764,7 @@ EOF ...@@ -767,12 +764,7 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;; exit ;;
*:FreeBSD:*:*) *:FreeBSD:*:*)
case ${UNAME_MACHINE} in echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
pc98)
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;; exit ;;
i*:CYGWIN*:*) i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin echo ${UNAME_MACHINE}-pc-cygwin
...@@ -787,7 +779,7 @@ EOF ...@@ -787,7 +779,7 @@ EOF
i*:PW*:*) i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32 echo ${UNAME_MACHINE}-pc-pw32
exit ;; exit ;;
x86:Interix*:[345]*) x86:Interix*:[34]*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
exit ;; exit ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
...@@ -859,11 +851,7 @@ EOF ...@@ -859,11 +851,7 @@ EOF
#endif #endif
#endif #endif
EOF EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;; ;;
mips64:Linux:*:*) mips64:Linux:*:*)
...@@ -882,11 +870,7 @@ EOF ...@@ -882,11 +870,7 @@ EOF
#endif #endif
#endif #endif
EOF EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;; ;;
or32:Linux:*:*) or32:Linux:*:*)
...@@ -935,9 +919,6 @@ EOF ...@@ -935,9 +919,6 @@ EOF
sparc:Linux:*:* | sparc64:Linux:*:*) sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*) x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu echo x86_64-unknown-linux-gnu
exit ;; exit ;;
...@@ -983,7 +964,7 @@ EOF ...@@ -983,7 +964,7 @@ EOF
LIBC=gnulibc1 LIBC=gnulibc1
# endif # endif
#else #else
#if defined(__INTEL_COMPILER) || defined(__PGI) #ifdef __INTEL_COMPILER
LIBC=gnu LIBC=gnu
#else #else
LIBC=gnuaout LIBC=gnuaout
...@@ -993,11 +974,7 @@ EOF ...@@ -993,11 +974,7 @@ EOF
LIBC=dietlibc LIBC=dietlibc
#endif #endif
EOF EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
/^LIBC/{
s: ::g
p
}'`"
test x"${LIBC}" != x && { test x"${LIBC}" != x && {
echo "${UNAME_MACHINE}-pc-linux-${LIBC}" echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit exit
...@@ -1208,6 +1185,7 @@ EOF ...@@ -1208,6 +1185,7 @@ EOF
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in case $UNAME_PROCESSOR in
*86) UNAME_PROCESSOR=i686 ;;
unknown) UNAME_PROCESSOR=powerpc ;; unknown) UNAME_PROCESSOR=powerpc ;;
esac esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
...@@ -1286,9 +1264,6 @@ EOF ...@@ -1286,9 +1264,6 @@ EOF
i*86:skyos:*:*) i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
exit ;; exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
esac esac
#echo '(No uname command or uname output not recognized.)' 1>&2 #echo '(No uname command or uname output not recognized.)' 1>&2
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
timestamp='2006-01-02' timestamp='2005-07-08'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
...@@ -119,9 +119,8 @@ esac ...@@ -119,9 +119,8 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations. # Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;; ;;
...@@ -172,10 +171,6 @@ case $os in ...@@ -172,10 +171,6 @@ case $os in
-hiux*) -hiux*)
os=-hiuxwe2 os=-hiuxwe2
;; ;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5) -sco5)
os=-sco3.2v5 os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
...@@ -192,10 +187,6 @@ case $os in ...@@ -192,10 +187,6 @@ case $os in
# Don't forget version if it is 3.2v4 or newer. # Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;; ;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*) -sco*)
os=-sco3.2v2 os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
...@@ -248,7 +239,7 @@ case $basic_machine in ...@@ -248,7 +239,7 @@ case $basic_machine in
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \ | mips16 \
| mips64 | mips64el \ | mips64 | mips64el \
...@@ -266,7 +257,7 @@ case $basic_machine in ...@@ -266,7 +257,7 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \ | mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \ | mipstx39 | mipstx39el \
| mn10200 | mn10300 \ | mn10200 | mn10300 \
| mt \ | ms1 \
| msp430 \ | msp430 \
| ns16k | ns32k \ | ns16k | ns32k \
| or32 \ | or32 \
...@@ -295,9 +286,6 @@ case $basic_machine in ...@@ -295,9 +286,6 @@ case $basic_machine in
;; ;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;; ;;
ms1)
basic_machine=mt-unknown
;;
# We use `pc' rather than `unknown' # We use `pc' rather than `unknown'
# because (1) that's what they normally are, and # because (1) that's what they normally are, and
...@@ -348,7 +336,7 @@ case $basic_machine in ...@@ -348,7 +336,7 @@ case $basic_machine in
| mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \ | mipstx39-* | mipstx39el-* \
| mmix-* \ | mmix-* \
| mt-* \ | ms1-* \
| msp430-* \ | msp430-* \
| none-* | np1-* | ns16k-* | ns32k-* \ | none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \ | orion-* \
...@@ -708,9 +696,6 @@ case $basic_machine in ...@@ -708,9 +696,6 @@ case $basic_machine in
basic_machine=i386-pc basic_machine=i386-pc
os=-msdos os=-msdos
;; ;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
mvs) mvs)
basic_machine=i370-ibm basic_machine=i370-ibm
os=-mvs os=-mvs
...@@ -818,12 +803,6 @@ case $basic_machine in ...@@ -818,12 +803,6 @@ case $basic_machine in
pc532 | pc532-*) pc532 | pc532-*)
basic_machine=ns32k-pc532 basic_machine=ns32k-pc532
;; ;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3) pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc basic_machine=i586-pc
;; ;;
...@@ -880,10 +859,6 @@ case $basic_machine in ...@@ -880,10 +859,6 @@ case $basic_machine in
basic_machine=i586-unknown basic_machine=i586-unknown
os=-pw32 os=-pw32
;; ;;
rdos)
basic_machine=i386-pc
os=-rdos
;;
rom68k) rom68k)
basic_machine=m68k-rom68k basic_machine=m68k-rom68k
os=-coff os=-coff
...@@ -1199,23 +1174,21 @@ case $os in ...@@ -1199,23 +1174,21 @@ case $os in
| -aos* \ | -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
| -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \ | -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos*) | -skyos* | -haiku*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
......
This diff is collapsed.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,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.3, opensource@google.com) AC_INIT(gflags, 0.4, 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)
...@@ -40,6 +40,9 @@ AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0) ...@@ -40,6 +40,9 @@ 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(__uint16, ac_cv_have___uint16=1, ac_cv_have___uint16=0)
AC_CHECK_FUNCS(strtoll)
AC_CHECK_FUNCS(strtoq)
AX_C___ATTRIBUTE__ AX_C___ATTRIBUTE__
ACX_PTHREAD ACX_PTHREAD
......
...@@ -159,7 +159,7 @@ use a flag that's defined in another file. For instance, if I were ...@@ -159,7 +159,7 @@ use a flag that's defined in another file. For instance, if I were
writing <code>bar.cc</code> but wanted to access the big_menu, flag, I writing <code>bar.cc</code> but wanted to access the big_menu, flag, I
would put this near the top of <code>bar.cc</code>:</p> would put this near the top of <code>bar.cc</code>:</p>
<pre> <pre>
DEFINE_bool(big_menu); DECLARE_bool(big_menu);
</pre> </pre>
<p>This is functionally equivalent to saying <code>extern <p>This is functionally equivalent to saying <code>extern
...@@ -280,7 +280,7 @@ processing. So in <code>foo -f1 1 -- -f2 2</code>, <code>f1</code> is ...@@ -280,7 +280,7 @@ processing. So in <code>foo -f1 1 -- -f2 2</code>, <code>f1</code> is
considered a flag, but <code>-f2</code> is not.</p> considered a flag, but <code>-f2</code> is not.</p>
<p>Note that flags do not have single-letter synonyms, like they do in <p>Note that flags do not have single-letter synonyms, like they do in
the getopt library, nor do we allowing "combining" flags behind a the getopt library, nor do we allow "combining" flags behind a
single dash, as in <code>ls -la</code>.</p> single dash, as in <code>ls -la</code>.</p>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
google-gflags (0.4-1) unstable; urgency=low
* google-gflags: version 0.4
* Remove is_default from GetCommandLineFlagInfo (csilvers)
* Portability fixes: includes, strtoll, gcc4.3 errors (csilvers)
* A few doc typo cleanups (csilvers)
-- Google Inc. <opensource@google.com> Thu, 19 Apr 2007 15:18:43 -0700
google-gflags (0.3-1) unstable; urgency=low
* google-gflags: version 0.2
* added support for python commandlineflags, as well as c++
* gflags2man, a script to turn flags into a man page (dchristian)
-- Google Inc. <opensource@google.com> Mon, 22 Jan 2007 15:33:06 -0800
google-gflags (0.2-1) unstable; urgency=low
* google-gflags: version 0.3
* python portability fix: use popen instead of subprocess (csilvers)
* Add is_default to CommandLineFlagInfo (pchien)
* Make docs a bit prettier (csilvers)
* Actually include the python files in the distribution! :-/ (csilvers)
-- Google Inc. <opensource@google.com> Wed, 28 Mar 2007 12:15:56 -0700
google-gflags (0.1-1) unstable; urgency=low google-gflags (0.1-1) unstable; urgency=low
* Initial release. * Initial release.
......
...@@ -9,17 +9,17 @@ Section: libdevel ...@@ -9,17 +9,17 @@ Section: libdevel
Architecture: any Architecture: any
Depends: libgoogle-gflags0 (= ${Source-Version}) Depends: libgoogle-gflags0 (= ${Source-Version})
Description: a library that implements commandline flags Description: a library that implements commandline flags
processing. As such it's a replacement for getopt(). It has increased processing. As such it's a replacement for getopt(). It has increased
flexibility, including built-in support for C++ types like string, and flexibility, including built-in support for C++ types like string, and
the ability to define flags in the source file in which they're used. the ability to define flags in the source file in which they're used.
The devel package contains static and debug libraries and header files The devel package contains static and debug libraries and header files
for developing applications that use the google-gflags package. for developing applications that use the google-gflags package.
Package: libgoogle-gflags0 Package: libgoogle-gflags0
Section: libs Section: libs
Architecture: any Architecture: any
Depends: ${shlibs:Depends} Depends: ${shlibs:Depends}
Description: a library that implements commandline flags Description: a library that implements commandline flags
processing. As such it's a replacement for getopt(). It has increased processing. As such it's a replacement for getopt(). It has increased
flexibility, including built-in support for C++ types like string, and flexibility, including built-in support for C++ types like string, and
the ability to define flags in the source file in which they're used. the ability to define flags in the source file in which they're used.
\ No newline at end of file \ No newline at end of file
...@@ -4,4 +4,5 @@ ChangeLog ...@@ -4,4 +4,5 @@ ChangeLog
INSTALL INSTALL
NEWS NEWS
README README
doc/designstyle.css
doc/gflags.html doc/gflags.html
...@@ -52,7 +52,7 @@ rm -rf $RPM_BUILD_ROOT ...@@ -52,7 +52,7 @@ rm -rf $RPM_BUILD_ROOT
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README doc/gflags.html %doc AUTHORS COPYING ChangeLog INSTALL NEWS README doc/designstyle.css doc/gflags.html
%{prefix}/lib/libgflags.so.0 %{prefix}/lib/libgflags.so.0
%{prefix}/lib/libgflags.so.0.0.0 %{prefix}/lib/libgflags.so.0.0.0
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
from distutils.core import setup from distutils.core import setup
setup(name='gflags', setup(name='gflags',
version='0.3', version='0.4',
description='Google Commandline Flags Module', description='Google Commandline Flags Module',
license='BSD', license='BSD',
author='Google Inc.', author='Google Inc.',
......
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
/* Define to 1 if you have the <string.h> header file. */ /* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H #undef HAVE_STRING_H
/* Define to 1 if you have the `strtoll' function. */
#undef HAVE_STRTOLL
/* Define to 1 if you have the `strtoq' function. */
#undef HAVE_STRTOQ
/* Define to 1 if you have the <sys/stat.h> header file. */ /* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H #undef HAVE_SYS_STAT_H
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
// stuff. // stuff.
#include "config.h" #include "config.h"
#include <stdio.h> // for snprintf
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
...@@ -53,6 +54,19 @@ ...@@ -53,6 +54,19 @@
#define PATH_SEPARATOR '/' #define PATH_SEPARATOR '/'
#endif #endif
// Work properly if either strtoll or strtoq is on this system
#ifdef HAVE_STRTOLL
# define strtoint64 strtoll
# define strtouint64 strtoull
#elif HAVE_STRTOQ
# define strtoint64 strtoq
# define strtouint64 strtouq
#else
// Neither strtoll nor strtoq are defined. I hope strtol works!
# define strtoint64 strtol
# define strtouint64 strtoul
#endif
using std::string; using std::string;
using std::map; using std::map;
using std::vector; using std::vector;
...@@ -138,7 +152,7 @@ FlagValue::FlagValue(void* valbuf, const char* type) : value_buffer_(valbuf) { ...@@ -138,7 +152,7 @@ FlagValue::FlagValue(void* valbuf, const char* type) : value_buffer_(valbuf) {
else if (strcmp(type, "uint64") == 0) type_ = FV_UINT64; else if (strcmp(type, "uint64") == 0) type_ = FV_UINT64;
else if (strcmp(type, "double") == 0) type_ = FV_DOUBLE; else if (strcmp(type, "double") == 0) type_ = FV_DOUBLE;
else if (strcmp(type, "string") == 0) type_ = FV_STRING; else if (strcmp(type, "string") == 0) type_ = FV_STRING;
else assert("" == "Unknown typename"); else assert(false); // Unknown typename
} }
FlagValue::~FlagValue() { FlagValue::~FlagValue() {
...@@ -185,7 +199,7 @@ bool FlagValue::ParseFrom(const char* value) { ...@@ -185,7 +199,7 @@ bool FlagValue::ParseFrom(const char* value) {
switch (type_) { switch (type_) {
case FV_INT32: { case FV_INT32: {
const int64 r = strtoq(value, &end, base); const int64 r = strtoint64(value, &end, base);
if (errno || end != value + strlen(value)) return false; // bad parse if (errno || end != value + strlen(value)) return false; // bad parse
if (static_cast<int32>(r) != r) // worked, but number out of range if (static_cast<int32>(r) != r) // worked, but number out of range
return false; return false;
...@@ -193,7 +207,7 @@ bool FlagValue::ParseFrom(const char* value) { ...@@ -193,7 +207,7 @@ bool FlagValue::ParseFrom(const char* value) {
return true; return true;
} }
case FV_INT64: { case FV_INT64: {
const int64 r = strtoq(value, &end, base); const int64 r = strtoint64(value, &end, base);
if (errno || end != value + strlen(value)) return false; // bad parse if (errno || end != value + strlen(value)) return false; // bad parse
SET_VALUE_AS(int64, r); SET_VALUE_AS(int64, r);
return true; return true;
...@@ -201,7 +215,7 @@ bool FlagValue::ParseFrom(const char* value) { ...@@ -201,7 +215,7 @@ bool FlagValue::ParseFrom(const char* value) {
case FV_UINT64: { case FV_UINT64: {
while (*value == ' ') value++; while (*value == ' ') value++;
if (*value == '-') return false; // negative number if (*value == '-') return false; // negative number
const uint64 r = strtouq(value, &end, base); const uint64 r = strtouint64(value, &end, base);
if (errno || end != value + strlen(value)) return false; // bad parse if (errno || end != value + strlen(value)) return false; // bad parse
SET_VALUE_AS(uint64, r); SET_VALUE_AS(uint64, r);
return true; return true;
...@@ -213,7 +227,7 @@ bool FlagValue::ParseFrom(const char* value) { ...@@ -213,7 +227,7 @@ bool FlagValue::ParseFrom(const char* value) {
return true; return true;
} }
default: { default: {
assert("" == "unknown type"); assert(false); // unknown type
return false; return false;
} }
} }
...@@ -239,7 +253,7 @@ string FlagValue::ToString() const { ...@@ -239,7 +253,7 @@ string FlagValue::ToString() const {
case FV_STRING: case FV_STRING:
return VALUE_AS(string); return VALUE_AS(string);
default: default:
assert("" == "unknown type"); return ""; assert(false); return ""; // unknown type
} }
} }
...@@ -251,7 +265,7 @@ const char* FlagValue::TypeName() const { ...@@ -251,7 +265,7 @@ const char* FlagValue::TypeName() const {
case FV_UINT64: return "uint64"; case FV_UINT64: return "uint64";
case FV_DOUBLE: return "double"; case FV_DOUBLE: return "double";
case FV_STRING: return "string"; case FV_STRING: return "string";
default: assert("" == "unknown type"); return ""; default: assert(false); return ""; // unknown type
} }
} }
...@@ -265,7 +279,7 @@ bool FlagValue::Equal(const FlagValue& x) const { ...@@ -265,7 +279,7 @@ bool FlagValue::Equal(const FlagValue& x) const {
case FV_UINT64: return VALUE_AS(uint64) == OTHER_VALUE_AS(x, uint64); case FV_UINT64: return VALUE_AS(uint64) == OTHER_VALUE_AS(x, uint64);
case FV_DOUBLE: return VALUE_AS(double) == OTHER_VALUE_AS(x, double); case FV_DOUBLE: return VALUE_AS(double) == OTHER_VALUE_AS(x, double);
case FV_STRING: return VALUE_AS(string) == OTHER_VALUE_AS(x, string); case FV_STRING: return VALUE_AS(string) == OTHER_VALUE_AS(x, string);
default: assert("" == "unknown type"); return false; default: assert(false); return false; // unknown type
} }
} }
...@@ -277,7 +291,7 @@ FlagValue* FlagValue::New() const { ...@@ -277,7 +291,7 @@ FlagValue* FlagValue::New() const {
case FV_UINT64: return new FlagValue(new uint64, "uint64"); case FV_UINT64: return new FlagValue(new uint64, "uint64");
case FV_DOUBLE: return new FlagValue(new double, "double"); case FV_DOUBLE: return new FlagValue(new double, "double");
case FV_STRING: return new FlagValue(new string, "string"); case FV_STRING: return new FlagValue(new string, "string");
default: assert("" == "unknown type"); return NULL; default: assert(false); return NULL; // assert false
} }
} }
...@@ -290,7 +304,7 @@ void FlagValue::CopyFrom(const FlagValue& x) { ...@@ -290,7 +304,7 @@ void FlagValue::CopyFrom(const FlagValue& x) {
case FV_UINT64: SET_VALUE_AS(uint64, OTHER_VALUE_AS(x, uint64)); break; case FV_UINT64: SET_VALUE_AS(uint64, OTHER_VALUE_AS(x, uint64)); break;
case FV_DOUBLE: SET_VALUE_AS(double, OTHER_VALUE_AS(x, double)); break; case FV_DOUBLE: SET_VALUE_AS(double, OTHER_VALUE_AS(x, double)); break;
case FV_STRING: SET_VALUE_AS(string, OTHER_VALUE_AS(x, string)); break; case FV_STRING: SET_VALUE_AS(string, OTHER_VALUE_AS(x, string)); break;
default: assert("" == "unknown type"); default: assert(false); // unknown type
} }
} }
...@@ -611,7 +625,8 @@ bool FlagRegistry::SetFlagLocked(CommandLineFlag* flag, ...@@ -611,7 +625,8 @@ bool FlagRegistry::SetFlagLocked(CommandLineFlag* flag,
break; break;
} }
default: { default: {
assert("" == "unknown set_mode"); return false; // unknown set_mode
assert(false); return false;
} }
} }
...@@ -1155,13 +1170,11 @@ string CommandLineFlagParser::ProcessOptionsFromStringLocked( ...@@ -1155,13 +1170,11 @@ string CommandLineFlagParser::ProcessOptionsFromStringLocked(
// All of these work on the default, global registry. // All of these work on the default, global registry.
// For GetCommandLineOption, return false if no such flag // For GetCommandLineOption, return false if no such flag
// is known, true otherwise. We clear "value" if a suitable // is known, true otherwise. We clear "value" if a suitable
// flag is found. If is_default_value is non-NULL, we set it to // flag is found.
// contain whether the value is a default or was explicitly set.
// -------------------------------------------------------------------- // --------------------------------------------------------------------
bool GetCommandLineOption(const char* name, string* value, bool GetCommandLineOption(const char* name, string* value) {
bool *is_default_value) {
if (NULL == name) if (NULL == name)
return false; return false;
assert(value); assert(value);
...@@ -1174,10 +1187,6 @@ bool GetCommandLineOption(const char* name, string* value, ...@@ -1174,10 +1187,6 @@ bool GetCommandLineOption(const char* name, string* value,
return false; return false;
} else { } else {
*value = flag->current_value(); *value = flag->current_value();
if (is_default_value) {
flag->UpdateModifiedBit();
*is_default_value = !flag->modified_;
}
registry->Unlock(); registry->Unlock();
return true; return true;
} }
......
...@@ -763,36 +763,29 @@ TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to InitGoogle in main() ...@@ -763,36 +763,29 @@ TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to InitGoogle in main()
TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) { TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) {
string value("will be changed"); string value("will be changed");
bool is_default; bool r = GetCommandLineOption("test_bool", &value);
bool r = GetCommandLineOption("test_bool", &value, &is_default);
EXPECT_EQ(true, r); EXPECT_EQ(true, r);
EXPECT_EQ("false", value); EXPECT_EQ("false", value);
EXPECT_EQ(true, is_default);
r = GetCommandLineOption("test_int32", &value, &is_default); r = GetCommandLineOption("test_int32", &value);
EXPECT_EQ(true, r); EXPECT_EQ(true, r);
EXPECT_EQ("-1", value); EXPECT_EQ("-1", value);
EXPECT_EQ(true, is_default);
} }
TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) { TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) {
FLAGS_test_int32 = 400; FLAGS_test_int32 = 400;
string value("will be changed"); string value("will be changed");
bool is_default; const bool r = GetCommandLineOption("test_int32", &value);
const bool r = GetCommandLineOption("test_int32", &value, &is_default);
EXPECT_EQ(true, r); EXPECT_EQ(true, r);
EXPECT_EQ("400", value); EXPECT_EQ("400", value);
EXPECT_EQ(false, is_default);
} }
TEST(GetCommandLineOptionTest, NameExistsAndWasSet) { TEST(GetCommandLineOptionTest, NameExistsAndWasSet) {
SetCommandLineOption("test_int32", "700"); SetCommandLineOption("test_int32", "700");
string value("will be changed"); string value("will be changed");
bool is_default; const bool r = GetCommandLineOption("test_int32", &value);
const bool r = GetCommandLineOption("test_int32", &value, &is_default);
EXPECT_EQ(true, r); EXPECT_EQ(true, r);
EXPECT_EQ("700", value); EXPECT_EQ("700", value);
EXPECT_EQ(false, is_default);
} }
TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) { TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) {
...@@ -800,42 +793,26 @@ TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) { ...@@ -800,42 +793,26 @@ TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) {
// is_default is still true, but the 'default' value returned has changed! // is_default is still true, but the 'default' value returned has changed!
SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT); SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT);
string value("will be changed"); string value("will be changed");
bool is_default; const bool r = GetCommandLineOption("test_int32", &value);
const bool r = GetCommandLineOption("test_int32", &value, &is_default);
EXPECT_EQ(true, r); EXPECT_EQ(true, r);
EXPECT_EQ("800", value); EXPECT_EQ("800", value);
EXPECT_EQ(true, is_default); EXPECT_EQ(true, GetCommandLineFlagInfoOrDie("test_int32").is_default);
} }
TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) { TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) {
SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT); SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT);
string value("will be changed"); string value("will be changed");
bool is_default; const bool r = GetCommandLineOption("test_int32", &value);
const bool r = GetCommandLineOption("test_int32", &value, &is_default);
EXPECT_EQ(true, r); EXPECT_EQ(true, r);
EXPECT_EQ("900", value); EXPECT_EQ("900", value);
EXPECT_EQ(false, is_default);
} }
TEST(GetCommandLineOptionTest, NameDoesNotExist) { TEST(GetCommandLineOptionTest, NameDoesNotExist) {
string value("will not be changed"); string value("will not be changed");
bool is_default = false; const bool r = GetCommandLineOption("test_int3210", &value);
const bool r = GetCommandLineOption("test_int3210", &value, &is_default);
EXPECT_EQ(false, r); EXPECT_EQ(false, r);
EXPECT_EQ("will not be changed", value); EXPECT_EQ("will not be changed", value);
EXPECT_EQ(false, is_default);
}
TEST(GetCommandLineOptionTest, NoLastArg) {
// Mostly, makes sure passing in NULL as last arg doesn't cause a crash
string value("will not be changed, at first");
bool r = GetCommandLineOption("test_int3210", &value, NULL);
EXPECT_EQ(false, r);
EXPECT_EQ("will not be changed, at first", value);
r = GetCommandLineOption("test_int32", &value, NULL);
EXPECT_EQ(true, r);
EXPECT_EQ("-1", value);
} }
TEST(GetCommandLineFlagInfoTest, FlagExists) { TEST(GetCommandLineFlagInfoTest, FlagExists) {
...@@ -845,19 +822,49 @@ TEST(GetCommandLineFlagInfoTest, FlagExists) { ...@@ -845,19 +822,49 @@ TEST(GetCommandLineFlagInfoTest, FlagExists) {
EXPECT_EQ("test_int32", info.name); EXPECT_EQ("test_int32", info.name);
EXPECT_EQ("int32", info.type); EXPECT_EQ("int32", info.type);
EXPECT_EQ("", info.description); EXPECT_EQ("", info.description);
EXPECT_EQ("-1", info.current_value);
EXPECT_EQ("-1", info.default_value); EXPECT_EQ("-1", info.default_value);
EXPECT_EQ(true, info.is_default);
FLAGS_test_bool = true;
r = GetCommandLineFlagInfo("test_bool", &info); r = GetCommandLineFlagInfo("test_bool", &info);
EXPECT_EQ(true, r); EXPECT_EQ(true, r);
EXPECT_EQ("test_bool", info.name); EXPECT_EQ("test_bool", info.name);
EXPECT_EQ("bool", info.type); EXPECT_EQ("bool", info.type);
EXPECT_EQ("tests bool-ness", info.description); EXPECT_EQ("tests bool-ness", info.description);
EXPECT_EQ("true", info.current_value);
EXPECT_EQ("false", info.default_value); EXPECT_EQ("false", info.default_value);
EXPECT_EQ(false, info.is_default);
FLAGS_test_bool = false;
r = GetCommandLineFlagInfo("test_bool", &info);
EXPECT_EQ(true, r);
EXPECT_EQ("test_bool", info.name);
EXPECT_EQ("bool", info.type);
EXPECT_EQ("tests bool-ness", info.description);
EXPECT_EQ("false", info.current_value);
EXPECT_EQ("false", info.default_value);
EXPECT_EQ(false, info.is_default); // value is same, but flag *was* modified
} }
TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) { TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) {
CommandLineFlagInfo info; CommandLineFlagInfo info;
// Set to some random values that GetCommandLineFlagInfo should not change
info.name = "name";
info.type = "type";
info.current_value = "curr";
info.default_value = "def";
info.filename = "/";
info.is_default = false;
bool r = GetCommandLineFlagInfo("test_int3210", &info); bool r = GetCommandLineFlagInfo("test_int3210", &info);
EXPECT_EQ(false, r); EXPECT_EQ(false, r);
EXPECT_EQ("name", info.name);
EXPECT_EQ("type", info.type);
EXPECT_EQ("", info.description);
EXPECT_EQ("curr", info.current_value);
EXPECT_EQ("def", info.default_value);
EXPECT_EQ("/", info.filename);
EXPECT_EQ(false, info.is_default);
} }
TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) { TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) {
...@@ -866,12 +873,14 @@ TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) { ...@@ -866,12 +873,14 @@ TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) {
EXPECT_EQ("test_int32", info.name); EXPECT_EQ("test_int32", info.name);
EXPECT_EQ("int32", info.type); EXPECT_EQ("int32", info.type);
EXPECT_EQ("", info.description); EXPECT_EQ("", info.description);
EXPECT_EQ("-1", info.current_value);
EXPECT_EQ("-1", info.default_value); EXPECT_EQ("-1", info.default_value);
EXPECT_EQ(true, info.is_default); EXPECT_EQ(true, info.is_default);
info = GetCommandLineFlagInfoOrDie("test_bool"); info = GetCommandLineFlagInfoOrDie("test_bool");
EXPECT_EQ("test_bool", info.name); EXPECT_EQ("test_bool", info.name);
EXPECT_EQ("bool", info.type); EXPECT_EQ("bool", info.type);
EXPECT_EQ("tests bool-ness", info.description); EXPECT_EQ("tests bool-ness", info.description);
EXPECT_EQ("false", info.current_value);
EXPECT_EQ("false", info.default_value); EXPECT_EQ("false", info.default_value);
EXPECT_EQ(true, info.is_default); EXPECT_EQ(true, info.is_default);
} }
...@@ -883,6 +892,7 @@ TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) { ...@@ -883,6 +892,7 @@ TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) {
EXPECT_EQ("test_int32", info.name); EXPECT_EQ("test_int32", info.name);
EXPECT_EQ("int32", info.type); EXPECT_EQ("int32", info.type);
EXPECT_EQ("", info.description); EXPECT_EQ("", info.description);
EXPECT_EQ("400", info.current_value);
EXPECT_EQ("-1", info.default_value); EXPECT_EQ("-1", info.default_value);
EXPECT_EQ(false, info.is_default); EXPECT_EQ(false, info.is_default);
FLAGS_test_bool = true; FLAGS_test_bool = true;
...@@ -890,6 +900,7 @@ TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) { ...@@ -890,6 +900,7 @@ TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) {
EXPECT_EQ("test_bool", info.name); EXPECT_EQ("test_bool", info.name);
EXPECT_EQ("bool", info.type); EXPECT_EQ("bool", info.type);
EXPECT_EQ("tests bool-ness", info.description); EXPECT_EQ("tests bool-ness", info.description);
EXPECT_EQ("true", info.current_value);
EXPECT_EQ("false", info.default_value); EXPECT_EQ("false", info.default_value);
EXPECT_EQ(false, info.is_default); EXPECT_EQ(false, info.is_default);
} }
......
...@@ -136,22 +136,18 @@ extern const char* ProgramUsage(); // string set by SetUsageMessage() ...@@ -136,22 +136,18 @@ extern const char* ProgramUsage(); // string set by SetUsageMessage()
// commonly, via the DEFINE_foo macro). But if you need a bit more // commonly, via the DEFINE_foo macro). But if you need a bit more
// control, we have programmatic ways to get/set the flags as well. // control, we have programmatic ways to get/set the flags as well.
// Return true iff the flagname was found. If is_default_value is not // Return true iff the flagname was found.
// NULL, set to true iff the flag's value had never been set explicitly.
// OUTPUT is set to the flag's value, or unchanged if we return false. // OUTPUT is set to the flag's value, or unchanged if we return false.
extern bool GetCommandLineOption(const char* name, std::string* OUTPUT, extern bool GetCommandLineOption(const char* name, std::string* OUTPUT);
bool *is_default_value = NULL);
// Return true iff the flagname was found. OUTPUT is set to the flag's // Return true iff the flagname was found. OUTPUT is set to the flag's
// CommandLineFlagInfo or unchanged if we return false. // CommandLineFlagInfo or unchanged if we return false.
extern bool GetCommandLineFlagInfo(const char* name, extern bool GetCommandLineFlagInfo(const char* name,
CommandLineFlagInfo* OUTPUT); CommandLineFlagInfo* OUTPUT);
// Return the CommandLineFlagInfo of the flagname. // Return the CommandLineFlagInfo of the flagname. exit() if name not found.
// assertion failure if the flagname was not found. // Example usage, to check if a flag's value is currently the default value:
// // if (GetCommandLineFlagInfoOrDie("foo").is_default) ...
// Example to check if a flag has default value:
// if (GetCommandLineFlagInfoOrDie("foo").is_default)
extern CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name); extern CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name);
enum FlagSettingMode { enum FlagSettingMode {
......
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