From 622eae7b4ee8e8e35a8e9d95d5023019bda9e7b4 Mon Sep 17 00:00:00 2001 From: rok-cesnovar Date: Sat, 14 Mar 2020 22:04:11 +0100 Subject: [PATCH 1/4] use make findfiles --- make/cpplint | 2 +- make/libstanc | 2 +- make/tests | 14 +++++++------- makefile | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/make/cpplint b/make/cpplint index cb7250e332c..cee3afb7c00 100644 --- a/make/cpplint +++ b/make/cpplint @@ -10,4 +10,4 @@ endif .PHONY: cpplint cpplint: - @$(PYTHON2) $(CPPLINT)/cpplint.py --output=vs7 --counting=detailed --root=src --extension=hpp,cpp --filter=-runtime/indentation_namespace,-readability/namespace,-legal/copyright,-whitespace/indent,-runtime/reference,-build/c++11 $(shell find src/stan -name '*.hpp' -o -name '*.cpp') + @$(PYTHON2) $(CPPLINT)/cpplint.py --output=vs7 --counting=detailed --root=src --extension=hpp,cpp --filter=-runtime/indentation_namespace,-readability/namespace,-legal/copyright,-whitespace/indent,-runtime/reference,-build/c++11 $(call findfiles,src/stan,*.hpp) $(call findfiles,src/stan,*.cpp)) diff --git a/make/libstanc b/make/libstanc index d48bc5bc7f0..735eaf26a7d 100644 --- a/make/libstanc +++ b/make/libstanc @@ -1,7 +1,7 @@ ################################################################################ # libstanc build rules -STANC_TEMPLATE_INSTANTIATION_CPP := $(shell find src/stan/lang -type f -name '*_inst.cpp') $(shell find src/stan/lang -type f -name '*_def.cpp') +STANC_TEMPLATE_INSTANTIATION_CPP := $(call findfiles,src/stan/lang,*_inst.cpp) $(call findfiles,src/stan/lang,*_def.cpp) STANC_TEMPLATE_INSTANTIATION := $(STANC_TEMPLATE_INSTANTIATION_CPP:src/%.cpp=test/%.o) test/libstanc.a : $(STANC_TEMPLATE_INSTANTIATION) diff --git a/make/tests b/make/tests index aea7a43cbf1..80fc8728e0e 100644 --- a/make/tests +++ b/make/tests @@ -50,7 +50,7 @@ endif # needed by subset of unit tests that test stan compiler # all these tests are under stan/test/unit/lang ## -STANC_TESTS_HEADERS := $(shell find src/test/unit/lang -type f -name '*_test.cpp') +STANC_TESTS_HEADERS := $(call findfiles,src/test/unit/lang,*_test.cpp) STANC_TESTS_O := $(patsubst src/%.cpp,%.o,$(STANC_TESTS_HEADERS)) STANC_TESTS := $(patsubst src/%.cpp,%$(EXE),$(STANC_TESTS_HEADERS)) @@ -64,7 +64,7 @@ $(STANC_TESTS) : LDLIBS += $(LDLIBS_STANC) # Target to verify header files within Stan has # enough include calls ## -HEADER_TESTS := $(addsuffix -test,$(shell find src/stan -name '*.hpp' -type f)) +HEADER_TESTS := $(addsuffix -test,$(call findfiles,src/stan,*.hpp)) ifeq ($(OS),Windows_NT) DEV_NULL = nul @@ -160,7 +160,7 @@ test/test-models/stanc$(EXE) : %$(EXE) : %.o @mkdir -p $(dir $@) $(LINK.cpp) $< $(LDLIBS) $(OUTPUT_OPTION) -TEST_MODELS = $(shell find src/test/test-models -type f -name '*.stan') +TEST_MODELS = $(call findfiles,src/test/test-models,*.stan) $(patsubst src/%.stan,%.hpp,$(TEST_MODELS)) : test/test-models/%.hpp : src/test/test-models/%.stan test/test-models/stanc$(EXE) @mkdir -p $(dir $@) $(WINE) test/test-models/stanc$(EXE) $< --o=$@ @@ -168,7 +168,7 @@ $(patsubst src/%.stan,%.hpp,$(TEST_MODELS)) : test/test-models/%.hpp : src/test/ ## # Generate C++ from Stan standalone functions ## -TEST_FUNCTIONS = $(shell find src/test/test-models -type f -name '*.stanfuncs') +TEST_FUNCTIONS = $(call findfiles,src/test/test-models,*.stanfuncs) $(patsubst src/%.stanfuncs,%.hpp,$(TEST_FUNCTIONS)) : test/test-models/%.hpp : src/test/test-models/%.stanfuncs test/test-models/stanc$(EXE) @mkdir -p $(dir $@) $(WINE) test/test-models/stanc$(EXE) $< --o=$@ @@ -193,7 +193,7 @@ test/unit/lang/stanc_helper_test.o: change-file-permissions # Add additional dependencies for tests that should translate Stan to hpp, but # isn't included in the source using `#include`. ## -test/unit/lang/parser_generator_test$(EXE): $(patsubst src/%.stan,%.hpp,$(shell find src/test/test-models/good/parser-generator -type f -name '*.stan')) +test/unit/lang/parser_generator_test$(EXE): $(patsubst src/%.stan,%.hpp,$(call findfiles,src/test/test-models/good/parser-generator,*.stan)) ## # Compile models depends on every model within @@ -201,10 +201,10 @@ test/unit/lang/parser_generator_test$(EXE): $(patsubst src/%.stan,%.hpp,$(shell # be code-generated to a *.hpp, then passed through # the compiler using the -fsyntax-only flag ## -test/integration/compile_models_test$(EXE): $(patsubst src/%.stan,%.hpp-test,$(shell find src/test/test-models/good -type f -name '*.stan')) +test/integration/compile_models_test$(EXE): $(patsubst src/%.stan,%.hpp-test,$(call findfiles,src/test/test-models/good,*.stan)) ## # Same trick as above for models, but for standalone functions, using # "src/test/test-models/good-standalone-functions/*.stanfuncs" ## -test/integration/compile_standalone_functions_test$(EXE): $(patsubst src/%.stanfuncs,%.hpp-test,$(shell find src/test/test-models/good-standalone-functions -type f -name '*.stanfuncs')) +test/integration/compile_standalone_functions_test$(EXE): $(patsubst src/%.stanfuncs,%.hpp-test,$(call findfiles,src/test/test-models/good-standalone-functions,*.stanfuncs)) diff --git a/makefile b/makefile index da551f3baaa..839c6595c13 100644 --- a/makefile +++ b/makefile @@ -108,10 +108,10 @@ help: ## # Clean up. ## -MODEL_SPECS := $(shell find src/test -type f -name '*.stan') +MODEL_SPECS := $(call findfiles,src/test,*.stan) .PHONY: clean clean-demo clean-dox clean-models clean-all clean-deps clean: - $(RM) $(shell find src -type f -name '*.dSYM') $(shell find src -type f -name '*.d.*') + $(RM) $(call findfiles,src,*.dSYM) $(call findfiles,src,*.d.*) $(RM) $(wildcard $(MODEL_SPECS:%.stan=%.hpp)) $(RM) $(wildcard $(MODEL_SPECS:%.stan=%$(EXE))) $(RM) $(wildcard $(MODEL_SPECS:%.stan=%.o)) @@ -122,12 +122,12 @@ clean-dox: clean-deps: @echo ' removing dependency files' - $(shell find . -type f -name '*.d' -exec rm {} +) + $(RM) $(call findfiles,.,*.d) clean-all: clean clean-dox clean-deps clean-libraries $(RM) -r test bin @echo ' removing .o files' - $(shell find src -type f -name '*.o' -exec rm {} +) + $(RM) $(call findfiles,src,*.o) ## # Submodule related tasks From 2b01835bbbec51c55a444502dda19c3c0cb57684 Mon Sep 17 00:00:00 2001 From: rok-cesnovar Date: Sat, 14 Mar 2020 22:09:40 +0100 Subject: [PATCH 2/4] remove ) --- lib/stan_math | 2 +- make/cpplint | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/stan_math b/lib/stan_math index f2a3c1a6f8d..296392350e4 160000 --- a/lib/stan_math +++ b/lib/stan_math @@ -1 +1 @@ -Subproject commit f2a3c1a6f8de1d5bd380c265f0bc92472dce2d42 +Subproject commit 296392350e4db4e8a820e8200097216455e03b5a diff --git a/make/cpplint b/make/cpplint index cee3afb7c00..ca766fdc230 100644 --- a/make/cpplint +++ b/make/cpplint @@ -10,4 +10,4 @@ endif .PHONY: cpplint cpplint: - @$(PYTHON2) $(CPPLINT)/cpplint.py --output=vs7 --counting=detailed --root=src --extension=hpp,cpp --filter=-runtime/indentation_namespace,-readability/namespace,-legal/copyright,-whitespace/indent,-runtime/reference,-build/c++11 $(call findfiles,src/stan,*.hpp) $(call findfiles,src/stan,*.cpp)) + @$(PYTHON2) $(CPPLINT)/cpplint.py --output=vs7 --counting=detailed --root=src --extension=hpp,cpp --filter=-runtime/indentation_namespace,-readability/namespace,-legal/copyright,-whitespace/indent,-runtime/reference,-build/c++11 $(call findfiles,src/stan,*.hpp) $(call findfiles,src/stan,*.cpp) From 3bc6dba7d82b63dbea53c2c1c23c38452e3dbb9f Mon Sep 17 00:00:00 2001 From: Stan Jenkins Date: Wed, 8 Apr 2020 13:45:14 -0400 Subject: [PATCH 3/4] [Jenkins] auto-formatting by clang-format version 6.0.0 --- src/stan/lang/grammars/expression07_grammar_def.hpp | 2 +- src/stan/lang/grammars/expression_grammar_def.hpp | 2 +- src/stan/lang/grammars/program_grammar_def.hpp | 2 +- src/stan/lang/grammars/statement_2_grammar_def.hpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/stan/lang/grammars/expression07_grammar_def.hpp b/src/stan/lang/grammars/expression07_grammar_def.hpp index ec6d3a3b017..5a4ba6320ee 100644 --- a/src/stan/lang/grammars/expression07_grammar_def.hpp +++ b/src/stan/lang/grammars/expression07_grammar_def.hpp @@ -29,8 +29,8 @@ expression07_grammar::expression07_grammar( using boost::spirit::qi::_pass; using boost::spirit::qi::_val; using boost::spirit::qi::eps; - using boost::spirit::qi::labels::_r1; using boost::spirit::qi::lit; + using boost::spirit::qi::labels::_r1; expression07_r.name("expression"); expression07_r diff --git a/src/stan/lang/grammars/expression_grammar_def.hpp b/src/stan/lang/grammars/expression_grammar_def.hpp index 68e08ece804..0ed1294fdf3 100644 --- a/src/stan/lang/grammars/expression_grammar_def.hpp +++ b/src/stan/lang/grammars/expression_grammar_def.hpp @@ -30,9 +30,9 @@ expression_grammar::expression_grammar(variable_map& var_map, using boost::spirit::qi::_val; using boost::spirit::qi::char_; using boost::spirit::qi::eps; - using boost::spirit::qi::labels::_r1; using boost::spirit::qi::lit; using boost::spirit::qi::no_skip; + using boost::spirit::qi::labels::_r1; expression_r.name("expression"); expression_r %= (expression15_r(_r1) >> no_skip[!char_('?')] > eps) diff --git a/src/stan/lang/grammars/program_grammar_def.hpp b/src/stan/lang/grammars/program_grammar_def.hpp index f1ad0277847..58ddcebd8e1 100644 --- a/src/stan/lang/grammars/program_grammar_def.hpp +++ b/src/stan/lang/grammars/program_grammar_def.hpp @@ -52,10 +52,10 @@ program_grammar::program_grammar(const std::string& model_name, using boost::spirit::qi::_2; using boost::spirit::qi::_3; using boost::spirit::qi::eps; - using boost::spirit::qi::labels::_a; using boost::spirit::qi::lit; using boost::spirit::qi::on_error; using boost::spirit::qi::rethrow; + using boost::spirit::qi::labels::_a; // add model_name to var_map with special origin var_map_.add(model_name, var_decl(), scope(model_name_origin, true)); diff --git a/src/stan/lang/grammars/statement_2_grammar_def.hpp b/src/stan/lang/grammars/statement_2_grammar_def.hpp index a831ea83bcc..0af0c9e8803 100644 --- a/src/stan/lang/grammars/statement_2_grammar_def.hpp +++ b/src/stan/lang/grammars/statement_2_grammar_def.hpp @@ -27,10 +27,10 @@ statement_2_grammar::statement_2_grammar( using boost::spirit::qi::_pass; using boost::spirit::qi::_val; using boost::spirit::qi::char_; - using boost::spirit::qi::labels::_r1; - using boost::spirit::qi::labels::_r2; using boost::spirit::qi::lit; using boost::spirit::qi::no_skip; + using boost::spirit::qi::labels::_r1; + using boost::spirit::qi::labels::_r2; // _r1 var_scope // _r2 true if in loop (allowing break/continue) From b0f5962db0ff1d44ad373f2b9fc60c20d63ee6ff Mon Sep 17 00:00:00 2001 From: rok-cesnovar Date: Mon, 25 May 2020 19:37:17 +0200 Subject: [PATCH 4/4] replace find in cpplint --- make/cpplint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/cpplint b/make/cpplint index faefee164e0..79b977478ea 100644 --- a/make/cpplint +++ b/make/cpplint @@ -2,4 +2,4 @@ PYTHON ?= python .PHONY: cpplint cpplint: - @$(PYTHON) $(CPPLINT)/cpplint.py --output=vs7 --counting=detailed --root=src --extension=hpp,cpp --filter=-runtime/indentation_namespace,-build/c++11,-readability/namespace,-legal/copyright,-whitespace/indent,-runtime/reference,-build/header_guard,-build/include_order,-build/include_what_you_use,-runtime/string,-build/namespaces $(shell find src/stan -name '*.hpp' -o -name '*.cpp') + @$(PYTHON) $(CPPLINT)/cpplint.py --output=vs7 --counting=detailed --root=src --extension=hpp,cpp --filter=-runtime/indentation_namespace,-build/c++11,-readability/namespace,-legal/copyright,-whitespace/indent,-runtime/reference,-build/header_guard,-build/include_order,-build/include_what_you_use,-runtime/string,-build/namespaces $(call findfiles,src/stan,*.hpp) $(call findfiles,src/stan,*.cpp)