From 2dd940dc1ae69417ac2951faaa8f973da0775bc5 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Mon, 4 Jun 2018 11:56:43 +0200 Subject: [PATCH 01/12] datatomfile: Consistently replace char by cell arrays Required after https://github.com/DynareTeam/dynare/commit/7be8f10e0e035e503c391979ae41415ffaf64e0a --- tests/estimation/fs2000_stochastic_singularity_xfail.mod | 2 +- tests/filter_step_ahead/fs2000_filter_step_ahead_ML.mod | 2 +- tests/filter_step_ahead/fs2000_filter_step_ahead_bayesian.mod | 2 +- tests/fs2000/fs2000_missing_data.mod | 2 +- tests/fs2000/fs2000a.mod | 2 +- tests/kalman_filter_smoother/fs2000_smoother_only.mod | 2 +- tests/kalman_filter_smoother/fs2000_smoother_only_ns.mod | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/estimation/fs2000_stochastic_singularity_xfail.mod b/tests/estimation/fs2000_stochastic_singularity_xfail.mod index cdd977d07..a84cc0ce1 100644 --- a/tests/estimation/fs2000_stochastic_singularity_xfail.mod +++ b/tests/estimation/fs2000_stochastic_singularity_xfail.mod @@ -64,7 +64,7 @@ var e_junk; stderr 0.005; end; stoch_simul(order=1,periods=300,irf=0,nomoments) k y c; -datatomfile('fsdat_simul_collinear', char('k','y','c')); +datatomfile('fsdat_simul_collinear', {'k'; 'y'; 'c'}); estimated_params; alp, beta_pdf, 0.356, 0.02; diff --git a/tests/filter_step_ahead/fs2000_filter_step_ahead_ML.mod b/tests/filter_step_ahead/fs2000_filter_step_ahead_ML.mod index 9de6f5299..a7ddcecbb 100644 --- a/tests/filter_step_ahead/fs2000_filter_step_ahead_ML.mod +++ b/tests/filter_step_ahead/fs2000_filter_step_ahead_ML.mod @@ -118,4 +118,4 @@ estimation(order=1, datafile='../fs2000/fsdat_simul', nobs=192, loglinear, filte */ //stoch_simul(periods=200, order=1); -//datatomfile('fsdat_simul', char('gy_obs', 'gp_obs')); +//datatomfile('fsdat_simul', {gy_obs'; 'gp_obs'}); diff --git a/tests/filter_step_ahead/fs2000_filter_step_ahead_bayesian.mod b/tests/filter_step_ahead/fs2000_filter_step_ahead_bayesian.mod index 9e1815ada..e977f10e1 100644 --- a/tests/filter_step_ahead/fs2000_filter_step_ahead_bayesian.mod +++ b/tests/filter_step_ahead/fs2000_filter_step_ahead_bayesian.mod @@ -124,4 +124,4 @@ estimation(order=1, datafile='../fs2000/fsdat_simul', nobs=192, loglinear, mh_re */ //stoch_simul(periods=200, order=1); -//datatomfile('fsdat_simul', char('gy_obs', 'gp_obs')); +//datatomfile('fsdat_simul', {'gy_obs'; 'gp_obs'}); diff --git a/tests/fs2000/fs2000_missing_data.mod b/tests/fs2000/fs2000_missing_data.mod index 2ef89c2b8..3a0a77d4f 100644 --- a/tests/fs2000/fs2000_missing_data.mod +++ b/tests/fs2000/fs2000_missing_data.mod @@ -90,4 +90,4 @@ estimation(order=1, datafile=fsdat_simul_missing_obs, nobs=192, loglinear, mh_re */ //stoch_simul(periods=200, order=1); -//datatomfile('fsdat_simul', char('gy_obs', 'gp_obs')); +//datatomfile('fsdat_simul', {'gy_obs'; 'gp_obs'}); diff --git a/tests/fs2000/fs2000a.mod b/tests/fs2000/fs2000a.mod index 210417e4f..bc9d31b3f 100644 --- a/tests/fs2000/fs2000a.mod +++ b/tests/fs2000/fs2000a.mod @@ -92,4 +92,4 @@ estimation(order=1,datafile=fsdat_simul,nobs=192,loglinear,mh_replic=2000, mode_compute=4,mh_nblocks=2,mh_drop=0.45,mh_jscale=0.65,diffuse_filter); //stoch_simul(order=1, periods=200); -//datatomfile('fsdat_simul2', char('gy_obs', 'gp_obs', 'Y_obs', 'P_obs')); +//datatomfile('fsdat_simul2', {'gy_obs'; 'gp_obs'; 'Y_obs'; 'P_obs'}); diff --git a/tests/kalman_filter_smoother/fs2000_smoother_only.mod b/tests/kalman_filter_smoother/fs2000_smoother_only.mod index b24c8b94b..70e4f6bc4 100644 --- a/tests/kalman_filter_smoother/fs2000_smoother_only.mod +++ b/tests/kalman_filter_smoother/fs2000_smoother_only.mod @@ -113,4 +113,4 @@ estimation(order=1, datafile=fsdat_simul, mode_compute=0,nobs=192, loglinear, sm */ //stoch_simul(periods=200, order=1); -//datatomfile('fsdat_simul', char('gy_obs', 'gp_obs')); +//datatomfile('fsdat_simul', {'gy_obs'; 'gp_obs'}); diff --git a/tests/kalman_filter_smoother/fs2000_smoother_only_ns.mod b/tests/kalman_filter_smoother/fs2000_smoother_only_ns.mod index 557486b79..29fb1d923 100644 --- a/tests/kalman_filter_smoother/fs2000_smoother_only_ns.mod +++ b/tests/kalman_filter_smoother/fs2000_smoother_only_ns.mod @@ -118,4 +118,4 @@ estimation(order=1, datafile=fsdat_simul, mode_compute=0,nobs=192, loglinear,dif */ //stoch_simul(periods=200, order=1); -//datatomfile('fsdat_simul', char('gy_obs', 'gp_obs')); +//datatomfile('fsdat_simul', {'gy_obs'; 'gp_obs'}); From f30126ea6938345ed210713521de804dc8bc6930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Mon, 4 Jun 2018 18:07:26 +0200 Subject: [PATCH 02/12] Update preprocessor, following temporary terms array optimization and partial C++14 modernization --- preprocessor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preprocessor b/preprocessor index f338e8769..7e1630738 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit f338e8769227ba2d614f52c1ac9aa5fe5df977f3 +Subproject commit 7e1630738299e64559a895ee04ecd637ab34cf7a From fec0947c7b80be9a583a5523b4e0b1386c56e4a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Mon, 4 Jun 2018 18:07:56 +0200 Subject: [PATCH 03/12] Testsuite: clean files generated by move to temporary terms array --- tests/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 5f7a3563f..1abc8c978 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -931,10 +931,12 @@ clean-local: rm -f $(patsubst %.mod, %.m, $(MODFILES)) \ $(patsubst %.mod, %_static.*, $(MODFILES)) \ + $(patsubst %.mod, %_static_*.m, $(MODFILES)) \ $(patsubst %.mod, %_objective_static.m, $(MODFILES)) \ $(patsubst %.mod, %_set_auxiliary_variables.m, $(MODFILES)) \ $(patsubst %.mod, %_steadystate2.m, $(MODFILES)) \ - $(patsubst %.mod, %_dynamic.*, $(MODFILES)) + $(patsubst %.mod, %_dynamic.*, $(MODFILES)) \ + $(patsubst %.mod, %_dynamic_*.m, $(MODFILES)) rm -f $(patsubst %.mod, %_results.mat, $(MODFILES)) \ $(patsubst %.mod, %_mode.mat, $(MODFILES)) \ From 35320e2f93c4e310de47190d7a906dbaaa4b2ec6 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 5 Jun 2018 11:14:56 +0200 Subject: [PATCH 04/12] submodule update: preprocessor --- preprocessor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preprocessor b/preprocessor index 7e1630738..d453e8159 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 7e1630738299e64559a895ee04ecd637ab34cf7a +Subproject commit d453e815945dfa3a322355916e501fab47b81bdb From e669321eec23f07575a77b4ea87b21411dad29d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 5 Jun 2018 11:33:45 +0200 Subject: [PATCH 05/12] Require C++14 for MEX files Needed because bytecode DLL uses some preprocessor code which is C++14. --- license.txt | 11 + m4/ax_cxx_compile_stdcxx.m4 | 562 +++++++++++++++++++++++++++++++++ m4/ax_cxx_compile_stdcxx_14.m4 | 34 ++ mex/build/matlab/configure.ac | 1 + mex/build/octave/configure.ac | 1 + 5 files changed, 609 insertions(+) create mode 100644 m4/ax_cxx_compile_stdcxx.m4 create mode 100644 m4/ax_cxx_compile_stdcxx_14.m4 diff --git a/license.txt b/license.txt index affad04aa..651112b5c 100644 --- a/license.txt +++ b/license.txt @@ -239,6 +239,17 @@ Files: m4/ax_compare_version.m4 Copyright: 2008 Tim Toolan License: permissive-autoconf + +Files: m4/ax_cxx_compile_stdcxx.m4 + m4/ax_cxx_compile_stdcxx_14.m4 +Copyright: 2008 Benjamin Kosnik + 2012 Zack Weinberg + 2013 Roy Stogner + 2014, 2015 Google Inc.; contributed by Alexey Sokolov + 2015 Paul Norman + 2015 Moritz Klammler +License: permissive-autoconf + Files: m4/ax_latex_class.m4 m4/ax_tex_test.m4 Copyright: 2008 Boretti Mathieu 2009 Dynare Team diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 new file mode 100644 index 000000000..2c18e49c5 --- /dev/null +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -0,0 +1,562 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the specified +# version of the C++ standard. If necessary, add switches to CXX and +# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) +# or '14' (for the C++14 standard). +# +# The second argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The third argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline support for the specified C++ standard is +# required and that the macro should error out if no mode with that +# support is found. If specified 'optional', then configuration proceeds +# regardless, after defining HAVE_CXX${VERSION} if and only if a +# supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 4 + +dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro +dnl (serial version number 13). + +AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl + m4_if([$1], [11], [], + [$1], [14], [], + [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], + [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$2], [], [], + [$2], [ext], [], + [$2], [noext], [], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], + [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], + [$3], [optional], [ax_cxx_compile_cxx$1_required=false], + [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, + ax_cv_cxx_compile_cxx$1, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [ax_cv_cxx_compile_cxx$1=yes], + [ax_cv_cxx_compile_cxx$1=no])]) + if test x$ax_cv_cxx_compile_cxx$1 = xyes; then + ac_success=yes + fi + + m4_if([$2], [noext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=gnu++$1 -std=gnu++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + fi]) + + m4_if([$2], [ext], [], [dnl + if test x$ac_success = xno; then + dnl HP's aCC needs +std=c++11 according to: + dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf + dnl Cray's crayCC needs "-h std=c++11" + for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx$1_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) + fi + fi + if test x$ac_success = xno; then + HAVE_CXX$1=0 + AC_MSG_NOTICE([No compiler with C++$1 support was found]) + else + HAVE_CXX$1=1 + AC_DEFINE(HAVE_CXX$1,1, + [define if the compiler supports basic C++$1 syntax]) + fi + AC_SUBST(HAVE_CXX$1) +]) + + +dnl Test body for checking C++11 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 +) + + +dnl Test body for checking C++14 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 +) + + +dnl Tests for new features in C++11 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + +]]) + + +dnl Tests for new features in C++14 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_seperators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + +]]) diff --git a/m4/ax_cxx_compile_stdcxx_14.m4 b/m4/ax_cxx_compile_stdcxx_14.m4 new file mode 100644 index 000000000..51123f2d5 --- /dev/null +++ b/m4/ax_cxx_compile_stdcxx_14.m4 @@ -0,0 +1,34 @@ +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++14 +# standard; if necessary, add switches to CXX and CXXCPP to enable +# support. +# +# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX +# macro with the version set to C++14. The two optional arguments are +# forwarded literally as the second and third argument respectively. +# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for +# more information. If you want to use this macro, you also need to +# download the ax_cxx_compile_stdcxx.m4 file. +# +# LICENSE +# +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 4 + +AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) +AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])]) diff --git a/mex/build/matlab/configure.ac b/mex/build/matlab/configure.ac index 08508b6b9..668706229 100644 --- a/mex/build/matlab/configure.ac +++ b/mex/build/matlab/configure.ac @@ -60,6 +60,7 @@ AC_PROG_F77([gfortran g77 f77]) AC_PROG_CC AC_PROG_CC_C99 # mjdgges DLL now uses C99 features (variable declared in for loop) AC_PROG_CXX +AX_CXX_COMPILE_STDCXX_14 AC_PROG_RANLIB AX_PROG_LN_S AC_PROG_MKDIR_P diff --git a/mex/build/octave/configure.ac b/mex/build/octave/configure.ac index d3661feb6..17e074c2b 100755 --- a/mex/build/octave/configure.ac +++ b/mex/build/octave/configure.ac @@ -43,6 +43,7 @@ AC_PROG_F77([gfortran g77 f77]) AC_PROG_CC AC_PROG_CC_C99 # mjdgges DLL now uses C99 features (variable declared in for loop) AC_PROG_CXX +AX_CXX_COMPILE_STDCXX_14 AC_PROG_RANLIB AX_PROG_LN_S AC_PROG_MKDIR_P From 28bd362329fd2a5936dec58ef25119f8938523cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?= Date: Tue, 5 Jun 2018 11:52:32 +0200 Subject: [PATCH 06/12] Updated preprocessor. --- preprocessor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preprocessor b/preprocessor index d453e8159..f2390623b 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit d453e815945dfa3a322355916e501fab47b81bdb +Subproject commit f2390623b2a1bd988b741a9c762a28b78bae6653 From e1a3c40ef089d0e1ff1b7a5337c94edf370db9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 5 Jun 2018 17:07:45 +0200 Subject: [PATCH 07/12] Fix compilation of MS-SBVAR DLL under Octave 4.4 --- mex/sources/ms-sbvar/modify_for_mex.h | 1 - 1 file changed, 1 deletion(-) diff --git a/mex/sources/ms-sbvar/modify_for_mex.h b/mex/sources/ms-sbvar/modify_for_mex.h index 0689df90f..5a7a30c87 100644 --- a/mex/sources/ms-sbvar/modify_for_mex.h +++ b/mex/sources/ms-sbvar/modify_for_mex.h @@ -36,7 +36,6 @@ # ifdef MATLAB_MEX_FILE extern bool utIsInterruptPending(); # else -# include # include # endif From c7a57e590674461d3e5d70cd406a6911cbb7e36a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 5 Jun 2018 17:14:41 +0200 Subject: [PATCH 08/12] corrcoef is included in Octave 4.4 --- matlab/dynare_config.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m index 8a582580f..513b99c33 100644 --- a/matlab/dynare_config.m +++ b/matlab/dynare_config.m @@ -94,8 +94,8 @@ if isoctave p{end+1} = '/missing/ordeig'; end -% corrcoef with two outputs is missing in Octave (ticket #796) -if isoctave && ~user_has_octave_forge_package('nan') +% corrcoef with two outputs is missing in Octave < 4.4 (ticket #796) +if isoctave && octave_ver_less_than('4.4') && ~user_has_octave_forge_package('nan') p{end+1} = '/missing/corrcoef'; end From 8cadb2ac595c55e4a2b2caa204b253b6f921f764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 5 Jun 2018 17:24:52 +0200 Subject: [PATCH 09/12] Silence Octave:classdef-to-struct warning --- matlab/warning_config.m | 1 + 1 file changed, 1 insertion(+) diff --git a/matlab/warning_config.m b/matlab/warning_config.m index c1abf3d85..b1fbae177 100644 --- a/matlab/warning_config.m +++ b/matlab/warning_config.m @@ -46,6 +46,7 @@ if isoctave warning('off', 'Octave:mixed-string-concat'); warning('off', 'Octave:variable-switch-label'); warning('off', 'Octave:fortran-indexing'); + warning('off', 'Octave:classdef-to-struct'); else % In MATLAB >= 7.7, don't display a warning if we use deprecated % interface to set seed of random number generators From e8ade6a18749c6955705e9468b2293df95a9e4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 5 Jun 2018 17:27:03 +0200 Subject: [PATCH 10/12] Fix display of Dynare command arguments --- matlab/dynare.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/matlab/dynare.m b/matlab/dynare.m index 53c67a98e..f6b98eff2 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -226,9 +226,10 @@ end if preprocessoroutput fprintf(['Starting Dynare (version ' dynare_version() ').\n']); fprintf('Calling Dynare with arguments: '); - disp(varargin); if isempty(varargin) disp('none') + else + disp(varargin); end end From 0b2828af8a58955ed1bac507eaab0d3ab59ed735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 5 Jun 2018 17:27:22 +0200 Subject: [PATCH 11/12] Fix typo --- matlab/dynare.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matlab/dynare.m b/matlab/dynare.m index f6b98eff2..6c25e1915 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -239,14 +239,14 @@ if status ~= 0 || preprocessoroutput end if ismember('onlymacro', varargin) if preprocessoroutput - disp('Preprocesser stopped after macroprocessing step because of ''onlymacro'' option.'); + disp('Preprocessor stopped after macroprocessing step because of ''onlymacro'' option.'); end return end if ismember('onlyjson', varargin) if preprocessoroutput - disp('Preprocesser stopped after preprocessing step because of ''onlyjson'' option.'); + disp('Preprocessor stopped after preprocessing step because of ''onlyjson'' option.'); end return; end From b6355776a09db12d0d635b066c1ece6364fedb9f Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 5 Jun 2018 18:45:11 +0200 Subject: [PATCH 12/12] submodule update: preprocessor --- preprocessor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preprocessor b/preprocessor index f2390623b..a30f8f365 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit f2390623b2a1bd988b741a9c762a28b78bae6653 +Subproject commit a30f8f365e89b9520fa44caa6c3c1c288c0adbba