diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | args.hxx | 6 | ||||
-rw-r--r-- | test/multiple_inclusion_1.cpp | 6 | ||||
-rw-r--r-- | test/multiple_inclusion_2.cpp | 3 |
6 files changed, 19 insertions, 6 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/CMakeLists.txt b/CMakeLists.txt index 81864d7..24d4a08 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.cpp test/multiple_inclusion_2.cpp) +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.cpp b/test/multiple_inclusion_1.cpp new file mode 100644 index 0000000..b831d0a --- /dev/null +++ b/test/multiple_inclusion_1.cpp @@ -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.cpp b/test/multiple_inclusion_2.cpp new file mode 100644 index 0000000..cdcb020 --- /dev/null +++ b/test/multiple_inclusion_2.cpp @@ -0,0 +1,3 @@ +#include <args.hxx> + +int bar() { return 42; } |