diff options
author | Taylor C. Richberger <taywee@gmx.com> | 2017-11-26 09:41:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-26 09:41:51 -0700 |
commit | 8c32aefd61e259a4a8dde7eee1252accd4c63372 (patch) | |
tree | c15d9be9c6a252cbb14b81a653582358e1e810e1 | |
parent | Merge pull request #44 from pavel-belikov/better-value-parsing (diff) | |
parent | trigger travis ci (diff) | |
download | args.hxx-8c32aefd61e259a4a8dde7eee1252accd4c63372.tar.xz |
Merge pull request #48 from pavel-belikov/fix-multiple-inclusion
Fix inclusion into multiple source files
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | args.hxx | 6 | ||||
-rw-r--r-- | test/multiple_inclusion_1.cxx | 6 | ||||
-rw-r--r-- | test/multiple_inclusion_2.cxx | 3 |
7 files changed, 20 insertions, 7 deletions
@@ -29,8 +29,6 @@ /userdoc.* # test and temp files -test* -!test.cxx *.pyc *.swp *.swo @@ -38,6 +36,7 @@ test* /ld # Executable +argstest /build/ CMakeCache.txt CMakeFiles diff --git a/.travis.yml b/.travis.yml index d4892fe..efba6f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -145,6 +145,6 @@ before_install: - pip install --user cpp-coveralls after_success: - - if [ "${COVERAGE}" = 1 ]; then coveralls --root .. -E ".*catch.*" -E ".*CMakeFiles.*" -E ".*gitlike.cxx.*" -E ".*test.cxx.*"; fi + - if [ "${COVERAGE}" = 1 ]; then coveralls --root .. -E ".*catch.*" -E ".*CMakeFiles.*" -E ".*gitlike.cxx.*" -E ".*test.*"; fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 81864d7..322e8d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,5 +35,10 @@ else () target_compile_options(argstest PRIVATE -Wall -Wextra -Werror -pedantic -Wshadow -Wunused-parameter) endif () +add_executable(argstest-multiple-inclusion test/multiple_inclusion_1.cxx test/multiple_inclusion_2.cxx) +target_link_libraries(argstest-multiple-inclusion args) +set_property(TARGET argstest-multiple-inclusion PROPERTY CXX_STANDARD 11) + enable_testing() add_test(NAME "test" COMMAND argstest) +add_test(NAME "test-multiple-inclusion" COMMAND argstest-multiple-inclusion) @@ -17,7 +17,7 @@ LDFLAGS += $(FLAGS) SOURCES = test.cxx OBJECTS = $(SOURCES:.cxx=.o) DEPENDENCIES= $(SOURCES:.cxx=.d) -EXECUTABLE = test +EXECUTABLE = argstest .PHONY: all clean pages runtests uninstall install installman @@ -2545,18 +2545,18 @@ namespace args } }; - Command::RaiiSubparser::RaiiSubparser(ArgumentParser &parser_, std::vector<std::string> args_) + inline Command::RaiiSubparser::RaiiSubparser(ArgumentParser &parser_, std::vector<std::string> args_) : command(parser_.SelectedCommand()), parser(std::move(args_), parser_, command, parser_.helpParams), oldSubparser(command.subparser) { command.subparser = &parser; } - Command::RaiiSubparser::RaiiSubparser(const Command &command_, const HelpParams ¶ms_): command(command_), parser(command, params_), oldSubparser(command.subparser) + inline Command::RaiiSubparser::RaiiSubparser(const Command &command_, const HelpParams ¶ms_): command(command_), parser(command, params_), oldSubparser(command.subparser) { command.subparser = &parser; } - void Subparser::Parse() + inline void Subparser::Parse() { isParsed = true; Reset(); diff --git a/test/multiple_inclusion_1.cxx b/test/multiple_inclusion_1.cxx new file mode 100644 index 0000000..b831d0a --- /dev/null +++ b/test/multiple_inclusion_1.cxx @@ -0,0 +1,6 @@ +#include <args.hxx> + +int foo() { return 42; } +int bar(); + +int main() { return foo() - bar(); } diff --git a/test/multiple_inclusion_2.cxx b/test/multiple_inclusion_2.cxx new file mode 100644 index 0000000..cdcb020 --- /dev/null +++ b/test/multiple_inclusion_2.cxx @@ -0,0 +1,3 @@ +#include <args.hxx> + +int bar() { return 42; } |