Skip to content

Commit

Permalink
ENH: Updates to tclap branch 1.4
Browse files Browse the repository at this point in the history
This is from
  https://git.code.sf.net/p/tclap/code
  commit 81b3d2a0c47895c22e9bb8c577f5ab521f76e5d2
  branch 1.4 of tclap

Make virtual functions calls from constructor explicit.

Calling virtual functions from the ctor is safe in C++, but can be
confusing. This fixes clang-tidy warnings.

Fixes clan-tidy warnings (https://sourceforge.net/p/tclap/patches/18/).

Allow const Constraints in constructors

Constraints are only used in const-safe ways, so allow a caller
to pass a const Constraint.

It also allows static construction of constant constraints.

Add missing call to check visitor in Unlabeled args.

Fixed an error in packaging preventing proper discovery using CMake `find_package`

Added packaging using CPack and discovery using pkg-config.

Allowed to disable building of examples and unittests. And docs (BUILD_DOC used to have no effect, it is not the case since now.)

Remove confusing statement about not supplying flag argument.

This is more hurtful than helpful, flag doesn't have to be specified
(our docs even have this example), but flag or name does.

Fix compilation issue with C++20 and gcc-11.1

Fix some (harmless) warnings from Visual Studio.

VS issues warnings for `conversion from 'size_t' to 'int', possible
loss of data`. Of course since these are all short strings, it's not
an issue - but better to get rid of the warnings so we don't miss
anything else.

Remove instructions to use cmake --install . --prefix=..., it appears flaky.

It doesn't appear to work with my custom doc install targets, they
still revert to using the default value of CMAKE_INSTALL_PREFIX
(probably because the variable is expanded during configuration, not
install phase - but that's a guess).

Added docs to install targets.

There appears to be no standard way to install docs with CMake, so
I've setup paths for win and *NIX to the best of my ability.

Include generated docs in release tarball.

Also, make sure that release script doesn't have to be run from the
top level tclap directory.

Explicitly initiailze member variables in init-list.

clang-format on unittest files. No functional change.

Fixed typos.

Fix compilation issue on Windows.

Use ptrdiff_t (C++ type) instead of ssize_t (UNIX type).

Fix a bug where help output would crash if the program name was 3 chars.

https://sourceforge.net/p/tclap/patches/17/

Also added some very basic support for unit tests. We can look at pulling in some more robust unit testing framework later on, but for now keeping it simple to avoid bloat.

In addition, consider only platform specific path separators.

Script to copy files for release.

Make a note that CMake < 3.15 needs plaform specific installer.

Clarify that --prefix flag goes on the --install command.

--In preparation for release of v1.4.
  Upload docs for 1.4 to both 1.4 and root.
  Run clang-format on all files in prep. for 1.4 release.
  Clean the news file for 1.4 release.
  Note current maintainer in authors file.
  Update ChangeLog for 1.4 release.
  Cleaup manual.xml for 1.4 release candidate.

Update Google copyright stansa.

Fix compilation error on MacOS

operator>> has to be declared before inclusion of Arg.h (CmdLine.h).

Update copyright notices and version info.

Correct/clarify years and reorder in reverse chronological order in
the manual. Added note that this manual is for v1.4 since we'll soon
have two versions "live".

HTML manual is now built by cmake, no need to maintain it manually.

Make a note of it, and remove the checked in generated file.

Add example for how to use a pair as a custom type.

https://sourceforge.net/p/tclap/support-requests/2/

Update generated documentation for 1.4.

Echo commands from upload script.

To avoid myself getting confused when the right $USER is not set.

Add documentation for ExitException.

Looks like it may be useful for some users to catch this instead of
having TCLAP terminate the program. Also clarify that ArgException
doesn't catch *any* exception.

https://sourceforge.net/p/tclap/bugs/29/

Add missing expected test output from [96fd5ea].

Add some generated file types to gitignore (and sort it).

Check arguments vector is not empty before accessing first element.

Some users use TCLAP to parse messages sent between long-running
programs by puting arguments in a std::vector<std::string> and use
CmdLine::parse to parse it. Passing an empty vector to parse results
in a segmentation violation (due to the fact that we always expect to
be able to pop the first element). Change the behaviour to throw a
more user friendly error message.

https://sourceforge.net/p/tclap/bugs/30/

Revert dd2c7b6faa13ad74bce2bfe26e5483e62186ed6c that was pushed upstream by mistake.

Don't catch exceptions by value.

Exceptions are polymorphic, catching by value may loose information.

fix sign-conversion warnings

ENH: Adding travis build enviornment for CI testing

CI integration for many common platforms.
- Unix based platforms included
- Many common unix compilers included

Allow travis building of all branches

ENH: Adding my.cdash.org reporting site for testing.

To generate a report of the build & testing environment.

```
mkdir -p tclap-code-build
cd tclap-code-build
cmake ../tclap-code
make Experimental # or ninja Experimental or ...
```

Then open https://my.cdash.org/index.php?project=tclap to see the resulting report.

ENH: Explicitly add LANGUAGES CXX for project.

STYLE: Convert CMake-language commands to lower case

Ancient CMake versions required upper-case commands.  Later command names
became case-insensitive.  Now the preferred style is lower-case.

STYLE: Remove CMake-language block-end command arguments

Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the block.
This is no longer the preferred style.

ENH: enable_testing at top level

You need to move the enable_testing() call to be before you do add_subdirectory(tests).

https://stackoverflow.com/questions/30250494/ctest-not-detecting-tests

Clean up handling of locally allocated objects.

1) Just keep a default StdOutput around so we don't have to track if
it was set by user.

2) Generalize handling of deleting allocated objects when CmdLine is
destroyed.

Updated TODOs

Cleanup some simple setters.

Inline into the class if they are only one line and make them const
whenever possible.
  • Loading branch information
hjmjohnson committed Jan 27, 2025
1 parent 087c020 commit 1ae9316
Show file tree
Hide file tree
Showing 308 changed files with 4,637 additions and 18,285 deletions.
65 changes: 65 additions & 0 deletions tclap/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
BinPackArguments: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: None
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
Standard: Auto
IndentWidth: 4
TabWidth: 4
UseTab: Never
BreakBeforeBraces: Attach
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
DisableFormat: false
...

22 changes: 14 additions & 8 deletions tclap/.gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
*.gcno
*#
*.gcda
*.gcno
*.in
*.o
*.orig
*.patch
*.pyc
*~
*#
*.in
cov/
.vs/
Makefile
aclocal.m4
autom4te.cache/
build/
config.log
config.status
config/Makefile
config/Makefile.in
config/config.h*
config/stamp-h1
config/test-driver
configure
cov/
docs/Doxyfile
docs/html/
examples/.deps/
examples/test[0-9][0-9]
examples/test[0-9]
Makefile
examples/test[0-9][0-9]
inst/
tclap.pc
config/test-driver
tests/tmp.out
tests/test*.log
tests/test*.trs
tests/tmp.out
182 changes: 182 additions & 0 deletions tclap/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
language: cpp
cache:
- ccache
- directories:
- externalobjects
- $HOME/Library/Caches/Homebrew
- /usr/local/Homebrew
dist: bionic

git:
depth: false

# Only build the master branch, and pull-requests.
# This turns off commit builds to other branches
# branches:
# only:
# - master

before_cache:
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then brew cleanup; fi
# Credit https://discourse.brew.sh/t/best-practice-for-homebrew-on-travis-brew-update-is-5min-to-build-time/5215/9
# Cache only .git files under "/usr/local/Homebrew" so "brew update" does not take 5min every build
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then find /usr/local/Homebrew \! -regex ".+\.git.+" -delete; fi

addons:
apt:
sources:
- sourceline: 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic main'
key_url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x60C317803A41BA51845E371A1E9377A2BA9EF27F'
- sourceline: 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu bionic main'
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-5.0 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main'
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main'
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main'
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main'
- sourceline: 'deb https://apt.kitware.com/ubuntu/ bionic main'
key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc'
- sourceline: 'deb http://ppa.launchpad.net/jonathonf/gcc/ubuntu bionic main'
key_url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x4AB0F789CBA31744CC7DA76A8CF63AD3F06FC659'
packages:
- cmake
- ninja-build
- g++-4.8
- g++-5
- g++-6
- g++-7
- g++-8
- g++-9
- gcc-4.8
- gcc-5
- gcc-6
- gcc-7
- gcc-8
- gcc-9
- clang-3.9
- clang-4.0
- clang-5.0
- clang-6.0
- clang-7
- clang-8
- clang-9

matrix:
include:
- os: linux
env:
- MATRIX_EVAL="export CC=gcc-4.8 CXX=g++-4.8"
- os: linux
env:
- MATRIX_EVAL="export CC=gcc-5 CXX=g++-5"
- os: linux
env:
- MATRIX_EVAL="export CC=gcc-6 CXX=g++-6"
- os: linux
env:
- MATRIX_EVAL="export CC=gcc-7 CXX=g++-7"
- os: linux
env:
- MATRIX_EVAL="export CC=gcc-8 CXX=g++-8"
- os: linux
env:
- MATRIX_EVAL="export CC=gcc-9 CXX=g++-9"
#Linux Clang Starts Here
- os: linux
env:
- MATRIX_EVAL="export CC=clang-3.9 CXX=clang++-3.9"
- os: linux
env:
- MATRIX_EVAL="export CC=clang-4.0 CXX=clang++-4.0"
- os: linux
env:
- MATRIX_EVAL="export CC=clang-5.0 CXX=clang++-5.0"
- os: linux
env:
- MATRIX_EVAL="export CC=clang-6.0 CXX=clang++-6.0"
- os: linux
env:
- MATRIX_EVAL="export CC=clang-7 CXX=clang++-7"
- os: linux
env:
- MATRIX_EVAL="export CC=clang-8 CXX=clang++-8"
- os: linux
env:
- MATRIX_EVAL="export CC=clang-9 CXX=clang++-9"
#OSX GCC Starts here
- os: osx
osx_image: xcode11.3
env:
- MATRIX_EVAL="export CC=gcc-6 CXX=g++-6"
addons:
homebrew:
packages:
- cmake
- ccache
- ninja
- python
- gcc@6
update: yes
- os: osx
osx_image: xcode11.3
env:
- MATRIX_EVAL="export CC=gcc-7 CXX=g++-7"
addons:
homebrew:
packages:
- cmake
- ccache
- ninja
- python
- gcc@7
update: yes
- os: osx
osx_image: xcode11.3
env:
- MATRIX_EVAL="export CC=gcc-8 CXX=g++-8"
addons:
homebrew:
packages:
- cmake
- ccache
- ninja
- python
- gcc@8
update: yes
- os: osx
osx_image: xcode11.3
env:
- MATRIX_EVAL="export CC=gcc-9 CXX=g++-9"
addons:
homebrew:
packages:
- cmake
- ccache
- ninja
- python
- gcc@9
update: yes
#OSX clang starts here
- os: osx
osx_image: xcode11.3
env:
- MATRIX_EVAL="export CC=clang CXX=clang++"
addons:
homebrew:
packages:
- cmake
- ccache
- ninja
- python
update: yes

before_install:
- eval "${MATRIX_EVAL}"

script:
# NOTE: ${TRAVIS_BUILD_DIR} is actually the source checkout directory ${TRAVIS_BUILD_DIR}/build is the BUILD_DIR
- mkdir -p ${TRAVIS_BUILD_DIR}/build && cd ${TRAVIS_BUILD_DIR}/build
- "export PATH=\"$(echo ${PATH} | awk -v RS=: -v ORS=: '/ccache/ {next} {print}')\""
- cd ${TRAVIS_BUILD_DIR}/build && cmake -GNinja -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_DOC:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release ${TRAVIS_BUILD_DIR}
- cd ${TRAVIS_BUILD_DIR}/build && ctest -D Experimental -j2
2 changes: 1 addition & 1 deletion tclap/AUTHORS
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

original author: Michael E. Smoot
invaluable contributions: Daniel Aarno
current maintainer: Daniel Aarno
more contributions: Erik Zeek
more contributions: Fabien Carmagnac (Tinbergen-AM)
outstanding editing: Carol Smoot
Loading

0 comments on commit 1ae9316

Please sign in to comment.