Skip to content

Commit

Permalink
Merge 479527b into cd260c9
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Belikov committed Nov 23, 2017
2 parents cd260c9 + 479527b commit 15a31fe
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
/userdoc.*

# test and temp files
test*
!test.cxx
*.pyc
*.swp
*.swo
/log
/ld

# Executable
argstest
/build/
CMakeCache.txt
CMakeFiles
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions args.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 &params_): command(command_), parser(command, params_), oldSubparser(command.subparser)
inline Command::RaiiSubparser::RaiiSubparser(const Command &command_, const HelpParams &params_): command(command_), parser(command, params_), oldSubparser(command.subparser)
{
command.subparser = &parser;
}

void Subparser::Parse()
inline void Subparser::Parse()
{
isParsed = true;
Reset();
Expand Down
6 changes: 6 additions & 0 deletions test/multiple_inclusion_1.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <args.hxx>

int foo() { return 42; }
int bar();

int main() { return foo() - bar(); }
3 changes: 3 additions & 0 deletions test/multiple_inclusion_2.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <args.hxx>

int bar() { return 42; }

0 comments on commit 15a31fe

Please sign in to comment.