Better command-line option handling for tests.
authorTeemu Murtola <teemu.murtola@gmail.com>
Sun, 21 Jul 2013 05:34:18 +0000 (08:34 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 30 Jul 2013 04:08:56 +0000 (06:08 +0200)
commit828ad7f352d6a6193074b88fe8bd09b4336de046
tree6c73f20d1565527da8beeb106c63b5c6d1ca82c8
parent6301b697d1f2f63dbea2f9079c16900d80eac58b
Better command-line option handling for tests.

The options are now registered using global initializers (somewhat ugly,
but is the same mechanism as used by GTest for registering the test
cases).  This makes them all available on startup in initTestUtils(),
allowing it to print help text for them.  It also properly allows having
multiple option definitions in the same binary.  This did compile with
the previous approach as well, but didn't always work because of
limitations in the command-line parser.

The command-line parser now accepts, but does not require, a GNU-style
-- prefix for command-line options, and gives an error for unknown
options starting with --.  While at it, also made the parser accept
options that start with digits, and even options consisting of only
digits (the latter requires one to use a double dash).

Add a helper for ignoring return values of
__attribute__((warn_unused_result)) functions (works only for C++), and
remove unused function from ngmx.cpp that had previously had a dummy
variable for this purpose (the dummy variable was removed when
converting to C++).

Change-Id: Id1674510c4feb88ffc1d193274a6357cebef3916
14 files changed:
cmake/legacy_and_external.supp
doxygen/Doxyfile-common.cmakein
src/gromacs/commandline/cmdlineparser.cpp
src/gromacs/commandline/cmdlineparser.h
src/gromacs/commandline/tests/cmdlineparser.cpp
src/gromacs/selection/tests/selectioncollection.cpp
src/gromacs/utility/common.h
src/ngmx/ngmx.cpp
src/testutils/refdata.cpp
src/testutils/refdata.h
src/testutils/stringtest.cpp
src/testutils/stringtest.h
src/testutils/testoptions.cpp
src/testutils/testoptions.h