diff --git a/ChangeLog b/ChangeLog index 1cde543..a265a31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,44 @@ +2018-10-23 21:19 + + * [r488] build-in-docker.sh, mac-create-app-bundle.sh, + resolve-rpmbuilddeps.sh, src/mrw/string.hxx: + update buildsystem + +2018-09-14 08:43 + + * [r487] build-in-docker.sh: + added support for opensuse tumbleweed + +2018-09-11 10:07 + + * [r486] ax_init_standard_project.m4, build-in-docker.sh: + fix installation check after package build + +2018-09-10 20:56 + + * [r485] ax_init_standard_project.m4, bootstrap.sh, + build-in-docker.sh: + add check whether built package can be installed + +2018-09-07 13:24 + + * [r484] bootstrap.sh, debian/control.in: + fixed build for xenial and bionic + +2018-08-21 14:32 + + * [r483] ChangeLog, ax_check_qt.m4, ax_init_standard_project.m4, + bootstrap.sh, build-in-docker.sh, debian/control.in, + mac-create-app-bundle.sh, resolve-debbuilddeps.sh, + resolve-rpmbuilddeps.sh: + cross compilation with qemu enabled + +2018-04-12 11:01 + + * [r482] ChangeLog, ax_init_standard_project.m4, configure.ac, + mac-create-app-bundle.sh: + fix log4cxx dependency in buster + 2018-04-04 19:50 * [r481] bootstrap.sh, build-in-docker.sh: diff --git a/NEWS b/NEWS index fb34ae7..00e50e7 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +2018-11-21 + +Upgraded to support C++17, mainly all throw declarations have been +replaced by noexcept. Now minimum requirement is C++11. The library +should be reviewed with regard to latest C++ standards. Probably some +features can be removed, especially regular expressions are now part +of the standard. + 2006-02-04 New RPM mrw-c++-minimal with minimal dependencies on other libraries diff --git a/README b/README deleted file mode 100644 index 64404be..0000000 --- a/README +++ /dev/null @@ -1,59 +0,0 @@ -MRW C++ Library - -Featureful C++ Library containing a lot of needful things. Everything, -I often need, but is missing in C++ standard libraries and other -common 3rd party libraries, such as log4cxx, cppunit and boost. - -I have paid attention to define simple and a nice to use -interfaces. The library makes use of object orientation, operator -overload and templates, where it makes sense. The library passes -several module tests before each delivery. It is therefore stable and -tested. - -The library contains modules for the following purposes: - - - Collect and Format a Stack Trace - Having a stack trace is extremely useful, if you have - unexpected or uncaught exceptions - - Exceptions with Stack Trace - - Automated Unexpected and Terminate Handler - - - C++ Evaluation of Command Line Arguments - A fully object oriented replacement for optarg - - - Classes for Automated Resource Handling - Automatically free resources from C libraries, - such as open, malloc, etc. - - - Configuration File Handler - Read and write UNIX / Windows like configuration files - - - Execute UNIX Commands - Write to stdin and read from stdout, stderr of the sub process - - - File and System Utilities - C++ wrapper around C library file and directory access (incomplete) - - - Regular Expressions - C++ wrapper around C library regular expressions - - - Tokenizer - Split a string into tokens and iterate through them - - - Function Trace (using log4cxx) - - Automatic Function Trace: Add function trace with no code - change! - - - A C++ wrapper around libltdl, Libtool Dynamic Loading library - - - Extensions for C++ Standard Libraries - - - STL extensions - - Shift values into containers - - Read Line that reads a full line - - - String extensions - Add integers to strings, shift into strings - -HTML and PDF documentation is include in the installation (built with -Doxygen) and available online on: https://dev.marc.waeckerlin.org/projects/mrw-cxx diff --git a/README.md b/README.md new file mode 100644 index 0000000..7a91340 --- /dev/null +++ b/README.md @@ -0,0 +1,71 @@ +MRW C++ Library +=============== + +Featureful C++ Library containing a lot of needful things. Everything, I often need, but is missing in C++ standard libraries and other common 3rd party libraries, such as log4cxx, cppunit and boost. + +I have paid attention to define simple and a nice to use interfaces. The library makes use of object orientation, operator overload and templates, where it makes sense. The library passes several module tests before each delivery. It is therefore stable and tested. + +Features +-------- + +This library contains [modules](modules.html) for the following purposes: + + - [Collect and Format a Stack Trace](group__grpStackTrace.html): + Having a stack trace is extremely useful, if you have + unexpected or uncaught exceptions + - Exceptions with Stack Trace + - Automated Unexpected and Terminate Handler + + - [C++ Evaluation of Command Line Arguments](group__arguments.html): + A fully object oriented replacement for optarg + + - [Classes for Automated Resource Handling](group__AutoTools.html): + Automatically free resources from C libraries, such as open, malloc, etc. + + - [Configuration File Handler](group__config.html): + Read and write UNIX / Windows like configuration files + + - [Execute UNIX Commands](group__CmdExec.html): + Write to stdin and read from stdout, stderr of the sub process + + - [File and System Utilities](group__sysFile.html): + C++ wrapper around C library file and directory access (incomplete) + + - [Regular Expressions](group__regexp.html): + C++ wrapper around C library regular expressions + - [Tokenizer](group__regexptokenizer.html): + Split a string into tokens and iterate through them + + - [Function Trace (using log4cxx)](group__FunctionTrace.html): + Automatic Function Trace: Add function trace with no code change! + + - [Libtool Wrapper](group__dll.html): + A C++ wrapper around libltdl, Libtool Dynamic Loading library + + - [Extensions for C++ Standard Libraries](group__StdExt.html): + - Shift values into containers + - Read Line that reads a full line + - String ext ensions: + Add integers to strings, shift into strings + - Useful Functions: + Minumum, maximum of any kind of values + + +In the Web +---------- + + - The official project page is on: https://mrw.sh/libraries/mrw-cxx + - The official documentation is on: https://doc.mrw.sh/mrw-c++ + - The official repositories are on: https://repository.mrw.sh + + +Supported Platforms +------------------- + +The library is generic UNIX, but should also work on Windows. It is sporadically tested on Windows in Cygwin. Stack trace works on Linux only, it could theoretically work on Sun Solaris too, but this is untested. Stack trace without symbol resolution, just getting the raw addresses, only depends on GNU gcc and should work on all platforms. Feedback is welcome! + + +Missing a Feature, Found a Bug +------------------------------ + +You are missing a feature, or an implementation is too incomplete for the purpose you need it? Or you even found a bug? Just register and open an issue [on the project management page](https://mrw.sh/libraries/mrw-cxx/issues). diff --git a/ax_cxx_compile_stdcxx.m4 b/ax_cxx_compile_stdcxx.m4 new file mode 100644 index 0000000..9e9eaed --- /dev/null +++ b/ax_cxx_compile_stdcxx.m4 @@ -0,0 +1,948 @@ +# =========================================================================== +# https://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 +# Copyright (c) 2016, 2018 Krzesimir Nowak +# +# 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 10 + +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], [ax_cxx_compile_alternatives="11 0x"], + [$1], [14], [ax_cxx_compile_alternatives="14 1y"], + [$1], [17], [ax_cxx_compile_alternatives="17 1z"], + [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 + + m4_if([$2], [noext], [], [dnl + if test x$ac_success = xno; then + for alternative in ${ax_cxx_compile_alternatives}; do + switch="-std=gnu++${alternative}" + 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 alternative in ${ax_cxx_compile_alternatives}; do + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; 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 + if test x$ac_success = xyes; then + 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 +) + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 +) + +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_separators + { + + 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 + +]]) + + +dnl Tests for new features in C++17 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ + +// If the compiler admits that it is not ready for C++17, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201703L + +#error "This is not a C++17 compiler" + +#else + +#include +#include +#include + +namespace cxx17 +{ + + namespace test_constexpr_lambdas + { + + constexpr int foo = [](){return 42;}(); + + } + + namespace test::nested_namespace::definitions + { + + } + + namespace test_fold_expression + { + + template + int multiply(Args... args) + { + return (args * ... * 1); + } + + template + bool all(Args... args) + { + return (args && ...); + } + + } + + namespace test_extended_static_assert + { + + static_assert (true); + + } + + namespace test_auto_brace_init_list + { + + auto foo = {5}; + auto bar {5}; + + static_assert(std::is_same, decltype(foo)>::value); + static_assert(std::is_same::value); + } + + namespace test_typename_in_template_template_parameter + { + + template typename X> struct D; + + } + + namespace test_fallthrough_nodiscard_maybe_unused_attributes + { + + int f1() + { + return 42; + } + + [[nodiscard]] int f2() + { + [[maybe_unused]] auto unused = f1(); + + switch (f1()) + { + case 17: + f1(); + [[fallthrough]]; + case 42: + f1(); + } + return f1(); + } + + } + + namespace test_extended_aggregate_initialization + { + + struct base1 + { + int b1, b2 = 42; + }; + + struct base2 + { + base2() { + b3 = 42; + } + int b3; + }; + + struct derived : base1, base2 + { + int d; + }; + + derived d1 {{1, 2}, {}, 4}; // full initialization + derived d2 {{}, {}, 4}; // value-initialized bases + + } + + namespace test_general_range_based_for_loop + { + + struct iter + { + int i; + + int& operator* () + { + return i; + } + + const int& operator* () const + { + return i; + } + + iter& operator++() + { + ++i; + return *this; + } + }; + + struct sentinel + { + int i; + }; + + bool operator== (const iter& i, const sentinel& s) + { + return i.i == s.i; + } + + bool operator!= (const iter& i, const sentinel& s) + { + return !(i == s); + } + + struct range + { + iter begin() const + { + return {0}; + } + + sentinel end() const + { + return {5}; + } + }; + + void f() + { + range r {}; + + for (auto i : r) + { + [[maybe_unused]] auto v = i; + } + } + + } + + namespace test_lambda_capture_asterisk_this_by_value + { + + struct t + { + int i; + int foo() + { + return [*this]() + { + return i; + }(); + } + }; + + } + + namespace test_enum_class_construction + { + + enum class byte : unsigned char + {}; + + byte foo {42}; + + } + + namespace test_constexpr_if + { + + template + int f () + { + if constexpr(cond) + { + return 13; + } + else + { + return 42; + } + } + + } + + namespace test_selection_statement_with_initializer + { + + int f() + { + return 13; + } + + int f2() + { + if (auto i = f(); i > 0) + { + return 3; + } + + switch (auto i = f(); i + 4) + { + case 17: + return 2; + + default: + return 1; + } + } + + } + + namespace test_template_argument_deduction_for_class_templates + { + + template + struct pair + { + pair (T1 p1, T2 p2) + : m1 {p1}, + m2 {p2} + {} + + T1 m1; + T2 m2; + }; + + void f() + { + [[maybe_unused]] auto p = pair{13, 42u}; + } + + } + + namespace test_non_type_auto_template_parameters + { + + template + struct B + {}; + + B<5> b1; + B<'a'> b2; + + } + + namespace test_structured_bindings + { + + int arr[2] = { 1, 2 }; + std::pair pr = { 1, 2 }; + + auto f1() -> int(&)[2] + { + return arr; + } + + auto f2() -> std::pair& + { + return pr; + } + + struct S + { + int x1 : 2; + volatile double y1; + }; + + S f3() + { + return {}; + } + + auto [ x1, y1 ] = f1(); + auto& [ xr1, yr1 ] = f1(); + auto [ x2, y2 ] = f2(); + auto& [ xr2, yr2 ] = f2(); + const auto [ x3, y3 ] = f3(); + + } + + namespace test_exception_spec_type_system + { + + struct Good {}; + struct Bad {}; + + void g1() noexcept; + void g2(); + + template + Bad + f(T*, T*); + + template + Good + f(T1*, T2*); + + static_assert (std::is_same_v); + + } + + namespace test_inline_variables + { + + template void f(T) + {} + + template inline T g(T) + { + return T{}; + } + + template<> inline void f<>(int) + {} + + template<> int g<>(int) + { + return 5; + } + + } + +} // namespace cxx17 + +#endif // __cplusplus < 201703L + +]]) diff --git a/ax_cxx_compile_stdcxx_11.m4 b/ax_cxx_compile_stdcxx_11.m4 deleted file mode 100644 index 4c831e0..0000000 --- a/ax_cxx_compile_stdcxx_11.m4 +++ /dev/null @@ -1,231 +0,0 @@ -# ============================================================================ -# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html -# ============================================================================ -# -# SYNOPSIS -# -# AX_REQUIRE_STDCXX_11 -# AX_REQUIRE_STDCXX_14 -# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) -# AX_CXX_COMPILE_STDCXX_14([ext|noext],[mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the C++11 -# or C++14 standard; if necessary, add switches to CXXFLAGS to -# enable support. -# -# The first 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 second argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline C++11 support 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_CXX11 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 -# -# 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 3 - -m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [ - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - typedef check> right_angle_brackets; - - int a; - decltype(a) b; - - typedef check check_type; - check_type c; - check_type&& cr = static_cast(c); - - auto d = a; -]) - -AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl - m4_if([$1], [], [], - [$1], [ext], [], - [$1], [noext], [], - [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl - m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], - [$2], [mandatory], [ax_cxx_compile_cxx11_required=true], - [$2], [optional], [ax_cxx_compile_cxx11_required=false], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl - AC_LANG_PUSH([C++])dnl - ac_success=no - AC_CACHE_CHECK(whether $CXX supports C++11 features by default, - ax_cv_cxx_compile_cxx11, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [ax_cv_cxx_compile_cxx11=yes], - [ax_cv_cxx_compile_cxx11=no])]) - if test x$ax_cv_cxx_compile_cxx11 = xyes; then - ac_success=yes - fi - - m4_if([$1], [noext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=gnu++11 -std=gnu++0x; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, - $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes - break - fi - done - fi]) - - m4_if([$1], [ext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=c++11 -std=c++0x; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, - $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx11_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) - fi - else - if test x$ac_success = xno; then - HAVE_CXX11=0 - AC_MSG_NOTICE([No compiler with C++11 support was found]) - else - HAVE_CXX11=1 - AC_DEFINE(HAVE_CXX11,1, - [define if the compiler supports basic C++11 syntax]) - fi - - AC_SUBST(HAVE_CXX11) - fi -]) - -AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [dnl - m4_if([$1], [], [], - [$1], [ext], [], - [$1], [noext], [], - [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_14])])dnl - m4_if([$2], [], [ax_cxx_compile_cxx14_required=true], - [$2], [mandatory], [ax_cxx_compile_cxx14_required=true], - [$2], [optional], [ax_cxx_compile_cxx14_required=false], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_14])])dnl - AC_LANG_PUSH([C++])dnl - ac_success=no - AC_CACHE_CHECK(whether $CXX supports C++14 features by default, - ax_cv_cxx_compile_cxx14, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [ax_cv_cxx_compile_cxx14=yes], - [ax_cv_cxx_compile_cxx14=no])]) - if test x$ax_cv_cxx_compile_cxx14 = xyes; then - ac_success=yes - fi - - m4_if([$1], [noext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=gnu++14 -std=gnu++0y; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch, - $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes - break - fi - done - fi]) - - m4_if([$1], [ext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=c++14 -std=c++0y; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch, - $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx14_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++14 language features is required.]) - fi - else - if test x$ac_success = xno; then - HAVE_CXX14=0 - AC_MSG_NOTICE([No compiler with C++14 support was found]) - AX_CXX_COMPILE_STDCXX_11([$1], [optional]) - else - HAVE_CXX11=1 - HAVE_CXX14=1 - AC_DEFINE(HAVE_CXX14,1, - [define if the compiler supports basic C++14 syntax]) - AC_DEFINE(HAVE_CXX11,1, - [define if the compiler supports basic C++14 syntax]) - fi - AC_SUBST(HAVE_CXX11) - AC_SUBST(HAVE_CXX14) - fi -]) - -AC_DEFUN([AX_REQUIRE_STDCXX_11], [ - if test x${HAVE_CXX11} != x1; then - AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) - fi -]) - -AC_DEFUN([AX_REQUIRE_STDCXX_14], [ - if test x${HAVE_CXX14} != x1; then - AC_MSG_ERROR([*** A compiler with support for C++14 language features is required.]) - fi -]) diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index 39b798c..528841d 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -170,9 +170,11 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ AX_SUBST(NUMBERS) AX_SUBST(HOME) if test -f README.md; then + README_FILE=README.md README=$(tail -n +3 README.md) DESCRIPTION=$(head -1 README.md | sed 's,^#\+ *,,;s, *#\+$,,') else + README_FILE=README README=$(tail -n +3 README) DESCRIPTION=$(head -1 README) fi @@ -182,6 +184,7 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ else README_HTML="${README}" fi + AX_SUBST(README_FILE) AX_SUBST(README) _AM_SUBST_NOTMAKE([README]) AX_SUBST(README_ESCAPED) @@ -329,7 +332,7 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-standard-project-targets], [makefile.in]) test -f makefile.in && cat >> makefile.in <@AUTHOR_NAME@" +ALIASES += "readme=@README_HTML@" +ALIASES += "description=@DESCRIPTION@" +ALIASES += "api=\xrefitem api \"API Call\" \"\"" ALIASES += "mutex=\par Reentrant:\nAccess is locked with mutex @c " ALIASES += "instancemutex=\par Reentrant:\nAccess is locked with per instance mutex @c " ALIASES += "classmutex=\par Reentrant:\nAccess is locked with class static mutex @c " ALIASES += "license=\par License\n" -ALIASES += "copy=\par Copyright\n" +ALIASES += "copy=\par Copyright by @AUTHOR_NAME@\n" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" @@ -266,11 +278,14 @@ OPTIMIZE_OUTPUT_VHDL = NO # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. # -# Note For files without extension you can use no_extension as a placeholder. +# Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. @@ -287,10 +302,19 @@ EXTENSION_MAPPING = MARKDOWN_SUPPORT = YES +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by by putting a % sign in front of the word -# or globally by setting AUTOLINK_SUPPORT to NO. +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = YES @@ -330,13 +354,20 @@ SIP_SUPPORT = NO IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first +# tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = YES +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent @@ -395,7 +426,7 @@ LOOKUP_CACHE_SIZE = 0 # Build related configuration options #--------------------------------------------------------------------------- -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. @@ -405,35 +436,35 @@ LOOKUP_CACHE_SIZE = 0 EXTRACT_ALL = YES -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = YES -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = YES -# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = YES -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = YES -# This flag is only useful for Objective-C code. When set to YES local methods, +# This flag is only useful for Objective-C code. If set to YES, local methods, # which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO only methods in the interface are +# included in the documentation. If set to NO, only methods in the interface are # included. # The default value is: NO. @@ -458,21 +489,21 @@ HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set -# to NO these classes will be included in the various overviews. This option has -# no effect if EXTRACT_ALL is enabled. +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO these declarations will be +# (class|struct|union) declarations. If set to NO, these declarations will be # included in the documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO these +# documentation blocks found inside the body of a function. If set to NO, these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. @@ -486,7 +517,7 @@ HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES upper-case letters are also +# names in lower-case letters. If set to YES, upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. @@ -495,12 +526,19 @@ INTERNAL_DOCS = NO CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES the +# their full class and namespace scopes in the documentation. If set to YES, the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = NO +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. @@ -528,14 +566,14 @@ INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. +# name. If set to NO, the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. Note that +# name. If set to NO, the members will appear in declaration order. Note that # this will also influence the order of the classes in the class list. # The default value is: NO. @@ -580,27 +618,25 @@ SORT_BY_SCOPE_NAME = NO STRICT_PROTO_MATCHING = NO -# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the -# todo list. This list is created by putting \todo commands in the -# documentation. +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. # The default value is: YES. GENERATE_TODOLIST = YES -# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the -# test list. This list is created by putting \test commands in the -# documentation. +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. # The default value is: YES. GENERATE_TESTLIST = YES -# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = YES -# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. @@ -625,8 +661,8 @@ ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES the list -# will mention the files that were used to generate the documentation. +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = YES @@ -674,8 +710,7 @@ LAYOUT_FILE = # to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. Do not use file names with spaces, bibtex cannot handle them. See -# also \cite for info how to create references. +# search path. See also \cite for info how to create references. CITE_BIB_FILES = @@ -691,7 +726,7 @@ CITE_BIB_FILES = QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. @@ -699,7 +734,7 @@ QUIET = NO WARNINGS = YES -# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. @@ -716,12 +751,18 @@ WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return -# value. If set to NO doxygen will only warn about wrong or incomplete parameter -# documentation, but not about the absence of documentation. +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. # The default value is: NO. WARN_NO_PARAMDOC = NO +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated @@ -745,11 +786,12 @@ WARN_LOGFILE = doxygen.errors # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with -# spaces. +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. INPUT = @top_srcdir@/src INPUT += @top_srcdir@/test +INPUT += @top_srcdir@/@README_FILE@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -762,14 +804,19 @@ INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. -FILE_PATTERNS = *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js *.wt +FILE_PATTERNS = *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js *.wt *.sql # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. @@ -800,7 +847,7 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = moc_* uic_* qrc_* +EXCLUDE_PATTERNS = moc_* uic_* qrc_* version.[ch]xx # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -817,14 +864,14 @@ EXCLUDE_SYMBOLS = # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = @top_srcdir@/examples +EXAMPLE_PATH = @top_srcdir@ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. -EXAMPLE_PATTERNS = +EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands @@ -853,6 +900,10 @@ IMAGE_PATH = # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. INPUT_FILTER = @@ -862,11 +913,15 @@ INPUT_FILTER = # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. -FILTER_PATTERNS = *.wt=doxygen-webtester.sed +FILTER_PATTERNS = *.wt=doxygen-webtester.sed *.sql=@top_srcdir@/sql-to-dot.sed # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER ) will also be used to filter the input files that are used for +# INPUT_FILTER) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. @@ -885,7 +940,7 @@ FILTER_SOURCE_PATTERNS = # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = +USE_MDFILE_AS_MAINPAGE = @top_srcdir@/@README_FILE@ #--------------------------------------------------------------------------- # Configuration options related to source browsing @@ -926,7 +981,7 @@ REFERENCED_BY_RELATION = NO REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# to YES then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. @@ -973,6 +1028,25 @@ USE_HTAGS = NO VERBATIM_HEADERS = YES +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -1003,7 +1077,7 @@ IGNORE_PREFIX = # Configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES @@ -1041,7 +1115,7 @@ HTML_FILE_EXTENSION = .html # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_HEADER = +HTML_HEADER = header.html # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard @@ -1051,7 +1125,7 @@ HTML_HEADER = # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_FOOTER = +HTML_FOOTER = footer.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of @@ -1065,16 +1139,18 @@ HTML_FOOTER = HTML_STYLESHEET = -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- -# defined cascading style sheet that is included after the standard style sheets +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefor more robust against future updates. -# Doxygen will copy the style sheet file to the output directory. For an example -# see the documentation. +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_STYLESHEET = +HTML_EXTRA_STYLESHEET = style.css # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note @@ -1087,7 +1163,7 @@ HTML_EXTRA_STYLESHEET = HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the stylesheet and background images according to +# will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see # http://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 @@ -1118,11 +1194,12 @@ HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_TIMESTAMP = YES +HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the @@ -1130,7 +1207,7 @@ HTML_TIMESTAMP = YES # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_DYNAMIC_SECTIONS = NO +HTML_DYNAMIC_SECTIONS = YES # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand @@ -1215,28 +1292,29 @@ GENERATE_HTMLHELP = NO CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# including file name) of the HTML help compiler (hhc.exe). If non-empty, # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = -# The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = -# The BINARY_TOC flag controls whether a binary table of contents is generated ( -# YES) or a normal table of contents ( NO) in the .chm file. +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1349,7 +1427,7 @@ DISABLE_INDEX = NO # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can # further fine-tune the look of the index. As an example, the default style # sheet generated by doxygen has an example that shows how to put an image at # the root of the tree instead of the PROJECT_NAME. Since the tree basically has @@ -1358,7 +1436,7 @@ DISABLE_INDEX = NO # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -GENERATE_TREEVIEW = NO +GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. @@ -1377,7 +1455,7 @@ ENUM_VALUES_PER_LINE = 4 TREEVIEW_WIDTH = 250 -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1406,7 +1484,7 @@ FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. @@ -1476,11 +1554,11 @@ SEARCHENGINE = NO # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a web server instead of a web client using Javascript. There -# are two flavours of web server based searching depending on the -# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for -# searching and an index file used by the script. When EXTERNAL_SEARCH is -# enabled the indexing and searching needs to be provided by external tools. See -# the section "External Indexing and Searching" for details. +# are two flavors of web server based searching depending on the EXTERNAL_SEARCH +# setting. When disabled, doxygen will generate a PHP script for searching and +# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing +# and searching needs to be provided by external tools. See the section +# "External Indexing and Searching" for details. # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1492,7 +1570,7 @@ SERVER_BASED_SEARCH = NO # external search engine pointed to by the SEARCHENGINE_URL option to obtain the # search results. # -# Doxygen ships with an example indexer ( doxyindexer) and search engine +# Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library # Xapian (see: http://xapian.org/). # @@ -1505,7 +1583,7 @@ EXTERNAL_SEARCH = NO # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will return the search results when EXTERNAL_SEARCH is enabled. # -# Doxygen ships with an example indexer ( doxyindexer) and search engine +# Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library # Xapian (see: http://xapian.org/). See the section "External Indexing and # Searching" for details. @@ -1543,7 +1621,7 @@ EXTRA_SEARCH_MAPPINGS = # Configuration options related to the LaTeX output #--------------------------------------------------------------------------- -# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output. +# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. # The default value is: YES. GENERATE_LATEX = NO @@ -1574,7 +1652,7 @@ LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex -# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX +# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX # documents. This may be useful for small projects and may help to save some # trees in general. # The default value is: NO. @@ -1592,9 +1670,12 @@ COMPACT_LATEX = NO PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names -# that should be included in the LaTeX output. To get the times font for -# instance you can specify -# EXTRA_PACKAGES=times +# that should be included in the LaTeX output. The package can be specified just +# by its name or with the correct syntax as to be used with the LaTeX +# \usepackage command. To get the times font for instance you can specify : +# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times} +# To use the option intlimits with the amsmath package you can specify: +# EXTRA_PACKAGES=[intlimits]{amsmath} # If left blank no extra packages will be included. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1608,23 +1689,36 @@ EXTRA_PACKAGES = # # Note: Only use a user-defined header if you know what you are doing! The # following commands have a special meaning inside the header: $title, -# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will -# replace them by respectively the title of the page, the current date and time, -# only the current date, the version number of doxygen, the project name (see -# PROJECT_NAME), or the project number (see PROJECT_NUMBER). +# $datetime, $date, $doxygenversion, $projectname, $projectnumber, +# $projectbrief, $projectlogo. Doxygen will replace $title with the empty +# string, for the replacement values of the other commands the user is referred +# to HTML_HEADER. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the # generated LaTeX document. The footer should contain everything after the last -# chapter. If it is left blank doxygen will generate a standard footer. +# chapter. If it is left blank doxygen will generate a standard footer. See +# LATEX_HEADER for more information on how to generate a default footer and what +# special commands can be used inside the footer. # # Note: Only use a user-defined footer if you know what you are doing! # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_FOOTER = +# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# LaTeX style sheets that are included after the standard style sheets created +# by doxygen. Using this option one can overrule certain style aspects. Doxygen +# will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EXTRA_STYLESHEET = + # The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the LATEX_OUTPUT output # directory. Note that the files will be copied as-is; there are no commands or @@ -1642,8 +1736,8 @@ LATEX_EXTRA_FILES = PDF_HYPERLINKS = YES -# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES to get a +# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate +# the PDF file directly from the LaTeX files. Set this option to YES, to get a # higher quality PDF documentation. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1684,11 +1778,19 @@ LATEX_SOURCE_CODE = NO LATEX_BIB_STYLE = plain +# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_TIMESTAMP = NO + #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- -# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The +# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The # RTF output is optimized for Word 97 and may not look too pretty with other RTF # readers/editors. # The default value is: NO. @@ -1703,7 +1805,7 @@ GENERATE_RTF = NO RTF_OUTPUT = rtf -# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF +# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF # documents. This may be useful for small projects and may help to save some # trees in general. # The default value is: NO. @@ -1740,11 +1842,21 @@ RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = +# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code +# with syntax highlighting in the RTF output. +# +# Note that which sources are shown also depends on other settings such as +# SOURCE_BROWSER. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_SOURCE_CODE = NO + #--------------------------------------------------------------------------- # Configuration options related to the man page output #--------------------------------------------------------------------------- -# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for +# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for # classes and files. # The default value is: NO. @@ -1768,6 +1880,13 @@ MAN_OUTPUT = man MAN_EXTENSION = .3 +# The MAN_SUBDIR tag determines the name of the directory created within +# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by +# MAN_EXTENSION with the initial . removed. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_SUBDIR = + # If the MAN_LINKS tag is set to YES and doxygen generates man output, then it # will generate one additional man file for each entity documented in the real # man page(s). These additional files only source the real man page, but without @@ -1781,7 +1900,7 @@ MAN_LINKS = NO # Configuration options related to the XML output #--------------------------------------------------------------------------- -# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that +# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that # captures the structure of the code including all documentation. # The default value is: NO. @@ -1795,19 +1914,7 @@ GENERATE_XML = NO XML_OUTPUT = xml -# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a -# validating XML parser to check the syntax of the XML files. -# This tag requires that the tag GENERATE_XML is set to YES. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify a XML DTD, which can be used by a -# validating XML parser to check the syntax of the XML files. -# This tag requires that the tag GENERATE_XML is set to YES. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program +# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program # listings (including syntax highlighting and cross-referencing information) to # the XML output. Note that enabling this will significantly increase the size # of the XML output. @@ -1820,7 +1927,7 @@ XML_PROGRAMLISTING = YES # Configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- -# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files +# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files # that can be used to generate PDF. # The default value is: NO. @@ -1834,14 +1941,23 @@ GENERATE_DOCBOOK = NO DOCBOOK_OUTPUT = docbook +# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the +# program listings (including syntax highlighting and cross-referencing +# information) to the DOCBOOK output. Note that enabling this will significantly +# increase the size of the DOCBOOK output. +# The default value is: NO. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_PROGRAMLISTING = NO + #--------------------------------------------------------------------------- # Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- -# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen -# Definitions (see http://autogen.sf.net) file that captures the structure of -# the code including all documentation. Note that this feature is still -# experimental and incomplete at the moment. +# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an +# AutoGen Definitions (see http://autogen.sf.net) file that captures the +# structure of the code including all documentation. Note that this feature is +# still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO @@ -1850,7 +1966,7 @@ GENERATE_AUTOGEN_DEF = NO # Configuration options related to the Perl module output #--------------------------------------------------------------------------- -# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module +# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module # file that captures the structure of the code including all documentation. # # Note that this feature is still experimental and incomplete at the moment. @@ -1858,7 +1974,7 @@ GENERATE_AUTOGEN_DEF = NO GENERATE_PERLMOD = NO -# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary +# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary # Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI # output from the Perl module output. # The default value is: NO. @@ -1866,9 +1982,9 @@ GENERATE_PERLMOD = NO PERLMOD_LATEX = NO -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely +# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely # formatted so it can be parsed by a human reader. This is useful if you want to -# understand what is going on. On the other hand, if this tag is set to NO the +# understand what is going on. On the other hand, if this tag is set to NO, the # size of the Perl module output will be much smaller and Perl will parse it # just the same. # The default value is: YES. @@ -1888,14 +2004,14 @@ PERLMOD_MAKEVAR_PREFIX = # Configuration options related to the preprocessor #--------------------------------------------------------------------------- -# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all +# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all # C-preprocessor directives found in the sources and include files. # The default value is: YES. ENABLE_PREPROCESSING = YES -# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names -# in the source code. If set to NO only conditional compilation will be +# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names +# in the source code. If set to NO, only conditional compilation will be # performed. Macro expansion can be done in a controlled way by setting # EXPAND_ONLY_PREDEF to YES. # The default value is: NO. @@ -1911,7 +2027,7 @@ MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = NO -# If the SEARCH_INCLUDES tag is set to YES the includes files in the +# If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. @@ -1954,9 +2070,9 @@ PREDEFINED += "NAMESPACE=@PACKAGE_NAME@" EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will -# remove all refrences to function-like macros that are alone on a line, have an -# all uppercase name, and do not end with a semicolon. Such function macros are -# typically used for boiler-plate code, and will confuse the parser if not +# remove all references to function-like macros that are alone on a line, have +# an all uppercase name, and do not end with a semicolon. Such function macros +# are typically used for boiler-plate code, and will confuse the parser if not # removed. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. @@ -1976,7 +2092,7 @@ SKIP_FUNCTION_MACROS = YES # where loc1 and loc2 can be relative or absolute paths or URLs. See the # section "Linking to external documentation" for more information about the use # of tag files. -# Note: Each tag file must have an unique name (where the name does NOT include +# Note: Each tag file must have a unique name (where the name does NOT include # the path). If a tag file is not located in the directory in which doxygen is # run, you must also specify the path to the tagfile here. @@ -1988,20 +2104,21 @@ TAGFILES = GENERATE_TAGFILE = @PACKAGE_NAME@.doxytag -# If the ALLEXTERNALS tag is set to YES all external class will be listed in the -# class index. If set to NO only the inherited external classes will be listed. +# If the ALLEXTERNALS tag is set to YES, all external class will be listed in +# the class index. If set to NO, only the inherited external classes will be +# listed. # The default value is: NO. ALLEXTERNALS = NO -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in -# the modules index. If set to NO, only the current project's groups will be +# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will be # listed. # The default value is: YES. EXTERNAL_GROUPS = YES -# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in +# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in # the related pages index. If set to NO, only the current project's pages will # be listed. # The default value is: YES. @@ -2018,7 +2135,7 @@ PERL_PATH = /usr/bin/perl # Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram +# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram # (in HTML and LaTeX) for classes with base or super classes. Setting the tag to # NO turns the diagrams off. Note that this option also works with HAVE_DOT # disabled, but it is recommended to install and use dot, since it yields more @@ -2043,7 +2160,7 @@ MSCGEN_PATH = DIA_PATH = -# If set to YES, the inheritance and collaboration graphs will hide inheritance +# If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. @@ -2054,7 +2171,7 @@ HIDE_UNDOC_RELATIONS = NO # http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO -# The default value is: NO. +# The default value is: YES. HAVE_DOT = YES @@ -2068,7 +2185,7 @@ HAVE_DOT = YES DOT_NUM_THREADS = 0 -# When you want a differently looking font n the dot files that doxygen +# When you want a differently looking font in the dot files that doxygen # generates you can specify the font name using DOT_FONTNAME. You need to make # sure dot is able to find the font, which can be done by putting it in a # standard location or by setting the DOTFONTPATH environment variable or by @@ -2116,7 +2233,7 @@ COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. # The default value is: NO. @@ -2168,7 +2285,8 @@ INCLUDED_BY_GRAPH = YES # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. +# functions only using the \callgraph command. Disabling a call graph can be +# accomplished by means of the command \hidecallgraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2179,7 +2297,8 @@ CALL_GRAPH = NO # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. +# functions only using the \callergraph command. Disabling a caller graph can be +# accomplished by means of the command \hidecallergraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2202,11 +2321,17 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. +# generated by dot. For an explanation of the image formats see the section +# output formats in the documentation of the dot tool (Graphviz (see: +# http://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). -# Possible values are: png, jpg, gif and svg. +# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd, +# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo, +# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo, +# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and +# png:gdiplus:gdiplus. # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2249,6 +2374,24 @@ MSCFILE_DIRS = DIAFILE_DIRS = +# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the +# path where java can find the plantuml.jar file. If left blank, it is assumed +# PlantUML is not used or called during a preprocessing step. Doxygen will +# generate a warning when it encounters a \startuml command in this case and +# will not generate output for the diagram. + +PLANTUML_JAR_PATH = "@top_srcdir@/doc/plantuml.jar" + +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + +# When using plantuml, the specified paths are searched for files specified by +# the !include statement in a plantuml block. + +PLANTUML_INCLUDE_PATH = + # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes # that will be shown in the graph. If the number of nodes in a graph becomes # larger than this value, doxygen will truncate the graph, which is visualized @@ -2285,14 +2428,14 @@ MAX_DOT_GRAPH_DEPTH = 0 DOT_TRANSPARENT = YES -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support # this, this feature is disabled by default. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_MULTI_TARGETS = YES +DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated @@ -2302,7 +2445,7 @@ DOT_MULTI_TARGETS = YES GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot # files that are used to generate the various graphs. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. diff --git a/doc/makefile.am b/doc/makefile.am index 631e906..6bce79b 100644 --- a/doc/makefile.am +++ b/doc/makefile.am @@ -1,48 +1,11 @@ -## @file +## @id $Id$ ## -## $Id: makefile.am 10 2009-06-17 12:15:51Z marwae $ +## This file has been added: +## - by bootstrap.sh +## - on Wed, 21 November 2018 16:05:22 +0100 +## Feel free to change it or even remove and rebuild it, up to your needs ## ## 1 2 3 4 5 6 7 8 ## 45678901234567890123456789012345678901234567890123456789012345678901234567890 -ALL_SRC = $(shell find ${top_srcdir}/examples ${top_srcdir}/src \ - -name '*.[ch]xx') -# ${top_srcdir}/src/*.doc - -DIRS = html -#latex - -all: ${DIRS} - -.PHONY: doc clean-local distclean-local dist-hool install-data-hook \ - uninstall-hook - -deps = ${top_srcdir}/COPYING ${top_srcdir}/README \ - ${top_srcdir}/INSTALL ${top_srcdir}/NEWS ${top_srcdir}/ChangeLog - -html: ${ALL_SRC} doxyfile ${deps} - doxygen doxyfile -if PEDANTIC - test \! -s doxygen.errors -endif -# cd latex && make -# mv latex/refman.pdf @PACKAGE_NAME@-@PACKAGE_VERSION@.pdf - -CLEANFILES = doxygen.errors @PACKAGE_NAME@-@PACKAGE_VERSION@.pdf -DISTCLEANFILES = @PACKAGE_NAME@.doxytag debug.txt MAINTAINERCLEANFILES = makefile.in - -distclean-local: - - rm -r html latex - -dist-hook: html -# cp -r html latex ${distdir}/ - -install-data-hook: - test -d $(DESTDIR)${docdir} || mkdir -p $(DESTDIR)${docdir} - chmod -R u+w $(DESTDIR)${docdir} - cp -r html $(DESTDIR)${docdir}/ - -uninstall-hook: - -chmod -R u+w $(DESTDIR)${docdir} - -rm -rf $(DESTDIR)${docdir}/html diff --git a/examples/exceptionhandling.cxx b/examples/exceptionhandling.cxx index 460839d..0735dc3 100644 --- a/examples/exceptionhandling.cxx +++ b/examples/exceptionhandling.cxx @@ -20,19 +20,19 @@ void unexpectedHandler() { throw std::bad_exception(); // try to recover } -void fn2() throw(std::bad_exception) { +void fn2() { std::cout<<"enter fn2"<>_i)) throw mrw::bad_cast(); } const mrw::SmartPointer& Param::operator[](unsigned int i) const - throw(std::exception) { + { if (i<_params.size()) return _params[i]; throw mrw::out_of_range (((std::stringstream&) @@ -60,7 +60,7 @@ namespace mrw { } mrw::SmartPointer& Param::setable(unsigned int i) - throw(std::exception) { + { if (i<_params.size()) return _params[i]; throw mrw::out_of_range (((std::stringstream&) @@ -68,7 +68,7 @@ namespace mrw { <second; } - const Opt& Args::find(const std::string& s) const throw(std::exception) { + const Opt& Args::find(const std::string& s) const { LongOpts::const_iterator it(_longopts.find(s)); if (it==_longopts.end()) throw mrw::out_of_range(s); return *it->second; } Args& Args::parse(int argc, char const*const*const argv) - throw(std::exception) { + { if (argc>0) _filename = argv[0]; for (int i(1); isecond; } mrw::ConfigFileReader& mrw::ConfigFileReader::load(const std::string& filename) - throw(std::exception) { + { _filename = filename; return reload(); } -mrw::ConfigFileReader& mrw::ConfigFileReader::reload() throw(std::exception) { +mrw::ConfigFileReader& mrw::ConfigFileReader::reload() { return parse(mrw::File::read(_filename)); } mrw::ConfigFileReader& mrw::ConfigFileReader::parse(const std::string& file) - throw(std::exception) { + { _values.erase(_values.begin(), _values.end()); std::string section; for (std::string::size_type pos(0); @@ -66,7 +66,7 @@ mrw::ConfigFileReader& mrw::ConfigFileReader::parse(const std::string& file) std::string mrw::ConfigFileReader::parseSection(const std::string& file, std::string::size_type& pos) - const throw(std::exception) { + const { std::string::size_type start(pos); if ((pos=file.find(']', pos))==std::string::npos) throw mrw::invalid_argument @@ -78,7 +78,7 @@ std::string mrw::ConfigFileReader::parseSection(const std::string& file, mrw::ConfigFileReader::Values::mapped_type::value_type mrw::ConfigFileReader::parseValue(const std::string& file, std::string::size_type& pos) - const throw(std::exception) { + const { // find the begin of the variable name std::string::size_type startName(file.rfind('\n', pos)); if (startName==std::string::npos) startName=0; @@ -119,7 +119,7 @@ mrw::ConfigFileReader::parseValue(const std::string& file, std::string mrw::ConfigFileReader::parseComment(const std::string& file, std::string::size_type& pos) - const throw(std::bad_exception) { + const { std::string::size_type start(pos); pos = file.find('\n', pos); return file.substr(start, pos-start); @@ -131,7 +131,7 @@ mrw::ConfigFileReader& #else mrw::ConfigFileWriter& #endif -mrw::ConfigFileWriter::reload() throw(std::exception) { +mrw::ConfigFileWriter::reload() { #if __GNUC__ == 3 && __GNUC_MINOR__ < 4 return parse(_file=mrw::File::read(_filename)); #else @@ -140,7 +140,7 @@ mrw::ConfigFileWriter::reload() throw(std::exception) { #endif } -mrw::ConfigFileWriter& mrw::ConfigFileWriter::save() throw(std::exception) { +mrw::ConfigFileWriter& mrw::ConfigFileWriter::save() { if (_filename=="") return *this; // work in changes bool changed(false); diff --git a/src/errno.cxx b/src/errno.cxx index 9e75edd..23f8b51 100644 --- a/src/errno.cxx +++ b/src/errno.cxx @@ -28,13 +28,13 @@ #include #include -mrw::Errno::Errno() throw(): _errnoxxx(errno) {} +mrw::Errno::Errno() noexcept: _errnoxxx(errno) {} -mrw::Errno::operator std::string() const throw(std::bad_exception) { +mrw::Errno::operator std::string() const { return *this; } -std::string mrw::Errno::string() const throw(std::bad_exception) { +std::string mrw::Errno::string() const { char* pos(0); char error[1024]; #ifdef __GLIBC__ diff --git a/src/exception.cxx b/src/exception.cxx index fddba33..13201e4 100644 --- a/src/exception.cxx +++ b/src/exception.cxx @@ -31,19 +31,19 @@ namespace mrw { class StackTrace { public: - operator std::string() throw() {return "";} + operator std::string() noexcept {return "";} }; } #endif namespace mrw { - exception::exception() throw(std::bad_exception): + exception::exception() : _stacktrace(new StackTrace) { } - exception::~exception() throw() { + exception::~exception() noexcept { delete _stacktrace; } - const std::string& exception::stacktrace() const throw(std::bad_exception) { + const std::string& exception::stacktrace() const { static const std::string st(*_stacktrace); return st; } diff --git a/src/exec.cxx b/src/exec.cxx index a14c5d8..a67c9bd 100644 --- a/src/exec.cxx +++ b/src/exec.cxx @@ -69,7 +69,7 @@ //------------------------------------------------------------------------------ mrw::ExecutionFailedExc::ExecutionFailedExc(const std::string& w, const std::string& c) - throw(std::bad_exception): + : _what(std::string("mrw::Exec: command execution failed\n")+ std::string(" failed command was: \""+c+"\"\n")+ std::string(" error was: \"")+w+'"') { @@ -86,26 +86,26 @@ mrw::ExecutionFailedExc::ExecutionFailedExc(const std::string& w, //========================================================================== Cmd //------------------------------------------------------------------------------ -mrw::Cmd::Cmd(const std::string& c) throw(std::bad_exception) { +mrw::Cmd::Cmd(const std::string& c) { _cmd.push_back(c); } //------------------------------------------------------------------------------ mrw::Cmd& mrw::Cmd::operator,(const std::string& arg) - throw(std::bad_exception) { + { _cmd.push_back(arg); return *this; } //------------------------------------------------------------------------------ mrw::Cmd& mrw::Cmd::operator<<(const std::string& arg) - throw(std::bad_exception) { + { _cmd.push_back(arg); return *this; } //------------------------------------------------------------------------------ -mrw::Cmd::operator std::string() const throw(std::bad_exception) { +mrw::Cmd::operator std::string() const { ArgList::const_iterator it(_cmd.begin()); std::string c(*it); while (++it!=_cmd.end()) c+=' '+*it; @@ -113,38 +113,38 @@ mrw::Cmd::operator std::string() const throw(std::bad_exception) { } //------------------------------------------------------------------------------ -mrw::Cmd::operator mrw::Exec() const throw(std::bad_exception) { +mrw::Cmd::operator mrw::Exec() const { return mrw::Exec(*this); } //------------------------------------------------------------------------------ -mrw::Cmd::operator mrw::PartialExec() const throw(std::bad_exception) { +mrw::Cmd::operator mrw::PartialExec() const { return mrw::PartialExec(*this); } //------------------------------------------------------------------------------ -mrw::Exec mrw::Cmd::execute(bool exc) const throw(std::exception) { +mrw::Exec mrw::Cmd::execute(bool exc) const { return mrw::Exec(*this).execute(exc); } //------------------------------------------------------------------------------ mrw::Exec mrw::Cmd::execute(const std::string& input, bool exc) const - throw(std::exception) { + { return mrw::Exec(*this).execute(input, exc); } //------------------------------------------------------------------------------ -mrw::PartialExec mrw::Cmd::start(bool useInput) const throw(std::exception) { +mrw::PartialExec mrw::Cmd::start(bool useInput) const { return mrw::PartialExec(*this).start(useInput); } //------------------------------------------------------------------------------ -const char* mrw::Cmd::path() const throw(std::bad_exception) { +const char* mrw::Cmd::path() const { return _cmd.front().c_str(); } //------------------------------------------------------------------------------ -char** mrw::Cmd::args() const throw(std::bad_exception) { +char** mrw::Cmd::args() const { if (_cmd.size()==0) return 0; char** array = new char*[_cmd.size()+1]; int i(0); @@ -157,30 +157,30 @@ char** mrw::Cmd::args() const throw(std::bad_exception) { //========================================================================= Exec //------------------------------------------------------------------------------ -mrw::Exec::Exec(const mrw::Cmd& c) throw(std::bad_exception): +mrw::Exec::Exec(const mrw::Cmd& c) : _cmd(new mrw::Cmd(c)), _success(false) { } //------------------------------------------------------------------------------ -mrw::Exec::Exec(const mrw::Exec& e) throw(std::bad_exception): +mrw::Exec::Exec(const mrw::Exec& e) : _cmd(new mrw::Cmd(*e._cmd)), _res(e._res), _err(e._err), _success(e._success) { } //------------------------------------------------------------------------------ -mrw::Exec::~Exec() throw() { +mrw::Exec::~Exec() noexcept { delete _cmd; } //------------------------------------------------------------------------------ -mrw::Exec& mrw::Exec::operator=(const mrw::Exec& e) throw(std::bad_exception) { +mrw::Exec& mrw::Exec::operator=(const mrw::Exec& e) { if (this==&e) return *this; *_cmd=*e._cmd; _res=e._res; _err=e._err; _success=e._success; return *this; } //------------------------------------------------------------------------------ -mrw::Exec& mrw::Exec::execute(bool exc) throw(std::exception) { +mrw::Exec& mrw::Exec::execute(bool exc) { /** This method calls @c fork, sets up a pipe connection to pass @c stdout and @c stderr from the child process to the parent process using mrw::Pipe and calls @c execvp to execute the @@ -250,7 +250,7 @@ mrw::Exec& mrw::Exec::execute(bool exc) throw(std::exception) { //------------------------------------------------------------------------------ mrw::Exec& mrw::Exec::execute(const std::string& input, bool exc) - throw(std::exception) { + { #ifdef SSIZE_MAX /// @c input length must be smaller than @c SSIZE_MAX. /// I'll only add support for longer strings upon request. @@ -342,50 +342,50 @@ mrw::Exec& mrw::Exec::execute(const std::string& input, bool exc) } //------------------------------------------------------------------------------ -mrw::Exec& mrw::Exec::operator>>(std::string& res) throw(std::exception) { +mrw::Exec& mrw::Exec::operator>>(std::string& res) { execute(); res += _res; return *this; } //------------------------------------------------------------------------------ -mrw::Exec::operator std::string&() throw(std::exception) { +mrw::Exec::operator std::string&() { if (!_success) execute(); return _res; } //------------------------------------------------------------------------------ -mrw::Exec::operator bool() throw(std::bad_exception) { +mrw::Exec::operator bool() { return _success; } //------------------------------------------------------------------------------ -std::string& mrw::Exec::result() throw(std::exception) { +std::string& mrw::Exec::result() { if (!_success) execute(); return _res; } //------------------------------------------------------------------------------ -std::string& mrw::Exec::error() throw(std::exception) { +std::string& mrw::Exec::error() { if (!_success) execute(); return _err; } //------------------------------------------------------------------------------ -bool mrw::Exec::success() throw(std::bad_exception) { +bool mrw::Exec::success() { return _success; } //================================================================== PartialExec //------------------------------------------------------------------------------ -mrw::PartialExec::PartialExec(const mrw::Cmd& c) throw(std::bad_exception): +mrw::PartialExec::PartialExec(const mrw::Cmd& c) : Exec(c), _finished(true), _finish(false) { } //------------------------------------------------------------------------------ mrw::PartialExec::PartialExec(mrw::PartialExec& e) - throw(std::bad_exception): + : Exec(e), _finished(e._finished), _finish(e._finish), _stdIn(e._stdIn), _stdOut(e._stdOut), _stdErr(e._stdErr), _input(e._input), _num0(e._num0), _num1(e._num1), _num2(e._num2), @@ -395,7 +395,7 @@ mrw::PartialExec::PartialExec(mrw::PartialExec& e) //------------------------------------------------------------------------------ mrw::PartialExec::PartialExec(const mrw::PartialExec& e) - throw(std::bad_exception): + : Exec(e), _finished(e._finished), _finish(e._finish), _input(e._input), _num0(e._num0), _num1(e._num1), _num2(e._num2), @@ -411,7 +411,7 @@ mrw::PartialExec::PartialExec(const mrw::PartialExec& e) //------------------------------------------------------------------------------ mrw::PartialExec& mrw::PartialExec::operator=(mrw::PartialExec& e) - throw(std::bad_exception) { + { if (this==&e) return *this; *_cmd=*e._cmd; _res=e._res; _err=e._err; _success=e._success; _finished = e._finished; @@ -426,19 +426,19 @@ mrw::PartialExec& mrw::PartialExec::operator=(mrw::PartialExec& e) } //------------------------------------------------------------------------------ -mrw::PartialExec& mrw::PartialExec::finish() throw() { +mrw::PartialExec& mrw::PartialExec::finish() noexcept { _finish = true; return *this; } //------------------------------------------------------------------------------ -bool mrw::PartialExec::finished() throw() { +bool mrw::PartialExec::finished() noexcept { return _finished; } //------------------------------------------------------------------------------ mrw::PartialExec& mrw::PartialExec::start(bool useInput) - throw(std::exception) { + { if (!_finished) throw mrw::runtime_error("running process not yet finished"); /** This method calls @c fork, sets up a pipe connection to pass @c stdin, @c stdout and @c stderr between the child process and the @@ -481,7 +481,7 @@ mrw::PartialExec& mrw::PartialExec::start(bool useInput) //------------------------------------------------------------------------------ std::pair mrw::PartialExec::read(const std::string& input, bool exc) - throw(std::exception) { + { std::pair output; #ifdef SSIZE_MAX /** @note @c input length must be smaller than @c SSIZE_MAX. @@ -557,13 +557,13 @@ std::pair } //------------------------------------------------------------------------------ -mrw::PartialExec& mrw::PartialExec::terminate() throw() { +mrw::PartialExec& mrw::PartialExec::terminate() noexcept { ::kill(_pid, SIGTERM); return *this; } //------------------------------------------------------------------------------ -mrw::PartialExec& mrw::PartialExec::kill() throw() { +mrw::PartialExec& mrw::PartialExec::kill() noexcept { ::kill(_pid, SIGKILL); return *this; } diff --git a/src/mrw/arg.hxx b/src/mrw/arg.hxx index 73205fe..9541414 100644 --- a/src/mrw/arg.hxx +++ b/src/mrw/arg.hxx @@ -223,14 +223,14 @@ namespace mrw { @throw mrw::bad_cast if the instance is not a string @return the string, if the instance is a string */ - virtual const std::string& toString() const throw(std::exception); + virtual const std::string& toString() const ; /** @brief If the instance is an @c int, return that integer, otherwise throw an exception. @throw mrw::bad_cast if the instance is not a integer @return the integer, if the instance is a integer */ - virtual int toInt() const throw(std::exception); + virtual int toInt() const ; /** @brief If the instance is an @c bool, return that boolean, otherwise throw an exception. @@ -242,19 +242,19 @@ namespace mrw { @throw mrw::bad_cast if the instance is not a boolean @return the boolean, if the instance is a boolean */ - virtual bool toBool() const throw(std::exception); + virtual bool toBool() const ; /// @brief returns a printable representation of the value - virtual std::string printable() const throw(std::bad_exception) = 0; + virtual std::string printable() const = 0; /// @brief returns a printable typename of the value - virtual const std::string& typestr() const throw(std::bad_exception)=0; + virtual const std::string& typestr() const =0; protected: /// Allow assign for Args, make it a friend. friend class Args; /// Only the class itself and friends (Args) are allowed to assign. - virtual void operator=(const std::string&) throw(std::exception) = 0; + virtual void operator=(const std::string&) = 0; }; private: @@ -262,20 +262,20 @@ namespace mrw { class StringValue: public Value { public: virtual ~StringValue() {} - StringValue(const std::string& s) throw(std::bad_exception): _s(s) { + StringValue(const std::string& s) : _s(s) { } - virtual const std::string& toString() const throw(std::exception) { + virtual const std::string& toString() const { return _s; } - virtual const std::string& typestr() const throw(std::bad_exception) { + virtual const std::string& typestr() const { static std::string name("string"); return name; } - virtual std::string printable() const throw(std::bad_exception) { + virtual std::string printable() const { return _s; } protected: - virtual void operator=(const std::string& s) throw(std::exception) { + virtual void operator=(const std::string& s) { _s = s; } private: @@ -285,20 +285,20 @@ namespace mrw { class IntValue: public Value { public: virtual ~IntValue() {} - IntValue(int i) throw(std::bad_exception): _i(i) { + IntValue(int i) : _i(i) { } - virtual int toInt() const throw(std::exception) { + virtual int toInt() const { return _i; } - virtual const std::string& typestr() const throw(std::bad_exception) { + virtual const std::string& typestr() const { static std::string name("integer"); return name; } - virtual std::string printable() const throw(std::bad_exception) { + virtual std::string printable() const { return ((std::stringstream&)(std::stringstream()<<_i)).str(); } protected: - virtual void operator=(const std::string& s) throw(std::exception); + virtual void operator=(const std::string& s) ; private: int _i; }; @@ -306,20 +306,20 @@ namespace mrw { class BoolValue: public Value { public: virtual ~BoolValue() {} - BoolValue(bool b) throw(std::bad_exception): _b(b) { + BoolValue(bool b) : _b(b) { } - virtual bool toBool() const throw(std::exception) { + virtual bool toBool() const { return _b; } - virtual const std::string& typestr() const throw(std::bad_exception) { + virtual const std::string& typestr() const { static std::string name("boolean (\"yes\" or \"no\")"); return name; } - virtual std::string printable() const throw(std::bad_exception) { + virtual std::string printable() const { return _b?"yes":"no"; } protected: - virtual void operator=(const std::string& s) throw(std::exception) { + virtual void operator=(const std::string& s) { _b = s=="true" || s=="yes" || s=="on"; } private: @@ -332,30 +332,30 @@ namespace mrw { public: /// @brief returns the number of (mandatory) parameter - Params::size_type size() const throw(std::bad_exception) { + Params::size_type size() const { return _params.size(); } /// @brief add one more mandatory string parameter - Param& operator<<(char const*const s) throw(std::bad_exception) { + Param& operator<<(char const*const s) { _params.push_back(new StringValue(s)); return *this; } /// @brief add one more mandatory string parameter - Param& operator<<(const std::string& s) throw(std::bad_exception) { + Param& operator<<(const std::string& s) { _params.push_back(new StringValue(s)); return *this; } /// @brief add one more mandatory integer parameter - Param& operator<<(int i) throw(std::bad_exception) { + Param& operator<<(int i) { _params.push_back(new IntValue(i)); return *this; } // @brief add one more mandatory boolean parameter - Param& operator<<(bool b) throw(std::bad_exception) { + Param& operator<<(bool b) { _params.push_back(new BoolValue(b)); return *this; } @@ -363,7 +363,7 @@ namespace mrw { /** @brief get parameter number @c i @throw mrw::out_of_range if @c i is too big */ const mrw::SmartPointer& operator[](unsigned int i) const - throw(std::exception); + ; private: @@ -371,7 +371,7 @@ namespace mrw { friend class Args; // allow set /// Get a parameter with acces right for setting. /// This is allowed for the class itself and friends (Args) only. - mrw::SmartPointer& setable(unsigned int i) throw(std::exception); + mrw::SmartPointer& setable(unsigned int i) ; }; /** @brief this class represents one command line option @@ -399,7 +399,7 @@ namespace mrw { */ Opt(const char shortname, const std::string& longname, const Param& param, const std::string& helptext) - throw(std::bad_exception): + : _set(false), _shortname(shortname), _longname(longname), _param(param), _help(helptext) { } @@ -414,13 +414,13 @@ namespace mrw { @param helptext the help string for this option */ Opt(const char shortname, const std::string& longname, - const std::string& helptext) throw(std::bad_exception): + const std::string& helptext) : _set(false), _shortname(shortname), _longname(longname), _help(helptext) { } /** @brief get the help text for this option */ - const std::string& help() const throw(std::bad_exception) { + const std::string& help() const { return _help; } @@ -438,7 +438,7 @@ namespace mrw { - @c true if the user has started the program with this option - @c false if the user has not set this option */ - operator bool() const throw(std::bad_exception) {return _set;} + operator bool() const {return _set;} /** @brief get one of the additional parameter @@ -449,7 +449,7 @@ namespace mrw { @return a smart pointer to the value (default or given by the user) */ const mrw::SmartPointer& operator[](unsigned int i) const - throw(std::exception) { + { return _param[i]; } @@ -458,10 +458,10 @@ namespace mrw { /// Allow set values, make Args a friend. friend class Args; /// Set @c _set to true, available only for friends (Args). - void set() const throw(std::bad_exception) { + void set() const { _set = true; } - Param& args() const throw(std::bad_exception) { + Param& args() const { return _param; } mutable bool _set; @@ -497,7 +497,7 @@ namespace mrw { typedef std::list OtherArgs; /// @brief get the one and only instance - static Args& instance() throw(std::bad_exception) { // singleton + static Args& instance() { // singleton static Args _instance; return _instance; } @@ -519,7 +519,7 @@ namespace mrw { @throw mrw::out_of_range if the parameter is not available (this would be a coding error) */ - static bool have(char c) throw(std::exception) { + static bool have(char c) { return mrw::Args::instance().find(c); } @@ -540,7 +540,7 @@ namespace mrw { @throw mrw::bad_cast if the parameter is not a string @throw mrw::out_of_range if the parameter is empty or not available */ - static const std::string& toString(char c) throw(std::exception) { + static const std::string& toString(char c) { return mrw::Args::instance().find(c)[0]->toString(); } @@ -561,7 +561,7 @@ namespace mrw { @throw mrw::bad_cast if the parameter is not an int @throw mrw::out_of_range if the parameter is empty or not available */ - static int toInt(char c) throw(std::exception) { + static int toInt(char c) { return mrw::Args::instance().find(c)[0]->toInt(); } @@ -582,7 +582,7 @@ namespace mrw { @throw mrw::bad_cast if the parameter is not an bool @throw mrw::out_of_range if the parameter is empty or not available */ - static bool toBool(char c) throw(std::exception) { + static bool toBool(char c) { return mrw::Args::instance().find(c)[0]->toBool(); } @@ -604,7 +604,7 @@ namespace mrw { @throw mrw::bad_cast if the parameter is not a string @throw mrw::out_of_range if the parameter is not available */ - static const std::string& toString(char c, int n) throw(std::exception) { + static const std::string& toString(char c, int n) { return mrw::Args::instance().find(c)[n]->toString(); } @@ -626,7 +626,7 @@ namespace mrw { @throw mrw::bad_cast if the parameter is not an int @throw mrw::out_of_range if the parameter is not available */ - static int toInt(char c, int n) throw(std::exception) { + static int toInt(char c, int n) { return mrw::Args::instance().find(c)[n]->toInt(); } @@ -648,7 +648,7 @@ namespace mrw { @throw mrw::bad_cast if the parameter is not an bool @throw mrw::out_of_range if the parameter not available */ - static bool toBool(char c, int n) throw(std::exception) { + static bool toBool(char c, int n) { return mrw::Args::instance().find(c)[n]->toBool(); } @@ -665,7 +665,7 @@ namespace mrw { @throw mrw::invalid_argument if opt is not setup correctly */ - Args& operator<<(const mrw::Opt& opt) throw(std::exception); + Args& operator<<(const mrw::Opt& opt) ; /** @brief setup the number of arguments @@ -681,7 +681,7 @@ namespace mrw { } @endcode */ - Args& operator<<(int argc) throw(std::bad_exception) { + Args& operator<<(int argc) { _argc = argc; return *this; } @@ -700,7 +700,7 @@ namespace mrw { } @endcode */ - Args& operator<<(char const*const*const argv) throw(std::exception); + Args& operator<<(char const*const*const argv) ; /** @brief add a description text @@ -715,7 +715,7 @@ namespace mrw { mrw::Args::instance()<<"this is a description for --help"; @endcode */ - Args& operator<<(const std::string& description) throw(std::exception) { + Args& operator<<(const std::string& description) { if (_description=="") _description = description; else @@ -737,7 +737,7 @@ namespace mrw { mrw::Args::instance()<<'h'; @endcode */ - Args& operator<<(char helpopt) throw(std::exception) { + Args& operator<<(char helpopt) { _help = helpopt; return *this; } @@ -745,12 +745,12 @@ namespace mrw { /** @brief get an option, given the short option name @throw mrw::out_of_range if the option does not exist */ - const Opt& find(char c) const throw(std::exception); + const Opt& find(char c) const ; /** @brief get an option, given the long option name @throw mrw::out_of_range if the option does not exist */ - const Opt& find(const std::string& s) const throw(std::exception); + const Opt& find(const std::string& s) const ; /** @brief get all non interpreted options @@ -763,7 +763,7 @@ namespace mrw { } /** @brief get the file name of the executable, that's @c argv[0] */ - const std::string& filename() throw(std::bad_exception) { + const std::string& filename() { return _filename; } @@ -793,7 +793,7 @@ namespace mrw { private: Args(): _argc(-1), _help(0) {} // singleton Args& operator=(const Args&); // singleton, not implemented - Args& parse(int argc, char const*const*const argv) throw(std::exception); + Args& parse(int argc, char const*const*const argv) ; typedef std::list Options; typedef std::map ShortOpts; typedef std::map LongOpts; diff --git a/src/mrw/args.hxx b/src/mrw/args.hxx index 38db916..b50030e 100644 --- a/src/mrw/args.hxx +++ b/src/mrw/args.hxx @@ -37,7 +37,7 @@ const std::string MRW_WHAT("#(@)" PACKAGE_NAME "-" PACKAGE_VERSION); namespace mrw { /// Cool and easy evaluation of commandline arguments in C++11. /** Evaluating command line arguments is extremely easy with this library: - @begincode + @code void test_func(); // bound to option --test int main(int argc, char** argv) try { diff --git a/src/mrw/auto.hxx b/src/mrw/auto.hxx index 0504d38..c0c96ee 100644 --- a/src/mrw/auto.hxx +++ b/src/mrw/auto.hxx @@ -109,10 +109,10 @@ namespace mrw { /// The resource is freed if necessary. /// AutoResource takes over ownership of the resource. explicit AutoResource(FREE_TYPE res = INITIAL_VALUE) - throw(std::bad_exception): _res((RESOURCE_TYPE)res) { + : _res((RESOURCE_TYPE)res) { } /// @brief Takeover ownership from another AutoResource. - AutoResource(AutoResource& o) throw(std::bad_exception): + AutoResource(AutoResource& o) : _res(o.release()) { } //! @brief Do not use this method! @@ -120,51 +120,51 @@ namespace mrw { //! @c operator[] first creates an empty element, then assigns it //! the real value. Because that empty element is temporary, gcc can //! not use @c AutoResource(AutoResource&) since release 4.0. - AutoResource(const AutoResource& o) throw(std::bad_exception): + AutoResource(const AutoResource& o) : _res(INITIAL_VALUE) { assert(o._res==INITIAL_VALUE); if (o._res!=INITIAL_VALUE) _res = const_cast(o).release(); } /// @brief Free resource. Calls @c reset(). - ~AutoResource() throw(std::bad_exception) {reset();} + ~AutoResource() {reset();} /// @brief Assign new resource. Calls @c reset(). /// The resource is freed if necessary. - AutoResource& operator=(RESOURCE_TYPE res) throw(std::bad_exception) { + AutoResource& operator=(RESOURCE_TYPE res) { return reset(res); } /// @brief Takeover ownership from another AutoResource. /// Calls @c reset() from @c this and @c release() from @c other. - AutoResource& operator=(AutoResource& other) throw(std::bad_exception) { + AutoResource& operator=(AutoResource& other) { return reset(other.release()); } /// @brief Get the resource. - operator const RESOURCE_TYPE&() const throw(std::bad_exception) { + operator const RESOURCE_TYPE&() const { return _res; } /// @brief find out, if a value is set /// @return @c true: resource is valid - operator bool() const throw(std::bad_exception) { + operator bool() const { return _res!=INITIAL_VALUE; } /// @brief get the resetted resource for resetting it. /// Calls @c reset and returns the cleaned resource. /// The intention is, that you can safely assign it a new value /// (e.g. in an expression). - RESOURCE_TYPE& getClean() throw(std::bad_exception) { + RESOURCE_TYPE& getClean() { reset(); return _res; } /// @brief Give away ownership of the resource. /// @return old resource - RESOURCE_TYPE release() throw(std::bad_exception) { + RESOURCE_TYPE release() { RESOURCE_TYPE res(_res); _res=INITIAL_VALUE; return res; } /// @brief Assign a new resource. /// The old resource of @c this is freed if necessary. AutoResource& reset(RESOURCE_TYPE res = INITIAL_VALUE) - throw(std::bad_exception) { + { if (_res!=INITIAL_VALUE) (*FREE_FUNCTION)((FREE_TYPE)_res); _res = res; return *this; @@ -192,11 +192,11 @@ namespace mrw { /// The resource is freed if necessary. /// AutoPtr takes over ownership of the resource. explicit AutoPtr(T* res = 0) - throw(std::bad_exception): _res(res) { + : _res(res) { res = 0; } /// @brief Takeover ownership from another AutoPtr. - AutoPtr(AutoPtr& o) throw(std::bad_exception): + AutoPtr(AutoPtr& o) : _res(o.release()) { } //! @brief Do not use this method! @@ -204,34 +204,34 @@ namespace mrw { //! @c operator[] first creates an empty element, then assigns it //! the real value. Because that empty element is temporary, gcc can //! not use @c AutoResource(AutoResource&) since release 4.0. - AutoPtr(const AutoPtr& o) throw(std::bad_exception): _res(0) { + AutoPtr(const AutoPtr& o) : _res(0) { assert(o._res==0); if (o._res!=0) _res = const_cast(o).release(); } /// @brief Free resource. Calls @c reset(). - ~AutoPtr() throw(std::bad_exception) {reset();} + ~AutoPtr() {reset();} /// @brief Assign new resource. Calls @c reset(). /// The resource is freed if necessary. - AutoPtr& operator=(T* res) throw(std::bad_exception) { + AutoPtr& operator=(T* res) { return reset(res); } /// @brief Takeover ownership from another AutoResource. /// Calls @c reset() from @c this and @c release() from @c other. - AutoPtr& operator=(AutoPtr& other) throw(std::bad_exception) { + AutoPtr& operator=(AutoPtr& other) { return reset(other.release()); } /// @brief Get the resource. - operator const T*() const throw(std::bad_exception) { + operator const T*() const { return _res; } /// @brief Get the resource. - operator T*() throw(std::bad_exception) { + operator T*() { return _res; } /// @brief find out, if a value is set /// @return @c true: resource is valid - operator bool() const throw(std::bad_exception) { + operator bool() const { return _res!=0; } /// @brief Access the AutoPtr like a normal pointer. @@ -246,20 +246,20 @@ namespace mrw { /// Calls @c reset and returns the cleaned resource. /// The intention is, that you can safely assign it a new value /// (e.g. in an expression). - T* getClean() throw(std::bad_exception) { + T* getClean() { reset(); return _res; } /// @brief Give away ownership of the resource. /// @return old resource - T* release() throw(std::bad_exception) { + T* release() { T* res(_res); _res=0; return res; } /// @brief Assign a new resource. /// The old resource of @c this is freed if necessary. AutoPtr& reset(T* res = 0) - throw(std::bad_exception) { + { delete _res; _res = res; return *this; @@ -290,11 +290,11 @@ namespace mrw { /// The resource is freed if necessary. /// AutoPtrAry takes over ownership of the resource. explicit AutoPtrAry(T* res = 0) - throw(std::bad_exception): _res(res) { + : _res(res) { res = 0; } /// @brief Takeover ownership from another AutoPtrAry. - AutoPtrAry(AutoPtrAry& o) throw(std::bad_exception): + AutoPtrAry(AutoPtrAry& o) : _res(o.release()) { } //! @brief Do not use this method! @@ -302,34 +302,34 @@ namespace mrw { //! @c operator[] first creates an empty element, then assigns it //! the real value. Because that empty element is temporary, gcc can //! not use @c AutoResource(AutoResource&) since release 4.0. - AutoPtrAry(const AutoPtrAry& o) throw(std::bad_exception): _res(0) { + AutoPtrAry(const AutoPtrAry& o) : _res(0) { assert(o._res==0); if (o._res!=0) _res = const_cast(o).release(); } /// @brief Free resource. Calls @c reset(). - ~AutoPtrAry() throw(std::bad_exception) {reset();} + ~AutoPtrAry() {reset();} /// @brief Assign new resource. Calls @c reset(). /// The resource is freed if necessary. - AutoPtrAry& operator=(T* res) throw(std::bad_exception) { + AutoPtrAry& operator=(T* res) { return reset(res); } /// @brief Takeover ownership from another AutoResource. /// Calls @c reset() from @c this and @c release() from @c other. - AutoPtrAry& operator=(AutoPtrAry& other) throw(std::bad_exception) { + AutoPtrAry& operator=(AutoPtrAry& other) { return reset(other.release()); } /// @brief Get the resource. - operator const T*() const throw(std::bad_exception) { + operator const T*() const { return _res; } /// @brief Get the resource. - operator T*() throw(std::bad_exception) { + operator T*() { return _res; } /// @brief find out, if a value is set /// @return @c true: resource is valid - operator bool() const throw(std::bad_exception) { + operator bool() const { return _res!=0; } /// @brief Access the AutoPtrAry like a normal pointer. @@ -344,20 +344,20 @@ namespace mrw { /// Calls @c reset and returns the cleaned resource. /// The intention is, that you can safely assign it a new value /// (e.g. in an expression). - T* getClean() throw(std::bad_exception) { + T* getClean() { reset(); return _res; } /// @brief Give away ownership of the resource. /// @return old resource - T* release() throw(std::bad_exception) { + T* release() { T* res(_res); _res=0; return res; } /// @brief Assign a new resource. /// The old resource of @c this is freed if necessary. AutoPtrAry& reset(T* res = 0) - throw(std::bad_exception) { + { delete[] _res; _res = res; return *this; @@ -389,18 +389,18 @@ namespace mrw { /// @brief Constructor that initializes the values through a call to mmap. MMapHandle(int, size_t=0, void* = 0, int = PROT_READ, int = MAP_SHARED, off_t = 0) - throw(std::bad_exception); + ; /// @brief Reset to zero, value of int is ignored. - MMapHandle& operator=(int) throw(std::bad_exception) { + MMapHandle& operator=(int) { first = 0; second = 0; return *this; } /// @brief Compare to zero, returns true, if i and handle are both zero. - bool operator==(int i) const throw(std::bad_exception) { + bool operator==(int i) const { return i==0 && first==0 && second==0; } }; - inline void munmap(MMapHandle& res) throw(std::bad_exception) { + inline void munmap(MMapHandle& res) { if (res.first!=0 && res.second>0) ::munmap((char*)res.first, res.second); // char* conversion for windoze cygwin compatibility } diff --git a/src/mrw/checkcxx11.hxx b/src/mrw/checkcxx11.hxx index 457f528..43a40b0 100644 --- a/src/mrw/checkcxx11.hxx +++ b/src/mrw/checkcxx11.hxx @@ -13,7 +13,7 @@ # ifndef MRW__OLD_PRE11_COMPILER # if __cplusplus < 201103L # if __cplusplus==1 -# if __APPLE__ +# ifdef __APPLE__ # if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 /// Code is compiled with old non C++11 standard compliant compiler /** There are workarounds for old non C++11 compatible @@ -73,7 +73,7 @@ namespace std { # warning trying standard C++11 support # include # endif -# elif __APPLE__ && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 +# elif defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 /// Code is compiled with an old non C++11 standard compliant compiler /** There are workarounds for old non C++11 compatible compilers. These workarounds are deprecated, but will remain diff --git a/src/mrw/configfile.hxx b/src/mrw/configfile.hxx index 2d645a9..b73167b 100644 --- a/src/mrw/configfile.hxx +++ b/src/mrw/configfile.hxx @@ -200,7 +200,7 @@ namespace mrw { @return the variable's value as string */ - operator const std::string&() const throw() { + operator const std::string&() const noexcept { return value; } @@ -212,7 +212,7 @@ namespace mrw { @return the variable's value as string */ - const std::string& operator()() const throw() { + const std::string& operator()() const noexcept { return value; } @@ -222,19 +222,19 @@ namespace mrw { ConfigFileReader, but it is stored in the destructor, if you use the ConfigFileWriter instead. */ - Value& operator=(const std::string& newValue) throw() { + Value& operator=(const std::string& newValue) noexcept { changed = true; value = newValue; return *this; } /// Compare the value to a string. - bool operator==(const std::string& o) const throw() { + bool operator==(const std::string& o) const noexcept { return o==value; } /// Compare a string to the value. - friend bool operator==(const std::string& o, const Value& v) throw() { + friend bool operator==(const std::string& o, const Value& v) noexcept { return v==o; } @@ -245,10 +245,10 @@ namespace mrw { friend class ConfigFileWriter; Value(const std::string& v, std::string::size_type s, - std::string::size_type e) throw(): + std::string::size_type e) noexcept: value(v), changed(false), start(s), end(e) {} - Value(const std::string& v) throw(): + Value(const std::string& v) noexcept: value(v), changed(true), start(0), end(0) { } @@ -276,7 +276,7 @@ namespace mrw { Uninitialized construction. Use this constructor, if you want to call @ref load() later. */ - ConfigFileReader() throw() {} + ConfigFileReader() noexcept {} /** @brief Parse a file at construction. @@ -290,17 +290,17 @@ namespace mrw { - if there is an unterminated section name in the file - if there is an empty variable name in the file */ - ConfigFileReader(const std::string& filename) throw(std::exception): + ConfigFileReader(const std::string& filename) : _filename(filename) { reload(); } /// Copy construct from other ConfigFileReader. - ConfigFileReader(const ConfigFileReader& o) throw(): + ConfigFileReader(const ConfigFileReader& o) noexcept: _filename(o._filename), _values(o._values) { } - virtual ~ConfigFileReader() throw() {} + virtual ~ConfigFileReader() noexcept {} /// Copy from other ConfigFileReader. ConfigFileReader& operator=(const ConfigFileReader& o) { @@ -321,7 +321,7 @@ namespace mrw { */ Value& operator()(const std::string& section, const std::string& name, const std::string& default_) - throw(std::bad_exception); + ; /** @brief Load and parse a new file. @@ -334,7 +334,7 @@ namespace mrw { - if there is an unterminated section name in the file - if there is an empty variable name in the file */ - ConfigFileReader& load(const std::string& filename) throw(std::exception); + ConfigFileReader& load(const std::string& filename) ; /** @brief Reload the last file again. @@ -346,7 +346,7 @@ namespace mrw { - if there is an unterminated section name in the file - if there is an empty variable name in the file */ - virtual ConfigFileReader& reload() throw(std::exception); + virtual ConfigFileReader& reload() ; //............................................................... typedefs protected: @@ -364,19 +364,19 @@ namespace mrw { //................................................................ methods protected: - ConfigFileReader& parse(const std::string& file) throw(std::exception); + ConfigFileReader& parse(const std::string& file) ; std::string parseSection(const std::string& file, std::string::size_type& pos) - const throw(std::exception); + const ; Values::mapped_type::value_type parseValue(const std::string& file, std::string::size_type& pos) - const throw(std::exception); + const ; std::string parseComment(const std::string& file, std::string::size_type& pos) - const throw(std::bad_exception); + const ; }; //============================================================================ @@ -399,23 +399,23 @@ namespace mrw { @copydoc ConfigFileReader() */ - ConfigFileWriter() throw() {} + ConfigFileWriter() noexcept {} /** @brief Parse a file at construction. @copydoc ConfigFileReader(const std::string&) */ - ConfigFileWriter(const std::string& filename) throw(std::exception) { + ConfigFileWriter(const std::string& filename) { load(filename); } /// Copy construct from other ConfigFileWriter. - ConfigFileWriter(const ConfigFileWriter& o) throw(): + ConfigFileWriter(const ConfigFileWriter& o) noexcept: ConfigFileReader(o) { } /// The file is stored at destruction. - virtual ~ConfigFileWriter() throw() { + virtual ~ConfigFileWriter() noexcept { save(); } @@ -441,13 +441,13 @@ namespace mrw { will be changed as soon as you upgrade to the new compiler version. */ - virtual ConfigFileReader& reload() throw(std::exception); + virtual ConfigFileReader& reload() ; # else /** @brief Reload the last file again. @copydoc mrw::ConfigFileReader::reload() */ - virtual ConfigFileWriter& reload() throw(std::exception); + virtual ConfigFileWriter& reload() ; # endif /** @brief Saves changes back to the file. @@ -455,7 +455,7 @@ namespace mrw { All changed parameters are stored in the configuration file. The rest of the file is left untouched. */ - ConfigFileWriter& save() throw(std::exception); + ConfigFileWriter& save() ; //.............................................................. variables protected: diff --git a/src/mrw/deque.hxx b/src/mrw/deque.hxx index f349324..bd2d054 100644 --- a/src/mrw/deque.hxx +++ b/src/mrw/deque.hxx @@ -51,7 +51,7 @@ */ template std::deque& operator<<(std::deque& l, const T& o) - throw(std::bad_exception) { + { l.push_back(o); return l; } @@ -70,7 +70,7 @@ template */ template std::deque operator<<(const std::deque& l, const T& o) - throw(std::bad_exception) { + { std::deque copy(l); copy.push_back(o); return copy; @@ -89,7 +89,7 @@ template template std::deque& operator<<(std::deque& l, const char *const o) - throw(std::bad_exception) { + { l.push_back(T(o)); return l; } @@ -114,7 +114,7 @@ template */ template std::deque& operator>>(std::deque& l, T& o) - throw(std::exception) { + { typename std::deque::iterator it(l.begin()); if (it==l.end()) throw mrw::length_error(std::string(__FILE__ ":")+__LINE__+ diff --git a/src/mrw/dynamiclibrary.hxx b/src/mrw/dynamiclibrary.hxx index d37f7b6..d186f87 100644 --- a/src/mrw/dynamiclibrary.hxx +++ b/src/mrw/dynamiclibrary.hxx @@ -43,7 +43,7 @@ namespace mrw { Loading a symbol from a shared library: @code - void fn() throw(mrw::DynamicLibrary::failure) { + void fn() { static DynamicLibrary lib("libsomething"); static void(*theRealFunction)() = (void(*)())lib.symbol("theRealFunction"); @@ -75,7 +75,7 @@ namespace mrw { /// failure in access to shared libraries class failure: public mrw::runtime_error { public: - failure(const std::string& arg) throw(std::bad_exception): + failure(const std::string& arg) : mrw::runtime_error("DynamicLibrary failure "+arg +"; ltdl reason: "+ +mrw::ifelse(lt_dlerror(), "")) { @@ -88,7 +88,7 @@ namespace mrw { /** @brief initialize, but open dynamic library later @throw failure if initialisation fails */ - DynamicLibrary() throw(std::exception): _opened(false) { + DynamicLibrary() : _opened(false) { if (lt_dlinit()>0) throw failure("cannot initialize dynamic library loader"); _opened = true; @@ -107,7 +107,7 @@ namespace mrw { @throw failure if initialisation fails @throw failure if opeing the library fails */ - DynamicLibrary(const std::string& lib) throw(std::exception): + DynamicLibrary(const std::string& lib) : _opened(false) { if (lt_dlinit()>0) throw failure("cannot initialize dynamic library loader"); @@ -116,7 +116,7 @@ namespace mrw { } /// close and clean up - ~DynamicLibrary() throw() { + ~DynamicLibrary() noexcept { try {close();} catch (...) {} if (_opened) lt_dlexit(); } @@ -133,7 +133,7 @@ namespace mrw { @param lib the name of the library without the extension @throw failure if opeing the library fails */ - DynamicLibrary& open(const std::string& lib) throw(std::exception) { + DynamicLibrary& open(const std::string& lib) { _lib.open(lib); return *this; } @@ -141,7 +141,7 @@ namespace mrw { /** @brief close the dynamic library @throw failure if the library was open and close failed */ - DynamicLibrary& close() throw(std::exception) { + DynamicLibrary& close() { if (!isResident()) _lib.close(); return *this; } @@ -155,7 +155,7 @@ namespace mrw { @throw failure in case of an error */ - DynamicLibrary& resident() throw(std::exception) { + DynamicLibrary& resident() { if (lt_dlmakeresident(_lib.handle())!=0) throw failure("cannot make library resident"); return *this; @@ -163,7 +163,7 @@ namespace mrw { /** @brief check whether the library is resident @throw failure if the library is not open */ - bool isResident() throw(std::exception) { + bool isResident() { return lt_dlisresident(_lib.handle())==1; } @@ -174,7 +174,7 @@ namespace mrw { conversion is wrong, then your process will crash, or even worse, behave in an unexpected way, so be careful! */ - lt_ptr symbol(const std::string& name) throw(std::exception) { + lt_ptr symbol(const std::string& name) { lt_ptr sym(lt_dlsym(_lib.handle(), name.c_str())); if (!sym) throw failure("cannot load dynamic library symbol: "+name); @@ -196,7 +196,7 @@ namespace mrw { symbols except the list set by preloadDefault are deleted */ DynamicLibrary& preload(const lt_dlsymlist symbols[]) - throw(std::exception) { + { if (lt_dlpreload(symbols)!=0) throw failure("error in preloading libraries"); return *this; @@ -215,18 +215,18 @@ namespace mrw { character pointer and function pointer */ static void preloadDefault(const lt_dlsymlist symbols[]) - throw(std::exception) { + { if (lt_dlpreload_default(symbols)!=0) throw failure("error in preloading libraries"); } /** @brief set the default list of preloaded symbols */ - static void preloadedSymbols() throw(std::bad_exception) { + static void preloadedSymbols() { LTDL_SET_PRELOADED_SYMBOLS(); } /** @brief append a directory to the library search path */ - static void addSearchDir(const std::string& dir) throw(std::exception) { + static void addSearchDir(const std::string& dir) { if (lt_dladdsearchdir(dir.c_str())!=0) throw failure("cannot add search dir: "+dir); } @@ -235,7 +235,7 @@ namespace mrw { search path */ static void insertSearchDir(const std::string& before, const std::string& dir) - throw(std::exception) { + { if (lt_dlinsertsearchdir(before.c_str(), dir.c_str())!=0) throw failure("cannot add search dir: "+dir); } @@ -243,13 +243,13 @@ namespace mrw { /** @brief set the library search path The search path is a colon separated list of paths. */ - static void setSearchPath(const std::string& dirs) throw() { + static void setSearchPath(const std::string& dirs) { if (lt_dlsetsearchpath(dirs.c_str())) throw failure("cannot set search path to "+dirs); } /** @brief get the library search path */ - static std::string getSearchPath() throw() { + static std::string getSearchPath() { char const * const path(lt_dlgetsearchpath()); if (!path) throw failure("cannot get search path"); @@ -276,29 +276,29 @@ namespace mrw { */ int foreachfile(const char* searchPath, int(*function)(const char*, lt_ptr), - lt_ptr data) throw() { + lt_ptr data) noexcept { return lt_dlforeachfile(searchPath, function, data); } private: class Lib { - Lib() throw(): _lib(0) {} - Lib(const std::string& lib) throw(std::exception): _lib(0) { + Lib() noexcept: _lib(0) {} + Lib(const std::string& lib) : _lib(0) { open(lib); } - ~Lib() throw() { + ~Lib() noexcept { try {close();} catch(...) {} } - operator bool() throw() { + operator bool() noexcept { return _lib; } - Lib& open(const std::string& lib) throw(std::exception) { + Lib& open(const std::string& lib) { close(); if (!(_lib = lt_dlopenext(lib.c_str()))) throw failure("cannot open dynamic library "+lib); return *this; } - Lib& close() throw(std::exception) { + Lib& close() { if (_lib && lt_dlclose(_lib)!=0) throw failure("cannot close dynamic library"); _lib = 0; @@ -306,7 +306,7 @@ namespace mrw { } private: friend class DynamicLibrary; - lt_dlhandle handle() throw(std::exception) { + lt_dlhandle handle() { if (!_lib) throw failure("library not open"); return _lib; diff --git a/src/mrw/errno.hxx b/src/mrw/errno.hxx index b0c71cc..cbd1cd3 100644 --- a/src/mrw/errno.hxx +++ b/src/mrw/errno.hxx @@ -50,21 +50,21 @@ namespace mrw { public: /// stores the actual @c errno - Errno() throw(); + Errno() noexcept; /// returns a string that describes the error - operator std::string() const throw(std::bad_exception); + operator std::string() const ; /// returns a string that describes the error - std::string string() const throw(std::bad_exception); + std::string string() const ; /// returns the @c errno stored in the constructor - operator int() const throw() { + operator int() const noexcept { return _errnoxxx; } /// returns the @c errno stored in the constructor - int numerical() const throw() { + int numerical() const noexcept { return _errnoxxx; } @@ -107,7 +107,7 @@ namespace mrw { @throw mrw::unix_error if res<0 */ static void check(int res, const std::string& arg) - throw(std::exception) { + { if (res<0) throw mrw::unix_error(arg); } @@ -137,7 +137,7 @@ namespace mrw { @param arg additional error text */ - unix_error(const std::string& arg) throw(std::bad_exception): + unix_error(const std::string& arg) : mrw::runtime_error(std::string("unix error: ")+Errno().string() +"; "+arg) { } diff --git a/src/mrw/exception.hxx b/src/mrw/exception.hxx index ecddd56..6b1c5a2 100644 --- a/src/mrw/exception.hxx +++ b/src/mrw/exception.hxx @@ -153,7 +153,7 @@ call of fn0 successful @dot digraph ExceptionInheritance { graph [rankdir="LR", size="7,8"]; - node [shape=record, fontname=Helvetica, fontsize=8]; + node [shape=box, fontname=Helvetica, fontsize=8]; edge [dir=back, headport=w, tailport=e, arrowtail=empty]; std_exception [label="std::exception"]; @@ -251,8 +251,8 @@ call of fn0 successful unexpected handler, that rethrows, catches this exception, then throws a @c std::bad_exception to try to continue. This is the reason, why all the exception specifications in the MRW C++ - Library declar @c throw(std::bad_exception) instead of @c - throw(), when they throw nothing. + Library declar @c instead of @c + noexcept, when they throw nothing. @code namespace myProject { @@ -277,12 +277,12 @@ call of fn0 successful */ class exception: public std::exception { public: - exception() throw(std::bad_exception); - virtual ~exception() throw(); - virtual const char* what() const throw() { + exception() ; + virtual ~exception() noexcept; + virtual const char* what() const noexcept { return std::exception::what(); } - const std::string& stacktrace() const throw(std::bad_exception); + const std::string& stacktrace() const ; private: StackTrace* _stacktrace; }; @@ -290,8 +290,8 @@ call of fn0 successful /// Replacement for @c std::bad_alloc, but with stack trace class bad_alloc: public mrw::exception { public: - ~bad_alloc() throw() {} - virtual const char* what() const throw() { + ~bad_alloc() noexcept {} + virtual const char* what() const noexcept { return "mrw::bad_alloc"; } }; @@ -299,8 +299,8 @@ call of fn0 successful /// Replacement for @c std::bad_cast, but with stack trace class bad_cast: public mrw::exception { public: - ~bad_cast() throw() {} - virtual const char* what() const throw() { + ~bad_cast() noexcept {} + virtual const char* what() const noexcept { return "mrw::bad_cast"; } }; @@ -308,8 +308,8 @@ call of fn0 successful /// Replacement for @c std::bad_exception, but with stack trace class bad_exception: public mrw::exception { public: - ~bad_exception() throw() {} - virtual const char* what() const throw() { + ~bad_exception() noexcept {} + virtual const char* what() const noexcept { return "mrw::bad_exception"; } }; @@ -317,8 +317,8 @@ call of fn0 successful /// Replacement for @c std::bad_typeid, but with stack trace class bad_typeid: public mrw::exception { public: - ~bad_typeid() throw() {} - virtual const char* what() const throw() { + ~bad_typeid() noexcept {} + virtual const char* what() const noexcept { return "mrw::bad_typeid"; } }; @@ -326,9 +326,9 @@ call of fn0 successful /// Replacement for @c std::logic_error, but with stack trace class logic_error: public mrw::exception { public: - ~logic_error() throw() {} - logic_error(const std::string& arg) throw(): _what(arg) {} - virtual const char* what() const throw() { + ~logic_error() noexcept {} + logic_error(const std::string& arg) noexcept: _what(arg) {} + virtual const char* what() const noexcept { return _what.c_str(); } private: @@ -338,9 +338,9 @@ call of fn0 successful /// Replacement for @c std::domain_error, but with stack trace class domain_error: public mrw::logic_error { public: - ~domain_error() throw() {} - domain_error(const std::string& arg) throw(): mrw::logic_error(arg) {} - virtual const char* what() const throw() { + ~domain_error() noexcept {} + domain_error(const std::string& arg) noexcept: mrw::logic_error(arg) {} + virtual const char* what() const noexcept { return mrw::logic_error::what(); } }; @@ -348,9 +348,9 @@ call of fn0 successful /// Replacement for @c std::invalid_argument, but with stack trace class invalid_argument: public mrw::logic_error { public: - ~invalid_argument() throw() {} - invalid_argument(const std::string& arg) throw(): mrw::logic_error(arg) {} - virtual const char* what() const throw() { + ~invalid_argument() noexcept {} + invalid_argument(const std::string& arg) noexcept: mrw::logic_error(arg) {} + virtual const char* what() const noexcept { return mrw::logic_error::what(); } }; @@ -358,9 +358,9 @@ call of fn0 successful /// Replacement for @c std::length_error, but with stack trace class length_error: public mrw::logic_error { public: - ~length_error() throw() {} - length_error(const std::string& arg) throw(): mrw::logic_error(arg) {} - virtual const char* what() const throw() { + ~length_error() noexcept {} + length_error(const std::string& arg) noexcept: mrw::logic_error(arg) {} + virtual const char* what() const noexcept { return mrw::logic_error::what(); } }; @@ -368,9 +368,9 @@ call of fn0 successful /// Replacement for @c std::out_of_range, but with stack trace class out_of_range: public mrw::logic_error { public: - ~out_of_range() throw() {} - out_of_range(const std::string& arg) throw(): mrw::logic_error(arg) {} - virtual const char* what() const throw() { + ~out_of_range() noexcept {} + out_of_range(const std::string& arg) noexcept: mrw::logic_error(arg) {} + virtual const char* what() const noexcept { return mrw::logic_error::what(); } }; @@ -378,9 +378,9 @@ call of fn0 successful /// Replacement for @c std::runtime_error, but with stack trace class runtime_error: public mrw::exception { public: - ~runtime_error() throw() {} - runtime_error(const std::string& arg) throw(): _what(arg) {} - virtual const char* what() const throw() { + ~runtime_error() noexcept {} + runtime_error(const std::string& arg) noexcept: _what(arg) {} + virtual const char* what() const noexcept { return _what.c_str(); } private: @@ -390,9 +390,9 @@ call of fn0 successful /// Replacement for @c std::overflow_error, but with stack trace class overflow_error: public mrw::runtime_error { public: - ~overflow_error() throw() {} - overflow_error(const std::string& arg) throw(): mrw::runtime_error(arg) {} - virtual const char* what() const throw() { + ~overflow_error() noexcept {} + overflow_error(const std::string& arg) noexcept: mrw::runtime_error(arg) {} + virtual const char* what() const noexcept { return mrw::runtime_error::what(); } }; @@ -400,9 +400,9 @@ call of fn0 successful /// Replacement for @c std::range_error, but with stack trace class range_error: public mrw::runtime_error { public: - ~range_error() throw() {} - range_error(const std::string& arg) throw(): mrw::runtime_error(arg) {} - virtual const char* what() const throw() { + ~range_error() noexcept {} + range_error(const std::string& arg) noexcept: mrw::runtime_error(arg) {} + virtual const char* what() const noexcept { return mrw::runtime_error::what(); } }; @@ -410,9 +410,9 @@ call of fn0 successful /// Replacement for @c std::underflow_error, but with stack trace class underflow_error: public mrw::runtime_error { public: - ~underflow_error() throw() {} - underflow_error(const std::string& arg) throw(): mrw::runtime_error(arg) {} - virtual const char* what() const throw() { + ~underflow_error() noexcept {} + underflow_error(const std::string& arg) noexcept: mrw::runtime_error(arg) {} + virtual const char* what() const noexcept { return mrw::runtime_error::what(); } }; @@ -426,37 +426,38 @@ call of fn0 successful (this specification is "binary", it only declares whether an exception is thrown or not, but it does not specify which exact exception can be thrown) - - if no exception is thrown, specify @c throw(std::bad_exception) - instead of @c throw() as you would normally specify - - if any exception is thrown specify @c throw(std::exception) @n - (@b Note: If you need a more specific declaration, you must also - declare @c std::bad_exception in addition to your exceptions!) - - only declare @c throw() if you are 100% sure, that it is absolutely + - if no exception is thrown, specify @c noexcept + - if any exception is thrown specify nothing + - only declare @c noexcept if you are 100% sure, that it is absolutely impossible that this method ever throws an exception, that means this method calls no other function or method (not even from a - system library) that does not declare @c throw() + system library) that does not declare @c noexcept -# document the exact exception thrown with Doxygen's @c \@throw tag - -# write an unexpected handler as follows + -# add a terminate handler to catc + -# in @c main catch everything and trace errors: (or link to a @ref AutoTrace "library"): @code - void unexpectedHandler() { - try { - throw; - } catch (mrw::exception& x) { - // trace x.stacktrace() and x.what() - } catch (std::exception& x) { - // trace x.what() - } catch (...) { - // trace unknown unexpected + #include + ... + set_terminate([]{ + try { + auto p = std::current_exception(); + if (p) std::rethrow_exception (p); + // trace other problem + } catch (mrw::exception& x) { + // trace x.stacktrace() and x.what() + } catch (std::exception& x) { + // trace x.what() + } catch (...) { + // trace unknown unexpected + } } - throw std::bad_exception(); // try to recover - } @endcode What happens: - If you throw an exception in a method that declares not to - throw an exception, the unexpected handler is called. + throw an exception, the terminate handler is called. - It writes a stack trace for you to be able to find your bug. - Then it throws a @c std::bad_exception, which is allowed to pass. - Your program does not abort, but continues running. diff --git a/src/mrw/exec.hxx b/src/mrw/exec.hxx index 798f15d..bb34612 100644 --- a/src/mrw/exec.hxx +++ b/src/mrw/exec.hxx @@ -111,9 +111,9 @@ namespace mrw { class ExecutionFailedExc: public mrw::exception { public: ExecutionFailedExc(const std::string&, const std::string&) - throw(std::bad_exception); - virtual ~ExecutionFailedExc() throw() {} - virtual const char* what() const throw() {return _what.c_str();} + ; + virtual ~ExecutionFailedExc() noexcept {} + virtual const char* what() const noexcept {return _what.c_str();} private: std::string _what; }; @@ -157,11 +157,11 @@ namespace mrw { /** @brief Create an executor given a command. Construction without passing a command is not possible. */ - Exec(const mrw::Cmd&) throw(std::bad_exception); + Exec(const mrw::Cmd&) ; - Exec(const mrw::Exec&) throw(std::bad_exception); - ~Exec() throw(); - Exec& operator=(const mrw::Exec&) throw(std::bad_exception); + Exec(const mrw::Exec&) ; + ~Exec() noexcept; + Exec& operator=(const mrw::Exec&) ; /** @brief Execute the command. @@ -174,7 +174,7 @@ namespace mrw { - creation or setup of pipes failed - if given parameter is @c true (the default) also if the executed program terminates with an error */ - Exec& execute(bool exc=true) throw(std::exception); + Exec& execute(bool exc=true) ; /** @brief Execute the command, pass @c stdin. @@ -190,7 +190,7 @@ namespace mrw { - if given parameter is @c true (the default) also if the executed program terminates with an error */ Exec& execute(const std::string& input, bool exc=true) - throw(std::exception); + ; /** @brief Execute the command, pass @c stdin. @@ -206,7 +206,7 @@ namespace mrw { - if given parameter is @c true (the default) also if the executed program terminates with an error */ Exec& execute(char const*const input, bool exc=true) - throw(std::exception) { + { return execute(std::string(input), exc); } @@ -219,7 +219,7 @@ namespace mrw { @throw ExecutionFailedExc in case of any failure or if the executed program does not return a zero exit status. */ - Exec& operator>>(std::string&) throw(std::exception); + Exec& operator>>(std::string&) ; /** @brief Executes the command if not done, returns @c stdout as string @@ -231,13 +231,13 @@ namespace mrw { @throw ExecutionFailedExc in case of any failure or if the executed program does not return a zero exit status. */ - operator std::string&() throw(std::exception); + operator std::string&() ; /** @return - @c true if the last execution was successful - @c false if the last execution failed or the command was never executed */ - operator bool() throw(std::bad_exception); + operator bool() ; /** @brief Executes the command if not done, returns @c stdout as string @@ -249,7 +249,7 @@ namespace mrw { @throw ExecutionFailedExc in case of any failure or if the executed program does not return a zero exit status. */ - std::string& result() throw(std::exception); + std::string& result() ; /** @brief Executes the command if not done, returns @c stderr as string @@ -261,13 +261,13 @@ namespace mrw { @throw ExecutionFailedExc in case of any failure or if the executed program does not return a zero exit status. */ - std::string& error() throw(std::exception); + std::string& error() ; /** @return - @c true if the last execution was successful - @c false if the last execution failed or the command was never executed */ - bool success() throw(std::bad_exception); + bool success() ; //................................................................ methods private: @@ -340,13 +340,13 @@ while (!exec.finished()) res+=exec.read().first; /** @brief Create an executor given a command. Construction without passing a command is not possible. */ - PartialExec(const mrw::Cmd&) throw(std::bad_exception); + PartialExec(const mrw::Cmd&) ; /** @brief Copy construction invalidates the original object. All opened pipes (opened with start()) are lost in the original object and are then owned by the new object. */ - PartialExec(mrw::PartialExec&) throw(std::bad_exception); + PartialExec(mrw::PartialExec&) ; /** @brief Copy construction invalidates the original object. @@ -355,12 +355,12 @@ while (!exec.finished()) res+=exec.read().first; @warning @c const for the argument is a fake! It is casted away! @param e @b Warning: const is casted away! */ - PartialExec(const mrw::PartialExec& e) throw(std::bad_exception); + PartialExec(const mrw::PartialExec& e) ; /** @brief Assignment invalidates the original object. @copydoc PartialExec(mrw::PartialExec&) */ - PartialExec& operator=(mrw::PartialExec&) throw(std::bad_exception); + PartialExec& operator=(mrw::PartialExec&) ; /** @brief Close the input pipe of the child process. @@ -371,12 +371,12 @@ while (!exec.finished()) res+=exec.read().first; the child process does not stop waiting for more input! If your program seems to hang, check if you call finish() correctly! */ - PartialExec& finish() throw(); + PartialExec& finish() noexcept; /** @brief Check if there's more data left to read(). @return @c true if the child process has finished and all data is read. */ - bool finished() throw(); + bool finished() noexcept; /** @brief Start a new child process. @@ -391,7 +391,7 @@ while (!exec.finished()) res+=exec.read().first; - @c false if no input is sent to the child's @c stdin - the first parameter of read must allways be passed an empty string */ - PartialExec& start(bool useInput=false) throw(std::exception); + PartialExec& start(bool useInput=false) ; /** @brief Read from the subprocess, optionally pass an @c input to @c stdin of the subprocess. @@ -417,13 +417,13 @@ while (!exec.finished()) res+=exec.read().first; @pre start() was called */ std::pair read(const std::string& input="", bool exc=true) - throw(std::exception); + ; /// Terminates a running job by sending @c SIGTERM to the child process. - PartialExec& terminate() throw(); + PartialExec& terminate() noexcept; /// Kills a running job by sending @c SIGKILL to the child process. - PartialExec& kill() throw(); + PartialExec& kill() noexcept; //................................................................ methods private: @@ -468,54 +468,54 @@ while (!exec.finished()) res+=exec.read().first; /** @brief Create a command given the name of the executable @param command the name of the program to execute (no parameter) @note There is no default constructor. */ - Cmd(const std::string& command) throw(std::bad_exception); + Cmd(const std::string& command) ; /** @brief Append a parameter to a command @param param a parameter / commandline argument to append to the command */ - Cmd& operator,(const std::string& param) throw(std::bad_exception); + Cmd& operator,(const std::string& param) ; /** @brief Append a parameter to a command @param param a parameter / commandline argument to append to the command */ - Cmd& operator<<(const std::string& param) throw(std::bad_exception); + Cmd& operator<<(const std::string& param) ; /** @return the command including parameter */ - operator std::string() const throw(std::bad_exception); + operator std::string() const ; /** @return a mrw::Exec that's constructed with this class */ - operator mrw::Exec() const throw(std::bad_exception); + operator mrw::Exec() const ; /** @return a mrw::PartialExec that's constructed with this class */ - operator mrw::PartialExec() const throw(std::bad_exception); + operator mrw::PartialExec() const ; /** @brief Create a mrw::Exec and execute a child process. @see Exec::execute(bool) */ - Exec execute(bool exc=true) const throw(std::exception); + Exec execute(bool exc=true) const ; /** @brief Create a mrw::Exec and execute a child process. @see Exec::execute(const std::string&, bool) */ Exec execute(const std::string& input, bool exc=true) const - throw(std::exception); + ; /** @brief Create a mrw::Exec and execute a child process. @see Exec::execute(char const*const, bool) */ Exec execute(char const*const input, bool exc=true) const - throw(std::exception) { + { return execute(std::string(input), exc); } /** @brief Create a new mrw::PartialExec and start a new child process. @see PartialExec::start(bool) */ - PartialExec start(bool useInput=false) const throw(std::exception); + PartialExec start(bool useInput=false) const ; private: // Exec and PartialExec are allowed to call @c path() and @c args(). friend class Exec; friend class PartialExec; Cmd(); // No default constructor. - const char* path() const throw(std::bad_exception); - char** args() const throw(std::bad_exception); + const char* path() const ; + char** args() const ; typedef std::list ArgList; ArgList _cmd; }; diff --git a/src/mrw/file.hxx b/src/mrw/file.hxx index 8915095..0a68e74 100644 --- a/src/mrw/file.hxx +++ b/src/mrw/file.hxx @@ -76,7 +76,7 @@ namespace mrw { @note If the destination file already exists, it will be overwritten. */ static void copy(const std::string& from, - const std::string& to) throw(std::exception) { + const std::string& to) { std::ofstream os(to.c_str()); os<. and .. (self anf top) */ - Dir(const std::string& dir, bool ignoreDots=true) throw(std::exception): + Dir(const std::string& dir, bool ignoreDots=true) : _ignoreDots(ignoreDots), _dir(opendir(dir.c_str())) { if (!_dir) throw mrw::invalid_argument("Cannot read directory: '"+dir+'\''); } /// Directory is closed automatically in the destructor. - ~Dir() throw() { + ~Dir() noexcept { closedir(_dir); } @@ -357,15 +357,11 @@ namespace mrw { returned, behaviour is unspecified, but a crash is probable. */ - operator bool() throw() { + operator bool() noexcept { static const std::string D("."), DD(".."); static dirent* fake; -# if defined(WIN32) || defined(_WIN32) || defined(__MINGW32__) if (!(fake=readdir(_dir))) return false; _entry.entry()=*fake; -# else - if (readdir_r(_dir, &_entry.entry(), &fake) || !fake) return false; -# endif if (_ignoreDots && (_entry.type()==Entry::UNKNOWN || _entry.type()==Entry::DIR) && (D==_entry() || DD==_entry())) diff --git a/src/mrw/functiontrace.hxx b/src/mrw/functiontrace.hxx index 4817a38..683045f 100644 --- a/src/mrw/functiontrace.hxx +++ b/src/mrw/functiontrace.hxx @@ -248,7 +248,7 @@ namespace mrw { public: FnTrace(const void* addr, const std::string& name, const std::string& file, unsigned long line, - const std::string& tracer = "mrw.fntrace") throw(): + const std::string& tracer = "mrw.fntrace") noexcept: _addr(addr), _name(name.begin(), name.end()), _file(file), _line(line), _tracer(tracer.begin(), tracer.end()) { log4cxx::Logger* logger(log4cxx::Logger::getLogger(_tracer)); @@ -264,7 +264,7 @@ namespace mrw { } FnTrace(const std::string& name, const std::string& file, unsigned long line, - const std::string& tracer = "mrw.fntrace") throw(): + const std::string& tracer = "mrw.fntrace") noexcept: _addr(0), _name(name.begin(), name.end()), _file(file), _line(line), _tracer(tracer.begin(), tracer.end()) { log4cxx::Logger* logger(log4cxx::Logger::getLogger(_tracer)); @@ -278,7 +278,7 @@ namespace mrw { ++_level; } } - ~FnTrace() throw() { + ~FnTrace() noexcept { log4cxx::Logger* logger(log4cxx::Logger::getLogger(_tracer)); if (logger->isDebugEnabled()) { --_level; diff --git a/src/mrw/list.hxx b/src/mrw/list.hxx index 95e6148..d3e9853 100644 --- a/src/mrw/list.hxx +++ b/src/mrw/list.hxx @@ -69,7 +69,7 @@ */ template std::list& operator<<(std::list& l, const T& o) - throw(std::bad_exception) { + { l.push_back(o); return l; } @@ -88,7 +88,7 @@ template */ template std::list operator<<(const std::list& l, const T& o) - throw(std::bad_exception) { + { std::list copy(l); copy.push_back(o); return copy; @@ -107,7 +107,7 @@ template template std::list& operator<<(std::list& l, const char *const o) - throw(std::bad_exception) { + { l.push_back(T(o)); return l; } @@ -131,7 +131,7 @@ template @pre \#include */ template -std::list& operator>>(std::list& l, T& o) throw(std::exception) { +std::list& operator>>(std::list& l, T& o) { typename std::list::iterator it(l.begin()); if (it==l.end()) throw mrw::length_error(std::string(__FILE__ ":")+__LINE__+ diff --git a/src/mrw/map.hxx b/src/mrw/map.hxx index 2d8a2ea..9c43b75 100644 --- a/src/mrw/map.hxx +++ b/src/mrw/map.hxx @@ -54,7 +54,7 @@ template std::map& operator<<(std::map& l, const std::pair& o) - throw(std::exception) { + { if (!l.insert(o).second) throw mrw::invalid_argument(std::string(__FILE__ ":")+__LINE__+ ": std::map<>&" @@ -81,7 +81,7 @@ template template std::map operator<<(const std::map& l, const std::pair& o) - throw(std::exception) { + { std::map copy(l); if (!copy.insert(o).second) throw mrw::invalid_argument(std::string(__FILE__ ":")+__LINE__+ @@ -113,7 +113,7 @@ template template std::map& operator>>(std::map& l, std::pair& o) - throw(std::exception) { + { typename std::map::iterator it(l.begin()); if (it==l.end()) throw mrw::length_error(std::string(__FILE__ ":")+__LINE__+ diff --git a/src/mrw/mrw.hxx b/src/mrw/mrw.hxx index 8747787..5880590 100644 --- a/src/mrw/mrw.hxx +++ b/src/mrw/mrw.hxx @@ -1,42 +1,3 @@ -/** @mainpage - - The official homepage is on: - - https://dev.marc.waeckerlin.org/redmine/projects/mrw-cxx - - All features are listed on the "Modules" page. - - @section intro Introduction - - Featureful C++ Library containing a lot of needful - things. Everything, I often need, but it's missing in C++ standard - libraries and other common 3rd party libraries, such as log4cxx, cppunit and boost. - - I have paid attention to define simple and a nice to use - interfaces. The library makes use of object orientation, operator - overload and templates, where it makes sense. The library passes - several module tests before each delivery. It is therefore stable - and tested. - - @section support Supported Platforms - - The library is generic UNIX, but should also work on Windows. It - is sporadically tested on Windows in Cygwin. Stack trace works on - Linux only, it could theoretically work on Sun Solaris too, but - this is untested. Stack trace without symbol resolution, just - getting the raw addresses, only depends on GNU gcc and should work - on all platforms. Feedback is welcome! - - @section features Missing a Feature, Found a Bug? - - You are missing a feature, or an implementation is too incomplete - for the purpose you need it? Or you even found a bug? Just ask me - and I'll try to help you! My email address is in the file AUTHORS - and on my website: http://marc.waeckerlin.org - -*/ - /** @page usage Usage of the Library: Include and Link Include the headers you need with prefix @c mrw, e.g.: @@ -149,9 +110,6 @@ /** @page license License @verbinclude COPYING */ -/** @page readme Readme - @verbinclude README */ - /** @page install Installation @verbinclude INSTALL */ diff --git a/src/mrw/multimap.hxx b/src/mrw/multimap.hxx index 4899122..7fad4c4 100644 --- a/src/mrw/multimap.hxx +++ b/src/mrw/multimap.hxx @@ -54,7 +54,7 @@ template std::multimap& operator<<(std::multimap& l, const std::pair& o) - throw(std::bad_exception) { + { l.insert(o); return l; } @@ -77,7 +77,7 @@ template template std::multimap operator<<(const std::multimap& l, const std::pair& o) - throw(std::bad_exception) { + { std::multimap copy(l); copy.insert(o); return copy; @@ -105,7 +105,7 @@ template template std::multimap& operator>>(std::multimap& l, std::pair& o) - throw(std::exception) { + { typename std::multimap::iterator it(l.begin()); if (it==l.end()) throw mrw::length_error(std::string(__FILE__ ":")+__LINE__+ diff --git a/src/mrw/multiset.hxx b/src/mrw/multiset.hxx index bcec36c..7054fd2 100644 --- a/src/mrw/multiset.hxx +++ b/src/mrw/multiset.hxx @@ -51,7 +51,7 @@ */ template std::multiset& operator<<(std::multiset& l, const T& o) - throw(std::bad_exception) { + { l.insert(o); return l; } @@ -72,7 +72,7 @@ template template std::multiset operator<<(const std::multiset& l, const T& o) - throw(std::bad_exception) { + { std::multiset copy(l); copy.insert(o); return copy; @@ -91,7 +91,7 @@ template template std::multiset& operator<<(std::multiset& l, const char *const o) - throw(std::bad_exception) { + { l.push_back(T(o)); return l; } @@ -116,7 +116,7 @@ template */ template std::multiset& operator>>(std::multiset& l, T& o) - throw(std::exception) { + { typename std::multiset::iterator it(l.begin()); if (it==l.end()) throw mrw::length_error(std::string(__FILE__ ":")+__LINE__+ diff --git a/src/mrw/regexp.hxx b/src/mrw/regexp.hxx index d2a5eda..b853e14 100644 --- a/src/mrw/regexp.hxx +++ b/src/mrw/regexp.hxx @@ -128,10 +128,10 @@ namespace mrw { was set in @c flags */ RegExp(const std::string& pattern, bool hassub=false, int flags=extended) - throw(std::exception); + ; /** @brief cleans up expression from memory */ - ~RegExp() throw(); + ~RegExp() noexcept; /** @brief apply the expression, match a text against the expression @@ -139,7 +139,7 @@ namespace mrw { @return - true if @c text matches - false otherwise */ - bool operator()(const std::string& text) throw(std::bad_exception); + bool operator()(const std::string& text) ; /** @brief get the n-th sub expression of the last matched text @@ -153,7 +153,7 @@ namespace mrw { @throw mrw::invalid_argument if this subexpression is not available */ - std::string operator[](unsigned int n) const throw(std::exception); + std::string operator[](unsigned int n) const ; private: diff --git a/src/mrw/set.hxx b/src/mrw/set.hxx index 1ed31c9..58718ee 100644 --- a/src/mrw/set.hxx +++ b/src/mrw/set.hxx @@ -52,7 +52,7 @@ */ template std::set& operator<<(std::set& l, const T& o) - throw(std::exception) { + { if (!l.insert(o).second) throw mrw::invalid_argument(std::string(__FILE__ ":")+__LINE__+ ": std::set<>::operator<<, " @@ -75,7 +75,7 @@ template */ template std::set operator<<(const std::set& l, const T& o) - throw(std::exception) { + { std::set copy(l); if (!copy.insert(o).second) throw mrw::invalid_argument(std::string(__FILE__ ":")+__LINE__+ @@ -97,7 +97,7 @@ template template std::set& operator<<(std::set& l, const char *const o) - throw(std::bad_exception) { + { l.push_back(T(o)); return l; } @@ -122,7 +122,7 @@ template */ template std::set& operator>>(std::set& l, T& o) - throw(std::exception) { + { typename std::set::iterator it(l.begin()); if (it==l.end()) throw mrw::length_error(std::string(__FILE__ ":")+__LINE__+ diff --git a/src/mrw/smartpointer.hxx b/src/mrw/smartpointer.hxx index c77d95b..dbc41f3 100644 --- a/src/mrw/smartpointer.hxx +++ b/src/mrw/smartpointer.hxx @@ -18,17 +18,17 @@ namespace mrw { private: unsigned int _cnt; public: - PointerCounter() throw(): + PointerCounter() noexcept: _cnt(1) { } - PointerCounter* incr() throw() { + PointerCounter* incr() noexcept { ++_cnt; return this; } - int decr() throw() { + int decr() noexcept { return --_cnt; } - int get() throw() { + int get() noexcept { return _cnt; } }; @@ -38,11 +38,11 @@ namespace mrw { virtual ~SmartPointerParent() {} protected: template - PointerCounter* getCounter(TYPE& sp) throw() { + PointerCounter* getCounter(TYPE& sp) noexcept { return sp._cnt; } template - typename TYPE::Pointer getPointer(TYPE& sp) throw() { + typename TYPE::Pointer getPointer(TYPE& sp) noexcept { return sp._ptr; } }; @@ -81,7 +81,7 @@ namespace mrw { PointerCounter* _cnt; TYPE* _ptr; private: - void drop() throw() { + void drop() noexcept { if (_cnt && !_cnt->decr()) { delete _cnt; _cnt=0; delete _ptr; _ptr=0; @@ -91,30 +91,30 @@ namespace mrw { friend class SmartPointerParent; friend class SmartPointerTest; public: - SmartPointer() throw(): + SmartPointer() noexcept: _cnt(0), _ptr(0) { } - SmartPointer(const SmartPointer& o) throw(): + SmartPointer(const SmartPointer& o) noexcept: _cnt(o._cnt?o._cnt->incr():0), _ptr(o._ptr) { } - SmartPointer(TYPE* ptr) throw(): + SmartPointer(TYPE* ptr) noexcept: _cnt(ptr ? new PointerCounter : 0), _ptr(ptr) { } - template SmartPointer(const SmartPointer& o) throw(): + template SmartPointer(const SmartPointer& o) noexcept: _cnt(0), _ptr(dynamic_cast(getPointer(o))) { if (_ptr) _cnt = getCounter(o)->incr(); } - virtual ~SmartPointer() throw() { + virtual ~SmartPointer() noexcept { drop(); } - SmartPointer& operator=(const SmartPointer& o) throw() { + SmartPointer& operator=(const SmartPointer& o) noexcept { if (o._ptr==_ptr) return *this; drop(); _cnt = o._cnt ? o._cnt->incr() : 0; _ptr = o._ptr; return *this; } - SmartPointer& operator=(TYPE* ptr) throw() { + SmartPointer& operator=(TYPE* ptr) noexcept { if (ptr==_ptr) return *this; drop(); _cnt = ptr ? new PointerCounter : 0; @@ -122,26 +122,26 @@ namespace mrw { return *this; } template - SmartPointer& operator=(const SmartPointer& o) throw() { + SmartPointer& operator=(const SmartPointer& o) noexcept { if (getPointer(o)==_ptr) return *this; drop(); _ptr = dynamic_cast(getPointer(o)); _cnt = _ptr ? getCounter(o)->incr() : 0; return *this; } - TYPE& operator*() throw() { + TYPE& operator*() noexcept { return *_ptr; } - const TYPE& operator*() const throw() { + const TYPE& operator*() const noexcept { return *_ptr; } - TYPE* operator->() throw() { + TYPE* operator->() noexcept { return _ptr; } - const TYPE* operator->() const throw() { + const TYPE* operator->() const noexcept { return _ptr; } - operator bool() throw() { + operator bool() noexcept { return _ptr!=0; } }; diff --git a/src/mrw/stacktrace.hxx b/src/mrw/stacktrace.hxx index 3b8ab20..a3cb1c7 100644 --- a/src/mrw/stacktrace.hxx +++ b/src/mrw/stacktrace.hxx @@ -158,20 +158,20 @@ namespace mrw { }; //................................................................ methods /// the constructor stores the actual stack trace - StackTrace() throw(std::bad_exception); + StackTrace() ; /// depending on how we got the stack trace, we may have to free memory - ~StackTrace() throw(); + ~StackTrace() noexcept; /// evaluates the symbol table and returns the formatted stack trace - operator std::string() const throw(std::bad_exception); + operator std::string() const ; /** @return list of raw stack addresses */ - operator const AddressTrace&() const throw(std::bad_exception) { + operator const AddressTrace&() const { return _trace; } /// evaluate the stack trace and print it to a stream - const StackTrace& print(std::ostream& os) const throw(std::bad_exception); + const StackTrace& print(std::ostream& os) const ; /// evaluates and returns all information from a raw address /** @classmutex _mutex */ - static CodePos translate(void* addr) throw(std::bad_exception); + static CodePos translate(void* addr) ; /** @brief read the symbol table from the executable file or a shared library @@ -211,7 +211,7 @@ namespace mrw { @classmutex _mutex */ static bool createSymtable(const std::string& fname="", void* offs=0) - throw(std::bad_exception); + ; /** @brief get the error text if @ref createSymtable returns false @@ -220,7 +220,7 @@ namespace mrw { was caught in @ref createSymtable. @return error text */ - static const std::string& error() throw() { + static const std::string& error() noexcept { return _error; } @@ -251,12 +251,12 @@ namespace mrw { @classmutex _mutex */ static bool createSymtable(const BinFiles& files) - throw(std::bad_exception); + ; private: //............................................................... typedefs typedef std::map > Translator; - static int bfdClose(bfd*) throw(); + static int bfdClose(bfd*) noexcept; typedef mrw::AutoResource AutoBfd; friend class mrw::AutoResource @@ -273,9 +273,9 @@ namespace mrw { static std::string _error; //................................................................ methods - static BinFiles filename() throw(std::bad_exception); + static BinFiles filename() ; static void buildSectionMap(bfd*, asection*, void*) - throw(std::bad_exception); + ; }; //@} @@ -287,7 +287,7 @@ namespace mrw { /// evaluate a stack trace and shift it on a stream inline std::ostream& operator<<(std::ostream& os, const mrw::StackTrace& st) - throw(std::bad_exception) { + { return os<<(std::string)st; } diff --git a/src/mrw/stdext.hxx b/src/mrw/stdext.hxx index 5e9e4a5..1da04ab 100644 --- a/src/mrw/stdext.hxx +++ b/src/mrw/stdext.hxx @@ -45,10 +45,18 @@ namespace mrw { std::cout<<"Read: "< T& max(T& t1, T& t2) { return t2 T& min(T& t1, T& t2) { return t1?: operation: a ? a : b @@ -222,7 +236,6 @@ namespace mrw { std::istream& getline(std::istream& is, std::string& s, char d = '\n'); //@} - //@} } #endif diff --git a/src/mrw/string.hxx b/src/mrw/string.hxx index 2e7437e..22c383e 100644 --- a/src/mrw/string.hxx +++ b/src/mrw/string.hxx @@ -190,7 +190,7 @@ namespace mrw { @pre T must support operator<< to a stream */ template std::string string(const T& o) - throw(std::bad_exception) { + { std::stringstream ss; ss< T to(const std::string& s) throw(std::exception) { + template T to(const std::string& s) { T o; std::stringstream ss(s); if (!(ss>>o)) throw mrw::invalid_argument(s); @@ -235,7 +235,7 @@ namespace mrw { typename CONTENTS, typename ALLOC> std::string join(const LIST& l, const std::string& delimiter=" ") - throw(std::bad_exception) { + { std::string result; for (typename LIST::const_iterator it(l.begin()); it!=l.end(); ++it) @@ -263,7 +263,7 @@ namespace mrw { inline std::list split(const std::string& text, bool greedy=true, const std::string& delimiters=" \n\t") - throw(std::bad_exception) { + { std::list res; for (std::string::size_type pos(0); pos std::string& operator<<(std::string& s, const T& o) - throw(std::bad_exception) { + { return s+=mrw::string(o); } @@ -316,7 +316,7 @@ template std::string& operator<<(std::string& s, const T& o) @pre T must support operator<< to a stream */ template std::string operator<<(const std::string& s, const T& o) - throw(std::bad_exception) { + { return s+=mrw::string(o); } @@ -344,7 +344,7 @@ template std::string operator<<(const std::string& s, const T& o) (since 1.4.1) */ template std::string& operator>>(std::string& s, T& o) - throw(std::exception) { + { std::stringstream ss(s); if (!(ss>>o)) throw mrw::invalid_argument(s); return (s=ss.tellg()>0?s.substr(ss.tellg()):""); @@ -362,7 +362,7 @@ template std::string& operator>>(std::string& s, T& o) @pre \#include */ inline std::string operator+(const std::string& s, unsigned short o) - throw(std::bad_exception) { + { return s+mrw::string(o); } @@ -378,7 +378,7 @@ inline std::string operator+(const std::string& s, unsigned short o) @pre \#include */ inline std::string operator+(unsigned short o, const std::string& s) - throw(std::bad_exception) { + { return mrw::string(o)+s; } @@ -394,7 +394,7 @@ inline std::string operator+(unsigned short o, const std::string& s) @pre \#include */ inline std::string operator+(const std::string& s, unsigned int o) - throw(std::bad_exception) { + { return s+mrw::string(o); } @@ -410,7 +410,7 @@ inline std::string operator+(const std::string& s, unsigned int o) @pre \#include */ inline std::string operator+(unsigned int o, const std::string& s) - throw(std::bad_exception) { + { return mrw::string(o)+s; } @@ -426,7 +426,7 @@ inline std::string operator+(unsigned int o, const std::string& s) @pre \#include */ inline std::string operator+(const std::string& s, unsigned long o) - throw(std::bad_exception) { + { return s+mrw::string(o); } @@ -442,7 +442,7 @@ inline std::string operator+(const std::string& s, unsigned long o) @pre \#include */ inline std::string operator+(unsigned long o, const std::string& s) - throw(std::bad_exception) { + { return mrw::string(o)+s; } @@ -458,7 +458,7 @@ inline std::string operator+(unsigned long o, const std::string& s) @pre \#include */ inline std::string operator+(const std::string& s, signed short o) - throw(std::bad_exception) { + { return s+mrw::string(o); } @@ -474,7 +474,7 @@ inline std::string operator+(const std::string& s, signed short o) @pre \#include */ inline std::string operator+(signed short o, const std::string& s) - throw(std::bad_exception) { + { return mrw::string(o)+s; } @@ -490,7 +490,7 @@ inline std::string operator+(signed short o, const std::string& s) @pre \#include */ inline std::string operator+(const std::string& s, signed int o) - throw(std::bad_exception) { + { return s+mrw::string(o); } @@ -506,7 +506,7 @@ inline std::string operator+(const std::string& s, signed int o) @pre \#include */ inline std::string operator+(signed int o, const std::string& s) - throw(std::bad_exception) { + { return mrw::string(o)+s; } @@ -522,7 +522,7 @@ inline std::string operator+(signed int o, const std::string& s) @pre \#include */ inline std::string operator+(const std::string& s, signed long o) - throw(std::bad_exception) { + { return s+mrw::string(o); } @@ -538,7 +538,7 @@ inline std::string operator+(const std::string& s, signed long o) @pre \#include */ inline std::string operator+(signed long o, const std::string& s) - throw(std::bad_exception) { + { return mrw::string(o)+s; } @@ -555,7 +555,7 @@ inline std::string operator+(signed long o, const std::string& s) @pre \#include */ inline std::string& operator+=(std::string& s, unsigned short o) - throw(std::bad_exception) { + { return s+=mrw::string(o); } @@ -571,7 +571,7 @@ inline std::string& operator+=(std::string& s, unsigned short o) @pre \#include */ inline std::string& operator+=(std::string& s, unsigned int o) - throw(std::bad_exception) { + { return s+=mrw::string(o); } @@ -587,7 +587,7 @@ inline std::string& operator+=(std::string& s, unsigned int o) @pre \#include */ inline std::string& operator+=(std::string& s, unsigned long o) - throw(std::bad_exception) { + { return s+=mrw::string(o); } @@ -603,7 +603,7 @@ inline std::string& operator+=(std::string& s, unsigned long o) @pre \#include */ inline std::string& operator+=(std::string& s, signed short o) - throw(std::bad_exception) { + { return s+=mrw::string(o); } @@ -619,7 +619,7 @@ inline std::string& operator+=(std::string& s, signed short o) @pre \#include */ inline std::string& operator+=(std::string& s, signed int o) - throw(std::bad_exception) { + { return s+=mrw::string(o); } @@ -635,7 +635,7 @@ inline std::string& operator+=(std::string& s, signed int o) @pre \#include */ inline std::string& operator+=(std::string& s, signed long o) - throw(std::bad_exception) { + { return s+=mrw::string(o); } diff --git a/src/mrw/tokenizer.hxx b/src/mrw/tokenizer.hxx index 95bcf83..8502b36 100644 --- a/src/mrw/tokenizer.hxx +++ b/src/mrw/tokenizer.hxx @@ -87,7 +87,7 @@ namespace mrw { */ Tokenizer(const std::string& text, bool greedy = true, const std::string& delim = " \t\n") - throw(std::bad_exception): + : _text(text), _delim(delim), _pos(0), _oldpos(0), _greedy(greedy) { } @@ -105,7 +105,7 @@ namespace mrw { @see @ref mrw::Tokenizer for an example */ - operator bool() throw(std::bad_exception) { + operator bool() { _oldpos = _greedy ? _text.find_first_not_of(_delim, _pos) : _pos>0 ? _pos+1 : _pos; @@ -130,7 +130,7 @@ namespace mrw { @see @ref mrw::Tokenizer for an example */ - std::string operator()() const throw(std::bad_exception) { + std::string operator()() const { return _text.substr(_oldpos, _pos-_oldpos); } @@ -138,7 +138,7 @@ namespace mrw { Resets the tokenizer so, that you can restart your iteration. */ - void reset() throw() { + void reset() noexcept { _pos = _oldpos = 0; } @@ -156,7 +156,7 @@ namespace mrw { @param text the text given in the constructor is replaced */ - void reset(const std::string& text) throw(std::bad_exception) { + void reset(const std::string& text) { _text = text; reset(); } diff --git a/src/mrw/unistd.hxx b/src/mrw/unistd.hxx index 6f1e501..01e6862 100644 --- a/src/mrw/unistd.hxx +++ b/src/mrw/unistd.hxx @@ -71,7 +71,7 @@ namespace mrw { }; /// creates a unix pipe /** @param mode Flag whether the pipe is blocking (default: yes) */ - Pipe(BlockingMode mode=blocking) throw(std::bad_exception): + Pipe(BlockingMode mode=blocking) : _lastError(-1) { _fd[0] = -1; _fd[1] = -1; @@ -91,16 +91,16 @@ namespace mrw { } } /// destructor closes pipe if still open - ~Pipe() throw(std::bad_exception) { + ~Pipe() { close(); } /// closes pipe if open - void close() throw(std::bad_exception) { + void close() { close_in(); close_out(); } /// closes input pipe if open - void close_in() throw(std::bad_exception) { + void close_in() { if (_fd[0]!=-1) while (::close(_fd[0])==-1) if (errno!=EINTR) { _lastError = errno; break; @@ -108,7 +108,7 @@ namespace mrw { _fd[0] = -1; } /// closes output pipe if open - void close_out() throw(std::bad_exception) { + void close_out() { if (_fd[1]!=-1) while (::close(_fd[1])==-1) if (errno!=EINTR) { _lastError = errno; break; @@ -116,29 +116,29 @@ namespace mrw { _fd[1] = -1; } /** @return true if no error occured */ - operator bool() throw() { + operator bool() noexcept { return _lastError == -1; } /** @return last error code, -1 if no error */ - int error() throw() { + int error() noexcept { return _lastError; } /// connect input stream to @c stdin - void connect_cin() throw(std::bad_exception) { + void connect_cin() { while (::dup2(_fd[0], 0)==-1) if (errno!=EINTR) { _lastError = errno; return; } } /// connect output stream to @c stdout - void connect_cout() throw(std::bad_exception) { + void connect_cout() { while (::dup2(_fd[1], 1)==-1) if (errno!=EINTR) { _lastError = errno; return; } } /// connect output stream to @c stderr - void connect_cerr() throw(std::bad_exception) { + void connect_cerr() { while (::dup2(_fd[1], 2)==-1) if (errno!=EINTR) { _lastError = errno; return; @@ -147,13 +147,13 @@ namespace mrw { /// get an input stream /** @return stream to read from @note invalid after destruction or @c close or @c close_in */ - int istream() throw(std::bad_exception) { + int istream() { return _fd[0]; } /// get an output stream /** @return stream to write to @note invalid after destruction or @c close or @c close_out */ - int ostream() throw(std::bad_exception) { + int ostream() { return _fd[1]; } }; diff --git a/src/mrw/vector.hxx b/src/mrw/vector.hxx index 7d9ed11..8b95c12 100644 --- a/src/mrw/vector.hxx +++ b/src/mrw/vector.hxx @@ -51,7 +51,7 @@ */ template std::vector& operator<<(std::vector& l, const T& o) - throw(std::bad_exception) { + { l.push_back(o); return l; } @@ -70,7 +70,7 @@ template */ template std::vector operator<<(const std::vector& l, const T& o) - throw(std::bad_exception) { + { std::vector copy(l); copy.push_back(o); return copy; @@ -89,7 +89,7 @@ template template std::vector& operator<<(std::vector& l, const char *const o) - throw(std::bad_exception) { + { l.push_back(T(o)); return l; } @@ -114,7 +114,7 @@ template */ template std::vector& operator>>(std::vector& l, T& o) - throw(std::exception) { + { typename std::vector::iterator it(l.begin()); if (it==l.end()) throw mrw::length_error(std::string(__FILE__ ":")+__LINE__+ diff --git a/src/regexp.cxx b/src/regexp.cxx index e321e3f..f5e05d7 100644 --- a/src/regexp.cxx +++ b/src/regexp.cxx @@ -25,25 +25,25 @@ namespace mrw { RegExp::RegExp(const std::string& pattern, bool hassub, int flags) - throw(std::exception): + : _hassub(hassub) { if (flags&nosub) throw mrw::invalid_argument("nosub"); if (regcomp(&_regex, pattern.c_str(), (_hassub?flags:(flags|nosub)))) throw mrw::invalid_argument(pattern); } - RegExp::~RegExp() throw() { + RegExp::~RegExp() noexcept { regfree(&_regex); } - bool RegExp::operator()(const std::string& text) throw(std::bad_exception) { + bool RegExp::operator()(const std::string& text) { if (_hassub) return !regexec(&_regex, (_text=text).c_str(), MAX_SUB, _sub, 0); else return !regexec(&_regex, text.c_str(), 0, 0, 0); } - std::string RegExp::operator[](unsigned int n) const throw(std::exception) { + std::string RegExp::operator[](unsigned int n) const { if (!_hassub) throw mrw::invalid_argument("initialized with no sub expressions"); if (n>=MAX_SUB || _sub[n].rm_so<0 || _sub[n].rm_eo<0) diff --git a/src/stacktrace.cxx b/src/stacktrace.cxx index 4922504..dd8f3c3 100644 --- a/src/stacktrace.cxx +++ b/src/stacktrace.cxx @@ -36,7 +36,7 @@ #endif #include #include -#if HAVE_DEMANGLE_H +#ifdef HAVE_DEMANGLE_H /* the defines work around wrong definitions in libiberty.h */ #define HAVE_DECL_BASENAME 1 #define HAVE_DECL_FFS 1 @@ -87,7 +87,7 @@ namespace mrw { } //---------------------------------------------------------------------------- -mrw::StackTrace::StackTrace() throw(std::bad_exception) { +mrw::StackTrace::StackTrace() { // maximum trace level is limited here to 50, see below why # if defined(__GLIBC__) { @@ -123,7 +123,7 @@ mrw::StackTrace::StackTrace() throw(std::bad_exception) { # endif } -mrw::StackTrace::~StackTrace() throw() { +mrw::StackTrace::~StackTrace() noexcept { // maximum trace level is limited here to 50, see below why # if !defined(__GNUG__) && defined(__GLIBC__) /* GLIBC backtrace seems to leak memory, but I don't see why, so @@ -164,7 +164,7 @@ mrw::StackTrace::~StackTrace() throw() { # endif } //---------------------------------------------------------------------------- -mrw::StackTrace::operator std::string() const throw(std::bad_exception) { +mrw::StackTrace::operator std::string() const { std::stringstream s; std::string::size_type fusz(0), adsz(0); //lisz(0), fisz(0) std::list l; @@ -187,14 +187,14 @@ mrw::StackTrace::operator std::string() const throw(std::bad_exception) { //---------------------------------------------------------------------------- const mrw::StackTrace& mrw::StackTrace::print(std::ostream& os) const - throw(std::bad_exception) { + { os<<(std::string)*this; return *this; } //---------------------------------------------------------------------------- mrw::StackTrace::CodePos mrw::StackTrace::translate(void* addr) - throw(std::bad_exception) { + { #ifdef _MT boost::recursive_mutex::scoped_lock lock(_mutex); #endif @@ -223,13 +223,13 @@ mrw::StackTrace::CodePos mrw::StackTrace::translate(void* addr) //---------------------------------------------------------------------------- bool mrw::StackTrace::createSymtable(const std::string& fname, void* offs) - throw(std::bad_exception) { + { #ifdef _MT boost::recursive_mutex::scoped_lock lock(_mutex); #endif if (_dic.find(fname)!=_dic.end()) return true; // already loaded try { -#if NO_LTDL +#ifdef NO_LTDL static bfd*(*bfd_openr)(const char*, const char*) = ::bfd_openr; static bfd_boolean(*bfd_check_format)(bfd*, bfd_format) = @@ -289,7 +289,7 @@ bool mrw::StackTrace::createSymtable(const std::string& fname, void* offs) //---------------------------------------------------------------------------- bool mrw::StackTrace::createSymtable(const mrw::StackTrace::BinFiles& files) - throw(std::bad_exception) { + { #ifdef _MT boost::recursive_mutex::scoped_lock lock(_mutex); #endif @@ -302,9 +302,9 @@ bool mrw::StackTrace::createSymtable(const mrw::StackTrace::BinFiles& files) } //---------------------------------------------------------------------------- -int mrw::StackTrace::bfdClose(bfd* abfd) throw() { +int mrw::StackTrace::bfdClose(bfd* abfd) noexcept { try { -#if NO_LTDL +#ifdef NO_LTDL static int(*bfd_close)(bfd*) = ::bfd_close; #else static DynamicLibrary lib(""); @@ -318,7 +318,7 @@ int mrw::StackTrace::bfdClose(bfd* abfd) throw() { //---------------------------------------------------------------------------- mrw::StackTrace::BinFiles mrw::StackTrace::filename() - throw(std::bad_exception) { + { mrw::StackTrace::BinFiles res; # if defined(__solaris__) { @@ -365,7 +365,7 @@ mrw::StackTrace::BinFiles mrw::StackTrace::filename() //---------------------------------------------------------------------------- void mrw::StackTrace::buildSectionMap(bfd* abfd, asection* section, void* fileoffs) - throw(std::bad_exception) { + { if (!abfd || !section || !fileoffs) return; if (!(bfd_get_section_flags(abfd, section)&SEC_ALLOC)) return; std::pair fileoffset = diff --git a/test/exec_test.cxx b/test/exec_test.cxx index 80b9c9e..428e840 100644 --- a/test/exec_test.cxx +++ b/test/exec_test.cxx @@ -101,7 +101,7 @@ public: CPPUNIT_ASSERT_THROW(throw, mrw::ExecutionFailedExc); } } - void unexpectedExc2() throw(std::bad_exception) { + void unexpectedExc2() { try { mrw::PartialExec exec = (mrw::Cmd("/bin/false")).start(); while (!exec.finished()) exec.read(); diff --git a/test/makefile.am b/test/makefile.am index e38ba5d..47a5b11 100644 --- a/test/makefile.am +++ b/test/makefile.am @@ -26,9 +26,7 @@ if HAVE_LOG4CXX endif if HAVE_STACKTRACE NO_VALGRIND_CHECKS += stacktrace_test - VALGRIND_CHECKS += mrwexcstderr_test if HAVE_LOG4CXX - VALGRIND_CHECKS += mrwexclog4cxx_test if AUTOFNTRACE # @bug Actually, the following test fails; to be repaired, see # @@ -140,17 +138,7 @@ if HAVE_STACKTRACE stacktrace_test_CXXFLAGS = -g3 -O0 stacktrace_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src stacktrace_test_LDADD = -lmrw -lmrwexcstderr - mrwexcstderr_test_SOURCES = mrwexcstderr_test.cxx - mrwexcstderr_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0 - mrwexcstderr_test_CXXFLAGS = -g3 -O0 - mrwexcstderr_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src - mrwexcstderr_test_LDADD = -lmrw -lmrwexcstderr if HAVE_LOG4CXX - mrwexclog4cxx_test_SOURCES = mrwexclog4cxx_test.cxx - mrwexclog4cxx_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0 - mrwexclog4cxx_test_CXXFLAGS = -g3 -O0 - mrwexclog4cxx_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src - mrwexclog4cxx_test_LDADD = -lmrw -lmrwexclog4cxx -llog4cxx if AUTOFNTRACE # @bug Actually, the following test fails; to be repaired, see # @@ -195,6 +183,6 @@ TESTS = $(check_PROGRAMS) $(dist_check_SCRIPTS) endif check_PROGRAMS = $(VALGRIND_CHECKS) $(NO_VALGRIND_CHECKS) -CLEANFILES = +CLEANFILES = ${VALGRIND_CHECKS:%=%.xml} ${NO_VALGRIND_CHECKS:%=%.xml} DISTCLEANFILES = configfile2.ini MAINTAINERCLEANFILES = makefile.in diff --git a/test/mrwexclog4cxx_test.cxx b/test/mrwexclog4cxx_test.cxx deleted file mode 100644 index 3aef7c2..0000000 --- a/test/mrwexclog4cxx_test.cxx +++ /dev/null @@ -1,100 +0,0 @@ -/** @file - - $Id$ - - $Date$ - $Author$ - - @copy © Marc Wäckerlin - @license LGPL, see file COPYING - - $Log$ - Revision 1.2 2004/08/28 16:21:25 marc - mrw-c++-0.92 (mrw) - - new file: version.cxx - - new file header for all sources - - work around warning in mrw::auto - - possibility to compile without log4cxx - - work around bugs in demangle.h and libiberty.h - - corrections in documentation - - added simple tracing mechanism - - more warnings - - small corrections in Auto<>::Free and a new test for it - - possibility to compile without stack trace - -*/ -#include -#include -#include -#include -#include -#include -#include -#include - -namespace mrw { - class AutoExcLog4CxxTest: public CppUnit::TestFixture { - private: - bool enter_unexpectedThrow; - bool exit_unexpectedThrow; - bool enter_passUnexpected; - bool exit_passUnexpected; - bool enter_catchUnexpected; - bool exit_catchUnexpected; - public: - void setUp() { - enter_unexpectedThrow = false; - exit_unexpectedThrow = false; - enter_passUnexpected = false; - exit_passUnexpected = false; - enter_catchUnexpected = false; - exit_catchUnexpected = false; - } - void unexpectedThrow() throw(std::bad_exception) { - enter_unexpectedThrow = true; - throw mrw::exception(); - exit_unexpectedThrow = true; - } - void passUnexpected() throw(std::bad_exception) { - enter_passUnexpected = true; - unexpectedThrow(); - exit_passUnexpected = true; - } - void catchUnexpected() throw() { - enter_catchUnexpected = true; - bool caught(false); - try { - passUnexpected(); - } catch (std::bad_exception&) { - caught = true; - } - CPPUNIT_ASSERT(caught); - exit_catchUnexpected = true; - } - void testcase() { - std::set_unexpected([]{throw std::bad_exception();}); - catchUnexpected(); - CPPUNIT_ASSERT(enter_catchUnexpected && - enter_passUnexpected && - enter_unexpectedThrow && - exit_catchUnexpected && - !exit_passUnexpected && - !exit_unexpectedThrow); - } - CPPUNIT_TEST_SUITE(AutoExcLog4CxxTest); - CPPUNIT_TEST(testcase); - CPPUNIT_TEST_SUITE_END(); - }; - CPPUNIT_TEST_SUITE_REGISTRATION(AutoExcLog4CxxTest); -} - -int main(int argc, char** argv) try { - std::ofstream ofs((*argv+std::string(".xml")).c_str()); - CppUnit::TextUi::TestRunner runner; - runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs)); - runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); - return runner.run() ? 0 : 1; - } catch (std::exception& e) { - std::cerr<<"***Exception: "<COPYING - - $Log$ - Revision 1.2 2004/08/28 16:21:25 marc - mrw-c++-0.92 (mrw) - - new file: version.cxx - - new file header for all sources - - work around warning in mrw::auto - - possibility to compile without log4cxx - - work around bugs in demangle.h and libiberty.h - - corrections in documentation - - added simple tracing mechanism - - more warnings - - small corrections in Auto<>::Free and a new test for it - - possibility to compile without stack trace - -*/ -#include -#include -#include -#include -#include -#include -#include - -namespace mrw { - class AutoExcStderrTest: public CppUnit::TestFixture { - private: - bool enter_unexpectedThrow; - bool exit_unexpectedThrow; - bool enter_passUnexpected; - bool exit_passUnexpected; - bool enter_catchUnexpected; - bool exit_catchUnexpected; - public: - void setUp() { - enter_unexpectedThrow = false; - exit_unexpectedThrow = false; - enter_passUnexpected = false; - exit_passUnexpected = false; - enter_catchUnexpected = false; - exit_catchUnexpected = false; - } - void unexpectedThrow() throw(std::bad_exception) { - enter_unexpectedThrow = true; - throw mrw::exception(); - exit_unexpectedThrow = true; - } - void passUnexpected() throw(std::bad_exception) { - enter_passUnexpected = true; - unexpectedThrow(); - exit_passUnexpected = true; - } - void catchUnexpected() throw() { - enter_catchUnexpected = true; - bool caught(false); - try { - passUnexpected(); - } catch (std::bad_exception&) { - caught = true; - } - CPPUNIT_ASSERT(caught); - exit_catchUnexpected = true; - } - void testcase() { - std::set_unexpected([]{throw std::bad_exception();}); - catchUnexpected(); - CPPUNIT_ASSERT(enter_catchUnexpected && - enter_passUnexpected && - enter_unexpectedThrow && - exit_catchUnexpected && - !exit_passUnexpected && - !exit_unexpectedThrow); - } - CPPUNIT_TEST_SUITE(AutoExcStderrTest); - CPPUNIT_TEST(testcase); - CPPUNIT_TEST_SUITE_END(); - }; - CPPUNIT_TEST_SUITE_REGISTRATION(AutoExcStderrTest); -} - -int main(int argc, char** argv) try { - std::ofstream ofs((*argv+std::string(".xml")).c_str()); - CppUnit::TextUi::TestRunner runner; - runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs)); - runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); - return runner.run() ? 0 : 1; - } catch (std::exception& e) { - std::cerr<<"***Exception: "<