From 199294552d9d54d4774d16f4ac2441cffaff585a Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Mon, 31 May 2021 12:54:58 +0300 Subject: [PATCH 1/6] [#1907] catch all exceptions in main functions --- src/bin/agent/main.cc | 2 + src/bin/d2/main.cc | 2 + src/bin/dhcp4/main.cc | 391 +++++++++++++++---------------- src/bin/dhcp6/main.cc | 395 ++++++++++++++++---------------- src/bin/lfc/main.cc | 25 +- src/bin/netconf/main.cc | 4 +- src/bin/perfdhcp/main.cc | 12 +- src/lib/log/compiler/message.cc | 5 +- 8 files changed, 431 insertions(+), 405 deletions(-) diff --git a/src/bin/agent/main.cc b/src/bin/agent/main.cc index 01fee6acb2..2794b21640 100644 --- a/src/bin/agent/main.cc +++ b/src/bin/agent/main.cc @@ -38,6 +38,8 @@ int main(int argc, char* argv[]) { } catch (const isc::Exception& ex) { std::cerr << "Service failed: " << ex.what() << std::endl; ret = EXIT_FAILURE; + } catch (...) { + ret = EXIT_FAILURE; } return (ret); diff --git a/src/bin/d2/main.cc b/src/bin/d2/main.cc index 233d00465d..ae40b0a1d1 100644 --- a/src/bin/d2/main.cc +++ b/src/bin/d2/main.cc @@ -47,6 +47,8 @@ int main(int argc, char* argv[]) { } catch (const isc::Exception& ex) { std::cerr << "Service failed: " << ex.what() << std::endl; ret = EXIT_FAILURE; + } catch (...) { + ret = EXIT_FAILURE; } return (ret); diff --git a/src/bin/dhcp4/main.cc b/src/bin/dhcp4/main.cc index a79f40989b..d7dc4a6d0a 100644 --- a/src/bin/dhcp4/main.cc +++ b/src/bin/dhcp4/main.cc @@ -68,231 +68,236 @@ usage() { int main(int argc, char* argv[]) { - int ch; - // The default. Any other values are useful for testing only. - int server_port_number = DHCP4_SERVER_PORT; - // Not zero values are useful for testing only. - int client_port_number = 0; - bool verbose_mode = false; // Should server be verbose? - bool check_mode = false; // Check syntax - - // The standard config file - std::string config_file(""); - - while ((ch = getopt(argc, argv, "dvVWc:p:P:t:")) != -1) { - switch (ch) { - case 'd': - verbose_mode = true; - break; - - case 'v': - cout << Dhcpv4Srv::getVersion(false) << endl; - return (EXIT_SUCCESS); - - case 'V': - cout << Dhcpv4Srv::getVersion(true) << endl; - return (EXIT_SUCCESS); - - case 'W': - cout << isc::detail::getConfigReport() << endl; - return (EXIT_SUCCESS); - - case 't': - check_mode = true; - // falls through - - case 'c': // config file - config_file = optarg; - break; - - case 'p': // server port number - try { - server_port_number = boost::lexical_cast(optarg); - } catch (const boost::bad_lexical_cast &) { - cerr << "Failed to parse server port number: [" << optarg - << "], 1-65535 allowed." << endl; - usage(); - } - if (server_port_number <= 0 || server_port_number > 65535) { - cerr << "Failed to parse server port number: [" << optarg - << "], 1-65535 allowed." << endl; - usage(); - } - break; + try { + int ch; + // The default. Any other values are useful for testing only. + int server_port_number = DHCP4_SERVER_PORT; + // Not zero values are useful for testing only. + int client_port_number = 0; + bool verbose_mode = false; // Should server be verbose? + bool check_mode = false; // Check syntax + + // The standard config file + std::string config_file(""); + + while ((ch = getopt(argc, argv, "dvVWc:p:P:t:")) != -1) { + switch (ch) { + case 'd': + verbose_mode = true; + break; + + case 'v': + cout << Dhcpv4Srv::getVersion(false) << endl; + return (EXIT_SUCCESS); - case 'P': // client port number - try { - client_port_number = boost::lexical_cast(optarg); - } catch (const boost::bad_lexical_cast &) { - cerr << "Failed to parse client port number: [" << optarg - << "], 1-65535 allowed." << endl; - usage(); - } - if (client_port_number <= 0 || client_port_number > 65535) { - cerr << "Failed to parse client port number: [" << optarg - << "], 1-65535 allowed." << endl; + case 'V': + cout << Dhcpv4Srv::getVersion(true) << endl; + return (EXIT_SUCCESS); + + case 'W': + cout << isc::detail::getConfigReport() << endl; + return (EXIT_SUCCESS); + + case 't': + check_mode = true; + // falls through + + case 'c': // config file + config_file = optarg; + break; + + case 'p': // server port number + try { + server_port_number = boost::lexical_cast(optarg); + } catch (const boost::bad_lexical_cast &) { + cerr << "Failed to parse server port number: [" << optarg + << "], 1-65535 allowed." << endl; + usage(); + } + if (server_port_number <= 0 || server_port_number > 65535) { + cerr << "Failed to parse server port number: [" << optarg + << "], 1-65535 allowed." << endl; + usage(); + } + break; + + case 'P': // client port number + try { + client_port_number = boost::lexical_cast(optarg); + } catch (const boost::bad_lexical_cast &) { + cerr << "Failed to parse client port number: [" << optarg + << "], 1-65535 allowed." << endl; + usage(); + } + if (client_port_number <= 0 || client_port_number > 65535) { + cerr << "Failed to parse client port number: [" << optarg + << "], 1-65535 allowed." << endl; + usage(); + } + break; + + default: usage(); } - break; + } - default: + // Check for extraneous parameters. + if (argc > optind) { usage(); } - } - // Check for extraneous parameters. - if (argc > optind) { - usage(); - } + // Configuration file is required. + if (config_file.empty()) { + cerr << "Configuration file not specified." << endl; + usage(); + } - // Configuration file is required. - if (config_file.empty()) { - cerr << "Configuration file not specified." << endl; - usage(); - } + // This is the DHCPv4 server + CfgMgr::instance().setFamily(AF_INET); - // This is the DHCPv4 server - CfgMgr::instance().setFamily(AF_INET); + if (check_mode) { + try { + // We need to initialize logging, in case any error messages are to be printed. + // This is just a test, so we don't care about lockfile. + setenv("KEA_LOCKFILE_DIR", "none", 0); + Daemon::setDefaultLoggerName(DHCP4_ROOT_LOGGER_NAME); + Daemon::loggerInit(DHCP4_ROOT_LOGGER_NAME, verbose_mode); + + // Check the syntax first. + Parser4Context parser; + ConstElementPtr json; + json = parser.parseFile(config_file, Parser4Context::PARSER_DHCP4); + if (!json) { + cerr << "No configuration found" << endl; + return (EXIT_FAILURE); + } + if (verbose_mode) { + cerr << "Syntax check OK" << endl; + } + + // Check the logic next. + ConstElementPtr dhcp4 = json->get("Dhcp4"); + if (!dhcp4) { + cerr << "Missing mandatory Dhcp4 element" << endl; + return (EXIT_FAILURE); + } + ControlledDhcpv4Srv server(0); + ConstElementPtr answer; + + // Now we pass the Dhcp4 configuration to the server, but + // tell it to check the configuration only (check_only = true) + answer = configureDhcp4Server(server, dhcp4, true); + + int status_code = 0; + answer = isc::config::parseAnswer(status_code, answer); + if (status_code == 0) { + return (EXIT_SUCCESS); + } else { + cerr << "Error encountered: " << answer->stringValue() << endl; + return (EXIT_FAILURE); + } + } catch (const std::exception& ex) { + cerr << "Syntax check failed with: " << ex.what() << endl; + } + return (EXIT_FAILURE); + } - if (check_mode) { + int ret = EXIT_SUCCESS; try { - // We need to initialize logging, in case any error messages are to be printed. - // This is just a test, so we don't care about lockfile. - setenv("KEA_LOCKFILE_DIR", "none", 0); + // It is important that we set a default logger name because this name + // will be used when the user doesn't provide the logging configuration + // in the Kea configuration file. Daemon::setDefaultLoggerName(DHCP4_ROOT_LOGGER_NAME); + + // Initialize logging. If verbose, we'll use maximum verbosity. Daemon::loggerInit(DHCP4_ROOT_LOGGER_NAME, verbose_mode); + LOG_DEBUG(dhcp4_logger, DBG_DHCP4_START, DHCP4_START_INFO) + .arg(getpid()) + .arg(server_port_number) + .arg(client_port_number) + .arg(verbose_mode ? "yes" : "no"); - // Check the syntax first. - Parser4Context parser; - ConstElementPtr json; - json = parser.parseFile(config_file, Parser4Context::PARSER_DHCP4); - if (!json) { - cerr << "No configuration found" << endl; - return (EXIT_FAILURE); - } - if (verbose_mode) { - cerr << "Syntax check OK" << endl; - } + LOG_INFO(dhcp4_logger, DHCP4_STARTING) + .arg(VERSION) + .arg(PACKAGE_VERSION_TYPE); - // Check the logic next. - ConstElementPtr dhcp4 = json->get("Dhcp4"); - if (!dhcp4) { - cerr << "Missing mandatory Dhcp4 element" << endl; - return (EXIT_FAILURE); + if (string(PACKAGE_VERSION_TYPE) == "development") { + LOG_WARN(dhcp4_logger, DHCP4_DEVELOPMENT_VERSION); } - ControlledDhcpv4Srv server(0); - ConstElementPtr answer; - // Now we pass the Dhcp4 configuration to the server, but - // tell it to check the configuration only (check_only = true) - answer = configureDhcp4Server(server, dhcp4, true); + // Create the server instance. + ControlledDhcpv4Srv server(server_port_number, client_port_number); + + // Remember verbose-mode + server.setVerbose(verbose_mode); + + // Create our PID file. + server.setProcName(DHCP4_NAME); + server.setConfigFile(config_file); + server.createPIDFile(); + + try { + // Initialize the server. + server.init(config_file); + } catch (const std::exception& ex) { + + try { + // Let's log out what went wrong. + isc::log::LoggerManager log_manager; + log_manager.process(); + LOG_ERROR(dhcp4_logger, DHCP4_INIT_FAIL).arg(ex.what()); + } catch (...) { + // The exception thrown during the initialization could + // originate from logger subsystem. Therefore LOG_ERROR() + // may fail as well. + cerr << "Failed to initialize server: " << ex.what() << endl; + } - int status_code = 0; - answer = isc::config::parseAnswer(status_code, answer); - if (status_code == 0) { - return (EXIT_SUCCESS); - } else { - cerr << "Error encountered: " << answer->stringValue() << endl; return (EXIT_FAILURE); } - } catch (const std::exception& ex) { - cerr << "Syntax check failed with: " << ex.what() << endl; - } - return (EXIT_FAILURE); - } - int ret = EXIT_SUCCESS; - try { - // It is important that we set a default logger name because this name - // will be used when the user doesn't provide the logging configuration - // in the Kea configuration file. - Daemon::setDefaultLoggerName(DHCP4_ROOT_LOGGER_NAME); - - // Initialize logging. If verbose, we'll use maximum verbosity. - Daemon::loggerInit(DHCP4_ROOT_LOGGER_NAME, verbose_mode); - LOG_DEBUG(dhcp4_logger, DBG_DHCP4_START, DHCP4_START_INFO) - .arg(getpid()) - .arg(server_port_number) - .arg(client_port_number) - .arg(verbose_mode ? "yes" : "no"); - - LOG_INFO(dhcp4_logger, DHCP4_STARTING) - .arg(VERSION) - .arg(PACKAGE_VERSION_TYPE); - - if (string(PACKAGE_VERSION_TYPE) == "development") { - LOG_WARN(dhcp4_logger, DHCP4_DEVELOPMENT_VERSION); - } + // Tell the admin we are ready to process packets + LOG_INFO(dhcp4_logger, DHCP4_STARTED).arg(VERSION); - // Create the server instance. - ControlledDhcpv4Srv server(server_port_number, client_port_number); + // And run the main loop of the server. + ret = server.run(); - // Remember verbose-mode - server.setVerbose(verbose_mode); + LOG_INFO(dhcp4_logger, DHCP4_SHUTDOWN); - // Create our PID file. - server.setProcName(DHCP4_NAME); - server.setConfigFile(config_file); - server.createPIDFile(); + } catch (const isc::process::DaemonPIDExists& ex) { + // First, we print the error on stderr (that should always work) + cerr << DHCP4_NAME << " already running? " << ex.what() + << endl; - try { - // Initialize the server. - server.init(config_file); + // Let's also try to log it using logging system, but we're not + // sure if it's usable (the exception may have been thrown from + // the logger subsystem) + try { + LOG_FATAL(dhcp4_logger, DHCP4_ALREADY_RUNNING) + .arg(DHCP4_NAME).arg(ex.what()); + } catch (...) { + // Already logged so ignore + } + ret = EXIT_FAILURE; } catch (const std::exception& ex) { + // First, we print the error on stderr (that should always work) + cerr << DHCP4_NAME << ": Fatal error during start up: " << ex.what() + << endl; + // Let's also try to log it using logging system, but we're not + // sure if it's usable (the exception may have been thrown from + // the logger subsystem) try { - // Let's log out what went wrong. - isc::log::LoggerManager log_manager; - log_manager.process(); - LOG_ERROR(dhcp4_logger, DHCP4_INIT_FAIL).arg(ex.what()); + LOG_FATAL(dhcp4_logger, DHCP4_SERVER_FAILED).arg(ex.what()); } catch (...) { - // The exception thrown during the initialization could - // originate from logger subsystem. Therefore LOG_ERROR() - // may fail as well. - cerr << "Failed to initialize server: " << ex.what() << endl; + // Already logged so ignore } - - return (EXIT_FAILURE); + ret = EXIT_FAILURE; } - // Tell the admin we are ready to process packets - LOG_INFO(dhcp4_logger, DHCP4_STARTED).arg(VERSION); - - // And run the main loop of the server. - ret = server.run(); - - LOG_INFO(dhcp4_logger, DHCP4_SHUTDOWN); - - } catch (const isc::process::DaemonPIDExists& ex) { - // First, we print the error on stderr (that should always work) - cerr << DHCP4_NAME << " already running? " << ex.what() - << endl; - - // Let's also try to log it using logging system, but we're not - // sure if it's usable (the exception may have been thrown from - // the logger subsystem) - try { - LOG_FATAL(dhcp4_logger, DHCP4_ALREADY_RUNNING) - .arg(DHCP4_NAME).arg(ex.what()); - } catch (...) { - // Already logged so ignore - } - ret = EXIT_FAILURE; - } catch (const std::exception& ex) { - // First, we print the error on stderr (that should always work) - cerr << DHCP4_NAME << ": Fatal error during start up: " << ex.what() - << endl; - - // Let's also try to log it using logging system, but we're not - // sure if it's usable (the exception may have been thrown from - // the logger subsystem) - try { - LOG_FATAL(dhcp4_logger, DHCP4_SERVER_FAILED).arg(ex.what()); - } catch (...) { - // Already logged so ignore - } - ret = EXIT_FAILURE; + return (ret); + } catch (...) { } - return (ret); + return (EXIT_FAILURE); } diff --git a/src/bin/dhcp6/main.cc b/src/bin/dhcp6/main.cc index a216aa5dad..6e37bc4b78 100644 --- a/src/bin/dhcp6/main.cc +++ b/src/bin/dhcp6/main.cc @@ -52,7 +52,7 @@ usage() { cerr << endl; cerr << "Usage: " << DHCP6_NAME << " -[v|V|W] [-d] [-{c|t} cfgfile] [-p number] [-P number]" << endl; - cerr << " -v: print version number and exit." << endl; + cerr << " -v: print version number and exit" << endl; cerr << " -V: print extended version and exit" << endl; cerr << " -W: display the configuration report and exit" << endl; cerr << " -d: debug mode with extra verbosity (former -v)" << endl; @@ -68,231 +68,236 @@ usage() { int main(int argc, char* argv[]) { - int ch; - // The default. Any other values are useful for testing only. - int server_port_number = DHCP6_SERVER_PORT; - // Not zero values are useful for testing only. - int client_port_number = 0; - bool verbose_mode = false; // Should server be verbose? - bool check_mode = false; // Check syntax - - // The standard config file - std::string config_file(""); - - while ((ch = getopt(argc, argv, "dvVWc:p:P:t:")) != -1) { - switch (ch) { - case 'd': - verbose_mode = true; - break; - - case 'v': - cout << Dhcpv6Srv::getVersion(false) << endl; - return (EXIT_SUCCESS); - - case 'V': - cout << Dhcpv6Srv::getVersion(true) << endl; - return (EXIT_SUCCESS); - - case 'W': - cout << isc::detail::getConfigReport() << endl; - return (EXIT_SUCCESS); - - case 't': - check_mode = true; - // falls through - - case 'c': // config file - config_file = optarg; - break; - - case 'p': // server port number - try { - server_port_number = boost::lexical_cast(optarg); - } catch (const boost::bad_lexical_cast &) { - cerr << "Failed to parse server port number: [" << optarg - << "], 1-65535 allowed." << endl; - usage(); - } - if (server_port_number <= 0 || server_port_number > 65535) { - cerr << "Failed to parse server port number: [" << optarg - << "], 1-65535 allowed." << endl; - usage(); - } - break; + try { + int ch; + // The default. Any other values are useful for testing only. + int server_port_number = DHCP6_SERVER_PORT; + // Not zero values are useful for testing only. + int client_port_number = 0; + bool verbose_mode = false; // Should server be verbose? + bool check_mode = false; // Check syntax + + // The standard config file + std::string config_file(""); + + while ((ch = getopt(argc, argv, "dvVWc:p:P:t:")) != -1) { + switch (ch) { + case 'd': + verbose_mode = true; + break; + + case 'v': + cout << Dhcpv6Srv::getVersion(false) << endl; + return (EXIT_SUCCESS); - case 'P': // client port number - try { - client_port_number = boost::lexical_cast(optarg); - } catch (const boost::bad_lexical_cast &) { - cerr << "Failed to parse client port number: [" << optarg - << "], 1-65535 allowed." << endl; - usage(); - } - if (client_port_number <= 0 || client_port_number > 65535) { - cerr << "Failed to parse client port number: [" << optarg - << "], 1-65535 allowed." << endl; + case 'V': + cout << Dhcpv6Srv::getVersion(true) << endl; + return (EXIT_SUCCESS); + + case 'W': + cout << isc::detail::getConfigReport() << endl; + return (EXIT_SUCCESS); + + case 't': + check_mode = true; + // falls through + + case 'c': // config file + config_file = optarg; + break; + + case 'p': // server port number + try { + server_port_number = boost::lexical_cast(optarg); + } catch (const boost::bad_lexical_cast &) { + cerr << "Failed to parse server port number: [" << optarg + << "], 1-65535 allowed." << endl; + usage(); + } + if (server_port_number <= 0 || server_port_number > 65535) { + cerr << "Failed to parse server port number: [" << optarg + << "], 1-65535 allowed." << endl; + usage(); + } + break; + + case 'P': // client port number + try { + client_port_number = boost::lexical_cast(optarg); + } catch (const boost::bad_lexical_cast &) { + cerr << "Failed to parse client port number: [" << optarg + << "], 1-65535 allowed." << endl; + usage(); + } + if (client_port_number <= 0 || client_port_number > 65535) { + cerr << "Failed to parse client port number: [" << optarg + << "], 1-65535 allowed." << endl; + usage(); + } + break; + + default: usage(); } - break; + } - default: + // Check for extraneous parameters. + if (argc > optind) { usage(); } - } - // Check for extraneous parameters. - if (argc > optind) { - usage(); - } + // Configuration file is required. + if (config_file.empty()) { + cerr << "Configuration file not specified." << endl; + usage(); + } - // Configuration file is required. - if (config_file.empty()) { - cerr << "Configuration file not specified." << endl; - usage(); - } + // This is the DHCPv6 server + CfgMgr::instance().setFamily(AF_INET6); - // This is the DHCPv6 server - CfgMgr::instance().setFamily(AF_INET6); + if (check_mode) { + try { + // We need to initialize logging, in case any error messages are to be printed. + // This is just a test, so we don't care about lockfile. + setenv("KEA_LOCKFILE_DIR", "none", 0); + Daemon::setDefaultLoggerName(DHCP6_ROOT_LOGGER_NAME); + Daemon::loggerInit(DHCP6_ROOT_LOGGER_NAME, verbose_mode); + + // Check the syntax first. + Parser6Context parser; + ConstElementPtr json; + json = parser.parseFile(config_file, Parser6Context::PARSER_DHCP6); + if (!json) { + cerr << "No configuration found" << endl; + return (EXIT_FAILURE); + } + if (verbose_mode) { + cerr << "Syntax check OK" << endl; + } + + // Check the logic next. + ConstElementPtr dhcp6 = json->get("Dhcp6"); + if (!dhcp6) { + cerr << "Missing mandatory Dhcp6 element" << endl; + return (EXIT_FAILURE); + } + ControlledDhcpv6Srv server(0); + ConstElementPtr answer; + + // Now we pass the Dhcp6 configuration to the server, but + // tell it to check the configuration only (check_only = true) + answer = configureDhcp6Server(server, dhcp6, true); + + int status_code = 0; + answer = isc::config::parseAnswer(status_code, answer); + if (status_code == 0) { + return (EXIT_SUCCESS); + } else { + cerr << "Error encountered: " << answer->stringValue() << endl; + return (EXIT_FAILURE); + } + } catch (const std::exception& ex) { + cerr << "Syntax check failed with: " << ex.what() << endl; + } + return (EXIT_FAILURE); + } - if (check_mode) { + int ret = EXIT_SUCCESS; try { - // We need to initialize logging, in case any error messages are to be printed. - // This is just a test, so we don't care about lockfile. - setenv("KEA_LOCKFILE_DIR", "none", 0); + // It is important that we set a default logger name because this name + // will be used when the user doesn't provide the logging configuration + // in the Kea configuration file. Daemon::setDefaultLoggerName(DHCP6_ROOT_LOGGER_NAME); - Daemon::loggerInit(DHCP6_ROOT_LOGGER_NAME, verbose_mode); - // Check the syntax first. - Parser6Context parser; - ConstElementPtr json; - json = parser.parseFile(config_file, Parser6Context::PARSER_DHCP6); - if (!json) { - cerr << "No configuration found" << endl; - return (EXIT_FAILURE); - } - if (verbose_mode) { - cerr << "Syntax check OK" << endl; + // Initialize logging. If verbose, we'll use maximum verbosity. + Daemon::loggerInit(DHCP6_ROOT_LOGGER_NAME, verbose_mode); + LOG_DEBUG(dhcp6_logger, DBG_DHCP6_START, DHCP6_START_INFO) + .arg(getpid()) + .arg(server_port_number) + .arg(client_port_number) + .arg(verbose_mode ? "yes" : "no"); + + LOG_INFO(dhcp6_logger, DHCP6_STARTING) + .arg(VERSION) + .arg(PACKAGE_VERSION_TYPE); + + if (string(PACKAGE_VERSION_TYPE) == "development") { + LOG_WARN(dhcp6_logger, DHCP6_DEVELOPMENT_VERSION); } - // Check the logic next. - ConstElementPtr dhcp6 = json->get("Dhcp6"); - if (!dhcp6) { - cerr << "Missing mandatory Dhcp6 element" << endl; - return (EXIT_FAILURE); - } - ControlledDhcpv6Srv server(0); - ConstElementPtr answer; + // Create the server instance. + ControlledDhcpv6Srv server(server_port_number, client_port_number); - // Now we pass the Dhcp6 configuration to the server, but - // tell it to check the configuration only (check_only = true) - answer = configureDhcp6Server(server, dhcp6, true); + // Remember verbose-mode + server.setVerbose(verbose_mode); + + // Create our PID file. + server.setProcName(DHCP6_NAME); + server.setConfigFile(config_file); + server.createPIDFile(); + + try { + // Initialize the server. + server.init(config_file); + } catch (const std::exception& ex) { + + try { + // Let's log out what went wrong. + isc::log::LoggerManager log_manager; + log_manager.process(); + LOG_ERROR(dhcp6_logger, DHCP6_INIT_FAIL).arg(ex.what()); + } catch (...) { + // The exception thrown during the initialization could + // originate from logger subsystem. Therefore LOG_ERROR() + // may fail as well. + cerr << "Failed to initialize server: " << ex.what() << endl; + } - int status_code = 0; - answer = isc::config::parseAnswer(status_code, answer); - if (status_code == 0) { - return (EXIT_SUCCESS); - } else { - cerr << "Error encountered: " << answer->stringValue() << endl; return (EXIT_FAILURE); } - } catch (const std::exception& ex) { - cerr << "Syntax check failed with: " << ex.what() << endl; - } - return (EXIT_FAILURE); - } - int ret = EXIT_SUCCESS; - try { - // It is important that we set a default logger name because this name - // will be used when the user doesn't provide the logging configuration - // in the Kea configuration file. - Daemon::setDefaultLoggerName(DHCP6_ROOT_LOGGER_NAME); - - // Initialize logging. If verbose, we'll use maximum verbosity. - Daemon::loggerInit(DHCP6_ROOT_LOGGER_NAME, verbose_mode); - LOG_DEBUG(dhcp6_logger, DBG_DHCP6_START, DHCP6_START_INFO) - .arg(getpid()) - .arg(server_port_number) - .arg(client_port_number) - .arg(verbose_mode ? "yes" : "no"); - - LOG_INFO(dhcp6_logger, DHCP6_STARTING) - .arg(VERSION) - .arg(PACKAGE_VERSION_TYPE); - - if (string(PACKAGE_VERSION_TYPE) == "development") { - LOG_WARN(dhcp6_logger, DHCP6_DEVELOPMENT_VERSION); - } + // Tell the admin we are ready to process packets + LOG_INFO(dhcp6_logger, DHCP6_STARTED).arg(VERSION); - // Create the server instance. - ControlledDhcpv6Srv server(server_port_number, client_port_number); + // And run the main loop of the server. + ret = server.run(); - // Remember verbose-mode - server.setVerbose(verbose_mode); + LOG_INFO(dhcp6_logger, DHCP6_SHUTDOWN); - // Create our PID file. - server.setProcName(DHCP6_NAME); - server.setConfigFile(config_file); - server.createPIDFile(); + } catch (const isc::process::DaemonPIDExists& ex) { + // First, we print the error on stderr (that should always work) + cerr << DHCP6_NAME << " already running? " << ex.what() + << endl; - try { - // Initialize the server. - server.init(config_file); + // Let's also try to log it using logging system, but we're not + // sure if it's usable (the exception may have been thrown from + // the logger subsystem) + try { + LOG_FATAL(dhcp6_logger, DHCP6_ALREADY_RUNNING) + .arg(DHCP6_NAME).arg(ex.what()); + } catch (...) { + // Already logged so ignore + } + ret = EXIT_FAILURE; } catch (const std::exception& ex) { + // First, we print the error on stderr (that should always work) + cerr << DHCP6_NAME << ": Fatal error during start up: " << ex.what() + << endl; + // Let's also try to log it using logging system, but we're not + // sure if it's usable (the exception may have been thrown from + // the logger subsystem) try { - // Let's log out what went wrong. - isc::log::LoggerManager log_manager; - log_manager.process(); - LOG_ERROR(dhcp6_logger, DHCP6_INIT_FAIL).arg(ex.what()); + LOG_FATAL(dhcp6_logger, DHCP6_SERVER_FAILED).arg(ex.what()); } catch (...) { - // The exception thrown during the initialization could - // originate from logger subsystem. Therefore LOG_ERROR() may - // fail as well. - cerr << "Failed to initialize server: " << ex.what() << endl; + // Already logged so ignore } - - return (EXIT_FAILURE); + ret = EXIT_FAILURE; } - // Tell the admin we are ready to process packets - LOG_INFO(dhcp6_logger, DHCP6_STARTED).arg(VERSION); - - // And run the main loop of the server. - ret = server.run(); - - LOG_INFO(dhcp6_logger, DHCP6_SHUTDOWN); - - } catch (const isc::process::DaemonPIDExists& ex) { - // First, we print the error on stderr (that should always work) - cerr << DHCP6_NAME << " already running? " << ex.what() - << endl; - - // Let's also try to log it using logging system, but we're not - // sure if it's usable (the exception may have been thrown from - // the logger subsystem) - try { - LOG_FATAL(dhcp6_logger, DHCP6_ALREADY_RUNNING) - .arg(DHCP6_NAME).arg(ex.what()); - } catch (...) { - // Already logged so ignore - } - ret = EXIT_FAILURE; - } catch (const std::exception& ex) { - // First, we print the error on stderr (that should always work) - cerr << DHCP6_NAME << "Fatal error during start up: " << ex.what() - << endl; - - // Let's also try to log it using logging system, but we're not - // sure if it's usable (the exception may have been thrown from - // the logger subsystem) - try { - LOG_FATAL(dhcp6_logger, DHCP6_SERVER_FAILED).arg(ex.what()); - } catch (...) { - // Already logged so ignore - } - ret = EXIT_FAILURE; + return (ret); + } catch (...) { } - return (ret); + return (EXIT_FAILURE); } diff --git a/src/bin/lfc/main.cc b/src/bin/lfc/main.cc index 36023428c7..e0cd2681f3 100644 --- a/src/bin/lfc/main.cc +++ b/src/bin/lfc/main.cc @@ -24,19 +24,20 @@ using namespace isc::lfc; /// The exit value of the program will be EXIT_SUCCESS if there were no /// errors, EXIT_FAILURE otherwise. int main(int argc, char* argv[]) { - // Ask scheduling to not give too much resources to LFC. - // First parameter means to change only the process priority. - // Second parameter (0) means the calling process. - // Third parameter 4 is a bit below the default priority of 0 in - // a range of -20 (highest priority) and 19 or 20 (lowest priority). - static_cast(setpriority(PRIO_PROCESS, 0, 4)); - int ret = EXIT_SUCCESS; - LFCController lfc_controller; + try { + // Ask scheduling to not give too much resources to LFC. + // First parameter means to change only the process priority. + // Second parameter (0) means the calling process. + // Third parameter 4 is a bit below the default priority of 0 in + // a range of -20 (highest priority) and 19 or 20 (lowest priority). + static_cast(setpriority(PRIO_PROCESS, 0, 4)); + + LFCController lfc_controller; + + // Launch the controller passing in command line arguments. + // Exit program with the controller's return code. - // Launch the controller passing in command line arguments. - // Exit program with the controller's return code. - try { // 'false' value disables test mode. lfc_controller.launch(argc, argv, false); @@ -47,6 +48,8 @@ int main(int argc, char* argv[]) { } catch (const std::exception& ex) { std::cerr << "Service failed: " << ex.what() << std::endl; ret = EXIT_FAILURE; + } catch (...) { + ret = EXIT_FAILURE; } return (ret); diff --git a/src/bin/netconf/main.cc b/src/bin/netconf/main.cc index 30155b0909..4b56478ccb 100644 --- a/src/bin/netconf/main.cc +++ b/src/bin/netconf/main.cc @@ -18,7 +18,7 @@ int main(int argc, char* argv[]) { // Launch the controller passing in command line arguments. // Exit program with the controller's return code. - try { + try { // Instantiate/fetch the application controller singleton. DControllerBasePtr& controller = NetconfController::instance(); @@ -38,6 +38,8 @@ int main(int argc, char* argv[]) { } catch (const isc::Exception& ex) { std::cerr << "Service failed: " << ex.what() << std::endl; ret = EXIT_FAILURE; + } catch (...) { + ret = EXIT_FAILURE; } return (ret); diff --git a/src/bin/perfdhcp/main.cc b/src/bin/perfdhcp/main.cc index 9a1dbcee9f..fb68fec90d 100644 --- a/src/bin/perfdhcp/main.cc +++ b/src/bin/perfdhcp/main.cc @@ -19,10 +19,10 @@ using namespace isc::perfdhcp; int main(int argc, char* argv[]) { - CommandOptions command_options; - std::string diags(command_options.getDiags()); int ret_code = 0; try { + CommandOptions command_options; + std::string diags(command_options.getDiags()); // If parser returns true it means that user specified // 'h' or 'v' command line option. Program shows the // help or version message and exits here. @@ -42,8 +42,12 @@ main(int argc, char* argv[]) { std::cerr << "Fatal error" << std::endl; } return (ret_code); + } catch (...) { + ret_code = 1; + return (ret_code); } - try{ + + try { auto scenario = command_options.getScenario(); PerfSocket socket(command_options); if (scenario == Scenario::BASIC) { @@ -59,6 +63,8 @@ main(int argc, char* argv[]) { if (diags.find('e') != std::string::npos) { std::cerr << "Fatal error" << std::endl; } + } catch (...) { + ret_code = 1; } return (ret_code); } diff --git a/src/lib/log/compiler/message.cc b/src/lib/log/compiler/message.cc index a62d129d36..cfc11d029f 100644 --- a/src/lib/log/compiler/message.cc +++ b/src/lib/log/compiler/message.cc @@ -510,8 +510,7 @@ main(int argc, char* argv[]) { writeProgramFile(message_file, ns_components, dictionary, output_directory); - } - catch (const MessageException& e) { + } catch (const MessageException& e) { // Create an error message from the ID and the text const MessageDictionaryPtr& global = MessageDictionary::globalDictionary(); string text = e.id(); @@ -529,6 +528,8 @@ main(int argc, char* argv[]) { cerr << text << "\n"; + return (1); + } catch (...) { return (1); } -- GitLab From 873a42102c87cb0d77e7ec0bac5cf8a5e37e5492 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Mon, 31 May 2021 13:07:54 +0300 Subject: [PATCH 2/6] [#1907] fixed compilation --- src/bin/perfdhcp/main.cc | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/bin/perfdhcp/main.cc b/src/bin/perfdhcp/main.cc index fb68fec90d..99bf22e0c0 100644 --- a/src/bin/perfdhcp/main.cc +++ b/src/bin/perfdhcp/main.cc @@ -20,9 +20,10 @@ using namespace isc::perfdhcp; int main(int argc, char* argv[]) { int ret_code = 0; + std::string diags; try { CommandOptions command_options; - std::string diags(command_options.getDiags()); + diags = command_options.getDiags(); // If parser returns true it means that user specified // 'h' or 'v' command line option. Program shows the // help or version message and exits here. @@ -33,21 +34,7 @@ main(int argc, char* argv[]) { if (command_options.parse(argc, argv, true)) { return (ret_code); } - } catch (const isc::Exception& e) { - ret_code = 1; - command_options.usage(); - std::cerr << "\nERROR: parsing command line options: " - << e.what() << std::endl; - if (diags.find('e') != std::string::npos) { - std::cerr << "Fatal error" << std::endl; - } - return (ret_code); - } catch (...) { - ret_code = 1; - return (ret_code); - } - try { auto scenario = command_options.getScenario(); PerfSocket socket(command_options); if (scenario == Scenario::BASIC) { -- GitLab From e57db4f6906e98c3cdda18f138535ebf2b4f89a6 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Mon, 31 May 2021 21:28:37 +0300 Subject: [PATCH 3/6] [#1845] catch all exceptions in destructors --- doc/examples/kea6/all-options.json | 2 +- src/bin/agent/ca_cfg_mgr.cc | 3 - src/bin/agent/ca_cfg_mgr.h | 2 +- src/bin/agent/ca_controller.cc | 3 - src/bin/agent/ca_controller.h | 2 +- src/bin/agent/ca_process.cc | 3 - src/bin/agent/ca_process.h | 2 +- src/bin/agent/parser_context.cc | 37 +++----- src/bin/agent/parser_context.h | 2 +- src/bin/agent/tests/basic_auth_library.cc | 5 +- .../agent/tests/ca_command_mgr_unittests.cc | 7 +- src/bin/agent/tests/ca_process_unittests.cc | 3 +- .../tests/ca_response_creator_unittests.cc | 9 +- src/bin/agent/tests/get_config_unittest.cc | 7 +- src/bin/d2/d2_cfg_mgr.cc | 6 -- src/bin/d2/d2_cfg_mgr.h | 4 +- src/bin/d2/d2_config.cc | 15 ---- src/bin/d2/d2_config.h | 18 ++-- src/bin/d2/d2_controller.cc | 3 - src/bin/d2/d2_controller.h | 10 +-- src/bin/d2/d2_process.cc | 3 - src/bin/d2/d2_process.h | 7 +- src/bin/d2/d2_queue_mgr.cc | 3 - src/bin/d2/d2_queue_mgr.h | 2 +- src/bin/d2/d2_update_mgr.cc | 5 +- src/bin/d2/dns_client.cc | 13 +-- src/bin/d2/dns_client.h | 13 ++- src/bin/d2/nc_add.cc | 3 - src/bin/d2/nc_add.h | 2 +- src/bin/d2/nc_remove.cc | 3 - src/bin/d2/nc_remove.h | 2 +- src/bin/d2/nc_trans.cc | 3 - src/bin/d2/nc_trans.h | 2 +- src/bin/d2/parser_context.cc | 30 +++---- src/bin/d2/simple_add.cc | 3 - src/bin/d2/simple_add.h | 2 +- src/bin/d2/simple_remove.cc | 3 - src/bin/d2/simple_remove.h | 2 +- src/bin/d2/tests/d2_cfg_mgr_unittests.cc | 6 +- src/bin/d2/tests/d2_command_unittest.cc | 41 ++++++--- src/bin/d2/tests/d2_process_unittests.cc | 3 +- src/bin/d2/tests/d2_simple_parser_unittest.cc | 35 ++++++-- .../d2/tests/d2_update_message_unittests.cc | 4 +- src/bin/d2/tests/d2_update_mgr_unittests.cc | 8 +- src/bin/d2/tests/dns_client_unittests.cc | 7 +- src/bin/d2/tests/get_config_unittest.cc | 7 +- src/bin/d2/tests/nc_add_unittests.cc | 14 +-- src/bin/d2/tests/nc_remove_unittests.cc | 13 +-- src/bin/d2/tests/nc_test_utils.cc | 10 --- src/bin/d2/tests/nc_test_utils.h | 9 +- src/bin/d2/tests/nc_trans_unittests.cc | 11 ++- src/bin/d2/tests/simple_add_unittests.cc | 14 +-- src/bin/d2/tests/simple_remove_unittests.cc | 13 +-- src/bin/dhcp4/client_handler.cc | 41 ++++----- src/bin/dhcp4/dhcp4_srv.cc | 65 +++++++------- src/bin/dhcp4/dhcp4to6_ipc.cc | 2 - src/bin/dhcp4/dhcp4to6_ipc.h | 4 +- src/bin/dhcp4/parser_context.cc | 3 - src/bin/dhcp4/parser_context.h | 2 +- src/bin/dhcp4/tests/classify_unittest.cc | 4 +- .../dhcp4/tests/client_handler_unittest.cc | 7 +- .../dhcp4/tests/config_backend_unittest.cc | 11 ++- src/bin/dhcp4/tests/config_parser_unittest.cc | 15 ++-- .../dhcp4/tests/ctrl_dhcp4_srv_unittest.cc | 24 ++++-- src/bin/dhcp4/tests/d2_unittest.cc | 5 +- src/bin/dhcp4/tests/d2_unittest.h | 3 +- src/bin/dhcp4/tests/dhcp4_test_utils.cc | 37 ++++---- src/bin/dhcp4/tests/dhcp4_test_utils.h | 11 ++- src/bin/dhcp4/tests/dhcp4to6_ipc_unittest.cc | 15 ++-- src/bin/dhcp4/tests/dora_unittest.cc | 28 ++++-- src/bin/dhcp4/tests/fqdn_unittest.cc | 14 +-- src/bin/dhcp4/tests/get_config_unittest.cc | 9 +- .../dhcp4/tests/get_config_unittest.cc.skel | 9 +- src/bin/dhcp4/tests/hooks_unittest.cc | 57 +++++++------ src/bin/dhcp4/tests/host_unittest.cc | 7 +- src/bin/dhcp4/tests/inform_unittest.cc | 8 +- .../dhcp4/tests/kea_controller_unittest.cc | 23 +++-- src/bin/dhcp4/tests/out_of_range_unittest.cc | 3 +- .../dhcp4/tests/shared_network_unittest.cc | 5 +- src/bin/dhcp6/client_handler.cc | 9 +- src/bin/dhcp6/dhcp6_srv.cc | 55 ++++++------ src/bin/dhcp6/dhcp6to4_ipc.cc | 2 - src/bin/dhcp6/dhcp6to4_ipc.h | 4 +- src/bin/dhcp6/parser_context.cc | 3 - src/bin/dhcp6/parser_context.h | 2 +- .../dhcp6/tests/client_handler_unittest.cc | 7 +- .../dhcp6/tests/config_backend_unittest.cc | 11 ++- src/bin/dhcp6/tests/config_parser_unittest.cc | 17 ++-- .../dhcp6/tests/ctrl_dhcp6_srv_unittest.cc | 36 +++++--- src/bin/dhcp6/tests/d2_unittest.cc | 5 +- src/bin/dhcp6/tests/d2_unittest.h | 3 +- src/bin/dhcp6/tests/dhcp6_test_utils.cc | 85 ++++++++++--------- src/bin/dhcp6/tests/dhcp6_test_utils.h | 17 +++- src/bin/dhcp6/tests/dhcp6to4_ipc_unittest.cc | 15 ++-- src/bin/dhcp6/tests/fqdn_unittest.cc | 11 ++- src/bin/dhcp6/tests/get_config_unittest.cc | 11 ++- .../dhcp6/tests/get_config_unittest.cc.skel | 11 ++- src/bin/dhcp6/tests/hooks_unittest.cc | 57 +++++++------ src/bin/dhcp6/tests/infrequest_unittest.cc | 7 +- .../dhcp6/tests/kea_controller_unittest.cc | 22 +++-- src/bin/dhcp6/tests/sarr_unittest.cc | 13 +-- .../dhcp6/tests/shared_network_unittest.cc | 5 +- src/bin/lfc/lfc_controller.cc | 3 - src/bin/lfc/lfc_controller.h | 2 +- src/bin/netconf/control_socket.h | 3 +- src/bin/netconf/http_control_socket.cc | 3 - src/bin/netconf/http_control_socket.h | 2 +- src/bin/netconf/netconf.cc | 7 +- src/bin/netconf/netconf_cfg_mgr.cc | 3 - src/bin/netconf/netconf_cfg_mgr.h | 2 +- src/bin/netconf/netconf_config.cc | 6 -- src/bin/netconf/netconf_config.h | 4 +- src/bin/netconf/netconf_controller.cc | 3 - src/bin/netconf/netconf_controller.h | 2 +- src/bin/netconf/netconf_process.cc | 3 - src/bin/netconf/netconf_process.h | 2 +- src/bin/netconf/parser_context.cc | 37 +++----- src/bin/netconf/parser_context.h | 2 +- src/bin/netconf/stdout_control_socket.cc | 3 - src/bin/netconf/stdout_control_socket.h | 2 +- .../netconf/tests/control_socket_unittests.cc | 46 +++++----- src/bin/netconf/tests/get_config_unittest.cc | 7 +- .../tests/netconf_process_unittests.cc | 3 +- src/bin/netconf/tests/netconf_unittests.cc | 70 ++++++++------- src/bin/netconf/unix_control_socket.cc | 3 - src/bin/netconf/unix_control_socket.h | 2 +- src/bin/perfdhcp/abstract_scen.h | 2 +- src/bin/perfdhcp/perf_socket.cc | 10 ++- src/bin/perfdhcp/receiver.cc | 9 +- src/bin/perfdhcp/receiver.h | 2 +- src/bin/perfdhcp/test_control.h | 4 +- .../perfdhcp/tests/command_options_helper.h | 24 ++++-- src/hooks/dhcp/bootp/tests/bootp_unittests.cc | 3 +- src/hooks/dhcp/flex_option/flex_option.cc | 11 +-- src/hooks/dhcp/flex_option/flex_option.h | 4 +- .../libloadtests/callout_unittests.cc | 5 +- .../libloadtests/load_unload_unittests.cc | 6 +- .../tests/flex_option_unittests.cc | 6 +- .../high_availability/communication_state.cc | 5 +- src/hooks/dhcp/high_availability/ha_impl.cc | 11 ++- .../dhcp/high_availability/ha_service.cc | 9 +- .../libloadtests/close_unittests.cc | 14 +-- .../libloadtests/load_unload_unittests.cc | 5 +- .../tests/communication_state_unittest.cc | 7 +- .../high_availability/tests/ha_mt_unittest.cc | 9 +- .../tests/ha_service_unittest.cc | 15 ++-- .../dhcp/high_availability/tests/ha_test.cc | 3 - .../dhcp/high_availability/tests/ha_test.h | 2 +- .../tests/query_filter_unittest.cc | 5 +- src/hooks/dhcp/lease_cmds/lease_parser.h | 18 ++-- .../lease_cmds/tests/lease_cmds_unittest.cc | 22 +++-- src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc | 5 +- src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc | 5 +- src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc | 22 +++-- .../tests/mysql_cb_dhcp4_mgr_unittest.cc | 13 +-- .../mysql_cb/tests/mysql_cb_dhcp4_unittest.cc | 26 ++++-- .../tests/mysql_cb_dhcp6_mgr_unittest.cc | 13 +-- .../mysql_cb/tests/mysql_cb_dhcp6_unittest.cc | 26 ++++-- .../libloadtests/load_unload_unittests.cc | 5 +- .../run_script/tests/run_script_unittests.cc | 7 +- .../stat_cmds/tests/stat_cmds_unittest.cc | 18 ++-- src/hooks/dhcp/user_chk/user.cc | 6 -- src/hooks/dhcp/user_chk/user.h | 4 +- src/hooks/dhcp/user_chk/user_data_source.h | 4 +- src/hooks/dhcp/user_chk/user_file.cc | 9 +- src/hooks/dhcp/user_chk/user_registry.cc | 6 -- src/hooks/dhcp/user_chk/user_registry.h | 4 +- src/lib/asiodns/io_fetch.h | 6 +- src/lib/asiolink/botan_boost_tls.cc | 12 +-- src/lib/asiolink/botan_boost_tls.h | 4 +- src/lib/asiolink/botan_tls.h | 4 +- src/lib/asiolink/common_tls.h | 4 +- src/lib/asiolink/interval_timer.cc | 12 ++- src/lib/asiolink/io_acceptor.h | 2 +- src/lib/asiolink/io_asio_socket.h | 4 +- src/lib/asiolink/io_endpoint.h | 4 +- src/lib/asiolink/io_service.cc | 13 ++- src/lib/asiolink/io_service.h | 3 +- src/lib/asiolink/io_socket.h | 4 +- src/lib/asiolink/openssl_tls.h | 4 +- src/lib/asiolink/process_spawn.cc | 11 ++- src/lib/asiolink/tcp_endpoint.h | 11 ++- src/lib/asiolink/tcp_socket.h | 12 +-- .../asiolink/tests/interval_timer_unittest.cc | 46 +++++++--- .../tests/io_service_signal_unittests.cc | 2 +- .../asiolink/tests/process_spawn_unittest.cc | 2 +- .../asiolink/tests/tcp_acceptor_unittest.cc | 13 ++- src/lib/asiolink/tests/tcp_socket_unittest.cc | 13 ++- .../asiolink/tests/tls_acceptor_unittest.cc | 13 ++- src/lib/asiolink/tests/tls_socket_unittest.cc | 13 ++- src/lib/asiolink/tests/tls_unittest.cc | 11 ++- src/lib/asiolink/tests/udp_socket_unittest.cc | 10 +-- .../tests/unix_domain_socket_unittest.cc | 5 +- .../testutils/test_server_unix_socket.cc | 10 ++- src/lib/asiolink/testutils/timed_signal.h | 5 +- src/lib/asiolink/tls_acceptor.h | 2 +- src/lib/asiolink/tls_socket.h | 2 +- src/lib/asiolink/udp_endpoint.h | 11 ++- src/lib/asiolink/udp_socket.h | 12 +-- src/lib/asiolink/unix_domain_socket.cc | 5 +- src/lib/cc/cfg_to_element.h | 6 +- src/lib/cc/data.h | 6 +- src/lib/cc/tests/data_file_unittests.cc | 10 ++- src/lib/config/base_command_mgr.h | 2 +- src/lib/config/cmd_http_listener.cc | 5 +- src/lib/config/command_mgr.cc | 5 +- .../tests/client_connection_unittests.cc | 5 +- .../tests/cmd_http_listener_unittests.cc | 23 ++--- .../tests/cmd_response_creator_unittests.cc | 5 +- src/lib/config/tests/command_mgr_unittests.cc | 9 +- src/lib/config_backend/base_config_backend.h | 2 +- .../config_backend/base_config_backend_pool.h | 2 +- .../tests/config_backend_mgr_unittest.cc | 5 +- src/lib/cql/cql_connection.cc | 67 ++++++++------- src/lib/cql/cql_exchange.cc | 22 ----- src/lib/cql/cql_exchange.h | 18 ++-- src/lib/cql/sql_common.h | 6 +- src/lib/cql/tests/cql_connection_unittest.cc | 6 +- src/lib/cryptolink/botan_hash.cc | 10 ++- src/lib/cryptolink/botan_hmac.cc | 11 +-- src/lib/cryptolink/botan_link.cc | 8 +- src/lib/cryptolink/crypto_rng.cc | 9 +- src/lib/cryptolink/crypto_rng.h | 4 +- src/lib/cryptolink/cryptolink.h | 3 + src/lib/cryptolink/openssl_common.h | 31 ++++--- src/lib/cryptolink/openssl_hash.cc | 17 ++-- src/lib/cryptolink/openssl_hmac.cc | 17 ++-- src/lib/cryptolink/openssl_link.cc | 11 ++- src/lib/database/database_connection.h | 2 +- src/lib/database/dbaccess_parser.cc | 6 -- src/lib/database/dbaccess_parser.h | 7 +- .../tests/database_connection_unittest.cc | 9 +- .../tests/dbaccess_parser_unittest.cc | 12 +-- src/lib/dhcp/iface_mgr.cc | 5 +- src/lib/dhcp/iface_mgr.h | 2 +- src/lib/dhcp/iface_mgr_linux.cc | 5 +- src/lib/dhcp/option.cc | 4 - src/lib/dhcp/option.h | 6 +- src/lib/dhcp/option4_client_fqdn.cc | 5 +- src/lib/dhcp/option6_client_fqdn.cc | 5 +- src/lib/dhcp/packet_queue.h | 2 +- src/lib/dhcp/packet_queue_mgr4.h | 5 +- src/lib/dhcp/packet_queue_mgr6.h | 2 +- src/lib/dhcp/packet_queue_ring.h | 10 +-- src/lib/dhcp/pkt.h | 16 ++-- src/lib/dhcp/pkt_filter.h | 2 +- src/lib/dhcp/pkt_filter6.h | 2 +- src/lib/dhcp/tests/duid_factory_unittest.cc | 5 +- src/lib/dhcp/tests/iface_mgr_test_config.cc | 21 +++-- src/lib/dhcp/tests/iface_mgr_unittest.cc | 3 +- src/lib/dhcp/tests/libdhcp++_unittest.cc | 5 +- src/lib/dhcp/tests/packet_queue4_unittest.cc | 4 +- src/lib/dhcp/tests/packet_queue6_unittest.cc | 4 +- .../dhcp/tests/packet_queue_mgr4_unittest.cc | 2 +- .../dhcp/tests/packet_queue_mgr6_unittest.cc | 3 +- src/lib/dhcp/tests/pkt_filter6_test_utils.cc | 23 ++--- src/lib/dhcp/tests/pkt_filter_test_utils.cc | 23 ++--- src/lib/dhcp_ddns/ncr_io.h | 12 +-- src/lib/dhcp_ddns/ncr_udp.cc | 14 ++- src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc | 18 ++-- src/lib/dhcp_ddns/tests/ncr_unittests.cc | 3 +- .../generic_host_data_source_unittest.cc | 4 - .../generic_host_data_source_unittest.h | 2 +- 263 files changed, 1492 insertions(+), 1234 deletions(-) diff --git a/doc/examples/kea6/all-options.json b/doc/examples/kea6/all-options.json index 369454fc7d..295442ab4e 100644 --- a/doc/examples/kea6/all-options.json +++ b/doc/examples/kea6/all-options.json @@ -1187,7 +1187,7 @@ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION_PD_EXCLUDE | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | prefix-len | IPv6 subnet ID (1 to 16 octets) ~ + | prefix-len | IPv6 subnet ID (1 to 16 octets) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Prefix Exclude Option diff --git a/src/bin/agent/ca_cfg_mgr.cc b/src/bin/agent/ca_cfg_mgr.cc index f2f8caa92a..d147e39a93 100644 --- a/src/bin/agent/ca_cfg_mgr.cc +++ b/src/bin/agent/ca_cfg_mgr.cc @@ -39,9 +39,6 @@ CtrlAgentCfgMgr::CtrlAgentCfgMgr() : DCfgMgrBase(ConfigPtr(new CtrlAgentCfgContext())) { } -CtrlAgentCfgMgr::~CtrlAgentCfgMgr() { -} - std::string CtrlAgentCfgMgr::getConfigSummary(const uint32_t /*selection*/) { diff --git a/src/bin/agent/ca_cfg_mgr.h b/src/bin/agent/ca_cfg_mgr.h index 943a8b4269..065d1e5d2f 100644 --- a/src/bin/agent/ca_cfg_mgr.h +++ b/src/bin/agent/ca_cfg_mgr.h @@ -257,7 +257,7 @@ public: CtrlAgentCfgMgr(); /// @brief Destructor - virtual ~CtrlAgentCfgMgr(); + virtual ~CtrlAgentCfgMgr() = default; /// @brief Convenience method that returns the Control Agent configuration /// context. diff --git a/src/bin/agent/ca_controller.cc b/src/bin/agent/ca_controller.cc index f8408315b4..20eff7397e 100644 --- a/src/bin/agent/ca_controller.cc +++ b/src/bin/agent/ca_controller.cc @@ -98,9 +98,6 @@ CtrlAgentController::CtrlAgentController() : DControllerBase(agent_app_name_, agent_bin_name_) { } -CtrlAgentController::~CtrlAgentController() { -} - CtrlAgentProcessPtr CtrlAgentController::getCtrlAgentProcess() { return (boost::dynamic_pointer_cast(getProcess())); diff --git a/src/bin/agent/ca_controller.h b/src/bin/agent/ca_controller.h index 7d6b5aee3e..db67c28bab 100644 --- a/src/bin/agent/ca_controller.h +++ b/src/bin/agent/ca_controller.h @@ -31,7 +31,7 @@ public: static process::DControllerBasePtr& instance(); /// @brief Destructor - virtual ~CtrlAgentController(); + virtual ~CtrlAgentController() = default; /// @brief Returns pointer to an instance of the underlying process object. CtrlAgentProcessPtr getCtrlAgentProcess(); diff --git a/src/bin/agent/ca_process.cc b/src/bin/agent/ca_process.cc index 8c47377a78..2b1f0f3396 100644 --- a/src/bin/agent/ca_process.cc +++ b/src/bin/agent/ca_process.cc @@ -32,9 +32,6 @@ CtrlAgentProcess::CtrlAgentProcess(const char* name, http_listeners_() { } -CtrlAgentProcess::~CtrlAgentProcess() { -} - void CtrlAgentProcess::init() { } diff --git a/src/bin/agent/ca_process.h b/src/bin/agent/ca_process.h index 3e6e08418b..e1a943c68c 100644 --- a/src/bin/agent/ca_process.h +++ b/src/bin/agent/ca_process.h @@ -40,7 +40,7 @@ public: CtrlAgentProcess(const char* name, const asiolink::IOServicePtr& io_service); /// @brief Destructor - virtual ~CtrlAgentProcess(); + virtual ~CtrlAgentProcess() = default; /// @brief Initialize the Control Agent process. /// diff --git a/src/bin/agent/parser_context.cc b/src/bin/agent/parser_context.cc index 18b2586e03..26a9401da5 100644 --- a/src/bin/agent/parser_context.cc +++ b/src/bin/agent/parser_context.cc @@ -18,17 +18,11 @@ namespace isc { namespace agent { ParserContext::ParserContext() - : sfile_(0), ctx_(NO_KEYWORDS), trace_scanning_(false), trace_parsing_(false) -{ -} - -ParserContext::~ParserContext() -{ + : sfile_(0), ctx_(NO_KEYWORDS), trace_scanning_(false), trace_parsing_(false) { } isc::data::ElementPtr -ParserContext::parseString(const std::string& str, ParserType parser_type) -{ +ParserContext::parseString(const std::string& str, ParserType parser_type) { scanStringBegin(str, parser_type); return (parseCommon()); } @@ -71,8 +65,7 @@ ParserContext::parseCommon() { void ParserContext::error(const isc::agent::location& loc, const std::string& what, - size_t pos) -{ + size_t pos) { if (pos == 0) { isc_throw(ParseError, loc << ": " << what); } else { @@ -81,20 +74,17 @@ ParserContext::error(const isc::agent::location& loc, } void -ParserContext::error(const std::string& what) -{ +ParserContext::error(const std::string& what) { isc_throw(ParseError, what); } void -ParserContext::fatal(const std::string& what) -{ +ParserContext::fatal(const std::string& what) { isc_throw(ParseError, what); } isc::data::Element::Position -ParserContext::loc2pos(isc::agent::location& loc) -{ +ParserContext::loc2pos(isc::agent::location& loc) { const std::string& file = *loc.begin.filename; const uint32_t line = loc.begin.line; const uint32_t pos = loc.begin.column; @@ -104,8 +94,7 @@ ParserContext::loc2pos(isc::agent::location& loc) void ParserContext::require(const std::string& name, isc::data::Element::Position open_loc, - isc::data::Element::Position close_loc) -{ + isc::data::Element::Position close_loc) { ConstElementPtr value = stack_.back()->get(name); if (!value) { isc_throw(ParseError, @@ -118,8 +107,7 @@ ParserContext::require(const std::string& name, void ParserContext::unique(const std::string& name, - isc::data::Element::Position loc) -{ + isc::data::Element::Position loc) { ConstElementPtr value = stack_.back()->get(name); if (value) { if (ctx_ != NO_KEYWORDS) { @@ -135,15 +123,13 @@ ParserContext::unique(const std::string& name, } void -ParserContext::enter(const LexerContext& ctx) -{ +ParserContext::enter(const LexerContext& ctx) { cstack_.push_back(ctx_); ctx_ = ctx; } void -ParserContext::leave() -{ +ParserContext::leave() { if (cstack_.empty()) { fatal("unbalanced syntactic context"); } @@ -152,8 +138,7 @@ ParserContext::leave() } const std::string -ParserContext::contextName() -{ +ParserContext::contextName() { switch (ctx_) { case NO_KEYWORDS: return ("__no keywords__"); diff --git a/src/bin/agent/parser_context.h b/src/bin/agent/parser_context.h index b0b1406a5c..b53a7085e3 100644 --- a/src/bin/agent/parser_context.h +++ b/src/bin/agent/parser_context.h @@ -60,7 +60,7 @@ public: ParserContext(); /// @brief destructor - virtual ~ParserContext(); + virtual ~ParserContext() = default; /// @brief JSON elements being parsed. std::vector stack_; diff --git a/src/bin/agent/tests/basic_auth_library.cc b/src/bin/agent/tests/basic_auth_library.cc index 924d656bc5..8d694a63f3 100644 --- a/src/bin/agent/tests/basic_auth_library.cc +++ b/src/bin/agent/tests/basic_auth_library.cc @@ -84,7 +84,7 @@ public: Impl(); /// @brief Destructor. - ~Impl(); + ~Impl() = default; /// @brief Configure. /// @@ -102,9 +102,6 @@ Impl::Impl() : config_(new BasicHttpAuthConfig()), creator_(new ResponseCreator()) { } -Impl::~Impl() { -} - void Impl::configure(ConstElementPtr config) { config_->parse(config); diff --git a/src/bin/agent/tests/ca_command_mgr_unittests.cc b/src/bin/agent/tests/ca_command_mgr_unittests.cc index 6353916be1..9913d91571 100644 --- a/src/bin/agent/tests/ca_command_mgr_unittests.cc +++ b/src/bin/agent/tests/ca_command_mgr_unittests.cc @@ -58,8 +58,11 @@ public: /// /// Deregisters all commands except 'list-commands'. virtual ~CtrlAgentCommandMgrTest() { - mgr_.deregisterAll(); - removeUnixSocketFile(); + try { + mgr_.deregisterAll(); + removeUnixSocketFile(); + } catch (...) { + } } /// @brief Verifies received answer diff --git a/src/bin/agent/tests/ca_process_unittests.cc b/src/bin/agent/tests/ca_process_unittests.cc index 37e06f66ed..56f8a762c5 100644 --- a/src/bin/agent/tests/ca_process_unittests.cc +++ b/src/bin/agent/tests/ca_process_unittests.cc @@ -35,8 +35,7 @@ public: } /// @brief Destructor - virtual ~CtrlAgentProcessTest() { - } + virtual ~CtrlAgentProcessTest() = default; /// @brief Callback that will invoke shutdown method. void genShutdownCallback() { diff --git a/src/bin/agent/tests/ca_response_creator_unittests.cc b/src/bin/agent/tests/ca_response_creator_unittests.cc index a50a15c49b..56b58049a3 100644 --- a/src/bin/agent/tests/ca_response_creator_unittests.cc +++ b/src/bin/agent/tests/ca_response_creator_unittests.cc @@ -71,9 +71,12 @@ public: /// /// Removes registered commands from the command manager. virtual ~CtrlAgentResponseCreatorTest() { - CtrlAgentCommandMgr::instance().deregisterAll(); - HooksManager::prepareUnloadLibraries(); - static_cast(HooksManager::unloadLibraries()); + try { + CtrlAgentCommandMgr::instance().deregisterAll(); + HooksManager::prepareUnloadLibraries(); + static_cast(HooksManager::unloadLibraries()); + } catch (...) { + } } /// @brief Fills request context with required data to create new request. diff --git a/src/bin/agent/tests/get_config_unittest.cc b/src/bin/agent/tests/get_config_unittest.cc index 2d557294ed..3050caa1a4 100644 --- a/src/bin/agent/tests/get_config_unittest.cc +++ b/src/bin/agent/tests/get_config_unittest.cc @@ -120,6 +120,7 @@ public: /// Test fixture class class CtrlAgentGetCfgTest : public ConfigParseTest { public: + /// @brief Constructor CtrlAgentGetCfgTest() : rcode_(-1) { srv_.reset(new NakedAgentCfgMgr()); @@ -127,8 +128,12 @@ public: resetConfiguration(); } + /// @brief Destructor ~CtrlAgentGetCfgTest() { - resetConfiguration(); + try { + resetConfiguration(); + } catch (...) { + } } /// @brief Parse and Execute configuration diff --git a/src/bin/d2/d2_cfg_mgr.cc b/src/bin/d2/d2_cfg_mgr.cc index da1ae21ca5..41eb9b4d74 100644 --- a/src/bin/d2/d2_cfg_mgr.cc +++ b/src/bin/d2/d2_cfg_mgr.cc @@ -55,9 +55,6 @@ D2CfgContext::D2CfgContext(const D2CfgContext& rhs) : ConfigBase(rhs) { control_socket_ = rhs.control_socket_; } -D2CfgContext::~D2CfgContext() { -} - ElementPtr D2CfgContext::toElement() const { ElementPtr d2 = ConfigBase::toElement(); @@ -117,9 +114,6 @@ const char* D2CfgMgr::IPV6_REV_ZONE_SUFFIX = "ip6.arpa."; D2CfgMgr::D2CfgMgr() : DCfgMgrBase(ConfigPtr(new D2CfgContext())) { } -D2CfgMgr::~D2CfgMgr() { -} - ConfigPtr D2CfgMgr::createNewContext() { return (ConfigPtr(new D2CfgContext())); diff --git a/src/bin/d2/d2_cfg_mgr.h b/src/bin/d2/d2_cfg_mgr.h index 199d435486..0b84ea80e3 100644 --- a/src/bin/d2/d2_cfg_mgr.h +++ b/src/bin/d2/d2_cfg_mgr.h @@ -36,7 +36,7 @@ public: D2CfgContext(); /// @brief Destructor - virtual ~D2CfgContext(); + virtual ~D2CfgContext() = default; /// @brief Creates a clone of this context object. /// @@ -156,7 +156,7 @@ public: D2CfgMgr(); /// @brief Destructor - virtual ~D2CfgMgr(); + virtual ~D2CfgMgr() = default; /// @brief Convenience method that returns the D2 configuration context. /// diff --git a/src/bin/d2/d2_config.cc b/src/bin/d2/d2_config.cc index 74ff793f95..f4f3caf66e 100644 --- a/src/bin/d2/d2_config.cc +++ b/src/bin/d2/d2_config.cc @@ -48,8 +48,6 @@ D2Params::D2Params() validateContents(); } -D2Params::~D2Params(){}; - void D2Params::validateContents() { if ((ip_address_.toText() == "0.0.0.0") || (ip_address_.toText() == "::")) { @@ -139,9 +137,6 @@ TSIGKeyInfo::TSIGKeyInfo(const std::string& name, const std::string& algorithm, remakeKey(); } -TSIGKeyInfo::~TSIGKeyInfo() { -} - const dns::Name& TSIGKeyInfo::stringToAlgorithmName(const std::string& algorithm_id) { if (boost::iequals(algorithm_id, HMAC_MD5_STR)) { @@ -207,9 +202,6 @@ DnsServerInfo::DnsServerInfo(const std::string& hostname, enabled_(enabled) { } -DnsServerInfo::~DnsServerInfo() { -} - std::string DnsServerInfo::toText() const { std::ostringstream stream; @@ -248,9 +240,6 @@ DdnsDomain::DdnsDomain(const std::string& name, tsig_key_info_(tsig_key_info) { } -DdnsDomain::~DdnsDomain() { -} - const std::string DdnsDomain::getKeyName() const { if (tsig_key_info_) { @@ -294,10 +283,6 @@ DdnsDomainListMgr::DdnsDomainListMgr(const std::string& name) : name_(name), domains_(new DdnsDomainMap()) { } - -DdnsDomainListMgr::~DdnsDomainListMgr () { -} - void DdnsDomainListMgr::setDomains(DdnsDomainMapPtr domains) { if (!domains) { diff --git a/src/bin/d2/d2_config.h b/src/bin/d2/d2_config.h index d15a39ec3f..81d876c04f 100644 --- a/src/bin/d2/d2_config.h +++ b/src/bin/d2/d2_config.h @@ -167,7 +167,7 @@ public: D2Params(); /// @brief Destructor - virtual ~D2Params(); + virtual ~D2Params() = default; /// @brief Return the IP address D2 listens on. const isc::asiolink::IOAddress& getIpAddress() const { @@ -309,7 +309,7 @@ public: const std::string& secret, uint32_t digestbits = 0); /// @brief Destructor - virtual ~TSIGKeyInfo(); + virtual ~TSIGKeyInfo() = default; /// @brief Getter which returns the key's name. /// @@ -437,10 +437,10 @@ public: DnsServerInfo(const std::string& hostname, isc::asiolink::IOAddress ip_address, uint32_t port = STANDARD_DNS_PORT, - bool enabled=true); + bool enabled = true); /// @brief Destructor - virtual ~DnsServerInfo(); + virtual ~DnsServerInfo() = default; /// @brief Getter which returns the server's hostname. /// @@ -540,7 +540,7 @@ public: const TSIGKeyInfoPtr& tsig_key_info = TSIGKeyInfoPtr()); /// @brief Destructor - virtual ~DdnsDomain(); + virtual ~DdnsDomain() = default; /// @brief Getter which returns the domain's name. /// @@ -621,7 +621,7 @@ public: DdnsDomainListMgr(const std::string& name); /// @brief Destructor - virtual ~DdnsDomainListMgr (); + virtual ~DdnsDomainListMgr() = default; /// @brief Matches a given name to a domain based on a longest match /// scheme. @@ -710,12 +710,10 @@ class DScalarContext : public process::ConfigBase { public: /// @brief Constructor - DScalarContext() { - }; + DScalarContext() = default; /// @brief Destructor - virtual ~DScalarContext() { - } + virtual ~DScalarContext() = default; /// @brief Creates a clone of a DStubContext. /// diff --git a/src/bin/d2/d2_controller.cc b/src/bin/d2/d2_controller.cc index dc31b552b7..604c52dff6 100644 --- a/src/bin/d2/d2_controller.cc +++ b/src/bin/d2/d2_controller.cc @@ -120,9 +120,6 @@ D2Controller::parseFile(const std::string& file_name) { return (elements); } -D2Controller::~D2Controller() { -} - // Refer to config_report so it will be embedded in the binary. const char* const* d2_config_report = isc::detail::config_report; diff --git a/src/bin/d2/d2_controller.h b/src/bin/d2/d2_controller.h index 6f61735828..cb2f42d4cf 100644 --- a/src/bin/d2/d2_controller.h +++ b/src/bin/d2/d2_controller.h @@ -36,7 +36,7 @@ public: static process::DControllerBasePtr& instance(); /// @brief Destructor. - virtual ~D2Controller(); + virtual ~D2Controller() = default; /// @brief Defines the application name, this is passed into base class /// and appears in log statements. @@ -79,15 +79,13 @@ private: /// @throw BadValue if the file is empty virtual isc::data::ConstElementPtr parseFile(const std::string& file_name); +protected: /// @brief Constructor is declared private to maintain the integrity of /// the singleton instance. D2Controller(); - - /// To facilitate unit testing. - friend class NakedD2Controller; }; -}; // namespace isc::d2 -}; // namespace isc +} // namespace isc::d2 +} // namespace isc #endif diff --git a/src/bin/d2/d2_process.cc b/src/bin/d2/d2_process.cc index f1838d52da..64de96f21a 100644 --- a/src/bin/d2/d2_process.cc +++ b/src/bin/d2/d2_process.cc @@ -376,9 +376,6 @@ D2Process::reconfigureQueueMgr() { } } -D2Process::~D2Process() { -}; - D2CfgMgrPtr D2Process::getD2CfgMgr() { // The base class gives a base class pointer to our configuration manager. diff --git a/src/bin/d2/d2_process.h b/src/bin/d2/d2_process.h index 5ca34222d3..bf66bb634d 100644 --- a/src/bin/d2/d2_process.h +++ b/src/bin/d2/d2_process.h @@ -160,7 +160,7 @@ public: bool check_only = false); /// @brief Destructor - virtual ~D2Process(); + virtual ~D2Process() = default; protected: /// @brief Monitors current queue manager state, takes action accordingly @@ -312,13 +312,12 @@ private: /// @brief Current socket control configuration. isc::data::ConstElementPtr current_control_socket_; - }; /// @brief Defines a shared pointer to D2Process. typedef boost::shared_ptr D2ProcessPtr; -}; // namespace isc::d2 -}; // namespace isc +} // namespace isc::d2 +} // namespace isc #endif diff --git a/src/bin/d2/d2_queue_mgr.cc b/src/bin/d2/d2_queue_mgr.cc index c16880851e..f3e7c9f6df 100644 --- a/src/bin/d2/d2_queue_mgr.cc +++ b/src/bin/d2/d2_queue_mgr.cc @@ -26,9 +26,6 @@ D2QueueMgr::D2QueueMgr(asiolink::IOServicePtr& io_service, const size_t max_queu setMaxQueueSize(max_queue_size); } -D2QueueMgr::~D2QueueMgr() { -} - void D2QueueMgr::operator()(const dhcp_ddns::NameChangeListener::Result result, dhcp_ddns::NameChangeRequestPtr& ncr) { diff --git a/src/bin/d2/d2_queue_mgr.h b/src/bin/d2/d2_queue_mgr.h index bbd95ea016..23ce0280cb 100644 --- a/src/bin/d2/d2_queue_mgr.h +++ b/src/bin/d2/d2_queue_mgr.h @@ -163,7 +163,7 @@ public: const size_t max_queue_size = MAX_QUEUE_DEFAULT); /// @brief Destructor - virtual ~D2QueueMgr(); + virtual ~D2QueueMgr() = default; /// @brief Initializes the listener as a UDP listener. /// diff --git a/src/bin/d2/d2_update_mgr.cc b/src/bin/d2/d2_update_mgr.cc index 223430e9c9..88c3ab1446 100644 --- a/src/bin/d2/d2_update_mgr.cc +++ b/src/bin/d2/d2_update_mgr.cc @@ -43,7 +43,10 @@ D2UpdateMgr::D2UpdateMgr(D2QueueMgrPtr& queue_mgr, D2CfgMgrPtr& cfg_mgr, } D2UpdateMgr::~D2UpdateMgr() { - transaction_list_.clear(); + try { + transaction_list_.clear(); + } catch (...) { + } } void D2UpdateMgr::sweep() { diff --git a/src/bin/d2/dns_client.cc b/src/bin/d2/dns_client.cc index 73ffa61054..e1e98ca7c9 100644 --- a/src/bin/d2/dns_client.cc +++ b/src/bin/d2/dns_client.cc @@ -56,11 +56,13 @@ public: // TSIG context used to sign outbound and verify inbound messages. dns::TSIGContextPtr tsig_context_; - // Constructor and Destructor + // Constructor DNSClientImpl(D2UpdateMessagePtr& response_placeholder, DNSClient::Callback* callback, const DNSClient::Protocol proto); - virtual ~DNSClientImpl(); + + // Destructor + virtual ~DNSClientImpl() = default; // This internal callback is called when the DNS update message exchange is // complete. It further invokes the external callback provided by a caller. @@ -117,9 +119,6 @@ DNSClientImpl::DNSClientImpl(D2UpdateMessagePtr& response_placeholder, } } -DNSClientImpl::~DNSClientImpl() { -} - void DNSClientImpl::operator()(asiodns::IOFetch::Result result) { // Get the status from IO. If no success, we just call user's callback @@ -234,10 +233,6 @@ DNSClient::DNSClient(D2UpdateMessagePtr& response_placeholder, : impl_(new DNSClientImpl(response_placeholder, callback, proto)) { } -DNSClient::~DNSClient() { - delete (impl_); -} - unsigned int DNSClient::getMaxTimeout() { static const unsigned int max_timeout = std::numeric_limits::max(); diff --git a/src/bin/d2/dns_client.h b/src/bin/d2/dns_client.h index 41423be889..fd98f05aba 100644 --- a/src/bin/d2/dns_client.h +++ b/src/bin/d2/dns_client.h @@ -24,6 +24,9 @@ typedef boost::shared_ptr DNSClientPtr; /// DNSClient class implementation. class DNSClientImpl; +/// @brief Defines a smart pointer to a DNSClientImpl. +typedef boost::shared_ptr DNSClientImplPtr; + /// @brief The @c DNSClient class handles communication with the DNS server. /// /// Communication with the DNS server is asynchronous. Caller must provide a @@ -73,8 +76,11 @@ public: /// exchange is complete (@see @c DNSClient). class Callback { public: + // @brief Constructor. + Callback() = default; + /// @brief Virtual destructor. - virtual ~Callback() { } + virtual ~Callback() = default; /// @brief Function operator implementing a callback. /// @@ -96,7 +102,7 @@ public: const Protocol proto = UDP); /// @brief Virtual destructor, does nothing. - ~DNSClient(); + ~DNSClient() = default; /// /// @name Copy constructor and assignment operator @@ -149,7 +155,8 @@ public: const dns::TSIGKeyPtr& tsig_key = dns::TSIGKeyPtr()); private: - DNSClientImpl* impl_; ///< Pointer to DNSClient implementation. + /// @brief Smart pointer to DNSClient implementation. + DNSClientImplPtr impl_; }; } // namespace d2 diff --git a/src/bin/d2/nc_add.cc b/src/bin/d2/nc_add.cc index b4692a8614..2d9ada0413 100644 --- a/src/bin/d2/nc_add.cc +++ b/src/bin/d2/nc_add.cc @@ -41,9 +41,6 @@ NameAddTransaction(asiolink::IOServicePtr& io_service, } } -NameAddTransaction::~NameAddTransaction(){ -} - void NameAddTransaction::defineEvents() { // Call superclass impl first. diff --git a/src/bin/d2/nc_add.h b/src/bin/d2/nc_add.h index 0f9929abd1..1dfa018100 100644 --- a/src/bin/d2/nc_add.h +++ b/src/bin/d2/nc_add.h @@ -90,7 +90,7 @@ public: D2CfgMgrPtr& cfg_mgr); /// @brief Destructor - virtual ~NameAddTransaction(); + virtual ~NameAddTransaction() = default; protected: /// @brief Adds events defined by NameAddTransaction to the event set. diff --git a/src/bin/d2/nc_remove.cc b/src/bin/d2/nc_remove.cc index cd0b14bb59..9e359a3468 100644 --- a/src/bin/d2/nc_remove.cc +++ b/src/bin/d2/nc_remove.cc @@ -38,9 +38,6 @@ NameRemoveTransaction(asiolink::IOServicePtr& io_service, } } -NameRemoveTransaction::~NameRemoveTransaction(){ -} - void NameRemoveTransaction::defineEvents() { // Call superclass impl first. diff --git a/src/bin/d2/nc_remove.h b/src/bin/d2/nc_remove.h index 1584cb0025..5d2213f15a 100644 --- a/src/bin/d2/nc_remove.h +++ b/src/bin/d2/nc_remove.h @@ -86,7 +86,7 @@ public: D2CfgMgrPtr& cfg_mgr); /// @brief Destructor - virtual ~NameRemoveTransaction(); + virtual ~NameRemoveTransaction() = default; protected: /// @brief Adds events defined by NameRemoveTransaction to the event set. diff --git a/src/bin/d2/nc_trans.cc b/src/bin/d2/nc_trans.cc index d10b5c313c..62ab4d5c00 100644 --- a/src/bin/d2/nc_trans.cc +++ b/src/bin/d2/nc_trans.cc @@ -80,9 +80,6 @@ NameChangeTransaction(asiolink::IOServicePtr& io_service, } } -NameChangeTransaction::~NameChangeTransaction(){ -} - void NameChangeTransaction::startTransaction() { LOG_DEBUG(d2_to_dns_logger, isc::log::DBGLVL_TRACE_DETAIL, diff --git a/src/bin/d2/nc_trans.h b/src/bin/d2/nc_trans.h index 4634027f03..2aa4465bb3 100644 --- a/src/bin/d2/nc_trans.h +++ b/src/bin/d2/nc_trans.h @@ -173,7 +173,7 @@ public: D2CfgMgrPtr& cfg_mgr); /// @brief Destructor - virtual ~NameChangeTransaction(); + virtual ~NameChangeTransaction() = default; /// @brief Begins execution of the transaction. /// diff --git a/src/bin/d2/parser_context.cc b/src/bin/d2/parser_context.cc index fce0c9f79b..f5f3864ac4 100644 --- a/src/bin/d2/parser_context.cc +++ b/src/bin/d2/parser_context.cc @@ -18,13 +18,11 @@ namespace isc { namespace d2 { D2ParserContext::D2ParserContext() - : sfile_(0), ctx_(NO_KEYWORD), trace_scanning_(false), trace_parsing_(false) -{ + : sfile_(0), ctx_(NO_KEYWORD), trace_scanning_(false), trace_parsing_(false) { } isc::data::ElementPtr -D2ParserContext::parseString(const std::string& str, ParserType parser_type) -{ +D2ParserContext::parseString(const std::string& str, ParserType parser_type) { scanStringBegin(str, parser_type); return (parseCommon()); } @@ -67,8 +65,7 @@ D2ParserContext::parseCommon() { void D2ParserContext::error(const isc::d2::location& loc, const std::string& what, - size_t pos) -{ + size_t pos) { if (pos == 0) { isc_throw(D2ParseError, loc << ": " << what); } else { @@ -77,20 +74,17 @@ D2ParserContext::error(const isc::d2::location& loc, } void -D2ParserContext::error (const std::string& what) -{ +D2ParserContext::error (const std::string& what) { isc_throw(D2ParseError, what); } void -D2ParserContext::fatal (const std::string& what) -{ +D2ParserContext::fatal (const std::string& what) { isc_throw(D2ParseError, what); } isc::data::Element::Position -D2ParserContext::loc2pos(isc::d2::location& loc) -{ +D2ParserContext::loc2pos(isc::d2::location& loc) { const std::string& file = *loc.begin.filename; const uint32_t line = loc.begin.line; const uint32_t pos = loc.begin.column; @@ -99,8 +93,7 @@ D2ParserContext::loc2pos(isc::d2::location& loc) void D2ParserContext::unique(const std::string& name, - isc::data::Element::Position loc) -{ + isc::data::Element::Position loc) { ConstElementPtr value = stack_.back()->get(name); if (value) { if (ctx_ != NO_KEYWORD) { @@ -116,15 +109,13 @@ D2ParserContext::unique(const std::string& name, } void -D2ParserContext::enter(const ParserContext& ctx) -{ +D2ParserContext::enter(const ParserContext& ctx) { cstack_.push_back(ctx_); ctx_ = ctx; } void -D2ParserContext::leave() -{ +D2ParserContext::leave() { if (cstack_.empty()) { fatal("unbalanced syntactic context"); } @@ -134,8 +125,7 @@ D2ParserContext::leave() } const std::string -D2ParserContext::contextName() -{ +D2ParserContext::contextName() { switch (ctx_) { case NO_KEYWORD: return ("__no keyword__"); diff --git a/src/bin/d2/simple_add.cc b/src/bin/d2/simple_add.cc index 6ca7a3cfe2..e7e4030c0f 100644 --- a/src/bin/d2/simple_add.cc +++ b/src/bin/d2/simple_add.cc @@ -40,9 +40,6 @@ SimpleAddTransaction(asiolink::IOServicePtr& io_service, } } -SimpleAddTransaction::~SimpleAddTransaction(){ -} - void SimpleAddTransaction::defineEvents() { // Call superclass impl first. diff --git a/src/bin/d2/simple_add.h b/src/bin/d2/simple_add.h index 7bf7b6c605..a1ab2188f3 100644 --- a/src/bin/d2/simple_add.h +++ b/src/bin/d2/simple_add.h @@ -82,7 +82,7 @@ public: D2CfgMgrPtr& cfg_mgr); /// @brief Destructor - virtual ~SimpleAddTransaction(); + virtual ~SimpleAddTransaction() = default; protected: /// @brief Adds events defined by SimpleAddTransaction to the event set. diff --git a/src/bin/d2/simple_remove.cc b/src/bin/d2/simple_remove.cc index 63de0e3ab1..bb6cd4ccf7 100644 --- a/src/bin/d2/simple_remove.cc +++ b/src/bin/d2/simple_remove.cc @@ -37,9 +37,6 @@ SimpleRemoveTransaction(asiolink::IOServicePtr& io_service, } } -SimpleRemoveTransaction::~SimpleRemoveTransaction(){ -} - void SimpleRemoveTransaction::defineEvents() { // Call superclass impl first. diff --git a/src/bin/d2/simple_remove.h b/src/bin/d2/simple_remove.h index ce6d525145..c5beb136ac 100644 --- a/src/bin/d2/simple_remove.h +++ b/src/bin/d2/simple_remove.h @@ -81,7 +81,7 @@ public: D2CfgMgrPtr& cfg_mgr); /// @brief Destructor - virtual ~SimpleRemoveTransaction(); + virtual ~SimpleRemoveTransaction() = default; protected: /// @brief Adds events defined by SimpleRemoveTransaction to the event set. diff --git a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc index a2c901234e..fca3e7cccf 100644 --- a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc @@ -43,14 +43,12 @@ std::string testDataFile(const std::string& name) { /// results, and accessing the configuration context. class D2CfgMgrTest : public ConfigParseTest { public: - /// @brief Constructor - D2CfgMgrTest():cfg_mgr_(new D2CfgMgr()), d2_params_() { + D2CfgMgrTest() : cfg_mgr_(new D2CfgMgr()), d2_params_() { } /// @brief Destructor - ~D2CfgMgrTest() { - } + ~D2CfgMgrTest() = default; /// @brief Configuration manager instance. D2CfgMgrPtr cfg_mgr_; diff --git a/src/bin/d2/tests/d2_command_unittest.cc b/src/bin/d2/tests/d2_command_unittest.cc index 5192e7831b..35079c8aae 100644 --- a/src/bin/d2/tests/d2_command_unittest.cc +++ b/src/bin/d2/tests/d2_command_unittest.cc @@ -54,7 +54,13 @@ public: return (controller_ptr); } - virtual ~NakedD2Controller() { deregisterCommands(); } + /// @brief Destructor + virtual ~NakedD2Controller() { + try { + deregisterCommands(); + } catch (...) { + } + } using DControllerBase::getIOService; using DControllerBase::initProcess; @@ -64,11 +70,12 @@ public: } private: - NakedD2Controller() { } + /// @brief Constructor + NakedD2Controller() = default; }; -}; // namespace isc::d2 -}; // namespace isc +} // namespace isc::d2 +} // namespace isc namespace { @@ -88,7 +95,10 @@ public: /// /// Stops IO service. ~IOServiceWork() { - io_service_->stop(); + try { + io_service_->stop(); + } catch (...) { + } } private: @@ -117,7 +127,7 @@ public: /// @brief Configuration file. static const char* CFG_TEST_FILE; - /// @brief Default constructor. + /// @brief Constructor. /// /// Sets socket path to its default value. CtrlChannelD2Test() @@ -133,16 +143,19 @@ public: /// @brief Destructor. ~CtrlChannelD2Test() { - // Deregister & co. - server_.reset(); + try { + // Deregister & co. + server_.reset(); - // Remove files. - ::remove(CFG_TEST_FILE); - ::remove(socket_path_.c_str()); + // Remove files. + ::remove(CFG_TEST_FILE); + ::remove(socket_path_.c_str()); - // Reset command manager. - CommandMgr::instance().deregisterAll(); - CommandMgr::instance().setConnectionTimeout(TIMEOUT_DHCP_SERVER_RECEIVE_COMMAND); + // Reset command manager. + CommandMgr::instance().deregisterAll(); + CommandMgr::instance().setConnectionTimeout(TIMEOUT_DHCP_SERVER_RECEIVE_COMMAND); + } catch (...) { + } } /// @brief Returns pointer to the server's IO service. diff --git a/src/bin/d2/tests/d2_process_unittests.cc b/src/bin/d2/tests/d2_process_unittests.cc index 5a60b464a9..c03ae3f0e4 100644 --- a/src/bin/d2/tests/d2_process_unittests.cc +++ b/src/bin/d2/tests/d2_process_unittests.cc @@ -65,8 +65,7 @@ public: } /// @brief Destructor - virtual ~D2ProcessTest() { - } + virtual ~D2ProcessTest() = default; /// @brief Callback that will invoke shutdown method. void genShutdownCallback() { diff --git a/src/bin/d2/tests/d2_simple_parser_unittest.cc b/src/bin/d2/tests/d2_simple_parser_unittest.cc index 686d7fae8c..ce3a021b0a 100644 --- a/src/bin/d2/tests/d2_simple_parser_unittest.cc +++ b/src/bin/d2/tests/d2_simple_parser_unittest.cc @@ -163,7 +163,10 @@ public: /// @brief Destructor virtual ~D2SimpleParserTest() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief Parses JSON text and compares the results against an expected @@ -313,7 +316,10 @@ public: /// @brief Destructor virtual ~TSIGKeyInfoParserTest() { - reset(); + try { + reset(); + } catch (...) { + } }; /// @brief Adds TSIG Key default values to the given TSIG Key element @@ -353,7 +359,10 @@ public: /// @brief Destructor virtual ~TSIGKeyInfoListParserTest() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief Free up the keys created by parsing @@ -398,7 +407,10 @@ public: /// @brief Destructor virtual ~DnsServerInfoParserTest() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief Free up the server created by parsing @@ -442,7 +454,10 @@ public: /// @brief Destructor virtual ~DnsServerInfoListParserTest() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief Free up the servers created by parsing @@ -490,7 +505,10 @@ public: /// @brief Destructor virtual ~DdnsDomainParserTest() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief Free up the domain created by parsing @@ -549,7 +567,10 @@ public: /// @brief Destructor virtual ~DdnsDomainListParserTest() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief Free up domains created by parsing diff --git a/src/bin/d2/tests/d2_update_message_unittests.cc b/src/bin/d2/tests/d2_update_message_unittests.cc index 6e6fa5d949..851253f0ab 100644 --- a/src/bin/d2/tests/d2_update_message_unittests.cc +++ b/src/bin/d2/tests/d2_update_message_unittests.cc @@ -31,12 +31,12 @@ public: /// @brief Constructor // // Does nothing. - D2UpdateMessageTest() { } + D2UpdateMessageTest() = default; /// @brief Destructor // // Does nothing. - ~D2UpdateMessageTest() { }; + ~D2UpdateMessageTest() = default; /// @brief Returns string representation of the name encoded in wire format. // diff --git a/src/bin/d2/tests/d2_update_mgr_unittests.cc b/src/bin/d2/tests/d2_update_mgr_unittests.cc index a89de3e273..b3921f19ad 100644 --- a/src/bin/d2/tests/d2_update_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_update_mgr_unittests.cc @@ -45,8 +45,7 @@ public: } /// @brief Destructor - virtual ~D2UpdateMgrWrapper() { - } + virtual ~D2UpdateMgrWrapper() = default; // Expose the protected methods to be tested. using D2UpdateMgr::checkFinishedTransactions; @@ -72,6 +71,7 @@ public: std::vector canned_ncrs_; size_t canned_count_; + /// @brief Constructor D2UpdateMgrTest() { queue_mgr_.reset(new D2QueueMgr(io_service_)); cfg_mgr_.reset(new D2CfgMgr()); @@ -81,8 +81,8 @@ public: makeCannedConfig(); } - ~D2UpdateMgrTest() { - } + /// @brief Destructor + ~D2UpdateMgrTest() = default; /// @brief Creates a list of valid NameChangeRequest. /// diff --git a/src/bin/d2/tests/dns_client_unittests.cc b/src/bin/d2/tests/dns_client_unittests.cc index 02bbc569c8..e33c7c3536 100644 --- a/src/bin/d2/tests/dns_client_unittests.cc +++ b/src/bin/d2/tests/dns_client_unittests.cc @@ -92,8 +92,11 @@ public: // // Sets the asiodns logging level back to DEBUG. virtual ~DNSClientTest() { - asiodns::logger.setSeverity(isc::log::DEBUG); - }; + try { + asiodns::logger.setSeverity(isc::log::DEBUG); + } catch (...) { + } + } /// @brief Exchange completion callback // diff --git a/src/bin/d2/tests/get_config_unittest.cc b/src/bin/d2/tests/get_config_unittest.cc index f1f914e754..82498a718f 100644 --- a/src/bin/d2/tests/get_config_unittest.cc +++ b/src/bin/d2/tests/get_config_unittest.cc @@ -100,6 +100,7 @@ parseDHCPDDNS(const std::string& in, bool verbose = false) { /// Test fixture class class D2GetConfigTest : public ConfigParseTest { public: + /// @brief Constructor D2GetConfigTest() : rcode_(-1) { srv_.reset(new D2CfgMgr()); @@ -109,8 +110,12 @@ public: resetConfiguration(); } + /// @brief Destructor ~D2GetConfigTest() { - resetConfiguration(); + try { + resetConfiguration(); + } catch (...) { + } } /// @brief Parse and Execute configuration diff --git a/src/bin/d2/tests/nc_add_unittests.cc b/src/bin/d2/tests/nc_add_unittests.cc index a6a906478a..ae527320cd 100644 --- a/src/bin/d2/tests/nc_add_unittests.cc +++ b/src/bin/d2/tests/nc_add_unittests.cc @@ -25,6 +25,7 @@ namespace { // to protected methods. class NameAddStub : public NameAddTransaction { public: + /// @brief Constructor NameAddStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, @@ -36,8 +37,8 @@ public: simulate_build_request_exception_(false) { } - virtual ~NameAddStub() { - } + /// @brief Destructor + virtual ~NameAddStub() = default; /// @brief Simulates sending update requests to the DNS server /// @@ -183,12 +184,11 @@ typedef boost::shared_ptr NameAddStubPtr; /// aspects of NameAddTransaction. class NameAddTransactionTest : public TransactionTest { public: + /// @brief Constructor + NameAddTransactionTest() = default; - NameAddTransactionTest() { - } - - virtual ~NameAddTransactionTest() { - } + /// @brief Destructor + virtual ~NameAddTransactionTest() = default; /// @brief Creates a transaction which requests an IPv4 DNS update. /// diff --git a/src/bin/d2/tests/nc_remove_unittests.cc b/src/bin/d2/tests/nc_remove_unittests.cc index 4a1ee5c22d..418622d043 100644 --- a/src/bin/d2/tests/nc_remove_unittests.cc +++ b/src/bin/d2/tests/nc_remove_unittests.cc @@ -26,6 +26,7 @@ namespace { // to protected methods. class NameRemoveStub : public NameRemoveTransaction { public: + /// @brief Constructor NameRemoveStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, @@ -37,8 +38,8 @@ public: simulate_build_request_exception_(false) { } - virtual ~NameRemoveStub() { - } + /// @brief Destructor + virtual ~NameRemoveStub() = default; /// @brief Simulates sending update requests to the DNS server /// @@ -184,11 +185,11 @@ typedef boost::shared_ptr NameRemoveStubPtr; /// aspects of NameRemoveTransaction. class NameRemoveTransactionTest : public TransactionTest { public: - NameRemoveTransactionTest() { - } + /// @brief Constructor + NameRemoveTransactionTest() = default; - virtual ~NameRemoveTransactionTest() { - } + /// @brief Destructor + virtual ~NameRemoveTransactionTest() = default; /// @brief Creates a transaction which requests an IPv4 DNS update. /// diff --git a/src/bin/d2/tests/nc_test_utils.cc b/src/bin/d2/tests/nc_test_utils.cc index f6392e07a2..28ed0db579 100644 --- a/src/bin/d2/tests/nc_test_utils.cc +++ b/src/bin/d2/tests/nc_test_utils.cc @@ -82,10 +82,6 @@ FauxServer::FauxServer(asiolink::IOService& io_service, server_socket_->bind(endpoint.getASIOEndpoint()); } - -FauxServer::~FauxServer() { -} - void FauxServer::receive (const ResponseMode& response_mode, const dns::Rcode& response_rcode) { @@ -219,9 +215,6 @@ TimedIO::TimedIO() timer_(*io_service_), run_time_(0) { } -TimedIO::~TimedIO() { -} - int TimedIO::runTimedIO(int run_time) { run_time_ = run_time; @@ -250,9 +243,6 @@ const unsigned int TransactionTest::FWD_AND_REV_CHG = REVERSE_CHG | FORWARD_CHG; TransactionTest::TransactionTest() : ncr_(), cfg_mgr_(new D2CfgMgr()) { } -TransactionTest::~TransactionTest() { -} - void TransactionTest::setupForIPv4Transaction(dhcp_ddns::NameChangeType chg_type, int change_mask, diff --git a/src/bin/d2/tests/nc_test_utils.h b/src/bin/d2/tests/nc_test_utils.h index 26eacd82d0..e6726b35ed 100644 --- a/src/bin/d2/tests/nc_test_utils.h +++ b/src/bin/d2/tests/nc_test_utils.h @@ -79,7 +79,7 @@ public: FauxServer(asiolink::IOService& io_service, DnsServerInfo& server); /// @brief Destructor - virtual ~FauxServer(); + virtual ~FauxServer() = default; /// @brief Initiates an asynchronous receive /// @@ -141,7 +141,7 @@ public: TimedIO(); // Destructor - virtual ~TimedIO(); + virtual ~TimedIO() = default; /// @brief IO Timer expiration handler /// @@ -182,8 +182,11 @@ public: static const unsigned int REVERSE_CHG; // Only reverse change. static const unsigned int FWD_AND_REV_CHG; // Both forward and reverse. + /// @brief Constructor TransactionTest(); - virtual ~TransactionTest(); + + /// @brief Destructor + virtual ~TransactionTest() = default; /// @brief Creates a transaction which requests an IPv4 DNS update. /// diff --git a/src/bin/d2/tests/nc_trans_unittests.cc b/src/bin/d2/tests/nc_trans_unittests.cc index 4744477230..74588b9f98 100644 --- a/src/bin/d2/tests/nc_trans_unittests.cc +++ b/src/bin/d2/tests/nc_trans_unittests.cc @@ -60,8 +60,7 @@ public: } /// @brief Destructor - virtual ~NameChangeStub() { - } + virtual ~NameChangeStub() = default; /// @brief DNSClient callback /// Overrides the callback in NameChangeTransaction to allow testing @@ -268,11 +267,11 @@ typedef boost::shared_ptr NameChangeStubPtr; /// aspects of NameChangeTransaction. class NameChangeTransactionTest : public TransactionTest { public: - NameChangeTransactionTest() { - } + /// @brief Constructor + NameChangeTransactionTest() = default; - virtual ~NameChangeTransactionTest() { - } + /// @brief Destructor + virtual ~NameChangeTransactionTest() = default; /// @brief Instantiates a NameChangeStub test transaction diff --git a/src/bin/d2/tests/simple_add_unittests.cc b/src/bin/d2/tests/simple_add_unittests.cc index 2d7a884c4e..1037ab14de 100644 --- a/src/bin/d2/tests/simple_add_unittests.cc +++ b/src/bin/d2/tests/simple_add_unittests.cc @@ -25,6 +25,7 @@ namespace { // to protected methods. class SimpleAddStub : public SimpleAddTransaction { public: + /// @brief Constructor SimpleAddStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, @@ -36,8 +37,8 @@ public: simulate_build_request_exception_(false) { } - virtual ~SimpleAddStub() { - } + /// @brief Destructor + virtual ~SimpleAddStub() = default; /// @brief Simulates sending update requests to the DNS server /// @@ -181,12 +182,11 @@ typedef boost::shared_ptr SimpleAddStubPtr; /// aspects of SimpleAddTransaction. class SimpleAddTransactionTest : public TransactionTest { public: + /// @brief Constructor + SimpleAddTransactionTest() = default; - SimpleAddTransactionTest() { - } - - virtual ~SimpleAddTransactionTest() { - } + /// @brief Destructor + virtual ~SimpleAddTransactionTest() = default; /// @brief Creates a transaction which requests an IPv4 DNS update. /// diff --git a/src/bin/d2/tests/simple_remove_unittests.cc b/src/bin/d2/tests/simple_remove_unittests.cc index 2e4238e553..caa86e8d67 100644 --- a/src/bin/d2/tests/simple_remove_unittests.cc +++ b/src/bin/d2/tests/simple_remove_unittests.cc @@ -26,6 +26,7 @@ namespace { // to protected methods. class SimpleRemoveStub : public SimpleRemoveTransaction { public: + /// @brief Constructor SimpleRemoveStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, DdnsDomainPtr& forward_domain, @@ -37,8 +38,8 @@ public: simulate_build_request_exception_(false) { } - virtual ~SimpleRemoveStub() { - } + /// @brief Destructor + virtual ~SimpleRemoveStub() = default; /// @brief Simulates sending update requests to the DNS server /// @@ -182,11 +183,11 @@ typedef boost::shared_ptr SimpleRemoveStubPtr; /// aspects of SimpleRemoveTransaction. class SimpleRemoveTransactionTest : public TransactionTest { public: - SimpleRemoveTransactionTest() { - } + /// @brief Constructor + SimpleRemoveTransactionTest() = default; - virtual ~SimpleRemoveTransactionTest() { - } + /// @brief Destructor + virtual ~SimpleRemoveTransactionTest() = default; /// @brief Creates a transaction which requests an IPv4 DNS update. /// diff --git a/src/bin/dhcp4/client_handler.cc b/src/bin/dhcp4/client_handler.cc index f116df3ad6..5586fe5279 100644 --- a/src/bin/dhcp4/client_handler.cc +++ b/src/bin/dhcp4/client_handler.cc @@ -136,26 +136,29 @@ ClientHandler::ClientHandler() } ClientHandler::~ClientHandler() { - bool unlocked = false; - lock_guard lk(mutex_); - if (locked_client_id_) { - unlocked = true; - unLockById(); - } - if (locked_hwaddr_) { - unlocked = true; - unLockByHWAddr(); - } - if (!unlocked || !client_ || !client_->cont_) { - return; - } - // Try to process next query. As the caller holds the mutex of - // the handler class the continuation will be resumed after. - MultiThreadingMgr& mt_mgr = MultiThreadingMgr::instance(); - if (mt_mgr.getMode()) { - if (!mt_mgr.getThreadPool().addFront(client_->cont_)) { - LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC, DHCP4_PACKET_QUEUE_FULL); + try { + bool unlocked = false; + lock_guard lk(mutex_); + if (locked_client_id_) { + unlocked = true; + unLockById(); + } + if (locked_hwaddr_) { + unlocked = true; + unLockByHWAddr(); + } + if (!unlocked || !client_ || !client_->cont_) { + return; + } + // Try to process next query. As the caller holds the mutex of + // the handler class the continuation will be resumed after. + MultiThreadingMgr& mt_mgr = MultiThreadingMgr::instance(); + if (mt_mgr.getMode()) { + if (!mt_mgr.getThreadPool().addFront(client_->cont_)) { + LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC, DHCP4_PACKET_QUEUE_FULL); + } } + } catch (...) { } } diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 6c943ead56..7c4029992d 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -671,41 +671,44 @@ void Dhcpv4Srv::setPacketStatisticsDefaults() { } Dhcpv4Srv::~Dhcpv4Srv() { - // Discard any parked packets - discardPackets(); - try { - stopD2(); - } catch (const std::exception& ex) { - // Highly unlikely, but lets Report it but go on - LOG_ERROR(dhcp4_logger, DHCP4_SRV_D2STOP_ERROR).arg(ex.what()); - } + // Discard any parked packets + discardPackets(); - try { - Dhcp4to6Ipc::instance().close(); - } catch (const std::exception& ex) { - // Highly unlikely, but lets Report it but go on - LOG_ERROR(dhcp4_logger, DHCP4_SRV_DHCP4O6_ERROR).arg(ex.what()); - } - - IfaceMgr::instance().closeSockets(); - - // The lease manager was instantiated during DHCPv4Srv configuration, - // so we should clean up after ourselves. - LeaseMgrFactory::destroy(); - - // Explicitly unload hooks - HooksManager::prepareUnloadLibraries(); - if (!HooksManager::unloadLibraries()) { - auto names = HooksManager::getLibraryNames(); - std::string msg; - if (!names.empty()) { - msg = names[0]; - for (size_t i = 1; i < names.size(); ++i) { - msg += std::string(", ") + names[i]; + try { + stopD2(); + } catch (const std::exception& ex) { + // Highly unlikely, but lets Report it but go on + LOG_ERROR(dhcp4_logger, DHCP4_SRV_D2STOP_ERROR).arg(ex.what()); + } + + try { + Dhcp4to6Ipc::instance().close(); + } catch (const std::exception& ex) { + // Highly unlikely, but lets Report it but go on + LOG_ERROR(dhcp4_logger, DHCP4_SRV_DHCP4O6_ERROR).arg(ex.what()); + } + + IfaceMgr::instance().closeSockets(); + + // The lease manager was instantiated during DHCPv4Srv configuration, + // so we should clean up after ourselves. + LeaseMgrFactory::destroy(); + + // Explicitly unload hooks + HooksManager::prepareUnloadLibraries(); + if (!HooksManager::unloadLibraries()) { + auto names = HooksManager::getLibraryNames(); + std::string msg; + if (!names.empty()) { + msg = names[0]; + for (size_t i = 1; i < names.size(); ++i) { + msg += std::string(", ") + names[i]; + } } + LOG_ERROR(dhcp4_logger, DHCP4_SRV_UNLOAD_LIBRARIES_ERROR).arg(msg); } - LOG_ERROR(dhcp4_logger, DHCP4_SRV_UNLOAD_LIBRARIES_ERROR).arg(msg); + } catch (...) { } } diff --git a/src/bin/dhcp4/dhcp4to6_ipc.cc b/src/bin/dhcp4/dhcp4to6_ipc.cc index 074fde6618..f3ad045e38 100644 --- a/src/bin/dhcp4/dhcp4to6_ipc.cc +++ b/src/bin/dhcp4/dhcp4to6_ipc.cc @@ -27,8 +27,6 @@ using namespace isc::hooks; namespace isc { namespace dhcp { -Dhcp4to6Ipc::Dhcp4to6Ipc() : Dhcp4o6IpcBase() {} - Dhcp4to6Ipc& Dhcp4to6Ipc::instance() { static Dhcp4to6Ipc dhcp4to6_ipc; return (dhcp4to6_ipc); diff --git a/src/bin/dhcp4/dhcp4to6_ipc.h b/src/bin/dhcp4/dhcp4to6_ipc.h index a2e86f0717..3e45a1b631 100644 --- a/src/bin/dhcp4/dhcp4to6_ipc.h +++ b/src/bin/dhcp4/dhcp4to6_ipc.h @@ -25,10 +25,10 @@ protected: /// @brief Constructor /// /// Default constructor - Dhcp4to6Ipc(); + Dhcp4to6Ipc() = default; /// @brief Destructor. - virtual ~Dhcp4to6Ipc() { } + virtual ~Dhcp4to6Ipc() = default; public: /// @brief Returns pointer to the sole instance of Dhcp4to6Ipc diff --git a/src/bin/dhcp4/parser_context.cc b/src/bin/dhcp4/parser_context.cc index ff9673b81b..a7367b6573 100644 --- a/src/bin/dhcp4/parser_context.cc +++ b/src/bin/dhcp4/parser_context.cc @@ -22,9 +22,6 @@ Parser4Context::Parser4Context() trace_parsing_(false) { } -Parser4Context::~Parser4Context() { -} - isc::data::ElementPtr Parser4Context::parseString(const std::string& str, ParserType parser_type) { scanStringBegin(str, parser_type); diff --git a/src/bin/dhcp4/parser_context.h b/src/bin/dhcp4/parser_context.h index 538800ebf7..502c4bee8a 100644 --- a/src/bin/dhcp4/parser_context.h +++ b/src/bin/dhcp4/parser_context.h @@ -95,7 +95,7 @@ public: Parser4Context(); /// @brief destructor - virtual ~Parser4Context(); + virtual ~Parser4Context() = default; /// @brief JSON elements being parsed. std::vector stack_; diff --git a/src/bin/dhcp4/tests/classify_unittest.cc b/src/bin/dhcp4/tests/classify_unittest.cc index eb11c25763..fd7a42cd69 100644 --- a/src/bin/dhcp4/tests/classify_unittest.cc +++ b/src/bin/dhcp4/tests/classify_unittest.cc @@ -388,9 +388,7 @@ public: } /// @brief Destructor. - /// - ~ClassifyTest() { - } + ~ClassifyTest() = default; /// @brief Does client exchanges and checks if fixed fields have expected values. /// diff --git a/src/bin/dhcp4/tests/client_handler_unittest.cc b/src/bin/dhcp4/tests/client_handler_unittest.cc index 50b3ba5e67..93543b3193 100644 --- a/src/bin/dhcp4/tests/client_handler_unittest.cc +++ b/src/bin/dhcp4/tests/client_handler_unittest.cc @@ -36,8 +36,11 @@ public: /// /// Removes statistics. ~ClientHandleTest() { - MultiThreadingMgr::instance().apply(false, 0, 0); - StatsMgr::instance().removeAll(); + try { + MultiThreadingMgr::instance().apply(false, 0, 0); + StatsMgr::instance().removeAll(); + } catch (...) { + } } /// @brief Generates a client-id option. diff --git a/src/bin/dhcp4/tests/config_backend_unittest.cc b/src/bin/dhcp4/tests/config_backend_unittest.cc index 751aef448a..0f5ac1561b 100644 --- a/src/bin/dhcp4/tests/config_backend_unittest.cc +++ b/src/bin/dhcp4/tests/config_backend_unittest.cc @@ -87,7 +87,7 @@ protected: public: - /// Constructor + /// @brief Constructor Dhcp4CBTest() : rcode_(-1), db1_selector("db1"), db2_selector("db1") { // Open port 0 means to not do anything at all. We don't want to @@ -99,10 +99,13 @@ public: resetConfiguration(); } - /// Destructor + /// @brief Destructor virtual ~Dhcp4CBTest() { - resetConfiguration(); - }; + try { + resetConfiguration(); + } catch (...) { + } + } /// @brief Reset configuration singletons. void resetConfiguration() { diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index bbbb976361..22507fb9c9 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -276,6 +276,7 @@ protected: } public: + /// @brief Constructor Dhcp4ParserTest() : rcode_(-1) { // Open port 0 means to not do anything at all. We don't want to @@ -348,13 +349,17 @@ public: } } + /// @brief Destructor ~Dhcp4ParserTest() { - resetConfiguration(); + try { + resetConfiguration(); - // ... and delete the hooks library marker files if present - static_cast(remove(LOAD_MARKER_FILE)); - static_cast(remove(UNLOAD_MARKER_FILE)); - }; + // ... and delete the hooks library marker files if present + static_cast(remove(LOAD_MARKER_FILE)); + static_cast(remove(UNLOAD_MARKER_FILE)); + } catch (...) { + } + } /// @brief Returns an interface configuration used by the most of the /// unit tests. diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index 176dff5ed9..1a38394584 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -74,7 +74,10 @@ public: /// /// Stops IO service. ~IOServiceWork() { - io_service_->stop(); + try { + io_service_->stop(); + } catch (...) { + } } private: @@ -123,16 +126,19 @@ public: /// @brief Destructor ~CtrlChannelDhcpv4SrvTest() { - LeaseMgrFactory::destroy(); - StatsMgr::instance().removeAll(); + try { + LeaseMgrFactory::destroy(); + StatsMgr::instance().removeAll(); - CommandMgr::instance().closeCommandSocket(); - CommandMgr::instance().deregisterAll(); - CommandMgr::instance().setConnectionTimeout(TIMEOUT_DHCP_SERVER_RECEIVE_COMMAND); + CommandMgr::instance().closeCommandSocket(); + CommandMgr::instance().deregisterAll(); + CommandMgr::instance().setConnectionTimeout(TIMEOUT_DHCP_SERVER_RECEIVE_COMMAND); - server_.reset(); - MultiThreadingMgr::instance().setMode(false); - }; + server_.reset(); + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } + } /// @brief Returns pointer to the server's IO service. /// diff --git a/src/bin/dhcp4/tests/d2_unittest.cc b/src/bin/dhcp4/tests/d2_unittest.cc index 0a11144fd4..24c7713baa 100644 --- a/src/bin/dhcp4/tests/d2_unittest.cc +++ b/src/bin/dhcp4/tests/d2_unittest.cc @@ -39,7 +39,10 @@ Dhcp4SrvD2Test::Dhcp4SrvD2Test() : rcode_(-1) { } Dhcp4SrvD2Test::~Dhcp4SrvD2Test() { - reset(); + try { + reset(); + } catch (...) { + } } dhcp_ddns::NameChangeRequestPtr diff --git a/src/bin/dhcp4/tests/d2_unittest.h b/src/bin/dhcp4/tests/d2_unittest.h index 20474e352e..5b4cbceefe 100644 --- a/src/bin/dhcp4/tests/d2_unittest.h +++ b/src/bin/dhcp4/tests/d2_unittest.h @@ -32,8 +32,7 @@ public: } /// @brief virtual Destructor. - virtual ~D2Dhcpv4Srv() { - } + virtual ~D2Dhcpv4Srv() = default; /// @brief Override the error handler. virtual void d2ClientErrorHandler(const dhcp_ddns::NameChangeSender:: diff --git a/src/bin/dhcp4/tests/dhcp4_test_utils.cc b/src/bin/dhcp4/tests/dhcp4_test_utils.cc index 3a4353c6da..6ebb2003b6 100644 --- a/src/bin/dhcp4/tests/dhcp4_test_utils.cc +++ b/src/bin/dhcp4/tests/dhcp4_test_utils.cc @@ -44,16 +44,19 @@ BaseServerTest::BaseServerTest() } BaseServerTest::~BaseServerTest() { - // Remove default lease file. - std::ostringstream s2; - s2 << CfgMgr::instance().getDataDir() << "/" << "kea-leases4.csv"; - static_cast(::remove(s2.str().c_str())); + try { + // Remove default lease file. + std::ostringstream s2; + s2 << CfgMgr::instance().getDataDir() << "/" << "kea-leases4.csv"; + static_cast(::remove(s2.str().c_str())); - // Revert to original data directory. - CfgMgr::instance().setDataDir(original_datadir_); + // Revert to original data directory. + CfgMgr::instance().setDataDir(original_datadir_); - // Revert to unit test logging, in case the test reconfigured it. - isc::log::initLogger(); + // Revert to unit test logging, in case the test reconfigured it. + isc::log::initLogger(); + } catch (...) { + } } Dhcpv4SrvTest::Dhcpv4SrvTest() @@ -87,17 +90,19 @@ Dhcpv4SrvTest::Dhcpv4SrvTest() } Dhcpv4SrvTest::~Dhcpv4SrvTest() { + try { + // Make sure that we revert to default value + CfgMgr::instance().clear(); - // Make sure that we revert to default value - CfgMgr::instance().clear(); + LibDHCP::clearRuntimeOptionDefs(); - LibDHCP::clearRuntimeOptionDefs(); + // Let's wipe all existing statistics. + isc::stats::StatsMgr::instance().removeAll(); - // Let's wipe all existing statistics. - isc::stats::StatsMgr::instance().removeAll(); - - // Reset the thread pool. - MultiThreadingMgr::instance().apply(false, 0, 0); + // Reset the thread pool. + MultiThreadingMgr::instance().apply(false, 0, 0); + } catch (...) { + } } void Dhcpv4SrvTest::addPrlOption(Pkt4Ptr& pkt) { diff --git a/src/bin/dhcp4/tests/dhcp4_test_utils.h b/src/bin/dhcp4/tests/dhcp4_test_utils.h index 7d35a16907..b8ab1b79f0 100644 --- a/src/bin/dhcp4/tests/dhcp4_test_utils.h +++ b/src/bin/dhcp4/tests/dhcp4_test_utils.h @@ -208,8 +208,8 @@ public: fake_received_.push_back(pkt); } - virtual ~NakedDhcpv4Srv() { - } + /// @brief Destructor + virtual ~NakedDhcpv4Srv() = default; /// @brief Runs processing DHCPREQUEST. /// @@ -314,11 +314,16 @@ public: class Dhcpv4SrvMTTestGuard { public: + /// @brief Constructor Dhcpv4SrvMTTestGuard(Dhcpv4SrvTest& test, bool mt_enabled) : test_(test) { test_.setMultiThreading(mt_enabled); } + /// @brief Destructor ~Dhcpv4SrvMTTestGuard() { - test_.setMultiThreading(false); + try { + test_.setMultiThreading(false); + } catch (...) { + } } Dhcpv4SrvTest& test_; }; diff --git a/src/bin/dhcp4/tests/dhcp4to6_ipc_unittest.cc b/src/bin/dhcp4/tests/dhcp4to6_ipc_unittest.cc index 2a47d71821..c5fc41b772 100644 --- a/src/bin/dhcp4/tests/dhcp4to6_ipc_unittest.cc +++ b/src/bin/dhcp4/tests/dhcp4to6_ipc_unittest.cc @@ -75,12 +75,15 @@ public: /// /// Various cleanups. virtual ~Dhcp4to6IpcTest() { - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer4_send"); - callback_recv_pkt_.reset(); - callback_sent_pkt_.reset(); - bool status = HooksManager::unloadLibraries(); - if (!status) { - cerr << "(fixture dtor) unloadLibraries failed" << endl; + try { + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer4_send"); + callback_recv_pkt_.reset(); + callback_sent_pkt_.reset(); + bool status = HooksManager::unloadLibraries(); + if (!status) { + cerr << "(fixture dtor) unloadLibraries failed" << endl; + } + } catch (...) { } } diff --git a/src/bin/dhcp4/tests/dora_unittest.cc b/src/bin/dhcp4/tests/dora_unittest.cc index 0faf40fe0a..10602b1047 100644 --- a/src/bin/dhcp4/tests/dora_unittest.cc +++ b/src/bin/dhcp4/tests/dora_unittest.cc @@ -594,8 +594,11 @@ public: /// /// Cleans up statistics after the test. ~DORATest() { - // Let's wipe all existing statistics. - isc::stats::StatsMgr::instance().removeAll(); + try { + // Let's wipe all existing statistics. + isc::stats::StatsMgr::instance().removeAll(); + } catch (...) { + } } /// @brief Test that server returns the same lease for the client which is @@ -2710,8 +2713,11 @@ public: /// /// Destroys MySQL schema. virtual ~DORAMySQLTest() { - // If data wipe enabled, delete transient data otherwise destroy the schema. - db::test::destroyMySQLSchema(); + try { + // If data wipe enabled, delete transient data otherwise destroy the schema. + db::test::destroyMySQLSchema(); + } catch (...) { + } } }; @@ -2753,8 +2759,11 @@ public: /// /// Destroys PgSQL schema. virtual ~DORAPgSQLTest() { - // If data wipe enabled, delete transient data otherwise destroy the schema - db::test::destroyPgSQLSchema(); + try { + // If data wipe enabled, delete transient data otherwise destroy the schema + db::test::destroyPgSQLSchema(); + } catch (...) { + } } }; @@ -2795,8 +2804,11 @@ public: /// /// Destroys CQL schema. virtual ~DORACQLTest() { - // If data wipe enabled, delete transient data otherwise destroy the schema - db::test::destroyCqlSchema(); + try { + // If data wipe enabled, delete transient data otherwise destroy the schema + db::test::destroyCqlSchema(); + } catch (...) { + } } }; diff --git a/src/bin/dhcp4/tests/fqdn_unittest.cc b/src/bin/dhcp4/tests/fqdn_unittest.cc index cb9a3e9a43..257ae00e76 100644 --- a/src/bin/dhcp4/tests/fqdn_unittest.cc +++ b/src/bin/dhcp4/tests/fqdn_unittest.cc @@ -332,21 +332,25 @@ public: NAME_NOT_REPLACED }; + /// @brief Constructor NameDhcpv4SrvTest() : Dhcpv4SrvTest(), d2_mgr_(CfgMgr::instance().getD2ClientMgr()), - iface_mgr_test_config_(true) - { + iface_mgr_test_config_(true) { srv_ = boost::make_shared(0); IfaceMgr::instance().openSockets4(); // Config DDNS to be enabled, all controls off enableD2(); } + /// @brief Destructor virtual ~NameDhcpv4SrvTest() { - // CfgMgr singleton doesn't get wiped between tests, so we'll - // disable D2 explicitly between tests. - disableD2(); + try { + // CfgMgr singleton doesn't get wiped between tests, so we'll + // disable D2 explicitly between tests. + disableD2(); + } catch (...) { + } } /// @brief Sets the server's DDNS configuration to ddns updates disabled. diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc b/src/bin/dhcp4/tests/get_config_unittest.cc index 56d8a4443e..e302e0f0b9 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc +++ b/src/bin/dhcp4/tests/get_config_unittest.cc @@ -11308,6 +11308,7 @@ namespace { /// Test fixture class (code from Dhcp4ParserTest) class Dhcp4GetConfigTest : public ::testing::TestWithParam { public: + /// @brief Constructor Dhcp4GetConfigTest() : rcode_(-1) { // Open port 0 means to not do anything at all. We don't want to @@ -11318,9 +11319,13 @@ public: resetConfiguration(); } + /// @brief Destructor ~Dhcp4GetConfigTest() { - resetConfiguration(); - }; + try { + resetConfiguration(); + } catch (...) { + } + } /// @brief Parse and Execute configuration /// diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc.skel b/src/bin/dhcp4/tests/get_config_unittest.cc.skel index cc4a64a349..322c7eaad7 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc.skel +++ b/src/bin/dhcp4/tests/get_config_unittest.cc.skel @@ -165,6 +165,7 @@ namespace { /// Test fixture class (code from Dhcp4ParserTest) class Dhcp4GetConfigTest : public ::testing::TestWithParam { public: + /// @brief Constructor Dhcp4GetConfigTest() : rcode_(-1) { // Open port 0 means to not do anything at all. We don't want to @@ -175,9 +176,13 @@ public: resetConfiguration(); } + /// @brief Destructor ~Dhcp4GetConfigTest() { - resetConfiguration(); - }; + try { + resetConfiguration(); + } catch (...) { + } + } /// @brief Parse and Execute configuration /// diff --git a/src/bin/dhcp4/tests/hooks_unittest.cc b/src/bin/dhcp4/tests/hooks_unittest.cc index f96653339a..af49f3dc27 100644 --- a/src/bin/dhcp4/tests/hooks_unittest.cc +++ b/src/bin/dhcp4/tests/hooks_unittest.cc @@ -102,7 +102,7 @@ class HooksDhcpv4SrvTest : public Dhcpv4SrvTest { public: - /// @brief creates Dhcpv4Srv and prepares buffers for callouts + /// @brief Constructor creates Dhcpv4Srv and prepares buffers for callouts HooksDhcpv4SrvTest() { HooksManager::setTestMode(false); bool status = HooksManager::unloadLibraries(); @@ -119,27 +119,30 @@ public: io_service_ = boost::make_shared(); } - /// @brief destructor (deletes Dhcpv4Srv) + /// @brief Destructor (deletes Dhcpv4Srv) virtual ~HooksDhcpv4SrvTest() { - // clear static buffers - resetCalloutBuffers(); - - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("dhcp4_srv_configured"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer4_receive"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer4_send"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("pkt4_receive"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("pkt4_send"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("subnet4_select"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease4_renew"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease4_release"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease4_decline"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("host4_identifier"); - - delete srv_; - HooksManager::setTestMode(false); - bool status = HooksManager::unloadLibraries(); - if (!status) { - cerr << "(fixture dtor) unloadLibraries failed" << endl; + try { + // clear static buffers + resetCalloutBuffers(); + + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("dhcp4_srv_configured"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer4_receive"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer4_send"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("pkt4_receive"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("pkt4_send"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("subnet4_select"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease4_renew"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease4_release"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease4_decline"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("host4_identifier"); + + delete srv_; + HooksManager::setTestMode(false); + bool status = HooksManager::unloadLibraries(); + if (!status) { + cerr << "(fixture dtor) unloadLibraries failed" << endl; + } + } catch (...) { } } @@ -871,6 +874,7 @@ public: /// @brief Pointer to the tested server object boost::shared_ptr server_; + /// @brief Constructor LoadUnloadDhcpv4SrvTest() { reset(); MultiThreadingMgr::instance().setMode(false); @@ -878,10 +882,13 @@ public: /// @brief Destructor ~LoadUnloadDhcpv4SrvTest() { - server_.reset(); - reset(); - MultiThreadingMgr::instance().setMode(false); - }; + try { + server_.reset(); + reset(); + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } + } /// @brief Reset hooks data /// diff --git a/src/bin/dhcp4/tests/host_unittest.cc b/src/bin/dhcp4/tests/host_unittest.cc index 6502f68fa2..16e13b2c1c 100644 --- a/src/bin/dhcp4/tests/host_unittest.cc +++ b/src/bin/dhcp4/tests/host_unittest.cc @@ -410,8 +410,11 @@ public: /// /// Cleans up statistics after the test. ~HostTest() { - // Let's wipe all existing statistics. - isc::stats::StatsMgr::instance().removeAll(); + try { + // Let's wipe all existing statistics. + isc::stats::StatsMgr::instance().removeAll(); + } catch (...) { + } } /// @brief Interface Manager's fake configuration control. diff --git a/src/bin/dhcp4/tests/inform_unittest.cc b/src/bin/dhcp4/tests/inform_unittest.cc index f6d83fd360..eff7c9018b 100644 --- a/src/bin/dhcp4/tests/inform_unittest.cc +++ b/src/bin/dhcp4/tests/inform_unittest.cc @@ -143,13 +143,15 @@ public: /// /// Cleans up statistics after the test. ~InformTest() { - // Let's wipe all existing statistics. - isc::stats::StatsMgr::instance().removeAll(); + try { + // Let's wipe all existing statistics. + isc::stats::StatsMgr::instance().removeAll(); + } catch (...) { + } } /// @brief Interface Manager's fake configuration control. IfaceMgrTestConfig iface_mgr_test_config_; - }; // Test that directly connected client's DHCPINFORM message is processed and diff --git a/src/bin/dhcp4/tests/kea_controller_unittest.cc b/src/bin/dhcp4/tests/kea_controller_unittest.cc index 55495ef121..f815d63907 100644 --- a/src/bin/dhcp4/tests/kea_controller_unittest.cc +++ b/src/bin/dhcp4/tests/kea_controller_unittest.cc @@ -196,14 +196,18 @@ public: /// near future. class JSONFileBackendTest : public isc::dhcp::test::BaseServerTest { public: - JSONFileBackendTest() { - } + /// @brief Constructor + JSONFileBackendTest() = default; + /// @brief Destructor ~JSONFileBackendTest() { - LeaseMgrFactory::destroy(); - static_cast(remove(TEST_FILE)); - static_cast(remove(TEST_INCLUDE)); - }; + try { + LeaseMgrFactory::destroy(); + static_cast(remove(TEST_FILE)); + static_cast(remove(TEST_INCLUDE)); + } catch (...) { + } + } /// @brief writes specified content to a well known file /// @@ -969,8 +973,11 @@ public: /// /// Destroys MySQL schema. virtual ~JSONFileBackendMySQLTest() { - // If data wipe enabled, delete transient data otherwise destroy the schema. - destroyMySQLSchema(); + try { + // If data wipe enabled, delete transient data otherwise destroy the schema. + destroyMySQLSchema(); + } catch (...) { + } } /// @brief Creates server configuration with specified backend type. diff --git a/src/bin/dhcp4/tests/out_of_range_unittest.cc b/src/bin/dhcp4/tests/out_of_range_unittest.cc index 850002da2e..620ea29105 100644 --- a/src/bin/dhcp4/tests/out_of_range_unittest.cc +++ b/src/bin/dhcp4/tests/out_of_range_unittest.cc @@ -205,8 +205,7 @@ public: /// @brief Destructor. /// /// Cleans up statistics after the test. - ~OutOfRangeTest() { - } + ~OutOfRangeTest() = default; void configure(const std::string& config, Dhcp4Client& client) { NakedDhcpv4Srv& server = *client.getServer(); diff --git a/src/bin/dhcp4/tests/shared_network_unittest.cc b/src/bin/dhcp4/tests/shared_network_unittest.cc index 60eb4550e7..960ce0438a 100644 --- a/src/bin/dhcp4/tests/shared_network_unittest.cc +++ b/src/bin/dhcp4/tests/shared_network_unittest.cc @@ -1322,7 +1322,10 @@ public: /// @brief Destructor. virtual ~Dhcpv4SharedNetworkTest() { - StatsMgr::instance().removeAll(); + try { + StatsMgr::instance().removeAll(); + } catch (...) { + } } /// @brief Interface Manager's fake configuration control. diff --git a/src/bin/dhcp6/client_handler.cc b/src/bin/dhcp6/client_handler.cc index f160392d12..c932f03e2e 100644 --- a/src/bin/dhcp6/client_handler.cc +++ b/src/bin/dhcp6/client_handler.cc @@ -75,9 +75,12 @@ ClientHandler::ClientHandler() : client_(), locked_() { } ClientHandler::~ClientHandler() { - if (locked_) { - lock_guard lk(mutex_); - unLock(); + try { + if (locked_) { + lock_guard lk(mutex_); + unLock(); + } + } catch (...) { } } diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index b593d07293..fa0bd573d1 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -261,39 +261,42 @@ void Dhcpv6Srv::setPacketStatisticsDefaults() { } Dhcpv6Srv::~Dhcpv6Srv() { - // Discard any parked packets - discardPackets(); - try { - stopD2(); - } catch (const std::exception& ex) { - // Highly unlikely, but lets Report it but go on - LOG_ERROR(dhcp6_logger, DHCP6_SRV_D2STOP_ERROR).arg(ex.what()); - } + // Discard any parked packets + discardPackets(); - try { - Dhcp6to4Ipc::instance().close(); - } catch (const std::exception& ex) { - // Highly unlikely, but lets Report it but go on - // LOG_ERROR(dhcp6_logger, DHCP6_SRV_DHCP4O6_ERROR).arg(ex.what()); - } + try { + stopD2(); + } catch (const std::exception& ex) { + // Highly unlikely, but lets Report it but go on + LOG_ERROR(dhcp6_logger, DHCP6_SRV_D2STOP_ERROR).arg(ex.what()); + } - IfaceMgr::instance().closeSockets(); + try { + Dhcp6to4Ipc::instance().close(); + } catch (const std::exception& ex) { + // Highly unlikely, but lets Report it but go on + // LOG_ERROR(dhcp6_logger, DHCP6_SRV_DHCP4O6_ERROR).arg(ex.what()); + } + + IfaceMgr::instance().closeSockets(); - LeaseMgrFactory::destroy(); + LeaseMgrFactory::destroy(); - // Explicitly unload hooks - HooksManager::prepareUnloadLibraries(); - if (!HooksManager::unloadLibraries()) { - auto names = HooksManager::getLibraryNames(); - std::string msg; - if (!names.empty()) { - msg = names[0]; - for (size_t i = 1; i < names.size(); ++i) { - msg += std::string(", ") + names[i]; + // Explicitly unload hooks + HooksManager::prepareUnloadLibraries(); + if (!HooksManager::unloadLibraries()) { + auto names = HooksManager::getLibraryNames(); + std::string msg; + if (!names.empty()) { + msg = names[0]; + for (size_t i = 1; i < names.size(); ++i) { + msg += std::string(", ") + names[i]; + } } + LOG_ERROR(dhcp6_logger, DHCP6_SRV_UNLOAD_LIBRARIES_ERROR).arg(msg); } - LOG_ERROR(dhcp6_logger, DHCP6_SRV_UNLOAD_LIBRARIES_ERROR).arg(msg); + } catch (...) { } } diff --git a/src/bin/dhcp6/dhcp6to4_ipc.cc b/src/bin/dhcp6/dhcp6to4_ipc.cc index 68b4970238..fa5297e097 100644 --- a/src/bin/dhcp6/dhcp6to4_ipc.cc +++ b/src/bin/dhcp6/dhcp6to4_ipc.cc @@ -29,8 +29,6 @@ namespace dhcp { uint16_t Dhcp6to4Ipc::client_port = 0; -Dhcp6to4Ipc::Dhcp6to4Ipc() : Dhcp4o6IpcBase() {} - Dhcp6to4Ipc& Dhcp6to4Ipc::instance() { static Dhcp6to4Ipc dhcp6to4_ipc; return (dhcp6to4_ipc); diff --git a/src/bin/dhcp6/dhcp6to4_ipc.h b/src/bin/dhcp6/dhcp6to4_ipc.h index 1d393e9884..340b895abc 100644 --- a/src/bin/dhcp6/dhcp6to4_ipc.h +++ b/src/bin/dhcp6/dhcp6to4_ipc.h @@ -23,10 +23,10 @@ protected: /// @brief Constructor /// /// Default constructor - Dhcp6to4Ipc(); + Dhcp6to4Ipc() = default; /// @brief Destructor. - virtual ~Dhcp6to4Ipc() { } + virtual ~Dhcp6to4Ipc() = default; public: /// @brief Returns pointer to the sole instance of Dhcp6to4Ipc diff --git a/src/bin/dhcp6/parser_context.cc b/src/bin/dhcp6/parser_context.cc index 2a0694b370..40b44061ef 100644 --- a/src/bin/dhcp6/parser_context.cc +++ b/src/bin/dhcp6/parser_context.cc @@ -22,9 +22,6 @@ Parser6Context::Parser6Context() trace_parsing_(false) { } -Parser6Context::~Parser6Context() { -} - isc::data::ElementPtr Parser6Context::parseString(const std::string& str, ParserType parser_type) { scanStringBegin(str, parser_type); diff --git a/src/bin/dhcp6/parser_context.h b/src/bin/dhcp6/parser_context.h index 1b89f747c3..4431427b1d 100644 --- a/src/bin/dhcp6/parser_context.h +++ b/src/bin/dhcp6/parser_context.h @@ -98,7 +98,7 @@ public: Parser6Context(); /// @brief destructor - virtual ~Parser6Context(); + virtual ~Parser6Context() = default; /// @brief JSON elements being parsed. std::vector stack_; diff --git a/src/bin/dhcp6/tests/client_handler_unittest.cc b/src/bin/dhcp6/tests/client_handler_unittest.cc index 6eed4c4bbd..3345313921 100644 --- a/src/bin/dhcp6/tests/client_handler_unittest.cc +++ b/src/bin/dhcp6/tests/client_handler_unittest.cc @@ -36,8 +36,11 @@ public: /// /// Removes statistics. ~ClientHandleTest() { - MultiThreadingMgr::instance().apply(false, 0, 0); - StatsMgr::instance().removeAll(); + try { + MultiThreadingMgr::instance().apply(false, 0, 0); + StatsMgr::instance().removeAll(); + } catch (...) { + } } /// @brief Generates a client-id option. diff --git a/src/bin/dhcp6/tests/config_backend_unittest.cc b/src/bin/dhcp6/tests/config_backend_unittest.cc index 879cf877c1..2775ca7196 100644 --- a/src/bin/dhcp6/tests/config_backend_unittest.cc +++ b/src/bin/dhcp6/tests/config_backend_unittest.cc @@ -89,7 +89,7 @@ protected: public: - /// Constructor + /// @brief Constructor Dhcp6CBTest() : rcode_(-1), db1_selector("db1"), db2_selector("db1") { // Open port 0 means to not do anything at all. We don't want to @@ -102,10 +102,13 @@ public: CfgMgr::instance().setFamily(AF_INET6); } - /// Destructor + /// @brief Destructor virtual ~Dhcp6CBTest() { - resetConfiguration(); - }; + try { + resetConfiguration(); + } catch (...) { + } + } /// @brief Reset configuration singletons. void resetConfiguration() { diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index be3895ac0c..99b59d883c 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -362,6 +362,7 @@ protected: } public: + /// @brief Constructor Dhcp6ParserTest() :rcode_(-1), srv_(0) { // srv_(0) means to not open any sockets. We don't want to // deal with sockets here, just check if configuration handling @@ -388,14 +389,18 @@ public: resetConfiguration(); } + /// @brief Destructor ~Dhcp6ParserTest() { - // Reset configuration database after each test. - resetConfiguration(); + try { + // Reset configuration database after each test. + resetConfiguration(); - // ... and delete the hooks library marker files if present - static_cast(remove(LOAD_MARKER_FILE)); - static_cast(remove(UNLOAD_MARKER_FILE)); - }; + // ... and delete the hooks library marker files if present + static_cast(remove(LOAD_MARKER_FILE)); + static_cast(remove(UNLOAD_MARKER_FILE)); + } catch (...) { + } + } // Checks if config_result (result of DHCP server configuration) has // expected code (0 for success, other for failures). diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc index ca9f4c981a..81c514b9eb 100644 --- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc @@ -71,7 +71,10 @@ public: /// /// Stops IO service. ~IOServiceWork() { - io_service_->stop(); + try { + io_service_->stop(); + } catch (...) { + } } private: @@ -98,20 +101,24 @@ const size_t DEFAULT_CONNECTION_TIMEOUT = 10000; class CtrlDhcpv6SrvTest : public BaseServerTest { public: + /// @brief Constructor CtrlDhcpv6SrvTest() : BaseServerTest() { reset(); } + /// @brief Destructor virtual ~CtrlDhcpv6SrvTest() { - LeaseMgrFactory::destroy(); - StatsMgr::instance().removeAll(); - CommandMgr::instance().deregisterAll(); - CommandMgr::instance().setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT); - - reset(); - }; - + try { + LeaseMgrFactory::destroy(); + StatsMgr::instance().removeAll(); + CommandMgr::instance().deregisterAll(); + CommandMgr::instance().setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT); + + reset(); + } catch (...) { + } + } /// @brief Reset hooks data /// @@ -156,10 +163,13 @@ public: /// @brief Destructor ~CtrlChannelDhcpv6SrvTest() { - server_.reset(); - reset(); - MultiThreadingMgr::instance().setMode(false); - }; + try { + server_.reset(); + reset(); + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } + } /// @brief Returns pointer to the server's IO service. /// diff --git a/src/bin/dhcp6/tests/d2_unittest.cc b/src/bin/dhcp6/tests/d2_unittest.cc index ef58d21d5a..e1ba97bf30 100644 --- a/src/bin/dhcp6/tests/d2_unittest.cc +++ b/src/bin/dhcp6/tests/d2_unittest.cc @@ -41,7 +41,10 @@ Dhcp6SrvD2Test::Dhcp6SrvD2Test() : rcode_(-1) { } Dhcp6SrvD2Test::~Dhcp6SrvD2Test() { - reset(); + try { + reset(); + } catch (...) { + } } dhcp_ddns::NameChangeRequestPtr diff --git a/src/bin/dhcp6/tests/d2_unittest.h b/src/bin/dhcp6/tests/d2_unittest.h index 55b94620cc..6de78364a8 100644 --- a/src/bin/dhcp6/tests/d2_unittest.h +++ b/src/bin/dhcp6/tests/d2_unittest.h @@ -32,8 +32,7 @@ public: } /// @brief virtual Destructor. - virtual ~D2Dhcpv6Srv() { - } + virtual ~D2Dhcpv6Srv() = default; /// @brief Override the error handler. virtual void d2ClientErrorHandler(const dhcp_ddns::NameChangeSender:: diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.cc b/src/bin/dhcp6/tests/dhcp6_test_utils.cc index 7c132a7567..304ed5e0ca 100644 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.cc +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.cc @@ -37,21 +37,24 @@ BaseServerTest::BaseServerTest() } BaseServerTest::~BaseServerTest() { - // Remove test DUID file. - std::ostringstream s; - s << CfgMgr::instance().getDataDir() << "/" << DUID_FILE; - static_cast(::remove(s.str().c_str())); - - // Remove default lease file. - std::ostringstream s2; - s2 << CfgMgr::instance().getDataDir() << "/" << "kea-leases6.csv"; - static_cast(::remove(s2.str().c_str())); - - // Revert to original data directory. - CfgMgr::instance().setDataDir(original_datadir_); - - // Revert to unit test logging in case the test reconfigured logging. - isc::log::initLogger(); + try { + // Remove test DUID file. + std::ostringstream s; + s << CfgMgr::instance().getDataDir() << "/" << DUID_FILE; + static_cast(::remove(s.str().c_str())); + + // Remove default lease file. + std::ostringstream s2; + s2 << CfgMgr::instance().getDataDir() << "/" << "kea-leases6.csv"; + static_cast(::remove(s2.str().c_str())); + + // Revert to original data directory. + CfgMgr::instance().setDataDir(original_datadir_); + + // Revert to unit test logging in case the test reconfigured logging. + isc::log::initLogger(); + } catch (...) { + } } Dhcpv6SrvTest::Dhcpv6SrvTest() @@ -81,11 +84,14 @@ Dhcpv6SrvTest::Dhcpv6SrvTest() } Dhcpv6SrvTest::~Dhcpv6SrvTest() { - isc::dhcp::CfgMgr::instance().clear(); + try { + isc::dhcp::CfgMgr::instance().clear(); - // Reset the thread pool. - MultiThreadingMgr::instance().apply(false, 0, 0); -}; + // Reset the thread pool. + MultiThreadingMgr::instance().apply(false, 0, 0); + } catch (...) { + } +} // Checks that server response (ADVERTISE or REPLY) contains proper IA_NA option // It returns IAADDR option for each chaining with checkIAAddr method. @@ -875,25 +881,28 @@ NakedDhcpv6SrvTest::NakedDhcpv6SrvTest() } NakedDhcpv6SrvTest::~NakedDhcpv6SrvTest() { - // Let's wipe all existing statistics. - isc::stats::StatsMgr::instance().removeAll(); - - // Let's clean up if there is such a file. - static_cast(remove(DUID_FILE)); - isc::hooks::HooksManager::preCalloutsLibraryHandle() - .deregisterAllCallouts("buffer6_receive"); - isc::hooks::HooksManager::preCalloutsLibraryHandle() - .deregisterAllCallouts("buffer6_send"); - isc::hooks::HooksManager::preCalloutsLibraryHandle() - .deregisterAllCallouts("lease6_renew"); - isc::hooks::HooksManager::preCalloutsLibraryHandle() - .deregisterAllCallouts("lease6_release"); - isc::hooks::HooksManager::preCalloutsLibraryHandle() - .deregisterAllCallouts("pkt6_receive"); - isc::hooks::HooksManager::preCalloutsLibraryHandle() - .deregisterAllCallouts("pkt6_send"); - isc::hooks::HooksManager::preCalloutsLibraryHandle() - .deregisterAllCallouts("subnet6_select"); + try { + // Let's wipe all existing statistics. + isc::stats::StatsMgr::instance().removeAll(); + + // Let's clean up if there is such a file. + static_cast(remove(DUID_FILE)); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("buffer6_receive"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("buffer6_send"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("lease6_renew"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("lease6_release"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("pkt6_receive"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("pkt6_send"); + isc::hooks::HooksManager::preCalloutsLibraryHandle() + .deregisterAllCallouts("subnet6_select"); + } catch (...) { + } } // Generate IA_NA option with specified parameters diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.h b/src/bin/dhcp6/tests/dhcp6_test_utils.h index f894b213f1..95087c9fa2 100644 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.h +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.h @@ -134,6 +134,7 @@ private: /// @brief "naked" Dhcpv6Srv class that exposes internal members class NakedDhcpv6Srv: public isc::dhcp::Dhcpv6Srv { public: + /// @brief Constructor NakedDhcpv6Srv(uint16_t port) : isc::dhcp::Dhcpv6Srv(port) { // Open the "memfile" database for leases std::string memfile = "type=memfile universe=6 persist=false"; @@ -219,9 +220,13 @@ public: fake_received_.push_back(pkt); } + /// @brief Destructor virtual ~NakedDhcpv6Srv() { - // Close the lease database - isc::dhcp::LeaseMgrFactory::destroy(); + try { + // Close the lease database + isc::dhcp::LeaseMgrFactory::destroy(); + } catch (...) { + } } /// @brief Processes incoming Request message. @@ -503,6 +508,7 @@ public: EXPECT_EQ(expected_transid, rsp->getTransid()); } + /// @brief Destructor virtual ~NakedDhcpv6SrvTest(); // A DUID used in most tests (typically as client-id) @@ -543,11 +549,16 @@ public: class Dhcpv6SrvMTTestGuard { public: + /// @brief Constructor Dhcpv6SrvMTTestGuard(Dhcpv6SrvTest& test, bool mt_enabled) : test_(test) { test_.setMultiThreading(mt_enabled); } + /// @brief Destructor ~Dhcpv6SrvMTTestGuard() { - test_.setMultiThreading(false); + try{ + test_.setMultiThreading(false); + } catch (...) { + } } Dhcpv6SrvTest& test_; }; diff --git a/src/bin/dhcp6/tests/dhcp6to4_ipc_unittest.cc b/src/bin/dhcp6/tests/dhcp6to4_ipc_unittest.cc index ce7e077f7c..6815d71afb 100644 --- a/src/bin/dhcp6/tests/dhcp6to4_ipc_unittest.cc +++ b/src/bin/dhcp6/tests/dhcp6to4_ipc_unittest.cc @@ -64,12 +64,15 @@ public: /// /// Various cleanups. virtual ~Dhcp6to4IpcTest() { - Dhcp6to4Ipc::client_port = 0; - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer6_send"); - callback_pkt_.reset(); - bool status = HooksManager::unloadLibraries(); - if (!status) { - std::cerr << "(fixture dtor) unloadLibraries failed" << std::endl; + try { + Dhcp6to4Ipc::client_port = 0; + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer6_send"); + callback_pkt_.reset(); + bool status = HooksManager::unloadLibraries(); + if (!status) { + std::cerr << "(fixture dtor) unloadLibraries failed" << std::endl; + } + } catch (...) { } } diff --git a/src/bin/dhcp6/tests/fqdn_unittest.cc b/src/bin/dhcp6/tests/fqdn_unittest.cc index 2e2910ef9f..889c4db52b 100644 --- a/src/bin/dhcp6/tests/fqdn_unittest.cc +++ b/src/bin/dhcp6/tests/fqdn_unittest.cc @@ -88,10 +88,13 @@ public: /// @brief Destructor virtual ~FqdnDhcpv6SrvTest() { - // Default constructor creates a config with DHCP-DDNS updates - // disabled. - D2ClientConfigPtr cfg(new D2ClientConfig()); - CfgMgr::instance().setD2ClientConfig(cfg); + try { + // Default constructor creates a config with DHCP-DDNS updates + // disabled. + D2ClientConfigPtr cfg(new D2ClientConfig()); + CfgMgr::instance().setD2ClientConfig(cfg); + } catch (...) { + } } /// @brief Sets the server's DDNS configuration to ddns updates disabled. diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc b/src/bin/dhcp6/tests/get_config_unittest.cc index 46ba9b8e9d..0df457c5f8 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc +++ b/src/bin/dhcp6/tests/get_config_unittest.cc @@ -9861,6 +9861,7 @@ namespace { /// Test fixture class (code from Dhcp6ParserTest) class Dhcp6GetConfigTest : public ::testing::TestWithParam { public: + /// @brief Constructor Dhcp6GetConfigTest() : rcode_(-1), srv_(0) { // srv_(0) means to not open any sockets. We don't want to // deal with sockets here, just check if configuration handling @@ -9870,10 +9871,14 @@ public: resetConfiguration(); } + /// @brief Destructor ~Dhcp6GetConfigTest() { - // Reset configuration database after each test. - resetConfiguration(); - }; + try { + // Reset configuration database after each test. + resetConfiguration(); + } catch (...) { + } + } /// @brief Parse and Execute configuration /// diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc.skel b/src/bin/dhcp6/tests/get_config_unittest.cc.skel index 0945e09fa6..9ced625d70 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc.skel +++ b/src/bin/dhcp6/tests/get_config_unittest.cc.skel @@ -166,6 +166,7 @@ namespace { /// Test fixture class (code from Dhcp6ParserTest) class Dhcp6GetConfigTest : public ::testing::TestWithParam { public: + /// @brief Constructor Dhcp6GetConfigTest() : rcode_(-1), srv_(0) { // srv_(0) means to not open any sockets. We don't want to // deal with sockets here, just check if configuration handling @@ -175,10 +176,14 @@ public: resetConfiguration(); } + /// @brief Destructor ~Dhcp6GetConfigTest() { - // Reset configuration database after each test. - resetConfiguration(); - }; + try { + // Reset configuration database after each test. + resetConfiguration(); + } catch (...) { + } + } /// @brief Parse and Execute configuration /// diff --git a/src/bin/dhcp6/tests/hooks_unittest.cc b/src/bin/dhcp6/tests/hooks_unittest.cc index 8d64e3a6c3..e8c3c8b440 100644 --- a/src/bin/dhcp6/tests/hooks_unittest.cc +++ b/src/bin/dhcp6/tests/hooks_unittest.cc @@ -116,7 +116,7 @@ class HooksDhcpv6SrvTest : public Dhcpv6SrvTest { public: - /// @brief creates Dhcpv6Srv and prepares buffers for callouts + /// @brief Constructor creates Dhcpv6Srv and prepares buffers for callouts HooksDhcpv6SrvTest() : Dhcpv6SrvTest() { @@ -138,27 +138,30 @@ public: HooksManager::unloadLibraries(); } - /// @brief destructor (deletes Dhcpv6Srv) + /// @brief Destructor (deletes Dhcpv6Srv) ~HooksDhcpv6SrvTest() { - // Clear static buffers - resetCalloutBuffers(); - - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer6_receive"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("pkt6_receive"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("pkt6_send"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer6_send"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("subnet6_select"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("leases6_committed"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease6_renew"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease6_release"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease6_rebind"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease6_decline"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("host6_identifier"); - - HooksManager::setTestMode(false); - bool status = HooksManager::unloadLibraries(); - if (!status) { - cerr << "(fixture dtor) unloadLibraries failed" << endl; + try { + // Clear static buffers + resetCalloutBuffers(); + + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer6_receive"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("pkt6_receive"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("pkt6_send"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("buffer6_send"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("subnet6_select"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("leases6_committed"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease6_renew"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease6_release"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease6_rebind"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("lease6_decline"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("host6_identifier"); + + HooksManager::setTestMode(false); + bool status = HooksManager::unloadLibraries(); + if (!status) { + cerr << "(fixture dtor) unloadLibraries failed" << endl; + } + } catch (...) { } } @@ -985,6 +988,7 @@ public: /// @brief Pointer to the tested server object boost::shared_ptr server_; + /// @brief Constructor LoadUnloadDhcpv6SrvTest() : Dhcpv6SrvTest() { reset(); @@ -993,10 +997,13 @@ public: /// @brief Destructor ~LoadUnloadDhcpv6SrvTest() { - server_.reset(); - reset(); - MultiThreadingMgr::instance().setMode(false); - }; + try { + server_.reset(); + reset(); + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } + } /// @brief Reset hooks data /// diff --git a/src/bin/dhcp6/tests/infrequest_unittest.cc b/src/bin/dhcp6/tests/infrequest_unittest.cc index a264b09c2f..b3d19f2db8 100644 --- a/src/bin/dhcp6/tests/infrequest_unittest.cc +++ b/src/bin/dhcp6/tests/infrequest_unittest.cc @@ -127,8 +127,11 @@ public: /// /// Removes any statistics that may have been set. ~InfRequestTest() { - // Let's wipe all existing statistics. - isc::stats::StatsMgr::instance().removeAll(); + try { + // Let's wipe all existing statistics. + isc::stats::StatsMgr::instance().removeAll(); + } catch (...) { + } } /// @brief Interface Manager's fake configuration control. diff --git a/src/bin/dhcp6/tests/kea_controller_unittest.cc b/src/bin/dhcp6/tests/kea_controller_unittest.cc index a124913272..44969e2ea9 100644 --- a/src/bin/dhcp6/tests/kea_controller_unittest.cc +++ b/src/bin/dhcp6/tests/kea_controller_unittest.cc @@ -188,16 +188,21 @@ public: class JSONFileBackendTest : public dhcp::test::BaseServerTest { public: + /// @brief Constructor JSONFileBackendTest() : BaseServerTest() { } + /// @brief Destructor ~JSONFileBackendTest() { - LeaseMgrFactory::destroy(); - isc::log::setDefaultLoggingOutput(); - static_cast(remove(TEST_FILE)); - static_cast(remove(TEST_INCLUDE)); - }; + try { + LeaseMgrFactory::destroy(); + isc::log::setDefaultLoggingOutput(); + static_cast(remove(TEST_FILE)); + static_cast(remove(TEST_INCLUDE)); + } catch (...) { + } + } void writeFile(const std::string& file_name, const std::string& content) { static_cast(remove(file_name.c_str())); @@ -954,8 +959,11 @@ public: /// /// Destroys MySQL schema. virtual ~JSONFileBackendMySQLTest() { - // If data wipe enabled, delete transient data otherwise destroy the schema. - destroyMySQLSchema(); + try { + // If data wipe enabled, delete transient data otherwise destroy the schema. + destroyMySQLSchema(); + } catch (...) { + } } /// @brief Creates server configuration with specified backend type. diff --git a/src/bin/dhcp6/tests/sarr_unittest.cc b/src/bin/dhcp6/tests/sarr_unittest.cc index cd485eed93..1bf5d637c2 100644 --- a/src/bin/dhcp6/tests/sarr_unittest.cc +++ b/src/bin/dhcp6/tests/sarr_unittest.cc @@ -235,11 +235,14 @@ public: /// /// Clear the DHCP-DDNS configuration. virtual ~SARRTest() { - D2ClientConfigPtr cfg(new D2ClientConfig()); - CfgMgr::instance().setD2ClientConfig(cfg); - - // Let's wipe all existing statistics. - isc::stats::StatsMgr::instance().removeAll(); + try { + D2ClientConfigPtr cfg(new D2ClientConfig()); + CfgMgr::instance().setD2ClientConfig(cfg); + + // Let's wipe all existing statistics. + isc::stats::StatsMgr::instance().removeAll(); + } catch (...) { + } } /// @brief Check that server processes correctly a prefix hint sent by the diff --git a/src/bin/dhcp6/tests/shared_network_unittest.cc b/src/bin/dhcp6/tests/shared_network_unittest.cc index 63aee55e00..a7b8258790 100644 --- a/src/bin/dhcp6/tests/shared_network_unittest.cc +++ b/src/bin/dhcp6/tests/shared_network_unittest.cc @@ -1491,7 +1491,10 @@ public: /// @brief Destructor. virtual ~Dhcpv6SharedNetworkTest() { - StatsMgr::instance().removeAll(); + try { + StatsMgr::instance().removeAll(); + } catch (...) { + } } /// @brief Interface Manager's fake configuration control. diff --git a/src/bin/lfc/lfc_controller.cc b/src/bin/lfc/lfc_controller.cc index ebd95cf236..aec68fce82 100644 --- a/src/bin/lfc/lfc_controller.cc +++ b/src/bin/lfc/lfc_controller.cc @@ -55,9 +55,6 @@ LFCController::LFCController() copy_file_(""), output_file_(""), finish_file_(""), pid_file_("") { } -LFCController::~LFCController() { -} - void LFCController::launch(int argc, char* argv[], const bool test_mode) { bool do_rotate = true; diff --git a/src/bin/lfc/lfc_controller.h b/src/bin/lfc/lfc_controller.h index d58b418358..f2f00686eb 100644 --- a/src/bin/lfc/lfc_controller.h +++ b/src/bin/lfc/lfc_controller.h @@ -48,7 +48,7 @@ public: LFCController(); /// @brief Destructor - ~LFCController(); + ~LFCController() = default; /// @brief Acts as the primary entry point to start execution /// of the process. diff --git a/src/bin/netconf/control_socket.h b/src/bin/netconf/control_socket.h index a075cb73ae..e1c1e5185e 100644 --- a/src/bin/netconf/control_socket.h +++ b/src/bin/netconf/control_socket.h @@ -44,8 +44,7 @@ public: } /// @brief Destructor (does nothing). - virtual ~ControlSocketBase() { - } + virtual ~ControlSocketBase() = default; /// @brief Getter which returns the socket type. /// diff --git a/src/bin/netconf/http_control_socket.cc b/src/bin/netconf/http_control_socket.cc index dbe46440ea..ec1f9ae569 100644 --- a/src/bin/netconf/http_control_socket.cc +++ b/src/bin/netconf/http_control_socket.cc @@ -37,9 +37,6 @@ HttpControlSocket::HttpControlSocket(CfgControlSocketPtr ctrl_sock) : ControlSocketBase(ctrl_sock) { } -HttpControlSocket::~HttpControlSocket() { -} - ConstElementPtr HttpControlSocket::configGet(const string& service) { if (service == "ca") { diff --git a/src/bin/netconf/http_control_socket.h b/src/bin/netconf/http_control_socket.h index 48023733ce..c37b65fc45 100644 --- a/src/bin/netconf/http_control_socket.h +++ b/src/bin/netconf/http_control_socket.h @@ -29,7 +29,7 @@ public: HttpControlSocket(CfgControlSocketPtr ctrl_sock); /// @brief Destructor (does nothing). - virtual ~HttpControlSocket(); + virtual ~HttpControlSocket() = default; /// @brief Get configuration. /// diff --git a/src/bin/netconf/netconf.cc b/src/bin/netconf/netconf.cc index ef27979322..ecaae1b87c 100644 --- a/src/bin/netconf/netconf.cc +++ b/src/bin/netconf/netconf.cc @@ -125,11 +125,14 @@ public: namespace isc { namespace netconf { -NetconfAgent::NetconfAgent() { +NetconfAgent::NetconfAgent() : cancel_(false) { } NetconfAgent::~NetconfAgent() { - clear(); + try { + clear(); + } catch (...) { + } } void diff --git a/src/bin/netconf/netconf_cfg_mgr.cc b/src/bin/netconf/netconf_cfg_mgr.cc index ad9b02a490..1f889a73d5 100644 --- a/src/bin/netconf/netconf_cfg_mgr.cc +++ b/src/bin/netconf/netconf_cfg_mgr.cc @@ -50,9 +50,6 @@ NetconfCfgMgr::NetconfCfgMgr() : DCfgMgrBase(ConfigPtr(new NetconfConfig())) { } -NetconfCfgMgr::~NetconfCfgMgr() { -} - std::string NetconfCfgMgr::getConfigSummary(const uint32_t /*selection*/) { diff --git a/src/bin/netconf/netconf_cfg_mgr.h b/src/bin/netconf/netconf_cfg_mgr.h index ef4a082684..ca9e80c52b 100644 --- a/src/bin/netconf/netconf_cfg_mgr.h +++ b/src/bin/netconf/netconf_cfg_mgr.h @@ -128,7 +128,7 @@ public: NetconfCfgMgr(); /// @brief Destructor - virtual ~NetconfCfgMgr(); + virtual ~NetconfCfgMgr() = default; /// @brief Convenience method that returns the Netconf configuration /// context. diff --git a/src/bin/netconf/netconf_config.cc b/src/bin/netconf/netconf_config.cc index 79f68ffa34..653ce4f2af 100644 --- a/src/bin/netconf/netconf_config.cc +++ b/src/bin/netconf/netconf_config.cc @@ -33,9 +33,6 @@ CfgControlSocket::CfgControlSocket(Type type, const string& name, : type_(type), name_(name), url_(url) { } -CfgControlSocket::~CfgControlSocket() { -} - CfgControlSocket::Type CfgControlSocket::stringToType(const string& type) { if (type == "unix") { @@ -83,9 +80,6 @@ CfgServer::CfgServer(const string& model, CfgControlSocketPtr ctrl_sock) validate_changes_(true), control_socket_(ctrl_sock) { } -CfgServer::~CfgServer() { -} - string CfgServer::toText() const { ostringstream s; diff --git a/src/bin/netconf/netconf_config.h b/src/bin/netconf/netconf_config.h index 7ffaf6141c..cd0ebb6df5 100644 --- a/src/bin/netconf/netconf_config.h +++ b/src/bin/netconf/netconf_config.h @@ -86,7 +86,7 @@ public: const isc::http::Url& url); /// @brief Destructor (doing nothing). - virtual ~CfgControlSocket(); + virtual ~CfgControlSocket() = default; /// @brief Getter which returns the socket type. /// @@ -156,7 +156,7 @@ public: CfgServer(const std::string& model, CfgControlSocketPtr ctrl_sock); /// @brief Destructor (doing nothing). - virtual ~CfgServer(); + virtual ~CfgServer() = default; /// @brief Getter which returns the model name. /// diff --git a/src/bin/netconf/netconf_controller.cc b/src/bin/netconf/netconf_controller.cc index 1e79b5f55c..43162a4535 100644 --- a/src/bin/netconf/netconf_controller.cc +++ b/src/bin/netconf/netconf_controller.cc @@ -62,9 +62,6 @@ NetconfController::NetconfController() : DControllerBase(netconf_app_name_, netconf_bin_name_) { } -NetconfController::~NetconfController() { -} - NetconfProcessPtr NetconfController::getNetconfProcess() { return (boost::dynamic_pointer_cast(getProcess())); diff --git a/src/bin/netconf/netconf_controller.h b/src/bin/netconf/netconf_controller.h index c4e14828cf..c6ef2bf6f4 100644 --- a/src/bin/netconf/netconf_controller.h +++ b/src/bin/netconf/netconf_controller.h @@ -31,7 +31,7 @@ public: static process::DControllerBasePtr& instance(); /// @brief Destructor - virtual ~NetconfController(); + virtual ~NetconfController() = default; /// @brief Returns pointer to an instance of the underlying process object. NetconfProcessPtr getNetconfProcess(); diff --git a/src/bin/netconf/netconf_process.cc b/src/bin/netconf/netconf_process.cc index 72eb04f680..273629710e 100644 --- a/src/bin/netconf/netconf_process.cc +++ b/src/bin/netconf/netconf_process.cc @@ -33,9 +33,6 @@ NetconfProcess::NetconfProcess(const char* name, : DProcessBase(name, io_service, DCfgMgrBasePtr(new NetconfCfgMgr())) { } -NetconfProcess::~NetconfProcess() { -} - void NetconfProcess::init() { } diff --git a/src/bin/netconf/netconf_process.h b/src/bin/netconf/netconf_process.h index eaa40bce33..3c90712ef3 100644 --- a/src/bin/netconf/netconf_process.h +++ b/src/bin/netconf/netconf_process.h @@ -33,7 +33,7 @@ public: NetconfProcess(const char* name, const asiolink::IOServicePtr& io_service); /// @brief Destructor - virtual ~NetconfProcess(); + virtual ~NetconfProcess() = default; /// @brief Initialize the Netconf process. /// diff --git a/src/bin/netconf/parser_context.cc b/src/bin/netconf/parser_context.cc index 24fc650407..06963e8379 100644 --- a/src/bin/netconf/parser_context.cc +++ b/src/bin/netconf/parser_context.cc @@ -18,17 +18,11 @@ namespace isc { namespace netconf { ParserContext::ParserContext() - : sfile_(0), ctx_(NO_KEYWORDS), trace_scanning_(false), trace_parsing_(false) -{ -} - -ParserContext::~ParserContext() -{ + : sfile_(0), ctx_(NO_KEYWORDS), trace_scanning_(false), trace_parsing_(false) { } isc::data::ElementPtr -ParserContext::parseString(const std::string& str, ParserType parser_type) -{ +ParserContext::parseString(const std::string& str, ParserType parser_type) { scanStringBegin(str, parser_type); return (parseCommon()); } @@ -71,8 +65,7 @@ ParserContext::parseCommon() { void ParserContext::error(const isc::netconf::location& loc, const std::string& what, - size_t pos) -{ + size_t pos) { if (pos == 0) { isc_throw(ParseError, loc << ": " << what); } else { @@ -81,20 +74,17 @@ ParserContext::error(const isc::netconf::location& loc, } void -ParserContext::error(const std::string& what) -{ +ParserContext::error(const std::string& what) { isc_throw(ParseError, what); } void -ParserContext::fatal(const std::string& what) -{ +ParserContext::fatal(const std::string& what) { isc_throw(ParseError, what); } isc::data::Element::Position -ParserContext::loc2pos(isc::netconf::location& loc) -{ +ParserContext::loc2pos(isc::netconf::location& loc) { const std::string& file = *loc.begin.filename; const uint32_t line = loc.begin.line; const uint32_t pos = loc.begin.column; @@ -104,8 +94,7 @@ ParserContext::loc2pos(isc::netconf::location& loc) void ParserContext::require(const std::string& name, isc::data::Element::Position open_loc, - isc::data::Element::Position close_loc) -{ + isc::data::Element::Position close_loc) { ConstElementPtr value = stack_.back()->get(name); if (!value) { isc_throw(ParseError, @@ -118,8 +107,7 @@ ParserContext::require(const std::string& name, void ParserContext::unique(const std::string& name, - isc::data::Element::Position loc) -{ + isc::data::Element::Position loc) { ConstElementPtr value = stack_.back()->get(name); if (value) { if (ctx_ != NO_KEYWORDS) { @@ -135,15 +123,13 @@ ParserContext::unique(const std::string& name, } void -ParserContext::enter(const LexerContext& ctx) -{ +ParserContext::enter(const LexerContext& ctx) { cstack_.push_back(ctx_); ctx_ = ctx; } void -ParserContext::leave() -{ +ParserContext::leave() { if (cstack_.empty()) { fatal("unbalanced syntactic context"); } @@ -152,8 +138,7 @@ ParserContext::leave() } const std::string -ParserContext::contextName() -{ +ParserContext::contextName() { switch (ctx_) { case NO_KEYWORDS: return ("__no keywords__"); diff --git a/src/bin/netconf/parser_context.h b/src/bin/netconf/parser_context.h index 22be5d0f63..f6103a4e7d 100644 --- a/src/bin/netconf/parser_context.h +++ b/src/bin/netconf/parser_context.h @@ -61,7 +61,7 @@ public: ParserContext(); /// @brief destructor - virtual ~ParserContext(); + virtual ~ParserContext() = default; /// @brief JSON elements being parsed. std::vector stack_; diff --git a/src/bin/netconf/stdout_control_socket.cc b/src/bin/netconf/stdout_control_socket.cc index 382c391c5c..e506bdb75d 100644 --- a/src/bin/netconf/stdout_control_socket.cc +++ b/src/bin/netconf/stdout_control_socket.cc @@ -33,9 +33,6 @@ StdoutControlSocket::StdoutControlSocket(CfgControlSocketPtr ctrl_sock, : ControlSocketBase(ctrl_sock), output_(output) { } -StdoutControlSocket::~StdoutControlSocket() { -} - ConstElementPtr StdoutControlSocket::configGet(const string& /*service*/) { isc_throw(NotImplemented, "No config-get for stdout control socket"); diff --git a/src/bin/netconf/stdout_control_socket.h b/src/bin/netconf/stdout_control_socket.h index 9b0d1f343d..017a68086b 100644 --- a/src/bin/netconf/stdout_control_socket.h +++ b/src/bin/netconf/stdout_control_socket.h @@ -32,7 +32,7 @@ public: StdoutControlSocket(CfgControlSocketPtr ctrl_sock); /// @brief Destructor (does nothing). - virtual ~StdoutControlSocket(); + virtual ~StdoutControlSocket() = default; /// @brief Get configuration. /// diff --git a/src/bin/netconf/tests/control_socket_unittests.cc b/src/bin/netconf/tests/control_socket_unittests.cc index 9e7700a111..eb2a0e25c0 100644 --- a/src/bin/netconf/tests/control_socket_unittests.cc +++ b/src/bin/netconf/tests/control_socket_unittests.cc @@ -54,8 +54,7 @@ public: } /// @brief Destructor. - virtual ~TestStdoutControlSocket() { - } + virtual ~TestStdoutControlSocket() = default; }; /// @brief Type definition for the pointer to the @c TestStdoutControlSocket. @@ -146,15 +145,18 @@ public: /// @brief Destructor. virtual ~UnixControlSocketTest() { - if (thread_) { - thread_->join(); - thread_.reset(); + try { + if (thread_) { + thread_->join(); + thread_.reset(); + } + // io_service must be stopped after the thread returns, + // otherwise the thread may never return if it is + // waiting for the completion of some asynchronous tasks. + io_service_.stop(); + removeUnixSocketFile(); + } catch (...) { } - // io_service must be stopped after the thread returns, - // otherwise the thread may never return if it is - // waiting for the completion of some asynchronous tasks. - io_service_.stop(); - removeUnixSocketFile(); } /// @brief Returns socket file path. @@ -504,20 +506,23 @@ public: /// @brief Test fixture class for http control sockets. class HttpControlSocketTest : public ThreadedTest { public: - HttpControlSocketTest() - : ThreadedTest(), io_service_() { + /// @brief Constructor. + HttpControlSocketTest() : ThreadedTest(), done_(false) { } /// @brief Destructor. virtual ~HttpControlSocketTest() { - if (thread_) { - thread_->join(); - thread_.reset(); + try { + if (thread_) { + thread_->join(); + thread_.reset(); + } + // io_service must be stopped after the thread returns, + // otherwise the thread may never return if it is + // waiting for the completion of some asynchronous tasks. + io_service_.stop(); + } catch (...) { } - // io_service must be stopped after the thread returns, - // otherwise the thread may never return if it is - // waiting for the completion of some asynchronous tasks. - io_service_.stop(); } /// @brief Returns socket URL. @@ -600,9 +605,6 @@ public: /// @brief Done flag (stopping thread). bool done_; - - /// @brief Finished flag (stopped thread). - bool finished_; }; /// @brief Create the reflecting listener. diff --git a/src/bin/netconf/tests/get_config_unittest.cc b/src/bin/netconf/tests/get_config_unittest.cc index 77dd2ab6cd..07fb601346 100644 --- a/src/bin/netconf/tests/get_config_unittest.cc +++ b/src/bin/netconf/tests/get_config_unittest.cc @@ -120,6 +120,7 @@ public: /// Test fixture class class NetconfGetCfgTest : public ConfigParseTest { public: + /// @brief Constructor NetconfGetCfgTest() : rcode_(-1) { srv_.reset(new NakedNetconfCfgMgr()); @@ -127,8 +128,12 @@ public: resetConfiguration(); } + /// @brief Destructor ~NetconfGetCfgTest() { - resetConfiguration(); + try { + resetConfiguration(); + } catch (...) { + } } /// @brief Parse and Execute configuration diff --git a/src/bin/netconf/tests/netconf_process_unittests.cc b/src/bin/netconf/tests/netconf_process_unittests.cc index c16b7e7233..4d82c59174 100644 --- a/src/bin/netconf/tests/netconf_process_unittests.cc +++ b/src/bin/netconf/tests/netconf_process_unittests.cc @@ -33,8 +33,7 @@ public: } /// @brief Destructor - virtual ~NetconfProcessTest() { - } + virtual ~NetconfProcessTest() = default; /// @brief Callback that will invoke shutdown method. void genShutdownCallback() { diff --git a/src/bin/netconf/tests/netconf_unittests.cc b/src/bin/netconf/tests/netconf_unittests.cc index 49bab08349..711a0b038f 100644 --- a/src/bin/netconf/tests/netconf_unittests.cc +++ b/src/bin/netconf/tests/netconf_unittests.cc @@ -52,12 +52,10 @@ typedef boost::shared_ptr ThreadPtr; class NakedNetconfAgent : public NetconfAgent { public: /// @brief Constructor. - NakedNetconfAgent() { - } + NakedNetconfAgent() = default; /// @brief Destructor. - virtual ~NakedNetconfAgent() { - } + virtual ~NakedNetconfAgent() = default; /// Export protected methods and fields. using NetconfAgent::keaConfig; @@ -105,24 +103,27 @@ public: /// @brief Destructor. virtual ~NetconfAgentTest() { - NetconfProcess::shut_down = true; - if (thread_) { - thread_->join(); - thread_.reset(); - } - // io_service must be stopped after the thread returns, - // otherwise the thread may never return if it is - // waiting for the completion of some asynchronous tasks. - io_service_->stop(); - io_service_.reset(); - if (agent_) { - clearYang(agent_); - agent_->clear(); + try { + NetconfProcess::shut_down = true; + if (thread_) { + thread_->join(); + thread_.reset(); + } + // io_service must be stopped after the thread returns, + // otherwise the thread may never return if it is + // waiting for the completion of some asynchronous tasks. + io_service_->stop(); + io_service_.reset(); + if (agent_) { + clearYang(agent_); + agent_->clear(); + } + agent_.reset(); + requests_.clear(); + responses_.clear(); + removeUnixSocketFile(); + } catch (...) { } - agent_.reset(); - requests_.clear(); - responses_.clear(); - removeUnixSocketFile(); } /// @brief Returns socket file path. @@ -186,19 +187,22 @@ public: /// @brief Destructor. virtual ~NetconfAgentLogTest() { - NetconfProcess::shut_down = true; - // io_service must be stopped to make the thread to return. - io_service_->stop(); - io_service_.reset(); - if (thread_) { - thread_->join(); - thread_.reset(); - } - if (agent_) { - clearYang(agent_); - agent_->clear(); + try { + NetconfProcess::shut_down = true; + // io_service must be stopped to make the thread to return. + io_service_->stop(); + io_service_.reset(); + if (thread_) { + thread_->join(); + thread_.reset(); + } + if (agent_) { + clearYang(agent_); + agent_->clear(); + } + agent_.reset(); + } catch (...) { } - agent_.reset(); } /// @brief IOService object. diff --git a/src/bin/netconf/unix_control_socket.cc b/src/bin/netconf/unix_control_socket.cc index 93a807eb1d..c4aabafdee 100644 --- a/src/bin/netconf/unix_control_socket.cc +++ b/src/bin/netconf/unix_control_socket.cc @@ -34,9 +34,6 @@ UnixControlSocket::UnixControlSocket(CfgControlSocketPtr ctrl_sock) : ControlSocketBase(ctrl_sock) { } -UnixControlSocket::~UnixControlSocket() { -} - ConstElementPtr UnixControlSocket::configGet(const string& /*service*/) { return (sendCommand(createCommand("config-get"))); diff --git a/src/bin/netconf/unix_control_socket.h b/src/bin/netconf/unix_control_socket.h index 09fe7c1e99..e0c2b17fde 100644 --- a/src/bin/netconf/unix_control_socket.h +++ b/src/bin/netconf/unix_control_socket.h @@ -29,7 +29,7 @@ public: UnixControlSocket(CfgControlSocketPtr ctrl_sock); /// @brief Destructor (does nothing). - virtual ~UnixControlSocket(); + virtual ~UnixControlSocket() = default; /// @brief Get configuration. /// diff --git a/src/bin/perfdhcp/abstract_scen.h b/src/bin/perfdhcp/abstract_scen.h index 99f64041b2..1951915ea0 100644 --- a/src/bin/perfdhcp/abstract_scen.h +++ b/src/bin/perfdhcp/abstract_scen.h @@ -45,7 +45,7 @@ public: virtual int run() = 0; /// \brief Trivial virtual destructor. - virtual ~AbstractScen() {}; + virtual ~AbstractScen() = default; protected: CommandOptions& options_; ///< Reference to commandline options. diff --git a/src/bin/perfdhcp/perf_socket.cc b/src/bin/perfdhcp/perf_socket.cc index aa67796a1d..2aecbf491c 100644 --- a/src/bin/perfdhcp/perf_socket.cc +++ b/src/bin/perfdhcp/perf_socket.cc @@ -25,7 +25,6 @@ PerfSocket::PerfSocket(CommandOptions& options) { initSocketData(); } - int PerfSocket::openSocket(CommandOptions& options) const { std::string localname = options.getLocalName(); @@ -126,9 +125,12 @@ PerfSocket::openSocket(CommandOptions& options) const { } PerfSocket::~PerfSocket() { - IfacePtr iface = IfaceMgr::instance().getIface(ifindex_); - if (iface) { - iface->delSocket(sockfd_); + try { + IfacePtr iface = IfaceMgr::instance().getIface(ifindex_); + if (iface) { + iface->delSocket(sockfd_); + } + } catch (...) { } } diff --git a/src/bin/perfdhcp/receiver.cc b/src/bin/perfdhcp/receiver.cc index 2bad426891..64e54b45f0 100644 --- a/src/bin/perfdhcp/receiver.cc +++ b/src/bin/perfdhcp/receiver.cc @@ -47,10 +47,13 @@ Receiver::stop() { } Receiver::~Receiver() { - if (single_threaded_) { - return; + try { + if (single_threaded_) { + return; + } + stop(); + } catch (...) { } - stop(); } diff --git a/src/bin/perfdhcp/receiver.h b/src/bin/perfdhcp/receiver.h index 2270948509..3b704125ee 100644 --- a/src/bin/perfdhcp/receiver.h +++ b/src/bin/perfdhcp/receiver.h @@ -53,7 +53,7 @@ private: uint8_t ip_version_; public: - /// \brief Receiver constructor. + /// \brief Constructor. /// /// \param socket A socket for receiving packets. /// \param single_threaded A flag indicating running mode. diff --git a/src/bin/perfdhcp/test_control.h b/src/bin/perfdhcp/test_control.h index e6a4c24432..2e2d3fc471 100644 --- a/src/bin/perfdhcp/test_control.h +++ b/src/bin/perfdhcp/test_control.h @@ -140,9 +140,11 @@ public: /// (e.g. sequential or based on random function). class NumberGenerator { public: + /// \brief Constructor. + NumberGenerator() = default; /// \brief Destructor. - virtual ~NumberGenerator() { } + virtual ~NumberGenerator() = default; /// \brief Generate number. /// diff --git a/src/bin/perfdhcp/tests/command_options_helper.h b/src/bin/perfdhcp/tests/command_options_helper.h index dd8e5127b5..aad4374ffb 100644 --- a/src/bin/perfdhcp/tests/command_options_helper.h +++ b/src/bin/perfdhcp/tests/command_options_helper.h @@ -45,30 +45,38 @@ public: /// /// \param argv array of C-strings. /// \param number of C-strings in the array. - ArgvPtr(char** argv, int argc) : argv_(argv), argc_(argc) { } + ArgvPtr(char** argv, int argc) : argv_(argv), argc_(argc) { + } /// \brief Destructor. /// /// Deallocates wrapped array of C-strings. ~ArgvPtr() { - if (argv_ != NULL) { - for(int i = 0; i < argc_; ++i) { - delete[] (argv_[i]); - argv_[i] = NULL; + try { + if (argv_ != NULL) { + for(int i = 0; i < argc_; ++i) { + delete[] (argv_[i]); + argv_[i] = NULL; + } + delete[] (argv_); } - delete[] (argv_); + } catch (...) { } } /// \brief Return the array of C-strings. /// /// \return array of C-strings. - char** getArgv() const { return (argv_); } + char** getArgv() const { + return (argv_); + } /// \brief Return C-strings counter. /// /// \return C-strings counter. - int getArgc() const { return(argc_); } + int getArgc() const { + return (argc_); + } public: char** argv_; ///< array of C-strings being wrapped. diff --git a/src/hooks/dhcp/bootp/tests/bootp_unittests.cc b/src/hooks/dhcp/bootp/tests/bootp_unittests.cc index 70327ea521..812fe2d759 100644 --- a/src/hooks/dhcp/bootp/tests/bootp_unittests.cc +++ b/src/hooks/dhcp/bootp/tests/bootp_unittests.cc @@ -40,8 +40,7 @@ public: } /// @brief Destructor. - virtual ~BootpTest() { - } + virtual ~BootpTest() = default; /// @brief Fetches the callout manager instance. boost::shared_ptrgetCalloutManager() { diff --git a/src/hooks/dhcp/flex_option/flex_option.cc b/src/hooks/dhcp/flex_option/flex_option.cc index a4835b4482..02d98c7fa5 100644 --- a/src/hooks/dhcp/flex_option/flex_option.cc +++ b/src/hooks/dhcp/flex_option/flex_option.cc @@ -79,14 +79,11 @@ FlexOptionImpl::OptionConfig::OptionConfig(uint16_t code, : code_(code), def_(def), action_(NONE) { } -FlexOptionImpl::OptionConfig::~OptionConfig() { -} - -FlexOptionImpl::FlexOptionImpl() { -} - FlexOptionImpl::~FlexOptionImpl() { - option_config_map_.clear(); + try { + option_config_map_.clear(); + } catch (...) { + } } void diff --git a/src/hooks/dhcp/flex_option/flex_option.h b/src/hooks/dhcp/flex_option/flex_option.h index fd028189c5..b59e1c769f 100644 --- a/src/hooks/dhcp/flex_option/flex_option.h +++ b/src/hooks/dhcp/flex_option/flex_option.h @@ -59,7 +59,7 @@ public: OptionConfig(uint16_t code, isc::dhcp::OptionDefinitionPtr def); /// @brief Destructor. - virtual ~OptionConfig(); + virtual ~OptionConfig() = default; /// @brief Return option code. /// @@ -142,7 +142,7 @@ public: typedef std::map OptionConfigMap; /// @brief Constructor. - FlexOptionImpl(); + FlexOptionImpl() = default; /// @brief Destructor. ~FlexOptionImpl(); diff --git a/src/hooks/dhcp/flex_option/libloadtests/callout_unittests.cc b/src/hooks/dhcp/flex_option/libloadtests/callout_unittests.cc index db1cb67ffe..02c233b3e6 100644 --- a/src/hooks/dhcp/flex_option/libloadtests/callout_unittests.cc +++ b/src/hooks/dhcp/flex_option/libloadtests/callout_unittests.cc @@ -61,7 +61,10 @@ public: /// @brief Destructor /// Removes files that may be left over from previous tests virtual ~CalloutTest() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief Removes files that may be left over from previous tests diff --git a/src/hooks/dhcp/flex_option/libloadtests/load_unload_unittests.cc b/src/hooks/dhcp/flex_option/libloadtests/load_unload_unittests.cc index d9a386a9bd..8157d01689 100644 --- a/src/hooks/dhcp/flex_option/libloadtests/load_unload_unittests.cc +++ b/src/hooks/dhcp/flex_option/libloadtests/load_unload_unittests.cc @@ -35,9 +35,13 @@ public: } /// @brief Destructor + /// /// Removes files that may be left over from previous tests virtual ~LibLoadTest() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief Removes files that may be left over from previous tests diff --git a/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc b/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc index c5fb04c1ec..57ccaca0d4 100644 --- a/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc +++ b/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc @@ -75,8 +75,10 @@ public: /// @brief Destructor. virtual ~FlexOptionTest() { - CfgMgr::instance().setFamily(AF_INET); - impl_.reset(); + try { + CfgMgr::instance().setFamily(AF_INET); + } catch (...) { + } } /// @brief Flex Option implementation. diff --git a/src/hooks/dhcp/high_availability/communication_state.cc b/src/hooks/dhcp/high_availability/communication_state.cc index 4c564c2491..ac5b58a172 100644 --- a/src/hooks/dhcp/high_availability/communication_state.cc +++ b/src/hooks/dhcp/high_availability/communication_state.cc @@ -63,7 +63,10 @@ CommunicationState::CommunicationState(const IOServicePtr& io_service, } CommunicationState::~CommunicationState() { - stopHeartbeat(); + try { + stopHeartbeat(); + } catch (...) { + } } void diff --git a/src/hooks/dhcp/high_availability/ha_impl.cc b/src/hooks/dhcp/high_availability/ha_impl.cc index eb5b5d219e..14b246d7d4 100644 --- a/src/hooks/dhcp/high_availability/ha_impl.cc +++ b/src/hooks/dhcp/high_availability/ha_impl.cc @@ -50,10 +50,13 @@ HAImpl::startService(const IOServicePtr& io_service, } HAImpl::~HAImpl() { - if (service_) { - // Shut down the services explicitly, we need finer control - // than relying on destruction order. - service_->stopClientAndListener(); + try { + if (service_) { + // Shut down the services explicitly, we need finer control + // than relying on destruction order. + service_->stopClientAndListener(); + } + } catch (...) { } } diff --git a/src/hooks/dhcp/high_availability/ha_service.cc b/src/hooks/dhcp/high_availability/ha_service.cc index 387d31b88a..1da7cc842b 100644 --- a/src/hooks/dhcp/high_availability/ha_service.cc +++ b/src/hooks/dhcp/high_availability/ha_service.cc @@ -106,10 +106,13 @@ HAService::HAService(const IOServicePtr& io_service, const NetworkStatePtr& netw } HAService::~HAService() { - // Stop client and/or listener. - stopClientAndListener(); + try { + // Stop client and/or listener. + stopClientAndListener(); - network_state_->reset(NetworkState::Origin::HA_COMMAND); + network_state_->reset(NetworkState::Origin::HA_COMMAND); + } catch (...) { + } } void diff --git a/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc b/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc index 1c122d12ad..4653026f06 100644 --- a/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc +++ b/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc @@ -101,15 +101,17 @@ TestHooks testHooks; class CloseHATest : public ::testing::Test { public: /// @brief Constructor - CloseHATest() { - } + CloseHATest() = default; /// @brief Destructor virtual ~CloseHATest() { - HooksManager::prepareUnloadLibraries(); - bool status = HooksManager::unloadLibraries(); - if (!status) { - cerr << "(fixture dtor) unloadLibraries failed" << endl; + try { + HooksManager::prepareUnloadLibraries(); + bool status = HooksManager::unloadLibraries(); + if (!status) { + cerr << "(fixture dtor) unloadLibraries failed" << endl; + } + } catch (...) { } } diff --git a/src/hooks/dhcp/high_availability/libloadtests/load_unload_unittests.cc b/src/hooks/dhcp/high_availability/libloadtests/load_unload_unittests.cc index 13b579f7d4..06aaecf2ed 100644 --- a/src/hooks/dhcp/high_availability/libloadtests/load_unload_unittests.cc +++ b/src/hooks/dhcp/high_availability/libloadtests/load_unload_unittests.cc @@ -40,7 +40,10 @@ public: /// @brief Destructor /// Removes files that may be left over from previous tests virtual ~LibLoadTest() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief Removes files that may be left over from previous tests diff --git a/src/hooks/dhcp/high_availability/tests/communication_state_unittest.cc b/src/hooks/dhcp/high_availability/tests/communication_state_unittest.cc index 12a8ff84b8..40dec39ee0 100644 --- a/src/hooks/dhcp/high_availability/tests/communication_state_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/communication_state_unittest.cc @@ -51,8 +51,11 @@ public: /// @brief Destructor. ~CommunicationStateTest() { - MultiThreadingMgr::instance().setMode(false); - io_service_->poll(); + try { + MultiThreadingMgr::instance().setMode(false); + io_service_->poll(); + } catch (...) { + } } /// @brief Verifies that the partner state is set and retrieved correctly. diff --git a/src/hooks/dhcp/high_availability/tests/ha_mt_unittest.cc b/src/hooks/dhcp/high_availability/tests/ha_mt_unittest.cc index 53f2c82d0a..0c9332f0aa 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_mt_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_mt_unittest.cc @@ -131,9 +131,12 @@ public: /// /// Stops all test servers. ~HAMtServiceTest() { - io_service_->get_io_service().reset(); - io_service_->poll(); - MultiThreadingMgr::instance().setMode(false); + try { + io_service_->get_io_service().reset(); + io_service_->poll(); + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief Callback function invoke upon test timeout. diff --git a/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc b/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc index 99588dd8cf..c85812d553 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc @@ -614,12 +614,15 @@ public: /// /// Stops all test servers. ~HAServiceTest() { - listener_->stop(); - listener2_->stop(); - listener3_->stop(); - io_service_->get_io_service().reset(); - io_service_->poll(); - MultiThreadingMgr::instance().setMode(false); + try { + listener_->stop(); + listener2_->stop(); + listener3_->stop(); + io_service_->get_io_service().reset(); + io_service_->poll(); + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief Callback function invoke upon test timeout. diff --git a/src/hooks/dhcp/high_availability/tests/ha_test.cc b/src/hooks/dhcp/high_availability/tests/ha_test.cc index 7dd35bbe33..1794fa6555 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_test.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_test.cc @@ -55,9 +55,6 @@ HATest::HATest() network_state_(new NetworkState(NetworkState::DHCPv4)) { } -HATest::~HATest() { -} - void HATest::startHAService() { if (HooksManager::calloutsPresent(Hooks.hooks_index_dhcp4_srv_configured_)) { diff --git a/src/hooks/dhcp/high_availability/tests/ha_test.h b/src/hooks/dhcp/high_availability/tests/ha_test.h index 8c244c8af1..22cddaf011 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_test.h +++ b/src/hooks/dhcp/high_availability/tests/ha_test.h @@ -84,7 +84,7 @@ public: HATest(); /// @brief Destructor. - virtual ~HATest(); + virtual ~HATest() = default; /// @brief Calls dhcp4_srv_configured callout to set IO service pointer. void startHAService(); diff --git a/src/hooks/dhcp/high_availability/tests/query_filter_unittest.cc b/src/hooks/dhcp/high_availability/tests/query_filter_unittest.cc index 2e162d4f56..33a2069046 100644 --- a/src/hooks/dhcp/high_availability/tests/query_filter_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/query_filter_unittest.cc @@ -39,7 +39,10 @@ public: /// @brief Destructor. ~QueryFilterTest() { - MultiThreadingMgr::instance().setMode(false); + try { + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief This test verifies that client identifier is used for load diff --git a/src/hooks/dhcp/lease_cmds/lease_parser.h b/src/hooks/dhcp/lease_cmds/lease_parser.h index 2220d49933..a84d426d0a 100644 --- a/src/hooks/dhcp/lease_cmds/lease_parser.h +++ b/src/hooks/dhcp/lease_cmds/lease_parser.h @@ -50,8 +50,11 @@ public: const isc::data::ConstElementPtr& lease_info, bool& force_create); - /// @brief virtual dtor (does nothing) - virtual ~Lease4Parser() {} + /// @brief Constructor + Lease4Parser() = default; + + /// @brief virtual Destructor (does nothing) + virtual ~Lease4Parser() = default; }; /// @brief Parser for Lease6 structure @@ -90,11 +93,14 @@ public: const isc::data::ConstElementPtr& lease_info, bool& force_create); - /// @brief virtual dtor (does nothing) - virtual ~Lease6Parser() {} + /// @brief Constructor + Lease6Parser() = default; + + /// @brief virtual Destructor (does nothing) + virtual ~Lease6Parser() = default; }; -}; // end of isc::dhcp namespace -}; // end of isc namespace +} // end of isc::dhcp namespace +} // end of isc namespace #endif diff --git a/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc b/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc index 71ad0e2088..a00768c4df 100644 --- a/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc +++ b/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc @@ -57,7 +57,10 @@ public: /// @brief Destructor /// Removes files that may be left over from previous tests virtual ~LibLoadTest() { - unloadLibs(); + try { + unloadLibs(); + } catch (...) { + } } /// @brief Adds library/parameters to list of libraries to be loaded @@ -285,13 +288,16 @@ public: /// /// Removes library (if any), destroys lease manager (if any). virtual ~LeaseCmdsTest() { - // destroys lease manager first because the other order triggers - // a clang/boost bug - LeaseMgrFactory::destroy(); - disableD2(); - unloadLibs(); - lmptr_ = 0; - StatsMgr::instance().removeAll(); + try { + // destroys lease manager first because the other order triggers + // a clang/boost bug + LeaseMgrFactory::destroy(); + disableD2(); + unloadLibs(); + lmptr_ = 0; + StatsMgr::instance().removeAll(); + } catch (...) { + } } /// @brief Initializes lease manager (and optionally populates it with a lease) diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc index 309291da94..bde14b4644 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc @@ -156,7 +156,7 @@ public: parameters); /// @brief Destructor. - ~MySqlConfigBackendDHCPv4Impl(); + ~MySqlConfigBackendDHCPv4Impl() = default; /// @brief Sends query to retrieve global parameter. /// @@ -3018,9 +3018,6 @@ MySqlConfigBackendDHCPv4Impl::MySqlConfigBackendDHCPv4Impl(const DatabaseConnect conn_.makeReconnectCtl(timer_name_); } -MySqlConfigBackendDHCPv4Impl::~MySqlConfigBackendDHCPv4Impl() { -} - MySqlConfigBackendDHCPv4::MySqlConfigBackendDHCPv4(const DatabaseConnection::ParameterMap& parameters) : impl_(new MySqlConfigBackendDHCPv4Impl(parameters)), base_impl_(impl_) { } diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc index 21036525f9..cfa397bcf8 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc @@ -164,7 +164,7 @@ public: parameters); /// @brief Destructor. - ~MySqlConfigBackendDHCPv6Impl(); + ~MySqlConfigBackendDHCPv6Impl() = default; /// @brief Sends query to retrieve global parameter. /// @@ -3491,9 +3491,6 @@ MySqlConfigBackendDHCPv6Impl::MySqlConfigBackendDHCPv6Impl(const DatabaseConnect conn_.makeReconnectCtl(timer_name_); } -MySqlConfigBackendDHCPv6Impl::~MySqlConfigBackendDHCPv6Impl() { -} - MySqlConfigBackendDHCPv6::MySqlConfigBackendDHCPv6(const DatabaseConnection::ParameterMap& parameters) : impl_(new MySqlConfigBackendDHCPv6Impl(parameters)), base_impl_(impl_) { } diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc index c9b596939a..8341765f36 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc @@ -41,7 +41,10 @@ ScopedAuditRevision::ScopedAuditRevision(MySqlConfigBackendImpl* impl, MySqlConfigBackendImpl:: ScopedAuditRevision::~ScopedAuditRevision() { - impl_->clearAuditRevision(); + try { + impl_->clearAuditRevision(); + } catch (...) { + } } MySqlConfigBackendImpl:: @@ -68,14 +71,17 @@ MySqlConfigBackendImpl(const DatabaseConnection::ParameterMap& parameters, } MySqlConfigBackendImpl::~MySqlConfigBackendImpl() { - // Free up the prepared statements, ignoring errors. (What would we do - // about them? We're destroying this object and are not really concerned - // with errors on a database connection that is about to go away.) - for (int i = 0; i < conn_.statements_.size(); ++i) { - if (conn_.statements_[i] != NULL) { - (void) mysql_stmt_close(conn_.statements_[i]); - conn_.statements_[i] = NULL; + try { + // Free up the prepared statements, ignoring errors. (What would we do + // about them? We're destroying this object and are not really concerned + // with errors on a database connection that is about to go away.) + for (int i = 0; i < conn_.statements_.size(); ++i) { + if (conn_.statements_[i] != NULL) { + (void) mysql_stmt_close(conn_.statements_[i]); + conn_.statements_[i] = NULL; + } } + } catch (...) { } } diff --git a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_mgr_unittest.cc b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_mgr_unittest.cc index fe94b556bc..f953832d62 100644 --- a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_mgr_unittest.cc +++ b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_mgr_unittest.cc @@ -35,11 +35,14 @@ public: /// @brief Destructor. virtual ~MySqlConfigBackendDHCPv4MgrTest() { - // Destroy the mgr. - ConfigBackendDHCPv4Mgr::destroy(); - - // If data wipe enabled, delete transient data otherwise destroy the schema. - destroyMySQLSchema(); + try { + // Destroy the mgr. + ConfigBackendDHCPv4Mgr::destroy(); + + // If data wipe enabled, delete transient data otherwise destroy the schema. + destroyMySQLSchema(); + } catch (...) { + } } }; diff --git a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc index 1a546e0725..4139ac59d3 100644 --- a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc +++ b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc @@ -110,9 +110,12 @@ public: /// @brief Destructor. virtual ~MySqlConfigBackendDHCPv4Test() { - cbptr_.reset(); - // If data wipe enabled, delete transient data otherwise destroy the schema. - destroyMySQLSchema(); + try { + cbptr_.reset(); + // If data wipe enabled, delete transient data otherwise destroy the schema. + destroyMySQLSchema(); + } catch (...) { + } } /// @brief Counts rows in a selected table in MySQL database. @@ -4164,6 +4167,7 @@ TEST_F(MySqlConfigBackendDHCPv4Test, multipleAuditEntries) { class MySqlConfigBackendDHCPv4DbLostCallbackTest : public ::testing::Test { public: + /// @brief Constructor MySqlConfigBackendDHCPv4DbLostCallbackTest() : db_lost_callback_called_(0), db_recovered_callback_called_(0), db_failed_callback_called_(0), @@ -4176,13 +4180,17 @@ public: isc::dhcp::CfgMgr::instance().clear(); } + /// @brief Destructor virtual ~MySqlConfigBackendDHCPv4DbLostCallbackTest() { - isc::db::DatabaseConnection::db_lost_callback_ = 0; - isc::db::DatabaseConnection::db_recovered_callback_ = 0; - isc::db::DatabaseConnection::db_failed_callback_ = 0; - isc::dhcp::MySqlConfigBackendImpl::setIOService(isc::asiolink::IOServicePtr()); - isc::dhcp::TimerMgr::instance()->unregisterTimers(); - isc::dhcp::CfgMgr::instance().clear(); + try { + isc::db::DatabaseConnection::db_lost_callback_ = 0; + isc::db::DatabaseConnection::db_recovered_callback_ = 0; + isc::db::DatabaseConnection::db_failed_callback_ = 0; + isc::dhcp::MySqlConfigBackendImpl::setIOService(isc::asiolink::IOServicePtr()); + isc::dhcp::TimerMgr::instance()->unregisterTimers(); + isc::dhcp::CfgMgr::instance().clear(); + } catch (...) { + } } /// @brief Prepares the class for a test. diff --git a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_mgr_unittest.cc b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_mgr_unittest.cc index fe1252f21c..15d8468542 100644 --- a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_mgr_unittest.cc +++ b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_mgr_unittest.cc @@ -35,11 +35,14 @@ public: /// @brief Destructor. virtual ~MySqlConfigBackendDHCPv6MgrTest() { - // Destroy the mgr. - ConfigBackendDHCPv6Mgr::destroy(); - - // If data wipe enabled, delete transient data otherwise destroy the schema. - destroyMySQLSchema(); + try { + // Destroy the mgr. + ConfigBackendDHCPv6Mgr::destroy(); + + // If data wipe enabled, delete transient data otherwise destroy the schema. + destroyMySQLSchema(); + } catch (...) { + } } }; diff --git a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc index d66f610669..b6a5e22282 100644 --- a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc +++ b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc @@ -109,9 +109,12 @@ public: /// @brief Destructor. virtual ~MySqlConfigBackendDHCPv6Test() { - cbptr_.reset(); - // If data wipe enabled, delete transient data otherwise destroy the schema. - destroyMySQLSchema(); + try { + cbptr_.reset(); + // If data wipe enabled, delete transient data otherwise destroy the schema. + destroyMySQLSchema(); + } catch (...) { + } } /// @brief Counts rows in a selected table in MySQL database. @@ -4339,6 +4342,7 @@ TEST_F(MySqlConfigBackendDHCPv6Test, multipleAuditEntries) { class MySqlConfigBackendDHCPv6DbLostCallbackTest : public ::testing::Test { public: + /// @brief Constructor MySqlConfigBackendDHCPv6DbLostCallbackTest() : db_lost_callback_called_(0), db_recovered_callback_called_(0), db_failed_callback_called_(0), @@ -4351,13 +4355,17 @@ public: isc::dhcp::CfgMgr::instance().clear(); } + /// @brief Destructor virtual ~MySqlConfigBackendDHCPv6DbLostCallbackTest() { - isc::db::DatabaseConnection::db_lost_callback_ = 0; - isc::db::DatabaseConnection::db_recovered_callback_ = 0; - isc::db::DatabaseConnection::db_failed_callback_ = 0; - isc::dhcp::MySqlConfigBackendImpl::setIOService(isc::asiolink::IOServicePtr()); - isc::dhcp::TimerMgr::instance()->unregisterTimers(); - isc::dhcp::CfgMgr::instance().clear(); + try { + isc::db::DatabaseConnection::db_lost_callback_ = 0; + isc::db::DatabaseConnection::db_recovered_callback_ = 0; + isc::db::DatabaseConnection::db_failed_callback_ = 0; + isc::dhcp::MySqlConfigBackendImpl::setIOService(isc::asiolink::IOServicePtr()); + isc::dhcp::TimerMgr::instance()->unregisterTimers(); + isc::dhcp::CfgMgr::instance().clear(); + } catch (...) { + } } /// @brief Prepares the class for a test. diff --git a/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc b/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc index b924b8ddf7..c89983674f 100644 --- a/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc +++ b/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc @@ -37,7 +37,10 @@ public: /// /// Removes files that may be left over from previous tests virtual ~LibLoadTest() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief Removes files that may be left over from previous tests diff --git a/src/hooks/dhcp/run_script/tests/run_script_unittests.cc b/src/hooks/dhcp/run_script/tests/run_script_unittests.cc index 06e1daf071..edbceab776 100644 --- a/src/hooks/dhcp/run_script/tests/run_script_unittests.cc +++ b/src/hooks/dhcp/run_script/tests/run_script_unittests.cc @@ -705,8 +705,11 @@ public: /// @brief Destructor. ~RunScriptTest() { - RunScriptImpl::setIOService(IOServicePtr()); - clearLogFile(); + try { + RunScriptImpl::setIOService(IOServicePtr()); + clearLogFile(); + } catch (...) { + } } /// @brief Clear the test file if it exists. diff --git a/src/hooks/dhcp/stat_cmds/tests/stat_cmds_unittest.cc b/src/hooks/dhcp/stat_cmds/tests/stat_cmds_unittest.cc index 58e5fcefa3..edd6dc0789 100644 --- a/src/hooks/dhcp/stat_cmds/tests/stat_cmds_unittest.cc +++ b/src/hooks/dhcp/stat_cmds/tests/stat_cmds_unittest.cc @@ -46,7 +46,10 @@ public: /// @brief Destructor /// Removes files that may be left over from previous tests virtual ~LibLoadTest() { - unloadLibs(); + try { + unloadLibs(); + } catch (...) { + } } /// @brief Adds library/parameters to list of libraries to be loaded @@ -337,11 +340,14 @@ public: /// /// Removes library (if any), destroys lease manager (if any). virtual ~StatCmdsTest() { - // destroys lease manager first because the other order triggers - // a clang/boost bug - LeaseMgrFactory::destroy(); - unloadLibs(); - lmptr_ = 0; + try { + // destroys lease manager first because the other order triggers + // a clang/boost bug + LeaseMgrFactory::destroy(); + unloadLibs(); + lmptr_ = 0; + } catch (...) { + } } /// @brief Initializes lease manager for v6 operation diff --git a/src/hooks/dhcp/user_chk/user.cc b/src/hooks/dhcp/user_chk/user.cc index 531a486d23..70416d8410 100644 --- a/src/hooks/dhcp/user_chk/user.cc +++ b/src/hooks/dhcp/user_chk/user.cc @@ -67,9 +67,6 @@ UserId::UserId(UserIdType id_type, const std::string & id_str) : id_ = addr_bytes; } -UserId::~UserId() { -} - const std::vector& UserId::getId() const { return (id_); @@ -164,9 +161,6 @@ User::User(UserId::UserIdType id_type, const std::string& id_str) : user_id_(id_type, id_str) { } -User::~User() { -} - const PropertyMap& User::getProperties() const { return (properties_); diff --git a/src/hooks/dhcp/user_chk/user.h b/src/hooks/dhcp/user_chk/user.h index 879c81580e..a50c11bc37 100644 --- a/src/hooks/dhcp/user_chk/user.h +++ b/src/hooks/dhcp/user_chk/user.h @@ -66,7 +66,7 @@ public: UserId(UserIdType id_type, const std::string& id_str); /// @brief Destructor. - ~UserId(); + ~UserId() = default; /// @brief Returns a const reference to the actual id value const std::vector& getId() const; @@ -181,7 +181,7 @@ public: User(UserId::UserIdType id_type, const std::string& id_str); /// @brief Destructor - ~User(); + ~User() = default; /// @brief Returns a reference to the map of properties. /// diff --git a/src/hooks/dhcp/user_chk/user_data_source.h b/src/hooks/dhcp/user_chk/user_data_source.h index c9a3571e66..109a0201b9 100644 --- a/src/hooks/dhcp/user_chk/user_data_source.h +++ b/src/hooks/dhcp/user_chk/user_data_source.h @@ -26,10 +26,10 @@ public: class UserDataSource { public: /// @brief Constructor. - UserDataSource() {}; + UserDataSource() = default; /// @brief Virtual Destructor. - virtual ~UserDataSource() {}; + virtual ~UserDataSource() = default; /// @brief Opens the data source. /// diff --git a/src/hooks/dhcp/user_chk/user_file.cc b/src/hooks/dhcp/user_chk/user_file.cc index 96cb6a0fc4..a94b04a2e3 100644 --- a/src/hooks/dhcp/user_chk/user_file.cc +++ b/src/hooks/dhcp/user_chk/user_file.cc @@ -22,9 +22,12 @@ UserFile::UserFile(const std::string& fname) : fname_(fname), file_() { } } -UserFile::~UserFile(){ - close(); -}; +UserFile::~UserFile() { + try { + close(); + } catch (...) { + } +} void UserFile::open() { diff --git a/src/hooks/dhcp/user_chk/user_registry.cc b/src/hooks/dhcp/user_chk/user_registry.cc index b0d3f3f641..a7ba924b31 100644 --- a/src/hooks/dhcp/user_chk/user_registry.cc +++ b/src/hooks/dhcp/user_chk/user_registry.cc @@ -11,12 +11,6 @@ namespace user_chk { -UserRegistry::UserRegistry() { -} - -UserRegistry::~UserRegistry(){ -} - void UserRegistry::addUser(UserPtr& user) { if (!user) { diff --git a/src/hooks/dhcp/user_chk/user_registry.h b/src/hooks/dhcp/user_chk/user_registry.h index d99c0c7262..358958e685 100644 --- a/src/hooks/dhcp/user_chk/user_registry.h +++ b/src/hooks/dhcp/user_chk/user_registry.h @@ -40,10 +40,10 @@ public: /// @brief Constructor /// /// Creates a new registry with an empty list of users and no data source. - UserRegistry(); + UserRegistry() = default; /// @brief Destructor - ~UserRegistry(); + ~UserRegistry() = default; /// @brief Adds a given user to the registry. /// diff --git a/src/lib/asiodns/io_fetch.h b/src/lib/asiodns/io_fetch.h index c6e909f286..4754e1d499 100644 --- a/src/lib/asiodns/io_fetch.h +++ b/src/lib/asiodns/io_fetch.h @@ -98,12 +98,10 @@ public: class Callback { public: /// \brief Default Constructor - Callback() - {} + Callback() = default; /// \brief Virtual Destructor - virtual ~Callback() - {} + virtual ~Callback() = default; /// \brief Callback method /// diff --git a/src/lib/asiolink/botan_boost_tls.cc b/src/lib/asiolink/botan_boost_tls.cc index 7d698cc73b..927e9da907 100644 --- a/src/lib/asiolink/botan_boost_tls.cc +++ b/src/lib/asiolink/botan_boost_tls.cc @@ -36,8 +36,7 @@ public: } // Destructor. - virtual ~KeaCredentialsManager() { - } + virtual ~KeaCredentialsManager() = default; // CA certificate stores. // nullptr means do not require or check peer certificate. @@ -150,8 +149,7 @@ public: } // Destructor. - virtual ~KeaPolicy() { - } + virtual ~KeaPolicy() = default; // Allowed signature methods in preference order. std::vector allowed_signature_methods() const override { @@ -202,8 +200,7 @@ public: } // Destructor. - virtual ~TlsContextImpl() { - } + virtual ~TlsContextImpl() = default; // Get the peer certificate requirement mode. virtual bool getCertRequired() const { @@ -286,9 +283,6 @@ public: std::unique_ptr context_; }; -TlsContext::~TlsContext() { -} - TlsContext::TlsContext(TlsRole role) : TlsContextBase(role), impl_(new TlsContextImpl()) { } diff --git a/src/lib/asiolink/botan_boost_tls.h b/src/lib/asiolink/botan_boost_tls.h index 9037ebc353..28ec9ba832 100644 --- a/src/lib/asiolink/botan_boost_tls.h +++ b/src/lib/asiolink/botan_boost_tls.h @@ -45,7 +45,7 @@ public: /// /// @note The destructor can't be defined here because a unique /// pointer to an incomplete type is used. - virtual ~TlsContext(); + virtual ~TlsContext() = default; /// @brief Create a fresh context. /// @@ -133,7 +133,7 @@ public: } /// @brief Destructor. - virtual ~TlsStream() { } + virtual ~TlsStream() = default; /// @brief TLS Handshake. /// diff --git a/src/lib/asiolink/botan_tls.h b/src/lib/asiolink/botan_tls.h index 1735cc757c..89c9965849 100644 --- a/src/lib/asiolink/botan_tls.h +++ b/src/lib/asiolink/botan_tls.h @@ -28,7 +28,7 @@ class TlsContext : public TlsContextBase { public: /// @brief Destructor. - virtual ~TlsContext() { } + virtual ~TlsContext() = default; /// @brief Create a fresh context. /// @@ -119,7 +119,7 @@ public: } /// @brief Destructor. - virtual ~TlsStream() { } + virtual ~TlsStream() = default; /// @brief TLS Handshake. virtual void handshake(Callback&) { diff --git a/src/lib/asiolink/common_tls.h b/src/lib/asiolink/common_tls.h index b119760ebf..6bf23e76d9 100644 --- a/src/lib/asiolink/common_tls.h +++ b/src/lib/asiolink/common_tls.h @@ -40,7 +40,7 @@ typedef boost::shared_ptr TlsContextPtr; class TlsContextBase : private boost::noncopyable { public: /// @brief Destructor. - virtual ~TlsContextBase() { } + virtual ~TlsContextBase() = default; /// @brief Create a fresh context. /// @@ -134,7 +134,7 @@ public: TlsStreamBase(IOService& service, TlsContextPtr context); /// @brief Destructor. - virtual ~TlsStreamBase() { } + virtual ~TlsStreamBase() = default; /// @brief Returns the role. TlsRole getRole() const { diff --git a/src/lib/asiolink/interval_timer.cc b/src/lib/asiolink/interval_timer.cc index 2cda9b0085..5d731606dd 100644 --- a/src/lib/asiolink/interval_timer.cc +++ b/src/lib/asiolink/interval_timer.cc @@ -106,7 +106,10 @@ IntervalTimerImpl::IntervalTimerImpl(IOService& io_service) : } IntervalTimerImpl::~IntervalTimerImpl() { - interval_ = INVALIDATED_INTERVAL; + try { + interval_ = INVALIDATED_INTERVAL; + } catch (...) { + } } void @@ -177,8 +180,11 @@ IntervalTimer::IntervalTimer(IOService& io_service) : } IntervalTimer::~IntervalTimer() { - // Cancel the timer to make sure cbfunc_() will not be called any more. - cancel(); + try { + // Cancel the timer to make sure cbfunc_() will not be called any more. + cancel(); + } catch (...) { + } } void diff --git a/src/lib/asiolink/io_acceptor.h b/src/lib/asiolink/io_acceptor.h index eab0d83022..56de45faf0 100644 --- a/src/lib/asiolink/io_acceptor.h +++ b/src/lib/asiolink/io_acceptor.h @@ -43,7 +43,7 @@ public: } /// @brief Destructor. - virtual ~IOAcceptor() { } + virtual ~IOAcceptor() = default; /// @brief Returns file descriptor of the underlying socket. virtual int getNative() const { diff --git a/src/lib/asiolink/io_asio_socket.h b/src/lib/asiolink/io_asio_socket.h index 29ca97f226..b3d6183576 100644 --- a/src/lib/asiolink/io_asio_socket.h +++ b/src/lib/asiolink/io_asio_socket.h @@ -103,10 +103,10 @@ protected: /// /// This is intentionally defined as \c protected as this base class /// should never be instantiated (except as part of a derived class). - IOAsioSocket() {} + IOAsioSocket() = default; public: /// The destructor. - virtual ~IOAsioSocket() {} + virtual ~IOAsioSocket() = default; //@} /// \brief Return the "native" representation of the socket. diff --git a/src/lib/asiolink/io_endpoint.h b/src/lib/asiolink/io_endpoint.h index 8421a305ee..ea926969a7 100644 --- a/src/lib/asiolink/io_endpoint.h +++ b/src/lib/asiolink/io_endpoint.h @@ -50,10 +50,10 @@ protected: /// /// This is intentionally defined as \c protected as this base class /// should never be instantiated (except as part of a derived class). - IOEndpoint() {} + IOEndpoint() = default; public: /// The destructor. - virtual ~IOEndpoint() {} + virtual ~IOEndpoint() = default; //@} /// \brief Returns the address of the endpoint. diff --git a/src/lib/asiolink/io_service.cc b/src/lib/asiolink/io_service.cc index aad5dc7070..449e27ac3b 100644 --- a/src/lib/asiolink/io_service.cc +++ b/src/lib/asiolink/io_service.cc @@ -48,10 +48,10 @@ public: IOServiceImpl() : io_service_(), work_(new boost::asio::io_service::work(io_service_)) { - }; + } /// \brief The destructor. - ~IOServiceImpl() {}; + ~IOServiceImpl() = default; //@} /// \brief Start the underlying event loop. @@ -60,7 +60,7 @@ public: /// the \c stop() method is called via some handler. void run() { io_service_.run(); - }; + } /// \brief Run the underlying event loop for a single event. /// @@ -69,7 +69,7 @@ public: /// it is run, it will block until one is.) void run_one() { io_service_.run_one(); - }; + } /// \brief Run the underlying event loop for a ready events. /// @@ -77,7 +77,7 @@ public: /// It will return immediately if there are no ready events. void poll() { io_service_.poll(); - }; + } /// \brief Stop the underlying event loop. /// @@ -130,9 +130,6 @@ private: IOService::IOService() : io_impl_(new IOServiceImpl()) { } -IOService::~IOService() { -} - void IOService::run() { io_impl_->run(); diff --git a/src/lib/asiolink/io_service.h b/src/lib/asiolink/io_service.h index 4bcedf1cb7..2dd7d318ef 100644 --- a/src/lib/asiolink/io_service.h +++ b/src/lib/asiolink/io_service.h @@ -43,8 +43,9 @@ private: public: /// \brief The constructor IOService(); + /// \brief The destructor. - ~IOService(); + ~IOService() = default; //@} /// \brief Start the underlying event loop. diff --git a/src/lib/asiolink/io_socket.h b/src/lib/asiolink/io_socket.h index 9c9cee16fd..6bd17c293f 100644 --- a/src/lib/asiolink/io_socket.h +++ b/src/lib/asiolink/io_socket.h @@ -59,10 +59,10 @@ protected: /// /// This is intentionally defined as \c protected as this base class /// should never be instantiated (except as part of a derived class). - IOSocket() {} + IOSocket() = default; public: /// The destructor. - virtual ~IOSocket() {} + virtual ~IOSocket() = default; //@} /// \brief Return the "native" representation of the socket. diff --git a/src/lib/asiolink/openssl_tls.h b/src/lib/asiolink/openssl_tls.h index e94b308862..a049ae7a57 100644 --- a/src/lib/asiolink/openssl_tls.h +++ b/src/lib/asiolink/openssl_tls.h @@ -37,7 +37,7 @@ class TlsContext : public TlsContextBase { public: /// @brief Destructor. - virtual ~TlsContext() { } + virtual ~TlsContext() = default; /// @brief Create a fresh context. /// @@ -133,7 +133,7 @@ public: } /// @brief Destructor. - virtual ~TlsStream() { } + virtual ~TlsStream() = default; /// @brief TLS Handshake. /// diff --git a/src/lib/asiolink/process_spawn.cc b/src/lib/asiolink/process_spawn.cc index 2b819183d3..d38c9ed6d6 100644 --- a/src/lib/asiolink/process_spawn.cc +++ b/src/lib/asiolink/process_spawn.cc @@ -228,10 +228,13 @@ ProcessSpawnImpl::ProcessSpawnImpl(IOServicePtr io_service, } ProcessSpawnImpl::~ProcessSpawnImpl() { - io_signal_set_->remove(SIGCHLD); - if (store_) { - lock_guard lk(mutex_); - process_collection_.erase(this); + try { + io_signal_set_->remove(SIGCHLD); + if (store_) { + lock_guard lk(mutex_); + process_collection_.erase(this); + } + } catch (...) { } } diff --git a/src/lib/asiolink/tcp_endpoint.h b/src/lib/asiolink/tcp_endpoint.h index 7cbb73b2ab..a5d47ed84a 100644 --- a/src/lib/asiolink/tcp_endpoint.h +++ b/src/lib/asiolink/tcp_endpoint.h @@ -65,11 +65,16 @@ public: /// \param asio_endpoint The ASIO representation of the TCP endpoint. TCPEndpoint(const boost::asio::ip::tcp::endpoint& asio_endpoint) : asio_endpoint_placeholder_(new boost::asio::ip::tcp::endpoint(asio_endpoint)), - asio_endpoint_(*asio_endpoint_placeholder_) - {} + asio_endpoint_(*asio_endpoint_placeholder_) { + } /// \brief The destructor. - virtual ~TCPEndpoint() { delete asio_endpoint_placeholder_; } + virtual ~TCPEndpoint() { + try { + delete asio_endpoint_placeholder_; + } catch (...) { + } + } //@} virtual IOAddress getAddress() const { diff --git a/src/lib/asiolink/tcp_socket.h b/src/lib/asiolink/tcp_socket.h index 72d98b3488..fcce11a7dd 100644 --- a/src/lib/asiolink/tcp_socket.h +++ b/src/lib/asiolink/tcp_socket.h @@ -71,7 +71,7 @@ public: TCPSocket(IOService& service); /// \brief Destructor - virtual ~TCPSocket(); + virtual ~TCPSocket() = default; /// \brief Return file descriptor of underlying socket virtual int getNative() const { @@ -263,15 +263,7 @@ TCPSocket::TCPSocket(boost::asio::ip::tcp::socket& socket) : template TCPSocket::TCPSocket(IOService& service) : socket_ptr_(new boost::asio::ip::tcp::socket(service.get_io_service())), - socket_(*socket_ptr_) -{ -} - -// Destructor. - -template -TCPSocket::~TCPSocket() -{ + socket_(*socket_ptr_) { } // Open the socket. diff --git a/src/lib/asiolink/tests/interval_timer_unittest.cc b/src/lib/asiolink/tests/interval_timer_unittest.cc index 95dfaf7f31..3510966263 100644 --- a/src/lib/asiolink/tests/interval_timer_unittest.cc +++ b/src/lib/asiolink/tests/interval_timer_unittest.cc @@ -24,28 +24,38 @@ using namespace isc::asiolink; // or not. class IntervalTimerTest : public ::testing::Test { protected: + /// @brief Constructor IntervalTimerTest() : - io_service_(), timer_called_(false), timer_cancel_success_(false) - {} - ~IntervalTimerTest() {} + io_service_(), timer_called_(false), timer_cancel_success_(false) { + } + + /// @brief Destructor + ~IntervalTimerTest() = default; + class TimerCallBack : public std::unary_function { public: - TimerCallBack(IntervalTimerTest* test_obj) : test_obj_(test_obj) {} + /// @brief Constructor + TimerCallBack(IntervalTimerTest* test_obj) : test_obj_(test_obj) { + } + void operator()() const { test_obj_->timer_called_ = true; test_obj_->io_service_.stop(); return; } + private: IntervalTimerTest* test_obj_; }; + class TimerCallBackCounter : public std::unary_function { public: + /// @brief Constructor TimerCallBackCounter(IntervalTimerTest* test_obj) : - test_obj_(test_obj) - { + test_obj_(test_obj) { counter_ = 0; } + void operator()() { ++counter_; return; @@ -54,14 +64,17 @@ protected: private: IntervalTimerTest* test_obj_; }; + class TimerCallBackCancelDeleter : public std::unary_function { public: + /// @brief Constructor TimerCallBackCancelDeleter(IntervalTimerTest* test_obj, IntervalTimer* timer, TimerCallBackCounter& counter) : test_obj_(test_obj), timer_(timer), counter_(counter), count_(0), - prev_counter_(-1) - {} + prev_counter_(-1) { + } + void operator()() { ++count_; if (count_ == 1) { @@ -89,11 +102,14 @@ protected: int count_; int prev_counter_; }; + class TimerCallBackCanceller { public: + /// @brief Constructor TimerCallBackCanceller(unsigned int& counter, IntervalTimer& itimer) : - counter_(counter), itimer_(itimer) - {} + counter_(counter), itimer_(itimer) { + } + void operator()() { ++counter_; itimer_.cancel(); @@ -102,12 +118,15 @@ protected: unsigned int& counter_; IntervalTimer& itimer_; }; + class TimerCallBackOverwriter : public std::unary_function { public: + /// @brief Constructor TimerCallBackOverwriter(IntervalTimerTest* test_obj, IntervalTimer& timer) - : test_obj_(test_obj), timer_(timer), count_(0) - {} + : test_obj_(test_obj), timer_(timer), count_(0) { + } + void operator()() { ++count_; if (count_ == 1) { @@ -128,11 +147,14 @@ protected: IntervalTimer& timer_; int count_; }; + class TimerCallBackAccumulator: public std::unary_function { public: + /// @brief Constructor TimerCallBackAccumulator(IntervalTimerTest* test_obj, int &counter) : test_obj_(test_obj), counter_(counter) { } + void operator()() { ++counter_; return; diff --git a/src/lib/asiolink/tests/io_service_signal_unittests.cc b/src/lib/asiolink/tests/io_service_signal_unittests.cc index 5f35359e64..a550eb9fc7 100644 --- a/src/lib/asiolink/tests/io_service_signal_unittests.cc +++ b/src/lib/asiolink/tests/io_service_signal_unittests.cc @@ -61,7 +61,7 @@ public: } /// @brief Destructor. - ~IOSignalTest() {} + ~IOSignalTest() = default; /// @brief Method used as the IOSignalSet handler. /// diff --git a/src/lib/asiolink/tests/process_spawn_unittest.cc b/src/lib/asiolink/tests/process_spawn_unittest.cc index 478fb92a60..514c459cdb 100644 --- a/src/lib/asiolink/tests/process_spawn_unittest.cc +++ b/src/lib/asiolink/tests/process_spawn_unittest.cc @@ -58,7 +58,7 @@ public: } /// @brief Destructor. - ~ProcessSpawnTest() {} + ~ProcessSpawnTest() = default; /// @brief Method used as the IOSignalSet handler. /// diff --git a/src/lib/asiolink/tests/tcp_acceptor_unittest.cc b/src/lib/asiolink/tests/tcp_acceptor_unittest.cc index d674146fd3..10f6ccb81f 100644 --- a/src/lib/asiolink/tests/tcp_acceptor_unittest.cc +++ b/src/lib/asiolink/tests/tcp_acceptor_unittest.cc @@ -71,7 +71,10 @@ public: /// /// Closes the underlying socket if it is open. ~TCPClient() { - close(); + try { + close(); + } catch (...) { + } } /// @brief Connect to the test server address and port. @@ -156,7 +159,10 @@ public: /// /// Closes socket. ~Acceptor() { - socket_.close(); + try { + socket_.close(); + } catch (...) { + } } /// @brief Asynchronous accept new connection. @@ -211,8 +217,7 @@ public: } /// @brief Destructor. - virtual ~TCPAcceptorTest() { - } + virtual ~TCPAcceptorTest() = default; /// @brief Specifies how many new connections are expected before the IO /// service is stopped. diff --git a/src/lib/asiolink/tests/tcp_socket_unittest.cc b/src/lib/asiolink/tests/tcp_socket_unittest.cc index 7531af6a8a..22585cc8c8 100644 --- a/src/lib/asiolink/tests/tcp_socket_unittest.cc +++ b/src/lib/asiolink/tests/tcp_socket_unittest.cc @@ -70,8 +70,8 @@ public: struct PrivateData { PrivateData() : error_code_(), length_(0), cumulative_(0), expected_(0), offset_(0), - name_(""), queued_(NONE), called_(NONE), data_(MIN_SIZE, 0) - {} + name_(""), queued_(NONE), called_(NONE), data_(MIN_SIZE, 0) { + } boost::system::error_code error_code_; ///< Completion error code size_t length_; ///< Bytes transferred in this I/O @@ -96,16 +96,14 @@ public: /// data. /// /// @param which Which of the two callback objects this is - TCPCallback(std::string which) : ptr_(new PrivateData()) - { + TCPCallback(std::string which) : ptr_(new PrivateData()) { ptr_->name_ = which; } /// @brief Destructor /// /// No code needed, destroying the shared pointer destroys the private data. - virtual ~TCPCallback() - {} + virtual ~TCPCallback() = default; /// @brief Client Callback Function /// @@ -115,8 +113,7 @@ public: /// @param ec I/O completion error code passed to callback function. /// @param length Number of bytes transferred void operator()(boost::system::error_code ec = boost::system::error_code(), - size_t length = 0) - { + size_t length = 0) { setCode(ec.value()); ptr_->called_ = ptr_->queued_; ptr_->length_ = length; diff --git a/src/lib/asiolink/tests/tls_acceptor_unittest.cc b/src/lib/asiolink/tests/tls_acceptor_unittest.cc index 06f06311a9..41c912f204 100644 --- a/src/lib/asiolink/tests/tls_acceptor_unittest.cc +++ b/src/lib/asiolink/tests/tls_acceptor_unittest.cc @@ -72,7 +72,10 @@ public: /// /// Closes the underlying socket if it is open. ~TLSClient() { - close(); + try { + close(); + } catch (...) { + } } /// @brief Connect to the test server address and port. @@ -161,7 +164,10 @@ public: /// /// Closes socket. ~Acceptor() { - socket_.close(); + try { + socket_.close(); + } catch (...) { + } } /// @brief Asynchronous accept new connection. @@ -216,8 +222,7 @@ public: } /// @brief Destructor. - virtual ~TLSAcceptorTest() { - } + virtual ~TLSAcceptorTest() = default; /// @brief Specifies how many new connections are expected before the IO /// service is stopped. diff --git a/src/lib/asiolink/tests/tls_socket_unittest.cc b/src/lib/asiolink/tests/tls_socket_unittest.cc index c2572c02d0..c20aebfe21 100644 --- a/src/lib/asiolink/tests/tls_socket_unittest.cc +++ b/src/lib/asiolink/tests/tls_socket_unittest.cc @@ -72,8 +72,8 @@ public: struct PrivateData { PrivateData() : error_code_(), length_(0), cumulative_(0), expected_(0), offset_(0), - name_(""), queued_(NONE), called_(NONE), data_(MIN_SIZE, 0) - {} + name_(""), queued_(NONE), called_(NONE), data_(MIN_SIZE, 0) { + } boost::system::error_code error_code_; ///< Completion error code size_t length_; ///< Bytes transferred in this I/O @@ -98,16 +98,14 @@ public: /// data. /// /// @param which Which of the two callback objects this is - TLSCallback(std::string which) : ptr_(new PrivateData()) - { + TLSCallback(std::string which) : ptr_(new PrivateData()) { ptr_->name_ = which; } /// @brief Destructor /// /// No code needed, destroying the shared pointer destroys the private data. - virtual ~TLSCallback() - {} + virtual ~TLSCallback() = default; /// @brief Client Callback Function /// @@ -117,8 +115,7 @@ public: /// @param ec I/O completion error code passed to callback function. /// @param length Number of bytes transferred void operator()(boost::system::error_code ec = boost::system::error_code(), - size_t length = 0) - { + size_t length = 0) { setCode(ec.value()); ptr_->called_ = ptr_->queued_; ptr_->length_ = length; diff --git a/src/lib/asiolink/tests/tls_unittest.cc b/src/lib/asiolink/tests/tls_unittest.cc index 8533f5ab37..c57ab1384b 100644 --- a/src/lib/asiolink/tests/tls_unittest.cc +++ b/src/lib/asiolink/tests/tls_unittest.cc @@ -49,10 +49,11 @@ public: /// @brief Constructor. /// /// @param role The TLS role client or server. - explicit TestTlsContext(TlsRole role) : TlsContext(role) { } + explicit TestTlsContext(TlsRole role) : TlsContext(role) { + } /// @brief Destructor. - virtual ~TestTlsContext() { } + virtual ~TestTlsContext() = default; /// @brief Make protected methods visible in tests. using TlsContext::setCertRequired; @@ -73,8 +74,7 @@ public: } /// @brief Destructor. - virtual ~State() { - } + virtual ~State() = default; /// @brief Called flag. /// @@ -103,8 +103,7 @@ public: } /// @brief Destructor. - virtual ~TestCallback() { - } + virtual ~TestCallback() = default; /// @brief Callback function (one argument). /// diff --git a/src/lib/asiolink/tests/udp_socket_unittest.cc b/src/lib/asiolink/tests/udp_socket_unittest.cc index 1fb96160ab..16e79c6312 100644 --- a/src/lib/asiolink/tests/udp_socket_unittest.cc +++ b/src/lib/asiolink/tests/udp_socket_unittest.cc @@ -57,8 +57,8 @@ public: struct PrivateData { PrivateData() : - error_code_(), length_(0), called_(false), name_("") - {} + error_code_(), length_(0), called_(false), name_("") { + } boost::system::error_code error_code_; ///< Completion error code size_t length_; ///< Number of bytes transferred @@ -78,16 +78,14 @@ public: /// data. /// /// \param which Which of the two callback objects this is - UDPCallback(const std::string& which) : ptr_(new PrivateData()) - { + UDPCallback(const std::string& which) : ptr_(new PrivateData()) { setName(which); } /// \brief Destructor /// /// No code needed, destroying the shared pointer destroys the private data. - virtual ~UDPCallback() - {} + virtual ~UDPCallback() = default; /// \brief Callback Function /// diff --git a/src/lib/asiolink/tests/unix_domain_socket_unittest.cc b/src/lib/asiolink/tests/unix_domain_socket_unittest.cc index a147e3bb8c..2b90636a2e 100644 --- a/src/lib/asiolink/tests/unix_domain_socket_unittest.cc +++ b/src/lib/asiolink/tests/unix_domain_socket_unittest.cc @@ -46,7 +46,10 @@ public: /// /// Removes unix socket descriptor after the test. virtual ~UnixDomainSocketTest() { - removeUnixSocketFile(); + try { + removeUnixSocketFile(); + } catch (...) { + } } /// @brief Returns socket file path. diff --git a/src/lib/asiolink/testutils/test_server_unix_socket.cc b/src/lib/asiolink/testutils/test_server_unix_socket.cc index 7f7007d018..702dde7e18 100644 --- a/src/lib/asiolink/testutils/test_server_unix_socket.cc +++ b/src/lib/asiolink/testutils/test_server_unix_socket.cc @@ -149,7 +149,10 @@ public: /// @brief Destructor. ~ConnectionPool() { - stopAll(); + try { + stopAll(); + } catch (...) { + } } /// @brief Creates new unix domain socket and returns it. @@ -237,7 +240,10 @@ TestServerUnixSocket::TestServerUnixSocket(IOService& io_service, } TestServerUnixSocket::~TestServerUnixSocket() { - server_acceptor_.close(); + try { + server_acceptor_.close(); + } catch (...) { + } } void diff --git a/src/lib/asiolink/testutils/timed_signal.h b/src/lib/asiolink/testutils/timed_signal.h index 3af545df38..7c5758e73f 100644 --- a/src/lib/asiolink/testutils/timed_signal.h +++ b/src/lib/asiolink/testutils/timed_signal.h @@ -47,7 +47,10 @@ public: /// @brief Destructor. ~TimedSignal() { - cancel(); + try { + cancel(); + } catch (...) { + } } /// @brief Callback for the TimeSignal's internal timer. diff --git a/src/lib/asiolink/tls_acceptor.h b/src/lib/asiolink/tls_acceptor.h index c5755592c0..75c2528f11 100644 --- a/src/lib/asiolink/tls_acceptor.h +++ b/src/lib/asiolink/tls_acceptor.h @@ -38,7 +38,7 @@ public: } /// @brief Destructor. - virtual ~TLSAcceptor() { } + virtual ~TLSAcceptor() = default; /// @brief Asynchronously accept new connection. /// diff --git a/src/lib/asiolink/tls_socket.h b/src/lib/asiolink/tls_socket.h index cdd2f78d0c..7b2bfbf01b 100644 --- a/src/lib/asiolink/tls_socket.h +++ b/src/lib/asiolink/tls_socket.h @@ -45,7 +45,7 @@ public: TLSSocket(IOService& service, TlsContextPtr context); /// @brief Destructor. - virtual ~TLSSocket() { } + virtual ~TLSSocket() = default; /// @brief Return file descriptor of underlying socket. virtual int getNative() const { diff --git a/src/lib/asiolink/udp_endpoint.h b/src/lib/asiolink/udp_endpoint.h index 894032b221..bf955546c6 100644 --- a/src/lib/asiolink/udp_endpoint.h +++ b/src/lib/asiolink/udp_endpoint.h @@ -65,11 +65,16 @@ public: /// \param asio_endpoint The ASIO representation of the TCP endpoint. UDPEndpoint(const boost::asio::ip::udp::endpoint& asio_endpoint) : asio_endpoint_placeholder_(new boost::asio::ip::udp::endpoint(asio_endpoint)), - asio_endpoint_(*asio_endpoint_placeholder_) - {} + asio_endpoint_(*asio_endpoint_placeholder_) { + } /// \brief The destructor. - virtual ~UDPEndpoint() { delete asio_endpoint_placeholder_; } + virtual ~UDPEndpoint() { + try { + delete asio_endpoint_placeholder_; + } catch (...) { + } + } //@} virtual IOAddress getAddress() const { diff --git a/src/lib/asiolink/udp_socket.h b/src/lib/asiolink/udp_socket.h index 66815ed018..c1d0b0fee8 100644 --- a/src/lib/asiolink/udp_socket.h +++ b/src/lib/asiolink/udp_socket.h @@ -59,7 +59,7 @@ public: UDPSocket(IOService& service); /// \brief Destructor - virtual ~UDPSocket(); + virtual ~UDPSocket() = default; /// \brief Return file descriptor of underlying socket virtual int getNative() const { @@ -174,15 +174,7 @@ UDPSocket::UDPSocket(boost::asio::ip::udp::socket& socket) : template UDPSocket::UDPSocket(IOService& service) : socket_ptr_(new boost::asio::ip::udp::socket(service.get_io_service())), - socket_(*socket_ptr_), isopen_(false) -{ -} - -// Destructor. - -template -UDPSocket::~UDPSocket() -{ + socket_(*socket_ptr_), isopen_(false) { } // Open the socket. diff --git a/src/lib/asiolink/unix_domain_socket.cc b/src/lib/asiolink/unix_domain_socket.cc index ca9e15ce30..5fdb996c41 100644 --- a/src/lib/asiolink/unix_domain_socket.cc +++ b/src/lib/asiolink/unix_domain_socket.cc @@ -33,7 +33,10 @@ public: /// /// Closes the socket. ~UnixDomainSocketImpl() { - close(); + try { + close(); + } catch (...) { + } } /// @brief Asynchronously connects to an endpoint. diff --git a/src/lib/cc/cfg_to_element.h b/src/lib/cc/cfg_to_element.h index 480dd1fa74..275e231626 100644 --- a/src/lib/cc/cfg_to_element.h +++ b/src/lib/cc/cfg_to_element.h @@ -28,7 +28,7 @@ namespace data { /// struct CfgToElement { /// Destructor - virtual ~CfgToElement() { } + virtual ~CfgToElement() = default; /// @brief Unparse a configuration object /// @@ -42,7 +42,7 @@ struct CfgToElement { virtual isc::data::ElementPtr toElement() const = 0; }; -}; // namespace isc::dhcp -}; // namespace isc +} // namespace isc::dhcp +} // namespace isc #endif // CFG_TO_ELEMENT_H diff --git a/src/lib/cc/data.h b/src/lib/cc/data.h index 4403b5179e..65989fd6ad 100644 --- a/src/lib/cc/data.h +++ b/src/lib/cc/data.h @@ -143,14 +143,14 @@ protected: : type_(t), position_(pos) { } - public: // any is a special type used in list specifications, specifying // that the elements can be of any type enum types { integer, real, boolean, null, string, list, map, any }; - // base class; make dtor virtual - virtual ~Element() {}; + + /// @brief Destructor. + virtual ~Element() = default; /// @return the type of this element int getType() const { return (type_); } diff --git a/src/lib/cc/tests/data_file_unittests.cc b/src/lib/cc/tests/data_file_unittests.cc index a7f1b8dcd7..1937d253dc 100644 --- a/src/lib/cc/tests/data_file_unittests.cc +++ b/src/lib/cc/tests/data_file_unittests.cc @@ -33,9 +33,15 @@ public: write_me.close(); } - /// destructor + /// @brief Constructor + DataFileTest() = default; + + /// @brief Destructor ~DataFileTest() { - static_cast(remove(TEMP_FILE)); + try { + static_cast(remove(TEMP_FILE)); + } catch (...) { + } } /// Name of the temporary file diff --git a/src/lib/config/base_command_mgr.h b/src/lib/config/base_command_mgr.h index 9cc5a7f987..e221660026 100644 --- a/src/lib/config/base_command_mgr.h +++ b/src/lib/config/base_command_mgr.h @@ -103,7 +103,7 @@ public: BaseCommandMgr(); /// @brief Destructor. - virtual ~BaseCommandMgr() { }; + virtual ~BaseCommandMgr() = default; /// @brief Triggers command processing. /// diff --git a/src/lib/config/cmd_http_listener.cc b/src/lib/config/cmd_http_listener.cc index 7063e17b4e..19b81738bb 100644 --- a/src/lib/config/cmd_http_listener.cc +++ b/src/lib/config/cmd_http_listener.cc @@ -33,7 +33,10 @@ CmdHttpListener::CmdHttpListener(const IOAddress& address, const uint16_t port, } CmdHttpListener::~CmdHttpListener() { - stop(); + try { + stop(); + } catch (...) { + } } void diff --git a/src/lib/config/command_mgr.cc b/src/lib/config/command_mgr.cc index 39cd471db7..2ce24ca129 100644 --- a/src/lib/config/command_mgr.cc +++ b/src/lib/config/command_mgr.cc @@ -90,7 +90,10 @@ public: /// /// Cancels timeout timer if one is scheduled. ~Connection() { - timeout_timer_.cancel(); + try { + timeout_timer_.cancel(); + } catch (...) { + } } /// @brief This method schedules timer or reschedules existing timer. diff --git a/src/lib/config/tests/client_connection_unittests.cc b/src/lib/config/tests/client_connection_unittests.cc index 3ecca82071..b112569a1c 100644 --- a/src/lib/config/tests/client_connection_unittests.cc +++ b/src/lib/config/tests/client_connection_unittests.cc @@ -43,7 +43,10 @@ public: /// /// Removes unix socket descriptor after the test. virtual ~ClientConnectionTest() { - removeUnixSocketFile(); + try { + removeUnixSocketFile(); + } catch (...) { + } } /// @brief Returns socket file path. diff --git a/src/lib/config/tests/cmd_http_listener_unittests.cc b/src/lib/config/tests/cmd_http_listener_unittests.cc index 32b4b5ecaf..5ea53264e5 100644 --- a/src/lib/config/tests/cmd_http_listener_unittests.cc +++ b/src/lib/config/tests/cmd_http_listener_unittests.cc @@ -70,19 +70,22 @@ public: /// /// Removes HTTP clients, unregisters commands, disables MT. virtual ~CmdHttpListenerTest() { - // Wipe out the listener. - listener_.reset(); + try { + // Wipe out the listener. + listener_.reset(); - // Destroy all remaining clients. - for (auto const& client : clients_) { - client->close(); - } + // Destroy all remaining clients. + for (auto const& client : clients_) { + client->close(); + } - // Deregisters commands. - config::CommandMgr::instance().deregisterAll(); + // Deregisters commands. + config::CommandMgr::instance().deregisterAll(); - // Disable multi-threading. - MultiThreadingMgr::instance().setMode(false); + // Disable multi-threading. + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief Constructs a complete HTTP POST given a request body. diff --git a/src/lib/config/tests/cmd_response_creator_unittests.cc b/src/lib/config/tests/cmd_response_creator_unittests.cc index d2126e5e88..e3dc55e0da 100644 --- a/src/lib/config/tests/cmd_response_creator_unittests.cc +++ b/src/lib/config/tests/cmd_response_creator_unittests.cc @@ -47,7 +47,10 @@ public: /// /// Removes registered commands from the command manager. virtual ~CmdResponseCreatorTest() { - config::CommandMgr::instance().deregisterAll(); + try { + config::CommandMgr::instance().deregisterAll(); + } catch (...) { + } } /// @brief SetUp function that wraps call to initCreator. diff --git a/src/lib/config/tests/command_mgr_unittests.cc b/src/lib/config/tests/command_mgr_unittests.cc index b607d3e414..82d1fb966b 100644 --- a/src/lib/config/tests/command_mgr_unittests.cc +++ b/src/lib/config/tests/command_mgr_unittests.cc @@ -52,9 +52,12 @@ public: /// Default destructor virtual ~CommandMgrTest() { - CommandMgr::instance().deregisterAll(); - CommandMgr::instance().closeCommandSocket(); - resetCalloutIndicators(); + try { + CommandMgr::instance().deregisterAll(); + CommandMgr::instance().closeCommandSocket(); + resetCalloutIndicators(); + } catch (...) { + } } /// @brief Returns socket path (using either hardcoded path or env variable) diff --git a/src/lib/config_backend/base_config_backend.h b/src/lib/config_backend/base_config_backend.h index 821a035509..5853afe0dd 100644 --- a/src/lib/config_backend/base_config_backend.h +++ b/src/lib/config_backend/base_config_backend.h @@ -35,7 +35,7 @@ class BaseConfigBackend { public: /// @brief Virtual destructor. - virtual ~BaseConfigBackend() { } + virtual ~BaseConfigBackend() = default; /// @brief Returns backend type in the textual format. /// diff --git a/src/lib/config_backend/base_config_backend_pool.h b/src/lib/config_backend/base_config_backend_pool.h index 1c836771a0..337adfd144 100644 --- a/src/lib/config_backend/base_config_backend_pool.h +++ b/src/lib/config_backend/base_config_backend_pool.h @@ -48,7 +48,7 @@ public: typedef boost::shared_ptr ConfigBackendTypePtr; /// @brief Virtual destructor. - virtual ~BaseConfigBackendPool() { } + virtual ~BaseConfigBackendPool() = default; /// @brief Adds a backend to the pool. /// diff --git a/src/lib/config_backend/tests/config_backend_mgr_unittest.cc b/src/lib/config_backend/tests/config_backend_mgr_unittest.cc index a635a3e1a6..375d210299 100644 --- a/src/lib/config_backend/tests/config_backend_mgr_unittest.cc +++ b/src/lib/config_backend/tests/config_backend_mgr_unittest.cc @@ -335,7 +335,10 @@ public: /// /// Removes backend instances. ~ConfigBackendMgrTest() { - config_mgr_.delAllBackends(); + try { + config_mgr_.delAllBackends(); + } catch (...) { + } } /// @brief Creates example database backend called "mysql". diff --git a/src/lib/cql/cql_connection.cc b/src/lib/cql/cql_connection.cc index e16a3fdc5d..a9cb4577b2 100644 --- a/src/lib/cql/cql_connection.cc +++ b/src/lib/cql/cql_connection.cc @@ -36,42 +36,45 @@ CqlConnection::CqlConnection(const ParameterMap& parameters) } CqlConnection::~CqlConnection() { - // Free up the prepared statements, ignoring errors. Session and connection - // resources are deallocated. - CassError rc = CASS_OK; - std::string error; - - // Let's free the prepared statements. - for (StatementMapEntry s : statements_) { - CqlTaggedStatement statement = s.second; - if (statement.prepared_statement_) { - cass_prepared_free(statement.prepared_statement_); + try { + // Free up the prepared statements, ignoring errors. Session and connection + // resources are deallocated. + CassError rc = CASS_OK; + std::string error; + + // Let's free the prepared statements. + for (StatementMapEntry s : statements_) { + CqlTaggedStatement statement = s.second; + if (statement.prepared_statement_) { + cass_prepared_free(statement.prepared_statement_); + } } - } - // If there's a session, tear it down and free the resources. - if (session_) { - cass_schema_meta_free(schema_meta_); - CassFuture* close_future = cass_session_close(session_); - cass_future_wait(close_future); - error = checkFutureError( - "CqlConnection::~CqlConnection(): cass_session_close() != CASS_OK", - close_future); - rc = cass_future_error_code(close_future); - cass_future_free(close_future); - cass_session_free(session_); - session_ = NULL; - } + // If there's a session, tear it down and free the resources. + if (session_) { + cass_schema_meta_free(schema_meta_); + CassFuture* close_future = cass_session_close(session_); + cass_future_wait(close_future); + error = checkFutureError( + "CqlConnection::~CqlConnection(): cass_session_close() != CASS_OK", + close_future); + rc = cass_future_error_code(close_future); + cass_future_free(close_future); + cass_session_free(session_); + session_ = NULL; + } - // Free the cluster if there's one. - if (cluster_) { - cass_cluster_free(cluster_); - cluster_ = NULL; - } + // Free the cluster if there's one. + if (cluster_) { + cass_cluster_free(cluster_); + cluster_ = NULL; + } - if (rc != CASS_OK) { - // We're closing the connection anyway. Let's not throw at this stage. - DB_LOG_ERROR(CQL_DEALLOC_ERROR).arg(error); + if (rc != CASS_OK) { + // We're closing the connection anyway. Let's not throw at this stage. + DB_LOG_ERROR(CQL_DEALLOC_ERROR).arg(error); + } + } catch (...) { } } diff --git a/src/lib/cql/cql_exchange.cc b/src/lib/cql/cql_exchange.cc index 1dd00c017a..6b3ba4274d 100644 --- a/src/lib/cql/cql_exchange.cc +++ b/src/lib/cql/cql_exchange.cc @@ -147,16 +147,6 @@ Udt::Udt(const CqlConnection& connection, const std::string& name) << " is not a UDT as expected. "); } } - -Udt::~Udt() { - /// @todo: Need to get back to this issue. This is likely a memory leak. - // - // Bug: it seems that if there is no call to - // cass_user_type_set_*(cass_user_type_), then - // cass_user_type_free(cass_user_type_) might SIGSEGV, so we never - // free. Udt objects should have application scope though. - // cass_user_type_free(cass_user_type_); -} /// @} /// @brief AnyArray method implementations @@ -733,12 +723,6 @@ CqlCommon::getData(const CassRow* row, AnyArray& data) { } } -CqlExchange::CqlExchange() { -} - -CqlExchange::~CqlExchange() { -} - void CqlExchange::convertToDatabaseTime(const time_t& cltt, const uint32_t& valid_lifetime, @@ -984,12 +968,6 @@ StatementMap CqlVersionExchange::tagged_statements_ = { {GET_VERSION, {GET_VERSION, "SELECT version, minor FROM schema_version "}} }; -CqlVersionExchange::CqlVersionExchange() { -} - -CqlVersionExchange::~CqlVersionExchange() { -} - void CqlVersionExchange::createBindForSelect(AnyArray& data, StatementTag) { data.clear(); // Start with a fresh array. diff --git a/src/lib/cql/cql_exchange.h b/src/lib/cql/cql_exchange.h index 5bf8d6962b..de8be58468 100644 --- a/src/lib/cql/cql_exchange.h +++ b/src/lib/cql/cql_exchange.h @@ -64,7 +64,15 @@ public: Udt(const CqlConnection& connection, const std::string& name); /// @brief Destructor - ~Udt(); + /// + /// @todo: Need to get back to this issue. This is likely a memory leak. + /// + /// Bug: it seems that if there is no call to + /// cass_user_type_set_*(cass_user_type_), then + /// cass_user_type_free(cass_user_type_) might SIGSEGV, so we never + /// free. Udt objects should have application scope though. + /// cass_user_type_free(cass_user_type_); + ~Udt() = default; /// @brief Frees the underlying container. void freeUserType(); @@ -144,10 +152,10 @@ public: /// @brief Constructor /// /// Empty body. Derived constructors specify table columns. - CqlExchange(); + CqlExchange() = default; /// @brief Destructor - virtual ~CqlExchange(); + virtual ~CqlExchange() = default; /// @name Time conversion: /// @{ @@ -238,10 +246,10 @@ public: /// @brief Constructor /// /// Specifies table columns. - CqlVersionExchange(); + CqlVersionExchange() = default; /// @brief Destructor - virtual ~CqlVersionExchange(); + virtual ~CqlVersionExchange() = default; /// @brief Create BIND array to receive C++ data. /// diff --git a/src/lib/cql/sql_common.h b/src/lib/cql/sql_common.h index a9e7e3865d..786fd1b9c7 100644 --- a/src/lib/cql/sql_common.h +++ b/src/lib/cql/sql_common.h @@ -42,12 +42,10 @@ enum ExchangeDataType { class SqlExchange { public: /// @brief Constructor - SqlExchange() { - } + SqlExchange() = default; /// @brief Destructor - virtual ~SqlExchange() { - } + virtual ~SqlExchange() = default; }; } // namespace db diff --git a/src/lib/cql/tests/cql_connection_unittest.cc b/src/lib/cql/tests/cql_connection_unittest.cc index 4d7a323c30..ebf06d4e82 100644 --- a/src/lib/cql/tests/cql_connection_unittest.cc +++ b/src/lib/cql/tests/cql_connection_unittest.cc @@ -28,12 +28,10 @@ using isc::db::CqlConnection; class CqlConnectionTest { public: /// @brief Constructor - CqlConnectionTest() { - } + CqlConnectionTest() = default; /// @brief Destructor - virtual ~CqlConnectionTest() { - } + virtual ~CqlConnectionTest() = default; }; /// @brief Check that the key is properly hashed for StatementMap. diff --git a/src/lib/cryptolink/botan_hash.cc b/src/lib/cryptolink/botan_hash.cc index 06dca6d05d..82546f3238 100644 --- a/src/lib/cryptolink/botan_hash.cc +++ b/src/lib/cryptolink/botan_hash.cc @@ -69,7 +69,7 @@ public: } /// @brief Destructor - ~HashImpl() { } + ~HashImpl() = default; /// @brief Returns the HashAlgorithm of the object HashAlgorithm getHashAlgorithm() const { @@ -156,13 +156,15 @@ private: boost::scoped_ptr hash_; }; -Hash::Hash(const HashAlgorithm hash_algorithm) -{ +Hash::Hash(const HashAlgorithm hash_algorithm) { impl_ = new HashImpl(hash_algorithm); } Hash::~Hash() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } HashAlgorithm diff --git a/src/lib/cryptolink/botan_hmac.cc b/src/lib/cryptolink/botan_hmac.cc index 88efb2efc0..70d7a04f5c 100644 --- a/src/lib/cryptolink/botan_hmac.cc +++ b/src/lib/cryptolink/botan_hmac.cc @@ -82,8 +82,7 @@ public: } /// @brief Destructor - ~HMACImpl() { - } + ~HMACImpl() = default; /// @brief Returns the HashAlgorithm of the object HashAlgorithm getHashAlgorithm() const { @@ -197,13 +196,15 @@ private: }; HMAC::HMAC(const void* secret, size_t secret_length, - const HashAlgorithm hash_algorithm) -{ + const HashAlgorithm hash_algorithm) { impl_ = new HMACImpl(secret, secret_length, hash_algorithm); } HMAC::~HMAC() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } HashAlgorithm diff --git a/src/lib/cryptolink/botan_link.cc b/src/lib/cryptolink/botan_link.cc index 714663d507..ee3d8355b2 100644 --- a/src/lib/cryptolink/botan_link.cc +++ b/src/lib/cryptolink/botan_link.cc @@ -24,7 +24,10 @@ class CryptoLinkImpl { }; CryptoLink::~CryptoLink() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } /// \brief Botan implementation of RNG. @@ -34,8 +37,7 @@ public: rng.reset(new Botan::AutoSeeded_RNG()); } - ~RNGImpl() { - } + ~RNGImpl() = default; private: std::vector random(size_t len) { diff --git a/src/lib/cryptolink/crypto_rng.cc b/src/lib/cryptolink/crypto_rng.cc index 54dacce408..8433a8843b 100644 --- a/src/lib/cryptolink/crypto_rng.cc +++ b/src/lib/cryptolink/crypto_rng.cc @@ -16,15 +16,8 @@ namespace isc { namespace cryptolink { -RNG::RNG() { -} - -RNG::~RNG() { -} - std::vector -random(size_t len) -{ +random(size_t len) { RNGPtr rng(CryptoLink::getCryptoLink().getRNG()); return (rng->random(len)); } diff --git a/src/lib/cryptolink/crypto_rng.h b/src/lib/cryptolink/crypto_rng.h index 916321e7ca..860ca1d0ac 100644 --- a/src/lib/cryptolink/crypto_rng.h +++ b/src/lib/cryptolink/crypto_rng.h @@ -25,10 +25,10 @@ public: /// /// \exception LibraryError if there was any unexpected exception /// in the underlying library - RNG(); + RNG() = default; /// \brief Destructor - virtual ~RNG(); + virtual ~RNG() = default; /// \brief Generate random value. /// diff --git a/src/lib/cryptolink/cryptolink.h b/src/lib/cryptolink/cryptolink.h index 41f1b620ff..0960c74630 100644 --- a/src/lib/cryptolink/cryptolink.h +++ b/src/lib/cryptolink/cryptolink.h @@ -227,9 +227,12 @@ private: // the 'real' instance getter is private static CryptoLink& getCryptoLinkInternal(); + /// @brief Constructor // To prevent people constructing their own, we make the constructor // private too. CryptoLink() : impl_(NULL) {} + + /// @brief Destructor ~CryptoLink(); CryptoLinkImpl* impl_; diff --git a/src/lib/cryptolink/openssl_common.h b/src/lib/cryptolink/openssl_common.h index 7e47e698f5..10082015f9 100644 --- a/src/lib/cryptolink/openssl_common.h +++ b/src/lib/cryptolink/openssl_common.h @@ -37,38 +37,41 @@ public: SecBuf(const std::vector& x) : vec_(x) {} ~SecBuf() { + try { #if defined(__has_feature) #if __has_feature(address_sanitizer) - // Make the address sanitizer happy assuming this won't reallocate - vec_.resize(vec_.capacity()); + // Make the address sanitizer happy assuming this won't reallocate + vec_.resize(vec_.capacity()); #endif #endif - std::memset(&vec_[0], 0, vec_.capacity() * sizeof(T)); - }; + std::memset(&vec_[0], 0, vec_.capacity() * sizeof(T)); + } catch (...) { + } + } iterator begin() { return (vec_.begin()); - }; + } const_iterator begin() const { return (vec_.begin()); - }; + } iterator end() { return (vec_.end()); - }; + } const_iterator end() const { return (vec_.end()); - }; + } size_t size() const { return (vec_.size()); - }; + } void resize(size_t sz) { vec_.resize(sz); - }; + } void clear() { #if defined(__has_feature) @@ -86,15 +89,15 @@ public: vec_ = x.vec_; } return (*this); - }; + } T& operator[](size_t n) { return (vec_[n]); - }; + } const T& operator[](size_t n) const { return (vec_[n]); - }; + } // constant time comparison against timing attacks // (same type than XXX::verify() so const void* (vs. const T*) x) @@ -104,7 +107,7 @@ public: for (size_t i = 0; i < len; ++i) ret = ret && (vec_[i] == p[i]); return ret; - }; + } private: std::vector vec_; diff --git a/src/lib/cryptolink/openssl_hash.cc b/src/lib/cryptolink/openssl_hash.cc index 68f2285e15..f0a635b4fb 100644 --- a/src/lib/cryptolink/openssl_hash.cc +++ b/src/lib/cryptolink/openssl_hash.cc @@ -73,10 +73,13 @@ public: /// @brief Destructor ~HashImpl() { - if (md_) { - EVP_MD_CTX_free(md_); + try { + if (md_) { + EVP_MD_CTX_free(md_); + } + md_ = 0; + } catch (...) { } - md_ = 0; } /// @brief Returns the HashAlgorithm of the object @@ -145,13 +148,15 @@ private: EVP_MD_CTX* md_; }; -Hash::Hash(const HashAlgorithm hash_algorithm) -{ +Hash::Hash(const HashAlgorithm hash_algorithm) { impl_ = new HashImpl(hash_algorithm); } Hash::~Hash() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } HashAlgorithm diff --git a/src/lib/cryptolink/openssl_hmac.cc b/src/lib/cryptolink/openssl_hmac.cc index 7d04685889..f24931de44 100644 --- a/src/lib/cryptolink/openssl_hmac.cc +++ b/src/lib/cryptolink/openssl_hmac.cc @@ -60,10 +60,13 @@ public: /// @brief Destructor ~HMACImpl() { - if (md_) { - HMAC_CTX_free(md_); + try { + if (md_) { + HMAC_CTX_free(md_); + } + md_ = 0; + } catch (...) { } - md_ = 0; } /// @brief Returns the HashAlgorithm of the object @@ -177,13 +180,15 @@ private: }; HMAC::HMAC(const void* secret, size_t secret_length, - const HashAlgorithm hash_algorithm) -{ + const HashAlgorithm hash_algorithm) { impl_ = new HMACImpl(secret, secret_length, hash_algorithm); } HMAC::~HMAC() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } HashAlgorithm diff --git a/src/lib/cryptolink/openssl_link.cc b/src/lib/cryptolink/openssl_link.cc index 1a573f7c41..c1eab33884 100644 --- a/src/lib/cryptolink/openssl_link.cc +++ b/src/lib/cryptolink/openssl_link.cc @@ -22,15 +22,20 @@ class CryptoLinkImpl { }; CryptoLink::~CryptoLink() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } /// \brief OpenSSL implementation of RNG. class RNGImpl : public RNG { public: - RNGImpl() { } + /// @brief Constructor + RNGImpl() = default; - ~RNGImpl() { } + /// @brief Destructor + ~RNGImpl() = default; private: std::vector random(size_t len) { diff --git a/src/lib/database/database_connection.h b/src/lib/database/database_connection.h index de25b5c91a..e80e11c252 100644 --- a/src/lib/database/database_connection.h +++ b/src/lib/database/database_connection.h @@ -243,7 +243,7 @@ public: } /// @brief Destructor - virtual ~DatabaseConnection(){}; + virtual ~DatabaseConnection() = default; /// @brief Instantiates a ReconnectCtl based on the connection's /// reconnect parameters diff --git a/src/lib/database/dbaccess_parser.cc b/src/lib/database/dbaccess_parser.cc index 5a0802aa6b..6a302dfc1b 100644 --- a/src/lib/database/dbaccess_parser.cc +++ b/src/lib/database/dbaccess_parser.cc @@ -22,12 +22,6 @@ using namespace isc::data; namespace isc { namespace db { - -// Factory function to build the parser -DbAccessParser::DbAccessParser() - : values_() { -} - // Parse the configuration and check that the various keywords are consistent. void DbAccessParser::parse(std::string& access_string, diff --git a/src/lib/database/dbaccess_parser.h b/src/lib/database/dbaccess_parser.h index ce0c9e2e88..d9d3fca635 100644 --- a/src/lib/database/dbaccess_parser.h +++ b/src/lib/database/dbaccess_parser.h @@ -25,11 +25,10 @@ namespace db { class DbAccessParser: public isc::data::SimpleParser { public: /// @brief Constructor - DbAccessParser(); + DbAccessParser() = default; - /// The destructor. - virtual ~DbAccessParser() - {} + /// @brief Destructor. + virtual ~DbAccessParser() = default; /// @brief Parse configuration value. /// diff --git a/src/lib/database/tests/database_connection_unittest.cc b/src/lib/database/tests/database_connection_unittest.cc index fcc8ef3fef..be5e6f14f9 100644 --- a/src/lib/database/tests/database_connection_unittest.cc +++ b/src/lib/database/tests/database_connection_unittest.cc @@ -31,9 +31,12 @@ public: /// Destructor ~DatabaseConnectionCallbackTest() { - DatabaseConnection::db_lost_callback_ = 0; - DatabaseConnection::db_recovered_callback_ = 0; - DatabaseConnection::db_failed_callback_ = 0; + try { + DatabaseConnection::db_lost_callback_ = 0; + DatabaseConnection::db_recovered_callback_ = 0; + DatabaseConnection::db_failed_callback_ = 0; + } catch (...) { + } } /// @brief Callback to register with a DatabaseConnection diff --git a/src/lib/database/tests/dbaccess_parser_unittest.cc b/src/lib/database/tests/dbaccess_parser_unittest.cc index dca15890f5..0ffed3171c 100644 --- a/src/lib/database/tests/dbaccess_parser_unittest.cc +++ b/src/lib/database/tests/dbaccess_parser_unittest.cc @@ -37,7 +37,10 @@ public: /// settings (when the parser's "parse" method is called), ensure that /// the logging is reset to the default after each test completes. ~DbAccessParserTest() { - isc::log::setDefaultLoggingOutput(); + try { + isc::log::setDefaultLoggingOutput(); + } catch (...) { + } } /// @brief Build JSON String @@ -184,13 +187,10 @@ class TestDbAccessParser : public DbAccessParser { public: /// @brief Constructor - TestDbAccessParser() - : DbAccessParser() - {} + TestDbAccessParser() = default; /// @brief Destructor - virtual ~TestDbAccessParser() - {} + virtual ~TestDbAccessParser() = default; /// @brief Parse configuration value /// diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc index 40e11635ab..475b1baf6c 100644 --- a/src/lib/dhcp/iface_mgr.cc +++ b/src/lib/dhcp/iface_mgr.cc @@ -312,7 +312,10 @@ void IfaceMgr::stopDHCPReceiver() { } IfaceMgr::~IfaceMgr() { - closeSockets(); + try { + closeSockets(); + } catch (...) { + } } bool diff --git a/src/lib/dhcp/iface_mgr.h b/src/lib/dhcp/iface_mgr.h index b9924e9eb0..8ab0592123 100644 --- a/src/lib/dhcp/iface_mgr.h +++ b/src/lib/dhcp/iface_mgr.h @@ -148,7 +148,7 @@ public: Iface(const std::string& name, unsigned int ifindex); /// @brief Destructor. - ~Iface() { } + ~Iface() = default; /// @brief Closes all open sockets on interface. void closeSockets(); diff --git a/src/lib/dhcp/iface_mgr_linux.cc b/src/lib/dhcp/iface_mgr_linux.cc index 6b1fddcb12..0d85943f53 100644 --- a/src/lib/dhcp/iface_mgr_linux.cc +++ b/src/lib/dhcp/iface_mgr_linux.cc @@ -91,7 +91,10 @@ public: } ~Netlink() { - rtnl_close_socket(); + try { + rtnl_close_socket(); + } catch (...) { + } } diff --git a/src/lib/dhcp/option.cc b/src/lib/dhcp/option.cc index 52a6da7ecf..949a58feb5 100644 --- a/src/lib/dhcp/option.cc +++ b/src/lib/dhcp/option.cc @@ -398,10 +398,6 @@ bool Option::equals(const Option& other) const { (getData() == other.getData()) ); } -Option::~Option() { - -} - bool Option::lenient_parsing_; } // end of isc::dhcp namespace diff --git a/src/lib/dhcp/option.h b/src/lib/dhcp/option.h index 720e4fd434..c010514ec4 100644 --- a/src/lib/dhcp/option.h +++ b/src/lib/dhcp/option.h @@ -131,7 +131,7 @@ public: return factory(u, type, OptionBuffer()); } - /// @brief ctor, used for options constructed, usually during transmission + /// @brief Constructor, used for options constructed, usually during transmission /// /// @param u option universe (DHCPv4 or DHCPv6) /// @param type option type @@ -424,8 +424,10 @@ public: return (encapsulated_space_); } + /// @brief Destructor. + /// /// just to force that every option has virtual dtor - virtual ~Option(); + virtual ~Option() = default; /// @brief Checks if options are equal. /// diff --git a/src/lib/dhcp/option4_client_fqdn.cc b/src/lib/dhcp/option4_client_fqdn.cc index 00608e0aa6..d9e443e44f 100644 --- a/src/lib/dhcp/option4_client_fqdn.cc +++ b/src/lib/dhcp/option4_client_fqdn.cc @@ -348,7 +348,10 @@ Option4ClientFqdn::Option4ClientFqdn(OptionBufferConstIter first, } Option4ClientFqdn::~Option4ClientFqdn() { - delete(impl_); + try { + delete (impl_); + } catch (...) { + } } Option4ClientFqdn::Option4ClientFqdn(const Option4ClientFqdn& source) diff --git a/src/lib/dhcp/option6_client_fqdn.cc b/src/lib/dhcp/option6_client_fqdn.cc index 65b0c1b6ec..a0ed41424c 100644 --- a/src/lib/dhcp/option6_client_fqdn.cc +++ b/src/lib/dhcp/option6_client_fqdn.cc @@ -287,7 +287,10 @@ Option6ClientFqdn::Option6ClientFqdn(OptionBufferConstIter first, } Option6ClientFqdn::~Option6ClientFqdn() { - delete(impl_); + try { + delete (impl_); + } catch (...) { + } } Option6ClientFqdn::Option6ClientFqdn(const Option6ClientFqdn& source) diff --git a/src/lib/dhcp/packet_queue.h b/src/lib/dhcp/packet_queue.h index f755910246..30a349f544 100644 --- a/src/lib/dhcp/packet_queue.h +++ b/src/lib/dhcp/packet_queue.h @@ -58,7 +58,7 @@ public: : queue_type_(queue_type) {} /// Virtual destructor - virtual ~PacketQueue(){}; + virtual ~PacketQueue() = default; /// @brief Adds a packet to the queue /// diff --git a/src/lib/dhcp/packet_queue_mgr4.h b/src/lib/dhcp/packet_queue_mgr4.h index 33fd4e400f..e7965eff77 100644 --- a/src/lib/dhcp/packet_queue_mgr4.h +++ b/src/lib/dhcp/packet_queue_mgr4.h @@ -25,17 +25,18 @@ public: /// @brief Logical name of the pre-registered, default queue implementation static const std::string DEFAULT_QUEUE_TYPE4; + /// @brief constructor. + /// /// It registers a default factory for DHCPv4 queues. PacketQueueMgr4(); /// @brief virtual Destructor - virtual ~PacketQueueMgr4(){} + virtual ~PacketQueueMgr4() = default; }; /// @brief Defines a shared pointer to PacketQueueMgr4 typedef boost::shared_ptr PacketQueueMgr4Ptr; - } // end of namespace isc::dhcp } // end of namespace isc diff --git a/src/lib/dhcp/packet_queue_mgr6.h b/src/lib/dhcp/packet_queue_mgr6.h index 7711ac9e1a..3d3c642a78 100644 --- a/src/lib/dhcp/packet_queue_mgr6.h +++ b/src/lib/dhcp/packet_queue_mgr6.h @@ -31,7 +31,7 @@ public: PacketQueueMgr6(); /// @brief virtual Destructor - virtual ~PacketQueueMgr6(){} + virtual ~PacketQueueMgr6() = default; }; /// @brief Defines a shared pointer to PacketQueueMgr6 diff --git a/src/lib/dhcp/packet_queue_ring.h b/src/lib/dhcp/packet_queue_ring.h index 8fce6ed85b..5aeec6a2f5 100644 --- a/src/lib/dhcp/packet_queue_ring.h +++ b/src/lib/dhcp/packet_queue_ring.h @@ -40,7 +40,7 @@ public: } /// @brief virtual Destructor - virtual ~PacketQueueRing(){}; + virtual ~PacketQueueRing() = default; /// @brief Adds a packet to the queue /// @@ -234,7 +234,7 @@ public: }; /// @brief virtual Destructor - virtual ~PacketQueueRing4(){} + virtual ~PacketQueueRing4() = default; }; /// @brief DHCPv6 packet queue buffer implementation @@ -254,10 +254,10 @@ public: }; /// @brief virtual Destructor - virtual ~PacketQueueRing6(){} + virtual ~PacketQueueRing6() = default; }; -}; // namespace isc::dhcp -}; // namespace isc +} // namespace isc::dhcp +} // namespace isc #endif // PACKET_QUEUE_RING_H diff --git a/src/lib/dhcp/pkt.h b/src/lib/dhcp/pkt.h index 54e61d73da..c2840132c4 100644 --- a/src/lib/dhcp/pkt.h +++ b/src/lib/dhcp/pkt.h @@ -64,11 +64,14 @@ public: /// /// Disables options copying on a packets. ~ScopedEnableOptionsCopy() { - if (pkts_.first) { - pkts_.first->setCopyRetrievedOptions(false); - } - if (pkts_.second) { - pkts_.second->setCopyRetrievedOptions(false); + try { + if (pkts_.first) { + pkts_.first->setCopyRetrievedOptions(false); + } + if (pkts_.second) { + pkts_.second->setCopyRetrievedOptions(false); + } + } catch (...) { } } @@ -584,8 +587,7 @@ public: /// There is nothing to clean up here, but since there are virtual methods, /// we define virtual destructor to ensure that derived classes will have /// a virtual one, too. - virtual ~Pkt() { - } + virtual ~Pkt() = default; /// @brief Classes this packet belongs to. /// diff --git a/src/lib/dhcp/pkt_filter.h b/src/lib/dhcp/pkt_filter.h index e175bef543..6c055cbf08 100644 --- a/src/lib/dhcp/pkt_filter.h +++ b/src/lib/dhcp/pkt_filter.h @@ -45,7 +45,7 @@ class PktFilter { public: /// @brief Virtual Destructor - virtual ~PktFilter() { } + virtual ~PktFilter() = default; /// @brief Check if packet can be sent to the host without address directly. /// diff --git a/src/lib/dhcp/pkt_filter6.h b/src/lib/dhcp/pkt_filter6.h index c7eb9e3c32..a35476c7ae 100644 --- a/src/lib/dhcp/pkt_filter6.h +++ b/src/lib/dhcp/pkt_filter6.h @@ -71,7 +71,7 @@ class PktFilter6 { public: /// @brief Virtual Destructor. - virtual ~PktFilter6() { } + virtual ~PktFilter6() = default; /// @brief Opens a socket. /// diff --git a/src/lib/dhcp/tests/duid_factory_unittest.cc b/src/lib/dhcp/tests/duid_factory_unittest.cc index 1669983d5d..af0c620ded 100644 --- a/src/lib/dhcp/tests/duid_factory_unittest.cc +++ b/src/lib/dhcp/tests/duid_factory_unittest.cc @@ -163,7 +163,10 @@ DUIDFactoryTest::DUIDFactoryTest() } DUIDFactoryTest::~DUIDFactoryTest() { - removeDefaultFile(); + try { + removeDefaultFile(); + } catch (...) { + } } std::string diff --git a/src/lib/dhcp/tests/iface_mgr_test_config.cc b/src/lib/dhcp/tests/iface_mgr_test_config.cc index c0689c36eb..054e92d1ea 100644 --- a/src/lib/dhcp/tests/iface_mgr_test_config.cc +++ b/src/lib/dhcp/tests/iface_mgr_test_config.cc @@ -39,15 +39,18 @@ IfaceMgrTestConfig::IfaceMgrTestConfig(const bool default_config) { } IfaceMgrTestConfig::~IfaceMgrTestConfig() { - IfaceMgr::instance().stopDHCPReceiver(); - IfaceMgr::instance().closeSockets(); - IfaceMgr::instance().getPacketQueueMgr4()->destroyPacketQueue(); - IfaceMgr::instance().getPacketQueueMgr6()->destroyPacketQueue(); - IfaceMgr::instance().clearIfaces(); - IfaceMgr::instance().setPacketFilter(PktFilterPtr(new PktFilterInet())); - IfaceMgr::instance().setPacketFilter(PktFilter6Ptr(new PktFilterInet6())); - IfaceMgr::instance().setTestMode(false); - IfaceMgr::instance().detectIfaces(); + try { + IfaceMgr::instance().stopDHCPReceiver(); + IfaceMgr::instance().closeSockets(); + IfaceMgr::instance().getPacketQueueMgr4()->destroyPacketQueue(); + IfaceMgr::instance().getPacketQueueMgr6()->destroyPacketQueue(); + IfaceMgr::instance().clearIfaces(); + IfaceMgr::instance().setPacketFilter(PktFilterPtr(new PktFilterInet())); + IfaceMgr::instance().setPacketFilter(PktFilter6Ptr(new PktFilterInet6())); + IfaceMgr::instance().setTestMode(false); + IfaceMgr::instance().detectIfaces(); + } catch (...) { + } } void diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc index 739aa0fd7a..7288438523 100644 --- a/src/lib/dhcp/tests/iface_mgr_unittest.cc +++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc @@ -362,8 +362,7 @@ public: : errors_count_(0) { } - ~IfaceMgrTest() { - } + ~IfaceMgrTest() = default; /// @brief Tests the number of IPv6 sockets on interface /// diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc index b525533496..07954b2c75 100644 --- a/src/lib/dhcp/tests/libdhcp++_unittest.cc +++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc @@ -66,7 +66,10 @@ public: /// /// Removes runtime option definitions. virtual ~LibDhcpTest() { - LibDHCP::clearRuntimeOptionDefs(); + try { + LibDHCP::clearRuntimeOptionDefs(); + } catch (...) { + } } /// @brief Generic factory function to create any option. diff --git a/src/lib/dhcp/tests/packet_queue4_unittest.cc b/src/lib/dhcp/tests/packet_queue4_unittest.cc index 58164f27e2..23671e3eab 100644 --- a/src/lib/dhcp/tests/packet_queue4_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue4_unittest.cc @@ -33,10 +33,10 @@ public: /// @param queue_size maximum number of packets the queue can hold TestQueue4(size_t queue_size) : PacketQueueRing4("kea-ring4", queue_size), drop_enabled_(false), eat_count_(0) { - }; + } /// @brief virtual Destructor - virtual ~TestQueue4(){}; + virtual ~TestQueue4() = default; /// @brief Determines is a packet should be dropped. /// diff --git a/src/lib/dhcp/tests/packet_queue6_unittest.cc b/src/lib/dhcp/tests/packet_queue6_unittest.cc index 52fb0dc3d7..8b4f7abf1f 100644 --- a/src/lib/dhcp/tests/packet_queue6_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue6_unittest.cc @@ -34,10 +34,10 @@ public: /// @param queue_size maximum number of packets the queue can hold TestQueue6(size_t queue_size) : PacketQueueRing6("kea-ring6", queue_size), drop_enabled_(false), eat_count_(0) { - }; + } /// @brief virtual Destructor - virtual ~TestQueue6(){}; + virtual ~TestQueue6() = default; /// @brief Determines is a packet should be dropped. /// diff --git a/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc b/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc index 90aa61eebe..22b17f1299 100644 --- a/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc @@ -46,7 +46,7 @@ public: } /// @brief Destructor - virtual ~PacketQueueMgr4Test(){} + virtual ~PacketQueueMgr4Test() = default; /// @brief Registers a queue type factory /// diff --git a/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc b/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc index b97f7e9fde..d65ea85b5f 100644 --- a/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc @@ -29,13 +29,12 @@ public: PacketQueueMgr6Test() : default_queue_type_(PacketQueueMgr6::DEFAULT_QUEUE_TYPE6) { packet_queue_mgr6_.reset(new PacketQueueMgr6()); - } /// @brief Destructor /// /// It destroys the PQM singleton. - virtual ~PacketQueueMgr6Test(){} + virtual ~PacketQueueMgr6Test() = default; /// @brief Registers a queue type factory /// diff --git a/src/lib/dhcp/tests/pkt_filter6_test_utils.cc b/src/lib/dhcp/tests/pkt_filter6_test_utils.cc index 83afc1c1e2..9fd0681979 100644 --- a/src/lib/dhcp/tests/pkt_filter6_test_utils.cc +++ b/src/lib/dhcp/tests/pkt_filter6_test_utils.cc @@ -33,16 +33,19 @@ PktFilter6Test::PktFilter6Test(const uint16_t port) } PktFilter6Test::~PktFilter6Test() { - // Cleanup after each test. This guarantees - // that the sockets do not hang after a test. - if (sock_info_.sockfd_ >= 0) { - close(sock_info_.sockfd_); - } - if (sock_info_.fallbackfd_ >=0) { - close(sock_info_.fallbackfd_); - } - if (send_msg_sock_ >= 0) { - close(send_msg_sock_); + try { + // Cleanup after each test. This guarantees + // that the sockets do not hang after a test. + if (sock_info_.sockfd_ >= 0) { + close(sock_info_.sockfd_); + } + if (sock_info_.fallbackfd_ >=0) { + close(sock_info_.fallbackfd_); + } + if (send_msg_sock_ >= 0) { + close(send_msg_sock_); + } + } catch (...) { } } diff --git a/src/lib/dhcp/tests/pkt_filter_test_utils.cc b/src/lib/dhcp/tests/pkt_filter_test_utils.cc index 7b5a79ec56..3d4c712197 100644 --- a/src/lib/dhcp/tests/pkt_filter_test_utils.cc +++ b/src/lib/dhcp/tests/pkt_filter_test_utils.cc @@ -26,16 +26,19 @@ PktFilterTest::PktFilterTest(const uint16_t port) } PktFilterTest::~PktFilterTest() { - // Cleanup after each test. This guarantees - // that the sockets do not hang after a test. - if (sock_info_.sockfd_ >= 0) { - close(sock_info_.sockfd_); - } - if (sock_info_.fallbackfd_ >=0) { - close(sock_info_.fallbackfd_); - } - if (send_msg_sock_ >= 0) { - close(send_msg_sock_); + try { + // Cleanup after each test. This guarantees + // that the sockets do not hang after a test. + if (sock_info_.sockfd_ >= 0) { + close(sock_info_.sockfd_); + } + if (sock_info_.fallbackfd_ >=0) { + close(sock_info_.fallbackfd_); + } + if (send_msg_sock_ >= 0) { + close(send_msg_sock_); + } + } catch (...) { } } diff --git a/src/lib/dhcp_ddns/ncr_io.h b/src/lib/dhcp_ddns/ncr_io.h index 664057d961..01352c3982 100644 --- a/src/lib/dhcp_ddns/ncr_io.h +++ b/src/lib/dhcp_ddns/ncr_io.h @@ -198,8 +198,7 @@ public: virtual void operator ()(const Result result, NameChangeRequestPtr& ncr) = 0; - virtual ~RequestReceiveHandler() { - } + virtual ~RequestReceiveHandler() = default; }; /// @brief Constructor @@ -209,8 +208,7 @@ public: NameChangeListener(RequestReceiveHandler& recv_handler); /// @brief Destructor - virtual ~NameChangeListener() { - }; + virtual ~NameChangeListener() = default; /// @brief Prepares the IO for reception and initiates the first receive. /// @@ -502,8 +500,7 @@ public: virtual void operator ()(const Result result, NameChangeRequestPtr& ncr) = 0; - virtual ~RequestSendHandler() { - } + virtual ~RequestSendHandler() = default; }; /// @brief Constructor @@ -517,8 +514,7 @@ public: size_t send_queue_max = MAX_QUEUE_DEFAULT); /// @brief Destructor - virtual ~NameChangeSender() { - } + virtual ~NameChangeSender() = default; /// @brief Prepares the IO for transmission. /// diff --git a/src/lib/dhcp_ddns/ncr_udp.cc b/src/lib/dhcp_ddns/ncr_udp.cc index 9ba44ca713..3cbfa403f5 100644 --- a/src/lib/dhcp_ddns/ncr_udp.cc +++ b/src/lib/dhcp_ddns/ncr_udp.cc @@ -80,8 +80,11 @@ NameChangeUDPListener(const isc::asiolink::IOAddress& ip_address, } NameChangeUDPListener::~NameChangeUDPListener() { - // Clean up. - stopListening(); + try { + // Clean up. + stopListening(); + } catch (...) { + } } void @@ -214,8 +217,11 @@ NameChangeUDPSender(const isc::asiolink::IOAddress& ip_address, } NameChangeUDPSender::~NameChangeUDPSender() { - // Clean up. - stopSending(); + try { + // Clean up. + stopSending(); + } catch (...) { + } } void diff --git a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc index a6350fa4a0..f39df8f08d 100644 --- a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc +++ b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc @@ -180,9 +180,7 @@ public: TEST_TIMEOUT); } - virtual ~NameChangeUDPListenerTest(){ - } - + virtual ~NameChangeUDPListenerTest() = default; /// @brief Converts JSON string into an NCR and sends it to the listener. /// @@ -298,8 +296,11 @@ public: } ~NameChangeUDPSenderBasicTest() { - // Disable multi-threading - MultiThreadingMgr::instance().setMode(false); + try { + // Disable multi-threading + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } }; @@ -988,8 +989,11 @@ public: } ~NameChangeUDPTest() { - // Disable multi-threading - MultiThreadingMgr::instance().setMode(false); + try { + // Disable multi-threading + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } void reset_results() { diff --git a/src/lib/dhcp_ddns/tests/ncr_unittests.cc b/src/lib/dhcp_ddns/tests/ncr_unittests.cc index ddbf0f631d..dd25996d9f 100644 --- a/src/lib/dhcp_ddns/tests/ncr_unittests.cc +++ b/src/lib/dhcp_ddns/tests/ncr_unittests.cc @@ -348,8 +348,7 @@ public: } /// @brief Destructor - virtual ~DhcidTest() { - } + virtual ~DhcidTest() = default; std::vector wire_fqdn_; }; diff --git a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc index 26732a9f6a..12d71f64a6 100644 --- a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc @@ -48,10 +48,6 @@ GenericHostDataSourceTest::GenericHostDataSourceTest() : GenericBackendTest(), hdsptr_() { } -GenericHostDataSourceTest::~GenericHostDataSourceTest() { - hdsptr_.reset(); -} - bool GenericHostDataSourceTest::compareHostsForSort4(const ConstHostPtr& host1, const ConstHostPtr& host2) { diff --git a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h index 8444f93704..942ef475a0 100644 --- a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h +++ b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h @@ -53,7 +53,7 @@ public: GenericHostDataSourceTest(); /// @brief Virtual destructor. - virtual ~GenericHostDataSourceTest(); + virtual ~GenericHostDataSourceTest() = default; /// @brief Used to sort a host collection by IPv4 subnet id. /// @param host1 first host to be compared -- GitLab From cc5d03ee56f8e7444392f4f16a6173551dc78ec1 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Thu, 3 Jun 2021 13:43:55 +0300 Subject: [PATCH 4/6] [#1845] catch all exceptions in destructors --- src/bin/dhcp4/tests/dhcp4_test_utils.h | 3 + src/bin/dhcp6/tests/dhcp6_test_utils.h | 3 + src/bin/perfdhcp/stats_mgr.h | 5 +- src/hooks/dhcp/bootp/tests/bootp_unittests.cc | 2 +- .../libloadtests/callout_unittests.cc | 2 + .../tests/ha_config_unittest.cc | 1 + .../run_script/tests/run_script_unittests.cc | 2 +- .../tests/cmd_http_listener_unittests.cc | 2 +- src/lib/cql/cql_exchange.h | 1 + src/lib/dhcp/iface_mgr_linux.cc | 2 + src/lib/dhcp_ddns/ncr_udp.h | 2 - src/lib/dhcpsrv/alloc_engine.h | 5 +- src/lib/dhcpsrv/base_host_data_source.h | 7 +- .../generic_host_data_source_benchmark.cc | 7 +- .../benchmarks/generic_lease_mgr_benchmark.cc | 3 - .../benchmarks/generic_lease_mgr_benchmark.h | 2 +- src/lib/dhcpsrv/cache_host_data_source.h | 6 +- src/lib/dhcpsrv/cfg_hosts.h | 4 +- src/lib/dhcpsrv/cfgmgr.cc | 3 - src/lib/dhcpsrv/cfgmgr.h | 2 +- src/lib/dhcpsrv/client_class_def.cc | 6 - src/lib/dhcpsrv/client_class_def.h | 5 +- src/lib/dhcpsrv/config_backend_dhcp4.h | 4 +- src/lib/dhcpsrv/config_backend_dhcp6.h | 4 +- src/lib/dhcpsrv/cql_host_data_source.cc | 19 +-- src/lib/dhcpsrv/cql_host_data_source.h | 7 +- src/lib/dhcpsrv/cql_lease_mgr.cc | 7 +- src/lib/dhcpsrv/cql_lease_mgr.h | 5 +- src/lib/dhcpsrv/d2_client_cfg.cc | 2 - src/lib/dhcpsrv/d2_client_cfg.h | 2 +- src/lib/dhcpsrv/d2_client_mgr.cc | 7 +- src/lib/dhcpsrv/dhcp4o6_ipc.cc | 8 +- src/lib/dhcpsrv/fuzz.cc | 5 +- src/lib/dhcpsrv/host_data_source_factory.cc | 15 +- src/lib/dhcpsrv/lease.h | 2 +- src/lib/dhcpsrv/lease_file_stats.h | 3 +- src/lib/dhcpsrv/lease_mgr.h | 11 +- src/lib/dhcpsrv/memfile_lease_mgr.cc | 42 ++--- src/lib/dhcpsrv/mysql_host_data_source.cc | 52 +++--- src/lib/dhcpsrv/mysql_host_data_source.h | 2 +- src/lib/dhcpsrv/mysql_lease_mgr.cc | 21 +-- src/lib/dhcpsrv/mysql_lease_mgr.h | 2 +- src/lib/dhcpsrv/network.h | 2 +- src/lib/dhcpsrv/network_state.cc | 7 +- src/lib/dhcpsrv/parsers/dhcp_parsers.h | 18 ++- .../parsers/expiration_config_parser.h | 6 +- .../parsers/host_reservation_parser.cc | 4 - .../dhcpsrv/parsers/host_reservation_parser.h | 9 +- src/lib/dhcpsrv/pgsql_host_data_source.cc | 28 ++-- src/lib/dhcpsrv/pgsql_host_data_source.h | 3 +- src/lib/dhcpsrv/pgsql_lease_mgr.cc | 23 +-- src/lib/dhcpsrv/pgsql_lease_mgr.h | 2 +- src/lib/dhcpsrv/pool.h | 3 +- src/lib/dhcpsrv/resource_handler.cc | 14 +- src/lib/dhcpsrv/resource_handler.h | 6 +- src/lib/dhcpsrv/srv_config.cc | 3 +- src/lib/dhcpsrv/subnet.h | 2 +- .../dhcpsrv/tests/alloc_engine6_unittest.cc | 2 +- .../tests/alloc_engine_expiration_unittest.cc | 59 ++++--- .../tests/alloc_engine_hooks_unittest.cc | 30 ++-- src/lib/dhcpsrv/tests/alloc_engine_utils.h | 12 +- src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc | 27 ++-- .../dhcpsrv/tests/cfg_db_access_unittest.cc | 27 ++-- src/lib/dhcpsrv/tests/cfg_duid_unittest.cc | 5 +- .../dhcpsrv/tests/cfg_expiration_unittest.cc | 5 +- src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc | 5 +- .../tests/cfg_multi_threading_unittest.cc | 5 + src/lib/dhcpsrv/tests/cfgmgr_unittest.cc | 10 +- .../tests/cql_host_data_source_unittest.cc | 10 +- .../dhcpsrv/tests/cql_lease_mgr_unittest.cc | 5 +- src/lib/dhcpsrv/tests/d2_client_unittest.cc | 7 + src/lib/dhcpsrv/tests/d2_udp_unittest.cc | 3 +- .../dhcpsrv/tests/dhcp_parsers_unittest.cc | 13 +- .../dhcp_queue_control_parser_unittest.cc | 5 + .../tests/generic_lease_mgr_unittest.cc | 5 - .../tests/generic_lease_mgr_unittest.h | 20 ++- src/lib/dhcpsrv/tests/host_cache_unittest.cc | 39 +++-- .../host_data_source_factory_unittest.cc | 7 + .../tests/host_reservation_parser_unittest.cc | 10 +- .../host_reservations_list_parser_unittest.cc | 5 + .../tests/lease_file_loader_unittest.cc | 7 +- src/lib/dhcpsrv/tests/lease_mgr_unittest.cc | 11 +- .../tests/memfile_lease_mgr_unittest.cc | 21 +-- .../multi_threading_config_parser_unittest.cc | 5 + .../tests/mysql_host_data_source_unittest.cc | 5 +- .../dhcpsrv/tests/mysql_lease_mgr_unittest.cc | 5 +- .../dhcpsrv/tests/ncr_generator_unittest.cc | 3 + .../dhcpsrv/tests/network_state_unittest.cc | 17 +- .../tests/pgsql_host_data_source_unittest.cc | 11 +- .../dhcpsrv/tests/pgsql_lease_mgr_unittest.cc | 5 +- .../dhcpsrv/tests/sanity_checks_unittest.cc | 10 +- .../tests/shared_network_parser_unittest.cc | 2 +- src/lib/dhcpsrv/tests/srv_config_unittest.cc | 3 +- src/lib/dhcpsrv/tests/timer_mgr_unittest.cc | 7 + .../testutils/generic_backend_unittest.cc | 5 +- .../generic_host_data_source_unittest.cc | 4 - .../generic_host_data_source_unittest.h | 24 ++- src/lib/dhcpsrv/testutils/lease_file_io.cc | 7 +- .../testutils/memory_host_data_source.h | 5 +- .../dhcpsrv/testutils/test_config_backend.h | 2 +- .../testutils/test_config_backend_dhcp4.h | 2 +- .../testutils/test_config_backend_dhcp6.h | 2 +- src/lib/dhcpsrv/testutils/test_utils.cc | 9 +- src/lib/dhcpsrv/timer_mgr.cc | 5 +- src/lib/dhcpsrv/writable_host_data_source.h | 4 +- src/lib/dns/gen-rdatacode.py.in | 1 + src/lib/dns/master_lexer.cc | 43 +++-- src/lib/dns/master_lexer_inputsource.cc | 14 +- src/lib/dns/master_lexer_state.h | 5 +- src/lib/dns/master_loader.cc | 5 +- src/lib/dns/message.cc | 14 +- src/lib/dns/message.h | 13 +- src/lib/dns/messagerenderer.cc | 9 +- src/lib/dns/messagerenderer.h | 5 +- src/lib/dns/nsec3hash.cc | 10 +- src/lib/dns/nsec3hash.h | 8 +- src/lib/dns/rdata.cc | 12 +- src/lib/dns/rdata.h | 4 +- src/lib/dns/rdata/any_255/tsig_250.cc | 5 +- src/lib/dns/rdata/generic/caa_257.cc | 5 +- src/lib/dns/rdata/generic/caa_257.h | 4 + src/lib/dns/rdata/generic/dlv_32769.cc | 5 +- src/lib/dns/rdata/generic/dlv_32769.h | 2 +- src/lib/dns/rdata/generic/dnskey_48.cc | 5 +- src/lib/dns/rdata/generic/dnskey_48.h | 2 + src/lib/dns/rdata/generic/ds_43.cc | 5 +- src/lib/dns/rdata/generic/ds_43.h | 2 +- src/lib/dns/rdata/generic/hinfo_13.cc | 19 ++- src/lib/dns/rdata/generic/hinfo_13.h | 4 +- src/lib/dns/rdata/generic/naptr_35.cc | 13 +- src/lib/dns/rdata/generic/naptr_35.h | 3 +- src/lib/dns/rdata/generic/nsec3_50.cc | 5 +- src/lib/dns/rdata/generic/nsec3_50.h | 2 + src/lib/dns/rdata/generic/nsec3param_51.cc | 5 +- src/lib/dns/rdata/generic/nsec3param_51.h | 2 + src/lib/dns/rdata/generic/nsec_47.cc | 5 +- src/lib/dns/rdata/generic/nsec_47.h | 2 + src/lib/dns/rdata/generic/opt_41.cc | 23 ++- src/lib/dns/rdata/generic/opt_41.h | 5 +- src/lib/dns/rdata/generic/rrsig_46.cc | 5 +- src/lib/dns/rdata/generic/rrsig_46.h | 2 + src/lib/dns/rdata/generic/spf_99.cc | 5 +- src/lib/dns/rdata/generic/spf_99.h | 2 +- src/lib/dns/rdata/generic/sshfp_44.cc | 5 +- src/lib/dns/rdata/generic/sshfp_44.h | 3 + src/lib/dns/rdata/generic/tlsa_52.cc | 5 +- src/lib/dns/rdata/generic/tlsa_52.h | 3 + src/lib/dns/rdata/generic/txt_16.cc | 5 +- src/lib/dns/rdata/generic/txt_16.h | 2 + src/lib/dns/rdata/in_1/a_1.h | 6 +- src/lib/dns/rdata/in_1/srv_33.cc | 5 +- src/lib/dns/rdata/in_1/srv_33.h | 2 +- src/lib/dns/rdata_pimpl_holder.h | 11 +- src/lib/dns/rdataclass.cc | 153 ++++++++++++++---- src/lib/dns/rdataclass.h | 83 ++++++++-- src/lib/dns/rdatafields.cc | 45 ++++-- src/lib/dns/rdatafields.h | 4 +- src/lib/dns/rrcollator.cc | 9 +- src/lib/dns/rrparamregistry-placeholder.cc | 5 +- src/lib/dns/rrparamregistry.cc | 5 +- src/lib/dns/rrparamregistry.h | 9 +- src/lib/dns/rrset.cc | 18 +-- src/lib/dns/rrset.h | 13 +- src/lib/dns/rrset_collection.h | 2 +- src/lib/dns/rrset_collection_base.h | 8 +- src/lib/dns/tests/nsec3hash_unittest.cc | 7 +- src/lib/dns/tests/rdatafields_unittest.cc | 14 +- src/lib/dns/tests/rrparamregistry_unittest.cc | 29 ++-- src/lib/dns/tests/tsig_unittest.cc | 11 +- src/lib/dns/tests/unittest_util.cc | 11 +- src/lib/dns/tsig.cc | 14 +- src/lib/dns/tsigkey.cc | 10 +- src/lib/eval/eval_context.cc | 6 +- src/lib/eval/eval_context.h | 2 +- src/lib/eval/tests/dependency_unittest.cc | 17 +- src/lib/eval/token.h | 2 +- src/lib/exceptions/exceptions.h | 4 +- src/lib/hooks/callout_handle.cc | 52 +++--- src/lib/hooks/library_manager.cc | 23 +-- src/lib/hooks/library_manager_collection.h | 5 +- src/lib/hooks/tests/hooks_manager_unittest.cc | 15 +- .../hooks/tests/library_manager_unittest.cc | 9 +- src/lib/http/auth_config.h | 5 +- src/lib/http/basic_auth_config.h | 4 +- src/lib/http/client.cc | 23 ++- src/lib/http/client.h | 5 +- src/lib/http/connection.cc | 5 +- src/lib/http/http_message.cc | 3 - src/lib/http/http_message.h | 2 +- src/lib/http/http_thread_pool.cc | 5 +- src/lib/http/listener.cc | 5 +- src/lib/http/listener_impl.h | 3 +- src/lib/http/response_creator.h | 5 +- src/lib/http/response_creator_factory.h | 5 +- src/lib/http/tests/client_mt_unittests.cc | 21 +-- .../http/tests/connection_pool_unittests.cc | 5 +- .../http/tests/http_thread_pool_unittests.cc | 5 +- src/lib/http/tests/request_test.h | 3 +- src/lib/http/tests/server_client_unittests.cc | 22 ++- src/lib/http/tests/test_http_client.h | 5 +- src/lib/http/tests/tls_client_unittests.cc | 13 +- src/lib/http/tests/tls_server_unittests.cc | 14 +- src/lib/log/interprocess/interprocess_sync.h | 18 ++- .../interprocess/interprocess_sync_file.cc | 13 +- .../interprocess/interprocess_sync_null.cc | 3 - .../log/interprocess/interprocess_sync_null.h | 2 +- src/lib/log/log_formatter.h | 15 +- src/lib/log/logger.cc | 15 +- src/lib/log/logger_impl.cc | 5 +- src/lib/log/logger_manager.cc | 5 +- src/lib/log/message_dictionary.cc | 10 -- src/lib/log/message_dictionary.h | 4 +- src/lib/log/message_exception.h | 2 +- src/lib/log/message_initializer.cc | 57 +++---- src/lib/log/message_reader.h | 7 +- src/lib/log/tests/buffer_appender_unittest.cc | 32 ++-- .../log/tests/logger_level_impl_unittest.cc | 5 +- src/lib/log/tests/logger_level_unittest.cc | 8 +- src/lib/log/tests/logger_lock_test.cc | 6 +- src/lib/log/tests/logger_manager_unittest.cc | 29 +++- src/lib/log/tests/logger_name_unittest.cc | 13 +- src/lib/log/tests/logger_support_unittest.cc | 6 +- src/lib/log/tests/logger_unittest.cc | 8 +- src/lib/log/tests/message_reader_unittest.cc | 10 +- src/lib/mysql/mysql_connection.cc | 32 ++-- src/lib/mysql/mysql_connection.h | 19 ++- .../mysql/tests/mysql_connection_unittest.cc | 19 ++- src/lib/pgsql/pgsql_connection.cc | 37 +++-- src/lib/pgsql/pgsql_connection.h | 21 ++- src/lib/pgsql/pgsql_exchange.cc | 6 +- src/lib/pgsql/pgsql_exchange.h | 11 +- .../pgsql/tests/pgsql_exchange_unittest.cc | 5 +- src/lib/process/cb_ctl_base.h | 5 +- src/lib/process/d_cfg_mgr.cc | 3 - src/lib/process/d_cfg_mgr.h | 2 +- src/lib/process/d_controller.cc | 3 - src/lib/process/d_controller.h | 2 +- src/lib/process/d_process.h | 2 +- src/lib/process/daemon.cc | 7 +- .../process/tests/cb_ctl_base_unittests.cc | 5 +- src/lib/process/tests/d_cfg_mgr_unittests.cc | 8 +- src/lib/process/tests/daemon_unittest.cc | 15 +- src/lib/process/tests/log_parser_unittests.cc | 20 ++- .../process/tests/logging_info_unittests.cc | 5 + src/lib/process/testutils/d_test_stubs.cc | 20 +-- src/lib/process/testutils/d_test_stubs.h | 40 ++--- src/lib/stats/tests/stats_mgr_unittest.cc | 11 +- src/lib/testutils/log_utils.cc | 5 +- src/lib/testutils/log_utils.h | 5 +- src/lib/testutils/multi_threading_utils.h | 5 +- src/lib/testutils/sandbox.h | 13 +- src/lib/testutils/unix_control_client.cc | 5 +- src/lib/util/buffer.h | 13 +- src/lib/util/csv_file.cc | 5 +- src/lib/util/io/socketsession.cc | 36 +++-- src/lib/util/io/socketsession.h | 7 +- src/lib/util/labeled_value.cc | 9 -- src/lib/util/labeled_value.h | 6 +- src/lib/util/memory_segment.h | 5 +- src/lib/util/memory_segment_local.h | 2 +- src/lib/util/multi_threading_mgr.cc | 8 +- src/lib/util/multi_threading_mgr.h | 2 +- src/lib/util/pid_file.cc | 3 - src/lib/util/pid_file.h | 2 +- src/lib/util/readwrite_mutex.h | 15 +- src/lib/util/state_model.cc | 12 -- src/lib/util/state_model.h | 8 +- src/lib/util/stopwatch.cc | 5 +- src/lib/util/stopwatch_impl.cc | 3 - src/lib/util/stopwatch_impl.h | 2 +- src/lib/util/strutil.cc | 11 +- src/lib/util/tests/csv_file_unittest.cc | 5 +- src/lib/util/tests/fd_tests.cc | 26 +-- src/lib/util/tests/pid_file_unittest.cc | 6 + .../tests/random_number_generator_unittest.cc | 17 +- src/lib/util/tests/state_model_unittest.cc | 3 +- src/lib/util/tests/time_utilities_unittest.cc | 9 +- .../util/tests/versioned_csv_file_unittest.cc | 5 +- src/lib/util/tests/watched_thread_unittest.cc | 5 +- src/lib/util/thread_pool.h | 15 +- src/lib/util/unlock_guard.h | 5 +- src/lib/util/versioned_csv_file.cc | 3 - src/lib/util/versioned_csv_file.h | 6 +- src/lib/util/watch_socket.cc | 5 +- src/lib/util/watched_thread.h | 4 +- src/lib/yang/adaptor.cc | 6 - src/lib/yang/adaptor.h | 4 +- src/lib/yang/adaptor_config.cc | 6 - src/lib/yang/adaptor_config.h | 7 +- src/lib/yang/adaptor_host.cc | 6 - src/lib/yang/adaptor_host.h | 4 +- src/lib/yang/adaptor_option.cc | 6 - src/lib/yang/adaptor_option.h | 4 +- src/lib/yang/adaptor_pool.cc | 6 - src/lib/yang/adaptor_pool.h | 4 +- src/lib/yang/adaptor_subnet.cc | 6 - src/lib/yang/adaptor_subnet.h | 4 +- src/lib/yang/tests/config_unittests.cc | 9 +- src/lib/yang/tests/sysrepo_setup.h | 9 +- .../yang/tests/translator_class_unittests.cc | 4 +- .../translator_control_socket_unittests.cc | 4 +- .../tests/translator_database_unittests.cc | 8 +- .../yang/tests/translator_host_unittests.cc | 4 +- .../yang/tests/translator_logger_unittests.cc | 4 +- .../tests/translator_option_data_unittests.cc | 4 +- .../tests/translator_option_def_unittests.cc | 4 +- .../tests/translator_pd_pool_unittests.cc | 4 +- .../yang/tests/translator_pool_unittests.cc | 4 +- .../translator_shared_network_unittests.cc | 4 +- .../yang/tests/translator_subnet_unittests.cc | 4 +- src/lib/yang/translator.cc | 3 - src/lib/yang/translator.h | 2 +- src/lib/yang/translator_class.cc | 6 - src/lib/yang/translator_class.h | 4 +- src/lib/yang/translator_config.cc | 3 - src/lib/yang/translator_config.h | 2 +- src/lib/yang/translator_control_socket.cc | 3 - src/lib/yang/translator_control_socket.h | 2 +- src/lib/yang/translator_database.cc | 6 - src/lib/yang/translator_database.h | 4 +- src/lib/yang/translator_host.cc | 6 - src/lib/yang/translator_host.h | 4 +- src/lib/yang/translator_logger.cc | 6 - src/lib/yang/translator_logger.h | 4 +- src/lib/yang/translator_option_data.cc | 6 - src/lib/yang/translator_option_data.h | 4 +- src/lib/yang/translator_option_def.cc | 6 - src/lib/yang/translator_option_def.h | 4 +- src/lib/yang/translator_pd_pool.cc | 6 - src/lib/yang/translator_pd_pool.h | 4 +- src/lib/yang/translator_pool.cc | 6 - src/lib/yang/translator_pool.h | 4 +- src/lib/yang/translator_shared_network.cc | 6 - src/lib/yang/translator_shared_network.h | 4 +- src/lib/yang/translator_subnet.cc | 6 - src/lib/yang/translator_subnet.h | 4 +- 336 files changed, 1917 insertions(+), 1191 deletions(-) diff --git a/src/bin/dhcp4/tests/dhcp4_test_utils.h b/src/bin/dhcp4/tests/dhcp4_test_utils.h index b8ab1b79f0..2b46882495 100644 --- a/src/bin/dhcp4/tests/dhcp4_test_utils.h +++ b/src/bin/dhcp4/tests/dhcp4_test_utils.h @@ -314,10 +314,12 @@ public: class Dhcpv4SrvMTTestGuard { public: + /// @brief Constructor Dhcpv4SrvMTTestGuard(Dhcpv4SrvTest& test, bool mt_enabled) : test_(test) { test_.setMultiThreading(mt_enabled); } + /// @brief Destructor ~Dhcpv4SrvMTTestGuard() { try { @@ -325,6 +327,7 @@ public: } catch (...) { } } + Dhcpv4SrvTest& test_; }; diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.h b/src/bin/dhcp6/tests/dhcp6_test_utils.h index 95087c9fa2..ae93c9840b 100644 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.h +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.h @@ -549,10 +549,12 @@ public: class Dhcpv6SrvMTTestGuard { public: + /// @brief Constructor Dhcpv6SrvMTTestGuard(Dhcpv6SrvTest& test, bool mt_enabled) : test_(test) { test_.setMultiThreading(mt_enabled); } + /// @brief Destructor ~Dhcpv6SrvMTTestGuard() { try{ @@ -560,6 +562,7 @@ public: } catch (...) { } } + Dhcpv6SrvTest& test_; }; diff --git a/src/bin/perfdhcp/stats_mgr.h b/src/bin/perfdhcp/stats_mgr.h index 0ca1695ad2..1090af4848 100644 --- a/src/bin/perfdhcp/stats_mgr.h +++ b/src/bin/perfdhcp/stats_mgr.h @@ -103,7 +103,7 @@ public: /// /// Method returns counter name. /// - /// \return counter name. + /// \return counter name. const std::string& getName() const { return(name_); } private: @@ -112,7 +112,8 @@ private: /// Default constructor is private because we don't want client /// class to call it because we want client class to specify /// counter's name. - CustomCounter() { }; + CustomCounter() : counter_(0) { + } uint64_t counter_; ///< Counter's value. std::string name_; ///< Counter's name. diff --git a/src/hooks/dhcp/bootp/tests/bootp_unittests.cc b/src/hooks/dhcp/bootp/tests/bootp_unittests.cc index 812fe2d759..b7da156901 100644 --- a/src/hooks/dhcp/bootp/tests/bootp_unittests.cc +++ b/src/hooks/dhcp/bootp/tests/bootp_unittests.cc @@ -44,7 +44,7 @@ public: /// @brief Fetches the callout manager instance. boost::shared_ptrgetCalloutManager() { - return(co_manager_); + return (co_manager_); } /// @brief Tests buffer4_receive callout. diff --git a/src/hooks/dhcp/flex_option/libloadtests/callout_unittests.cc b/src/hooks/dhcp/flex_option/libloadtests/callout_unittests.cc index 02c233b3e6..5bfe39adbf 100644 --- a/src/hooks/dhcp/flex_option/libloadtests/callout_unittests.cc +++ b/src/hooks/dhcp/flex_option/libloadtests/callout_unittests.cc @@ -53,12 +53,14 @@ TestHooks testHooks; /// @brief Test fixture for testing callouts called by the flex-option library class CalloutTest : public ::testing::Test { public: + /// @brief Constructor CalloutTest() { reset(); } /// @brief Destructor + /// /// Removes files that may be left over from previous tests virtual ~CalloutTest() { try { diff --git a/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc b/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc index 8c965af248..a1fc75bf43 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_config_unittest.cc @@ -80,6 +80,7 @@ public: } result.replace(where, from.size(), repl); } + return (result); } }; diff --git a/src/hooks/dhcp/run_script/tests/run_script_unittests.cc b/src/hooks/dhcp/run_script/tests/run_script_unittests.cc index edbceab776..1c09546a72 100644 --- a/src/hooks/dhcp/run_script/tests/run_script_unittests.cc +++ b/src/hooks/dhcp/run_script/tests/run_script_unittests.cc @@ -739,7 +739,7 @@ public: /// @brief Fetches the callout manager instance. boost::shared_ptrgetCalloutManager() { - return(co_manager_); + return (co_manager_); } private: diff --git a/src/lib/config/tests/cmd_http_listener_unittests.cc b/src/lib/config/tests/cmd_http_listener_unittests.cc index 5ea53264e5..e1341312d9 100644 --- a/src/lib/config/tests/cmd_http_listener_unittests.cc +++ b/src/lib/config/tests/cmd_http_listener_unittests.cc @@ -70,7 +70,7 @@ public: /// /// Removes HTTP clients, unregisters commands, disables MT. virtual ~CmdHttpListenerTest() { - try { + try { // Wipe out the listener. listener_.reset(); diff --git a/src/lib/cql/cql_exchange.h b/src/lib/cql/cql_exchange.h index de8be58468..1173097800 100644 --- a/src/lib/cql/cql_exchange.h +++ b/src/lib/cql/cql_exchange.h @@ -149,6 +149,7 @@ struct CqlFunction { /// the same exchange if they have the same columns. class CqlExchange : public virtual SqlExchange { public: + /// @brief Constructor /// /// Empty body. Derived constructors specify table columns. diff --git a/src/lib/dhcp/iface_mgr_linux.cc b/src/lib/dhcp/iface_mgr_linux.cc index 0d85943f53..7990f48257 100644 --- a/src/lib/dhcp/iface_mgr_linux.cc +++ b/src/lib/dhcp/iface_mgr_linux.cc @@ -85,11 +85,13 @@ public: /// }; typedef boost::array RTattribPtrs; + /// @brief Constructor Netlink() : fd_(-1), seq_(0), dump_(0) { memset(&local_, 0, sizeof(struct sockaddr_nl)); memset(&peer_, 0, sizeof(struct sockaddr_nl)); } + /// @brief Destructor ~Netlink() { try { rtnl_close_socket(); diff --git a/src/lib/dhcp_ddns/ncr_udp.h b/src/lib/dhcp_ddns/ncr_udp.h index 01284aff7e..318a6b9864 100644 --- a/src/lib/dhcp_ddns/ncr_udp.h +++ b/src/lib/dhcp_ddns/ncr_udp.h @@ -469,7 +469,6 @@ public: /// @brief Destructor virtual ~NameChangeUDPSender(); - /// @brief Opens a UDP socket using the given IOService. /// /// Creates a NameChangeUDPSocket bound to the sender's IP address @@ -480,7 +479,6 @@ public: /// @throw NcrUDPError if the open fails. virtual void open(isc::asiolink::IOService& io_service); - /// @brief Closes the UDPSocket. /// /// It first invokes the socket's cancel method which should stop any diff --git a/src/lib/dhcpsrv/alloc_engine.h b/src/lib/dhcpsrv/alloc_engine.h index d0b7a06d93..25ca923a30 100644 --- a/src/lib/dhcpsrv/alloc_engine.h +++ b/src/lib/dhcpsrv/alloc_engine.h @@ -115,8 +115,7 @@ protected: } /// @brief Virtual destructor - virtual ~Allocator() { - } + virtual ~Allocator() = default; private: virtual isc::asiolink::IOAddress @@ -285,7 +284,7 @@ public: AllocEngine(AllocType engine_type, uint64_t attempts, bool ipv6 = true); /// @brief Destructor. - virtual ~AllocEngine() { } + virtual ~AllocEngine() = default; /// @brief Returns allocator for a given pool type /// diff --git a/src/lib/dhcpsrv/base_host_data_source.h b/src/lib/dhcpsrv/base_host_data_source.h index 5228497397..e409225a18 100644 --- a/src/lib/dhcpsrv/base_host_data_source.h +++ b/src/lib/dhcpsrv/base_host_data_source.h @@ -94,8 +94,11 @@ public: ID_DUID = 1 ///< DUID/client-id }; - /// @brief Default destructor implementation. - virtual ~BaseHostDataSource() { } + /// @brief Constructor. + BaseHostDataSource() = default; + + /// @brief Default destructor. + virtual ~BaseHostDataSource() = default; /// @brief Return all hosts connected to any subnet for which reservations /// have been made using a specified identifier. diff --git a/src/lib/dhcpsrv/benchmarks/generic_host_data_source_benchmark.cc b/src/lib/dhcpsrv/benchmarks/generic_host_data_source_benchmark.cc index 59eb75323f..d58510897c 100644 --- a/src/lib/dhcpsrv/benchmarks/generic_host_data_source_benchmark.cc +++ b/src/lib/dhcpsrv/benchmarks/generic_host_data_source_benchmark.cc @@ -45,8 +45,11 @@ GenericHostDataSourceBenchmark::GenericHostDataSourceBenchmark() : hdsptr_() { } GenericHostDataSourceBenchmark::~GenericHostDataSourceBenchmark() { - LibDHCP::clearRuntimeOptionDefs(); - hdsptr_.reset(); + try { + LibDHCP::clearRuntimeOptionDefs(); + hdsptr_.reset(); + } catch (...) { + } } void diff --git a/src/lib/dhcpsrv/benchmarks/generic_lease_mgr_benchmark.cc b/src/lib/dhcpsrv/benchmarks/generic_lease_mgr_benchmark.cc index 39b98f6a6e..c892782590 100644 --- a/src/lib/dhcpsrv/benchmarks/generic_lease_mgr_benchmark.cc +++ b/src/lib/dhcpsrv/benchmarks/generic_lease_mgr_benchmark.cc @@ -37,9 +37,6 @@ namespace bench { GenericLeaseMgrBenchmark::GenericLeaseMgrBenchmark() : lmptr_(NULL) { } -GenericLeaseMgrBenchmark::~GenericLeaseMgrBenchmark() { -} - void GenericLeaseMgrBenchmark::setUp4(::benchmark::State& state, size_t const& lease_count) { state.PauseTiming(); diff --git a/src/lib/dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h b/src/lib/dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h index af90223df9..1b05656e1c 100644 --- a/src/lib/dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h +++ b/src/lib/dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h @@ -36,7 +36,7 @@ public: GenericLeaseMgrBenchmark(); /// Virtual destructor - virtual ~GenericLeaseMgrBenchmark(); + virtual ~GenericLeaseMgrBenchmark() = default; /// @brief set up code for initializing IPv4 version of a benchmark /// diff --git a/src/lib/dhcpsrv/cache_host_data_source.h b/src/lib/dhcpsrv/cache_host_data_source.h index a0a32cc233..f5c604656d 100644 --- a/src/lib/dhcpsrv/cache_host_data_source.h +++ b/src/lib/dhcpsrv/cache_host_data_source.h @@ -17,9 +17,11 @@ namespace dhcp { /// Only the insert() method is required to use the cache. class CacheHostDataSource : public virtual BaseHostDataSource { public: + /// @brief Constructor. + CacheHostDataSource() = default; - /// @brief Default destructor implementation. - virtual ~CacheHostDataSource() { } + /// @brief Default destructor. + virtual ~CacheHostDataSource() = default; /// @brief Insert a host into the cache. /// diff --git a/src/lib/dhcpsrv/cfg_hosts.h b/src/lib/dhcpsrv/cfg_hosts.h index 495cc81265..3ab7343b50 100644 --- a/src/lib/dhcpsrv/cfg_hosts.h +++ b/src/lib/dhcpsrv/cfg_hosts.h @@ -37,9 +37,11 @@ namespace dhcp { class CfgHosts : public BaseHostDataSource, public WritableHostDataSource, public isc::data::CfgToElement { public: + /// @brief Constructor. + CfgHosts() = default; /// @brief Destructor. - virtual ~CfgHosts() { } + virtual ~CfgHosts() = default; /// @brief Return all hosts connected to any subnet for which reservations /// have been made using a specified identifier. diff --git a/src/lib/dhcpsrv/cfgmgr.cc b/src/lib/dhcpsrv/cfgmgr.cc index c5324046ac..0bd9d56395 100644 --- a/src/lib/dhcpsrv/cfgmgr.cc +++ b/src/lib/dhcpsrv/cfgmgr.cc @@ -226,8 +226,5 @@ CfgMgr::CfgMgr() // See AM_CPPFLAGS definition in Makefile.am } -CfgMgr::~CfgMgr() { -} - } // end of isc::dhcp namespace } // end of isc namespace diff --git a/src/lib/dhcpsrv/cfgmgr.h b/src/lib/dhcpsrv/cfgmgr.h index 0302cf54e1..8ebb1357cd 100644 --- a/src/lib/dhcpsrv/cfgmgr.h +++ b/src/lib/dhcpsrv/cfgmgr.h @@ -294,7 +294,7 @@ protected: CfgMgr(); /// @brief virtual destructor - virtual ~CfgMgr(); + virtual ~CfgMgr() = default; private: diff --git a/src/lib/dhcpsrv/client_class_def.cc b/src/lib/dhcpsrv/client_class_def.cc index 48738aa9d4..fc1ea0d8f5 100644 --- a/src/lib/dhcpsrv/client_class_def.cc +++ b/src/lib/dhcpsrv/client_class_def.cc @@ -64,9 +64,6 @@ ClientClassDef::ClientClassDef(const ClientClassDef& rhs) filename_ = rhs.filename_; } -ClientClassDef::~ClientClassDef() { -} - std::string ClientClassDef::getName() const { return (name_); @@ -232,9 +229,6 @@ ClientClassDictionary::ClientClassDictionary(const ClientClassDictionary& rhs) } } -ClientClassDictionary::~ClientClassDictionary() { -} - void ClientClassDictionary::addClass(const std::string& name, const ExpressionPtr& match_expr, diff --git a/src/lib/dhcpsrv/client_class_def.h b/src/lib/dhcpsrv/client_class_def.h index 47b4baee60..85003eb01c 100644 --- a/src/lib/dhcpsrv/client_class_def.h +++ b/src/lib/dhcpsrv/client_class_def.h @@ -59,7 +59,7 @@ public: ClientClassDef(const ClientClassDef& rhs); /// @brief Destructor - virtual ~ClientClassDef(); + virtual ~ClientClassDef() = default; /// @brief Fetches the class's name std::string getName() const; @@ -287,10 +287,11 @@ public: /// @brief Constructor ClientClassDictionary(); + /// @brief Constructor ClientClassDictionary(const ClientClassDictionary& rhs); /// @brief Destructor - ~ClientClassDictionary(); + ~ClientClassDictionary() = default; /// @brief Adds a new class to the list /// diff --git a/src/lib/dhcpsrv/config_backend_dhcp4.h b/src/lib/dhcpsrv/config_backend_dhcp4.h index f7aaaf8c8e..5b19beedb2 100644 --- a/src/lib/dhcpsrv/config_backend_dhcp4.h +++ b/src/lib/dhcpsrv/config_backend_dhcp4.h @@ -84,9 +84,11 @@ namespace dhcp { /// however, be properly documented. class ConfigBackendDHCPv4 : public cb::BaseConfigBackend { public: + /// @brief Constructor + ConfigBackendDHCPv4() = default; /// @brief Virtual destructor. - virtual ~ConfigBackendDHCPv4() { } + virtual ~ConfigBackendDHCPv4() = default; /// @brief Retrieves a single subnet by subnet_prefix. /// diff --git a/src/lib/dhcpsrv/config_backend_dhcp6.h b/src/lib/dhcpsrv/config_backend_dhcp6.h index dd200cb760..068188a406 100644 --- a/src/lib/dhcpsrv/config_backend_dhcp6.h +++ b/src/lib/dhcpsrv/config_backend_dhcp6.h @@ -85,9 +85,11 @@ namespace dhcp { /// however, be properly documented. class ConfigBackendDHCPv6 : public cb::BaseConfigBackend { public: + /// @brief Constructor + ConfigBackendDHCPv6() = default; /// @brief Virtual destructor. - virtual ~ConfigBackendDHCPv6() { } + virtual ~ConfigBackendDHCPv6() = default; /// @brief Retrieves a single subnet by subnet_prefix. /// diff --git a/src/lib/dhcpsrv/cql_host_data_source.cc b/src/lib/dhcpsrv/cql_host_data_source.cc index 79ebecd7a4..a55fda64ae 100644 --- a/src/lib/dhcpsrv/cql_host_data_source.cc +++ b/src/lib/dhcpsrv/cql_host_data_source.cc @@ -131,7 +131,7 @@ public: CqlHostExchange(); /// @brief Virtual destructor. - virtual ~CqlHostExchange(); + virtual ~CqlHostExchange() = default; /// @brief Binds member variables to data array to receive @ref Host data. /// @@ -1450,9 +1450,6 @@ CqlHostExchange::CqlHostExchange() option_scope_id_(NULL_OPTION_SCOPE_ID) { } -CqlHostExchange::~CqlHostExchange() { -} - void CqlHostExchange::createBindForSelect(AnyArray& data, StatementTag /* not used */) { // Start with a fresh array. @@ -2055,7 +2052,10 @@ public: explicit CqlHostDataSourceImpl(const DatabaseConnection::ParameterMap& parameters); /// @brief Destructor. - virtual ~CqlHostDataSourceImpl(); + /// + /// There is no need to close the database in this destructor: it is + /// closed in the destructor of the dbconn_ member variable. + virtual ~CqlHostDataSourceImpl() = default; /// @brief Implementation of @ref CqlHostDataSource::add() and del() /// @@ -2529,11 +2529,6 @@ CqlHostDataSourceImpl::CqlHostDataSourceImpl(const DatabaseConnection::Parameter dbconn_.prepareStatements(CqlHostExchange::tagged_statements_); } -CqlHostDataSourceImpl::~CqlHostDataSourceImpl() { - // There is no need to close the database in this destructor: it is - // closed in the destructor of the dbconn_ member variable. -} - bool CqlHostDataSourceImpl::insertOrDelete(const HostPtr& host, bool insert) { // If there is no host, there is nothing to do. @@ -3451,10 +3446,6 @@ CqlHostDataSource::CqlHostDataSource(const DatabaseConnection::ParameterMap& par : impl_(new CqlHostDataSourceImpl(parameters)) { } -CqlHostDataSource::~CqlHostDataSource() { - delete impl_; -} - void CqlHostDataSource::add(const HostPtr& host) { LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_HOST_ADD); diff --git a/src/lib/dhcpsrv/cql_host_data_source.h b/src/lib/dhcpsrv/cql_host_data_source.h index fd17b762cb..c8480fe9e5 100644 --- a/src/lib/dhcpsrv/cql_host_data_source.h +++ b/src/lib/dhcpsrv/cql_host_data_source.h @@ -30,6 +30,9 @@ namespace dhcp { /// @brief Forward declaration to the implementation of @ref CqlHostDataSource. class CqlHostDataSourceImpl; +/// @brief CqlHostDataSourceImpl pointer +typedef boost::shared_ptr CqlHostDataSourceImplPtr; + /// @brief Cassandra host data source /// /// Implements @ref isc::dhcp::BaseHostDataSource interface customized to @@ -91,7 +94,7 @@ public: /// @brief Virtual destructor. /// /// Releases prepared CQL statements used by the backend. - virtual ~CqlHostDataSource(); + virtual ~CqlHostDataSource() = default; /// @brief Adds a new host to the collection. /// @@ -461,7 +464,7 @@ public: private: /// @brief Pointer to the implementation of the @ref CqlHostDataSource. - CqlHostDataSourceImpl* impl_; + CqlHostDataSourceImplPtr impl_; }; // class CqlHostDataSource } // namespace dhcp diff --git a/src/lib/dhcpsrv/cql_lease_mgr.cc b/src/lib/dhcpsrv/cql_lease_mgr.cc index 5d4ce28b30..91ea35b261 100644 --- a/src/lib/dhcpsrv/cql_lease_mgr.cc +++ b/src/lib/dhcpsrv/cql_lease_mgr.cc @@ -1748,7 +1748,7 @@ public: } /// @brief Destructor - virtual ~CqlLeaseStatsQuery() {}; + virtual ~CqlLeaseStatsQuery() = default; /// @brief Creates the lease statistical data result set /// @@ -2119,11 +2119,6 @@ CqlLeaseMgr::CqlLeaseMgr(const DatabaseConnection::ParameterMap ¶meters) dbconn_.prepareStatements(CqlLeaseStatsQuery::tagged_statements_); } -CqlLeaseMgr::~CqlLeaseMgr() { - // There is no need to close the database in this destructor: it is - // closed in the destructor of the dbconn_ member variable. -} - std::string CqlLeaseMgr::getDBVersion() { std::stringstream tmp; diff --git a/src/lib/dhcpsrv/cql_lease_mgr.h b/src/lib/dhcpsrv/cql_lease_mgr.h index c874cee410..49b0d6501e 100644 --- a/src/lib/dhcpsrv/cql_lease_mgr.h +++ b/src/lib/dhcpsrv/cql_lease_mgr.h @@ -73,7 +73,10 @@ public: explicit CqlLeaseMgr(const db::DatabaseConnection::ParameterMap& parameters); /// @brief Destructor (closes database) - virtual ~CqlLeaseMgr(); + /// + /// There is no need to close the database in this destructor: it is + /// closed in the destructor of the dbconn_ member variable. + virtual ~CqlLeaseMgr() = default; /// @brief Local version of getDBVersion() class method static std::string getDBVersion(); diff --git a/src/lib/dhcpsrv/d2_client_cfg.cc b/src/lib/dhcpsrv/d2_client_cfg.cc index 78d7ffd75c..8ffd81ccdd 100644 --- a/src/lib/dhcpsrv/d2_client_cfg.cc +++ b/src/lib/dhcpsrv/d2_client_cfg.cc @@ -112,8 +112,6 @@ D2ClientConfig::D2ClientConfig() validateContents(); } -D2ClientConfig::~D2ClientConfig(){}; - void D2ClientConfig::enableUpdates(bool enable) { enable_updates_ = enable; diff --git a/src/lib/dhcpsrv/d2_client_cfg.h b/src/lib/dhcpsrv/d2_client_cfg.h index 98c77a515e..c835bdc018 100644 --- a/src/lib/dhcpsrv/d2_client_cfg.h +++ b/src/lib/dhcpsrv/d2_client_cfg.h @@ -108,7 +108,7 @@ public: D2ClientConfig(); /// @brief Destructor - virtual ~D2ClientConfig(); + virtual ~D2ClientConfig() = default; /// @brief Return whether or not DHCP-DDNS updating is enabled. bool getEnableUpdates() const { diff --git a/src/lib/dhcpsrv/d2_client_mgr.cc b/src/lib/dhcpsrv/d2_client_mgr.cc index 6671471309..3d24bf097f 100644 --- a/src/lib/dhcpsrv/d2_client_mgr.cc +++ b/src/lib/dhcpsrv/d2_client_mgr.cc @@ -25,8 +25,11 @@ D2ClientMgr::D2ClientMgr() : d2_client_config_(new D2ClientConfig()), // Default constructor initializes with a disabled configuration. } -D2ClientMgr::~D2ClientMgr(){ - stopSender(); +D2ClientMgr::~D2ClientMgr() { + try { + stopSender(); + } catch (...) { + } } void diff --git a/src/lib/dhcpsrv/dhcp4o6_ipc.cc b/src/lib/dhcpsrv/dhcp4o6_ipc.cc index 742b9541c6..6f120a0992 100644 --- a/src/lib/dhcpsrv/dhcp4o6_ipc.cc +++ b/src/lib/dhcpsrv/dhcp4o6_ipc.cc @@ -30,10 +30,14 @@ using namespace std; namespace isc { namespace dhcp { -Dhcp4o6IpcBase::Dhcp4o6IpcBase() : port_(0), socket_fd_(-1) {} +Dhcp4o6IpcBase::Dhcp4o6IpcBase() : port_(0), socket_fd_(-1) { +} Dhcp4o6IpcBase::~Dhcp4o6IpcBase() { - close(); + try { + close(); + } catch (...) { + } } int Dhcp4o6IpcBase::open(uint16_t port, EndpointType endpoint_type) { diff --git a/src/lib/dhcpsrv/fuzz.cc b/src/lib/dhcpsrv/fuzz.cc index a62d7a6798..3424a9d143 100644 --- a/src/lib/dhcpsrv/fuzz.cc +++ b/src/lib/dhcpsrv/fuzz.cc @@ -106,7 +106,10 @@ Fuzz::Fuzz(int ipversion, uint16_t port) : // Destructor Fuzz::~Fuzz() { - static_cast(close(sockfd_)); + try { + static_cast(close(sockfd_)); + } catch (...) { + } } // Set up address structures. diff --git a/src/lib/dhcpsrv/host_data_source_factory.cc b/src/lib/dhcpsrv/host_data_source_factory.cc index cb66041e4b..e381e36c69 100644 --- a/src/lib/dhcpsrv/host_data_source_factory.cc +++ b/src/lib/dhcpsrv/host_data_source_factory.cc @@ -200,7 +200,10 @@ struct MySqlHostDataSourceInit { // Destructor deregisters ~MySqlHostDataSourceInit() { - HostDataSourceFactory::deregisterFactory("mysql", true); + try { + HostDataSourceFactory::deregisterFactory("mysql", true); + } catch (...) { + } } // Factory class method @@ -225,7 +228,10 @@ struct PgSqlHostDataSourceInit { // Destructor deregisters ~PgSqlHostDataSourceInit() { - HostDataSourceFactory::deregisterFactory("postgresql", true); + try { + HostDataSourceFactory::deregisterFactory("postgresql", true); + } catch (...) { + } } // Factory class method @@ -250,7 +256,10 @@ struct CqlHostDataSourceInit { // Destructor deregisters ~CqlHostDataSourceInit() { - HostDataSourceFactory::deregisterFactory("cql", true); + try { + HostDataSourceFactory::deregisterFactory("cql", true); + } catch (...) { + } } // Factory class method diff --git a/src/lib/dhcpsrv/lease.h b/src/lib/dhcpsrv/lease.h index 448c954b07..5f913379d2 100644 --- a/src/lib/dhcpsrv/lease.h +++ b/src/lib/dhcpsrv/lease.h @@ -111,7 +111,7 @@ struct Lease : public isc::data::UserContext, public isc::data::CfgToElement { const HWAddrPtr& hwaddr); /// @brief Destructor - virtual ~Lease() {} + virtual ~Lease() = default; /// @brief IPv4 ot IPv6 address /// diff --git a/src/lib/dhcpsrv/lease_file_stats.h b/src/lib/dhcpsrv/lease_file_stats.h index 6a46480fac..16eed843b4 100644 --- a/src/lib/dhcpsrv/lease_file_stats.h +++ b/src/lib/dhcpsrv/lease_file_stats.h @@ -25,8 +25,7 @@ public: } /// @brief Destructor - ~LeaseFileStats() { - } + ~LeaseFileStats() = default; /// @brief Gets the number of attempts to read a lease uint32_t getReads() const { diff --git a/src/lib/dhcpsrv/lease_mgr.h b/src/lib/dhcpsrv/lease_mgr.h index 261780d375..fe3fe3db33 100644 --- a/src/lib/dhcpsrv/lease_mgr.h +++ b/src/lib/dhcpsrv/lease_mgr.h @@ -156,8 +156,8 @@ public: /// @throw BadValue if either value given is 0 or if last <= first. LeaseStatsQuery(const SubnetID& first_subnet_id, const SubnetID& last_subnet_id); - /// @brief virtual destructor - virtual ~LeaseStatsQuery() {}; + /// @brief Virtual destructor + virtual ~LeaseStatsQuery() = default; /// @brief Executes the query /// @@ -222,13 +222,10 @@ typedef boost::shared_ptr LeaseStatsRowPtr; class LeaseMgr { public: /// @brief Constructor - /// - LeaseMgr() - {} + LeaseMgr() = default; /// @brief Destructor - virtual ~LeaseMgr() - {} + virtual ~LeaseMgr() = default; /// @brief Class method to return extended version info /// This class method must be redeclared and redefined in derived classes diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index da1b31c61b..9d35c81e9e 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -145,6 +145,7 @@ LFCSetup::~LFCSetup() { // we don't want an error message output during shutdown. LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_MEMFILE_LFC_UNREGISTER_TIMER_FAILED).arg(ex.what()); + } catch (...) { } } @@ -262,14 +263,14 @@ public: /// MemfileLeaseStatsQuery() : rows_(0), next_pos_(rows_.end()) { - }; + } /// @brief Constructor for single subnet query /// /// @param subnet_id ID of the desired subnet MemfileLeaseStatsQuery(const SubnetID& subnet_id) : LeaseStatsQuery(subnet_id), rows_(0), next_pos_(rows_.end()) { - }; + } /// @brief Constructor for subnet range query /// @@ -277,10 +278,10 @@ public: /// @param last_subnet_id ID of the last subnet in the desired range MemfileLeaseStatsQuery(const SubnetID& first_subnet_id, const SubnetID& last_subnet_id) : LeaseStatsQuery(first_subnet_id, last_subnet_id), rows_(0), next_pos_(rows_.end()) { - }; + } /// @brief Destructor - virtual ~MemfileLeaseStatsQuery() {}; + virtual ~MemfileLeaseStatsQuery() = default; /// @brief Fetches the next row in the result set /// @@ -331,7 +332,7 @@ public: /// @param storage4 A pointer to the v4 lease storage to be counted MemfileLeaseStatsQuery4(Lease4Storage& storage4) : MemfileLeaseStatsQuery(), storage4_(storage4) { - }; + } /// @brief Constructor for a single subnet query /// @@ -339,7 +340,7 @@ public: /// @param subnet_id ID of the desired subnet MemfileLeaseStatsQuery4(Lease4Storage& storage4, const SubnetID& subnet_id) : MemfileLeaseStatsQuery(subnet_id), storage4_(storage4) { - }; + } /// @brief Constructor for a subnet range query /// @@ -349,10 +350,10 @@ public: MemfileLeaseStatsQuery4(Lease4Storage& storage4, const SubnetID& first_subnet_id, const SubnetID& last_subnet_id) : MemfileLeaseStatsQuery(first_subnet_id, last_subnet_id), storage4_(storage4) { - }; + } /// @brief Destructor - virtual ~MemfileLeaseStatsQuery4() {}; + virtual ~MemfileLeaseStatsQuery4() = default; /// @brief Creates the IPv4 lease statistical data result set /// @@ -473,7 +474,7 @@ public: /// @param storage6 A pointer to the v6 lease storage to be counted MemfileLeaseStatsQuery6(Lease6Storage& storage6) : MemfileLeaseStatsQuery(), storage6_(storage6) { - }; + } /// @brief Constructor for a single subnet query /// @@ -481,7 +482,7 @@ public: /// @param subnet_id ID of the desired subnet MemfileLeaseStatsQuery6(Lease6Storage& storage6, const SubnetID& subnet_id) : MemfileLeaseStatsQuery(subnet_id), storage6_(storage6) { - }; + } /// @brief Constructor for a subnet range query /// @@ -491,10 +492,10 @@ public: MemfileLeaseStatsQuery6(Lease6Storage& storage6, const SubnetID& first_subnet_id, const SubnetID& last_subnet_id) : MemfileLeaseStatsQuery(first_subnet_id, last_subnet_id), storage6_(storage6) { - }; + } /// @brief Destructor - virtual ~MemfileLeaseStatsQuery6() {}; + virtual ~MemfileLeaseStatsQuery6() = default; /// @brief Creates the IPv6 lease statistical data result set /// @@ -668,13 +669,16 @@ Memfile_LeaseMgr::Memfile_LeaseMgr(const DatabaseConnection::ParameterMap& param } Memfile_LeaseMgr::~Memfile_LeaseMgr() { - if (lease_file4_) { - lease_file4_->close(); - lease_file4_.reset(); - } - if (lease_file6_) { - lease_file6_->close(); - lease_file6_.reset(); + try { + if (lease_file4_) { + lease_file4_->close(); + lease_file4_.reset(); + } + if (lease_file6_) { + lease_file6_->close(); + lease_file6_.reset(); + } + } catch (...) { } } diff --git a/src/lib/dhcpsrv/mysql_host_data_source.cc b/src/lib/dhcpsrv/mysql_host_data_source.cc index bbbba6c2cf..b81fcceb7a 100644 --- a/src/lib/dhcpsrv/mysql_host_data_source.cc +++ b/src/lib/dhcpsrv/mysql_host_data_source.cc @@ -148,11 +148,10 @@ public: columns_[13] = "auth_key"; BOOST_STATIC_ASSERT(13 < HOST_COLUMNS); - }; + } /// @brief Virtual destructor. - virtual ~MySqlHostExchange() { - } + virtual ~MySqlHostExchange() = default; /// @brief Returns index of the first uninitialized column name. /// @@ -179,7 +178,7 @@ public: /// This method is used by derived classes. uint64_t getHostId() const { return (host_id_); - }; + } /// @brief Set error indicators /// @@ -197,7 +196,7 @@ public: error[i] = MLM_FALSE; bind[i].error = reinterpret_cast(&error[i]); } - }; + } /// @brief Return columns in error /// @@ -231,7 +230,7 @@ public: } return (result); - }; + } /// @brief Create MYSQL_BIND objects for Host Pointer /// @@ -399,7 +398,7 @@ public: vec.push_back(bind_[3]); // subnet_id } return (vec); - }; + } /// @brief Create BIND array to receive Host data. /// @@ -531,7 +530,7 @@ public: // Add the data to the vector. Note the end element is one after the // end of the array. return (bind_); - }; + } /// @brief Copy received data into Host object /// @@ -651,7 +650,7 @@ public: } return (h); - }; + } /// @brief Processes one row of data fetched from a database. /// @@ -691,7 +690,7 @@ public: /// "(None)". std::string getErrorColumns() { return (getColumnsInError(error_, columns_)); - }; + } protected: @@ -1316,7 +1315,7 @@ public: setErrorIndicators(bind_, error_); return (bind_); - }; + } private: @@ -1401,7 +1400,7 @@ public: return (reservation_id_); } return (0); - }; + } /// @brief Creates IPv6 reservation from the data contained in the /// currently processed row. @@ -1433,7 +1432,7 @@ public: std::string address = ipv6_address_buffer_; IPv6Resrv r(type, IOAddress(address), prefix_len_); return (r); - }; + } /// @brief Processes one row of data fetched from a database. /// @@ -1529,7 +1528,7 @@ public: setErrorIndicators(bind_, error_); return (bind_); - }; + } private: @@ -2067,7 +2066,7 @@ public: MySqlHostDataSourceImpl(const DatabaseConnection::ParameterMap& parameters); /// @brief Destructor. - ~MySqlHostDataSourceImpl(); + ~MySqlHostDataSourceImpl() = default; /// @brief Attempts to reconnect the server to the host DB backend manager. /// @@ -2766,15 +2765,18 @@ MySqlHostDataSource::MySqlHostContextAlloc::MySqlHostContextAlloc( } MySqlHostDataSource::MySqlHostContextAlloc::~MySqlHostContextAlloc() { - if (MultiThreadingMgr::instance().getMode()) { - // multi-threaded - lock_guard lock(mgr_.pool_->mutex_); - mgr_.pool_->pool_.push_back(ctx_); - if (ctx_->conn_.isUnusable()) { + try { + if (MultiThreadingMgr::instance().getMode()) { + // multi-threaded + lock_guard lock(mgr_.pool_->mutex_); + mgr_.pool_->pool_.push_back(ctx_); + if (ctx_->conn_.isUnusable()) { + mgr_.unusable_ = true; + } + } else if (ctx_->conn_.isUnusable()) { mgr_.unusable_ = true; } - } else if (ctx_->conn_.isUnusable()) { - mgr_.unusable_ = true; + } catch (...) { } } @@ -2849,9 +2851,6 @@ MySqlHostDataSourceImpl::createContext() const { return (ctx); } -MySqlHostDataSourceImpl::~MySqlHostDataSourceImpl() { -} - bool MySqlHostDataSourceImpl::dbReconnect(ReconnectCtlPtr db_reconnect_ctl) { MultiThreadingCriticalSection cs; @@ -3159,9 +3158,6 @@ MySqlHostDataSource::MySqlHostDataSource(const DatabaseConnection::ParameterMap& : impl_(new MySqlHostDataSourceImpl(parameters)) { } -MySqlHostDataSource::~MySqlHostDataSource() { -} - DatabaseConnection::ParameterMap MySqlHostDataSource::getParameters() const { return impl_->parameters_; diff --git a/src/lib/dhcpsrv/mysql_host_data_source.h b/src/lib/dhcpsrv/mysql_host_data_source.h index 879eb7e3b6..3f677f11cd 100644 --- a/src/lib/dhcpsrv/mysql_host_data_source.h +++ b/src/lib/dhcpsrv/mysql_host_data_source.h @@ -68,7 +68,7 @@ public: /// @brief Virtual destructor. /// /// Releases prepared MySQL statements used by the backend. - virtual ~MySqlHostDataSource(); + virtual ~MySqlHostDataSource() = default; /// @brief Return backend parameters /// diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.cc b/src/lib/dhcpsrv/mysql_lease_mgr.cc index f7668540ea..d6aa1a0e18 100644 --- a/src/lib/dhcpsrv/mysql_lease_mgr.cc +++ b/src/lib/dhcpsrv/mysql_lease_mgr.cc @@ -1570,7 +1570,10 @@ public: /// @brief Destructor virtual ~MySqlLeaseStatsQuery() { - (void) mysql_stmt_free_result(statement_); + try { + (void) mysql_stmt_free_result(statement_); + } catch (...) { + } } /// @brief Creates the IPv4 lease statistical data result set @@ -1770,12 +1773,15 @@ MySqlLeaseMgr::MySqlLeaseContextAlloc::MySqlLeaseContextAlloc( } MySqlLeaseMgr::MySqlLeaseContextAlloc::~MySqlLeaseContextAlloc() { - if (MultiThreadingMgr::instance().getMode()) { - // multi-threaded - lock_guard lock(mgr_.pool_->mutex_); - mgr_.pool_->pool_.push_back(ctx_); + try { + if (MultiThreadingMgr::instance().getMode()) { + // multi-threaded + lock_guard lock(mgr_.pool_->mutex_); + mgr_.pool_->pool_.push_back(ctx_); + } + // If running in single-threaded mode, there's nothing to do here. + } catch (...) { } - // If running in single-threaded mode, there's nothing to do here. } // MySqlLeaseMgr Constructor and Destructor @@ -1805,9 +1811,6 @@ MySqlLeaseMgr::MySqlLeaseMgr(const DatabaseConnection::ParameterMap& parameters) pool_->pool_.push_back(createContext()); } -MySqlLeaseMgr::~MySqlLeaseMgr() { -} - bool MySqlLeaseMgr::dbReconnect(ReconnectCtlPtr db_reconnect_ctl) { MultiThreadingCriticalSection cs; diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.h b/src/lib/dhcpsrv/mysql_lease_mgr.h index edad80c4a6..5edb85981a 100644 --- a/src/lib/dhcpsrv/mysql_lease_mgr.h +++ b/src/lib/dhcpsrv/mysql_lease_mgr.h @@ -114,7 +114,7 @@ public: MySqlLeaseMgr(const db::DatabaseConnection::ParameterMap& parameters); /// @brief Destructor (closes database) - virtual ~MySqlLeaseMgr(); + virtual ~MySqlLeaseMgr() = default; /// @brief Create a new context. /// diff --git a/src/lib/dhcpsrv/network.h b/src/lib/dhcpsrv/network.h index 1ca386f7f5..65d128e2d9 100644 --- a/src/lib/dhcpsrv/network.h +++ b/src/lib/dhcpsrv/network.h @@ -195,7 +195,7 @@ public: /// @brief Virtual destructor. /// /// Does nothing at the moment. - virtual ~Network() { }; + virtual ~Network() = default; /// @brief Sets the optional callback function used to fetch globally /// configured parameters. diff --git a/src/lib/dhcpsrv/network_state.cc b/src/lib/dhcpsrv/network_state.cc index 14e4fe7efb..632422c3b8 100644 --- a/src/lib/dhcpsrv/network_state.cc +++ b/src/lib/dhcpsrv/network_state.cc @@ -41,8 +41,11 @@ public: /// @brief Destructor. ~NetworkStateImpl() { - destroyTimer(NetworkState::Origin::USER_COMMAND); - destroyTimer(NetworkState::Origin::HA_COMMAND); + try { + destroyTimer(NetworkState::Origin::USER_COMMAND); + destroyTimer(NetworkState::Origin::HA_COMMAND); + } catch (...) { + } } /// @brief Sets appropriate disabled or enabled DHCP service state for the diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.h b/src/lib/dhcpsrv/parsers/dhcp_parsers.h index ba040773a3..10c497dde8 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.h +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.h @@ -289,9 +289,11 @@ typedef boost::shared_ptr PoolStoragePtr; class PoolParser : public isc::data::SimpleParser { public: - /// @brief destructor. - virtual ~PoolParser() { - } + /// @brief Constructor. + PoolParser() = default; + + /// @brief Destructor. + virtual ~PoolParser() = default; /// @brief parses the actual structure /// @@ -366,9 +368,11 @@ protected: class PoolsListParser : public isc::data::SimpleParser { public: - /// @brief destructor. - virtual ~PoolsListParser() { - } + /// @brief Constructor. + PoolsListParser() = default; + + /// @brief Destructor. + virtual ~PoolsListParser() = default; /// @brief parses the actual structure /// @@ -476,7 +480,7 @@ public: explicit SubnetConfigParser(uint16_t family, bool check_iface = true); /// @brief virtual destructor (does nothing) - virtual ~SubnetConfigParser() { } + virtual ~SubnetConfigParser() = default; protected: /// @brief parses a subnet description and returns Subnet{4,6} structure diff --git a/src/lib/dhcpsrv/parsers/expiration_config_parser.h b/src/lib/dhcpsrv/parsers/expiration_config_parser.h index 44ba77d6e0..c2bf826596 100644 --- a/src/lib/dhcpsrv/parsers/expiration_config_parser.h +++ b/src/lib/dhcpsrv/parsers/expiration_config_parser.h @@ -39,8 +39,11 @@ namespace dhcp { class ExpirationConfigParser : public isc::data::SimpleParser { public: + /// @brief Constructor. + ExpirationConfigParser() = default; + /// @brief Destructor. - virtual ~ExpirationConfigParser() { } + virtual ~ExpirationConfigParser() = default; /// @brief Parses parameters in the JSON map, pertaining to the processing /// of the expired leases. @@ -50,7 +53,6 @@ public: /// @throw DhcpConfigError if unknown parameter specified or the /// parameter contains invalid value.. void parse(isc::data::ConstElementPtr expiration_config); - }; } // end of namespace isc::dhcp diff --git a/src/lib/dhcpsrv/parsers/host_reservation_parser.cc b/src/lib/dhcpsrv/parsers/host_reservation_parser.cc index 38a8915b41..b68c3de752 100644 --- a/src/lib/dhcpsrv/parsers/host_reservation_parser.cc +++ b/src/lib/dhcpsrv/parsers/host_reservation_parser.cc @@ -351,10 +351,6 @@ HostReservationParser6::getSupportedParameters(const bool identifiers_only) cons return (getSupportedParams6(identifiers_only)); } -HostReservationIdsParser::HostReservationIdsParser() - : staging_cfg_() { -} - void HostReservationIdsParser::parse(isc::data::ConstElementPtr ids_list) { parseInternal(ids_list); diff --git a/src/lib/dhcpsrv/parsers/host_reservation_parser.h b/src/lib/dhcpsrv/parsers/host_reservation_parser.h index b6542c4af7..6d19729d87 100644 --- a/src/lib/dhcpsrv/parsers/host_reservation_parser.h +++ b/src/lib/dhcpsrv/parsers/host_reservation_parser.h @@ -18,8 +18,11 @@ namespace dhcp { class HostReservationParser : public isc::data::SimpleParser { public: + /// @brief Constructor. + HostReservationParser() = default; + /// @brief Destructor. - virtual ~HostReservationParser() { } + virtual ~HostReservationParser() = default; /// @brief Parses a single entry for host reservation. /// @@ -141,10 +144,10 @@ class HostReservationIdsParser : public isc::data::SimpleParser { public: /// @brief Constructor. - HostReservationIdsParser(); + HostReservationIdsParser() = default; /// @brief Destructor. - virtual ~HostReservationIdsParser() { } + virtual ~HostReservationIdsParser() = default; /// @brief Parses a list of host identifiers. /// diff --git a/src/lib/dhcpsrv/pgsql_host_data_source.cc b/src/lib/dhcpsrv/pgsql_host_data_source.cc index 1f5164494d..45990ca76a 100644 --- a/src/lib/dhcpsrv/pgsql_host_data_source.cc +++ b/src/lib/dhcpsrv/pgsql_host_data_source.cc @@ -141,8 +141,7 @@ public: }; /// @brief Virtual destructor. - virtual ~PgSqlHostExchange() { - } + virtual ~PgSqlHostExchange() = default; /// @brief Reinitializes state information /// @@ -1428,7 +1427,7 @@ public: PgSqlHostDataSourceImpl(const DatabaseConnection::ParameterMap& parameters); /// @brief Destructor. - ~PgSqlHostDataSourceImpl(); + ~PgSqlHostDataSourceImpl() = default; /// @brief Attempts to reconnect the server to the host DB backend manager. /// @@ -2206,15 +2205,18 @@ PgSqlHostDataSource::PgSqlHostContextAlloc::PgSqlHostContextAlloc( } PgSqlHostDataSource::PgSqlHostContextAlloc::~PgSqlHostContextAlloc() { - if (MultiThreadingMgr::instance().getMode()) { - // multi-threaded - lock_guard lock(mgr_.pool_->mutex_); - mgr_.pool_->pool_.push_back(ctx_); - if (ctx_->conn_.isUnusable()) { + try { + if (MultiThreadingMgr::instance().getMode()) { + // multi-threaded + lock_guard lock(mgr_.pool_->mutex_); + mgr_.pool_->pool_.push_back(ctx_); + if (ctx_->conn_.isUnusable()) { + mgr_.unusable_ = true; + } + } else if (ctx_->conn_.isUnusable()) { mgr_.unusable_ = true; } - } else if (ctx_->conn_.isUnusable()) { - mgr_.unusable_ = true; + } catch (...) { } } @@ -2284,9 +2286,6 @@ PgSqlHostDataSourceImpl::createContext() const { return (ctx); } -PgSqlHostDataSourceImpl::~PgSqlHostDataSourceImpl() { -} - bool PgSqlHostDataSourceImpl::dbReconnect(ReconnectCtlPtr db_reconnect_ctl) { MultiThreadingCriticalSection cs; @@ -2567,9 +2566,6 @@ PgSqlHostDataSource::PgSqlHostDataSource(const DatabaseConnection::ParameterMap& : impl_(new PgSqlHostDataSourceImpl(parameters)) { } -PgSqlHostDataSource::~PgSqlHostDataSource() { -} - DatabaseConnection::ParameterMap PgSqlHostDataSource::getParameters() const { return impl_->parameters_; diff --git a/src/lib/dhcpsrv/pgsql_host_data_source.h b/src/lib/dhcpsrv/pgsql_host_data_source.h index 7fb251054a..6964f986d3 100644 --- a/src/lib/dhcpsrv/pgsql_host_data_source.h +++ b/src/lib/dhcpsrv/pgsql_host_data_source.h @@ -70,9 +70,10 @@ public: PgSqlHostDataSource(const db::DatabaseConnection::ParameterMap& parameters); /// @brief Virtual destructor. + /// /// Frees database resources and closes the database connection through /// the destruction of member impl_. - virtual ~PgSqlHostDataSource(); + virtual ~PgSqlHostDataSource() = default; /// @brief Return backend parameters /// diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.cc b/src/lib/dhcpsrv/pgsql_lease_mgr.cc index 8b009f7e27..e2da025e79 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.cc +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.cc @@ -374,7 +374,7 @@ namespace dhcp { /// database. class PgSqlLeaseExchange : public PgSqlExchange { public: - + /// @brief Constructor PgSqlLeaseExchange() : addr_str_(""), hwaddr_length_(0), hwaddr_(hwaddr_length_), valid_lifetime_(0), valid_lifetime_str_(""), expire_(0), @@ -383,7 +383,8 @@ public: user_context_("") { } - virtual ~PgSqlLeaseExchange(){} + /// @brief Destructor + virtual ~PgSqlLeaseExchange() = default; protected: @@ -1042,7 +1043,7 @@ public: } /// @brief Destructor - virtual ~PgSqlLeaseStatsQuery() {}; + virtual ~PgSqlLeaseStatsQuery() = default; /// @brief Creates the lease statistical data result set /// @@ -1204,12 +1205,15 @@ PgSqlLeaseMgr::PgSqlLeaseContextAlloc::PgSqlLeaseContextAlloc( } PgSqlLeaseMgr::PgSqlLeaseContextAlloc::~PgSqlLeaseContextAlloc() { - if (MultiThreadingMgr::instance().getMode()) { - // multi-threaded - lock_guard lock(mgr_.pool_->mutex_); - mgr_.pool_->pool_.push_back(ctx_); + try { + if (MultiThreadingMgr::instance().getMode()) { + // multi-threaded + lock_guard lock(mgr_.pool_->mutex_); + mgr_.pool_->pool_.push_back(ctx_); + } + // If running in single-threaded mode, there's nothing to do here. + } catch (...) { } - // If running in single-threaded mode, there's nothing to do here. } // PgSqlLeaseMgr Constructor and Destructor @@ -1239,9 +1243,6 @@ PgSqlLeaseMgr::PgSqlLeaseMgr(const DatabaseConnection::ParameterMap& parameters) pool_->pool_.push_back(createContext()); } -PgSqlLeaseMgr::~PgSqlLeaseMgr() { -} - bool PgSqlLeaseMgr::dbReconnect(ReconnectCtlPtr db_reconnect_ctl) { MultiThreadingCriticalSection cs; diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.h b/src/lib/dhcpsrv/pgsql_lease_mgr.h index 6ea58ca0c1..769140421f 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.h +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.h @@ -113,7 +113,7 @@ public: PgSqlLeaseMgr(const db::DatabaseConnection::ParameterMap& parameters); /// @brief Destructor (closes database) - virtual ~PgSqlLeaseMgr(); + virtual ~PgSqlLeaseMgr() = default; /// @brief Create a new context. /// diff --git a/src/lib/dhcpsrv/pool.h b/src/lib/dhcpsrv/pool.h index 95f89cfbf5..7f7e078e71 100644 --- a/src/lib/dhcpsrv/pool.h +++ b/src/lib/dhcpsrv/pool.h @@ -75,8 +75,7 @@ public: /// We need Pool to be a polymorphic class, so we could dynamic cast /// from PoolPtr to Pool6Ptr if we need to. A class becomes polymorphic, /// when there is at least one virtual method. - virtual ~Pool() { - } + virtual ~Pool() = default; /// @brief Returns the number of all leases in this pool. /// diff --git a/src/lib/dhcpsrv/resource_handler.cc b/src/lib/dhcpsrv/resource_handler.cc index 9ae2ee55b7..fde8c01d8d 100644 --- a/src/lib/dhcpsrv/resource_handler.cc +++ b/src/lib/dhcpsrv/resource_handler.cc @@ -20,15 +20,15 @@ mutex ResourceHandler::mutex_; ResourceHandler::ResourceContainer ResourceHandler::resources_; -ResourceHandler::ResourceHandler() : owned_() { -} - ResourceHandler::~ResourceHandler() { - lock_guard lock_(mutex_); - for (auto res : owned_) { - unLockInternal(res->type_, res->addr_); + try { + lock_guard lock_(mutex_); + for (auto res : owned_) { + unLockInternal(res->type_, res->addr_); + } + owned_.clear(); + } catch (...) { } - owned_.clear(); } ResourceHandler::ResourcePtr diff --git a/src/lib/dhcpsrv/resource_handler.h b/src/lib/dhcpsrv/resource_handler.h index 6430d6101d..8170b39aaa 100644 --- a/src/lib/dhcpsrv/resource_handler.h +++ b/src/lib/dhcpsrv/resource_handler.h @@ -28,7 +28,7 @@ class ResourceHandler : public boost::noncopyable { public: /// @brief Constructor. - ResourceHandler(); + ResourceHandler() = default; /// @brief Destructor. /// @@ -171,11 +171,13 @@ private: /// @brief Resource race avoidance RAII handler for DHCPv4. class ResourceHandler4 : public ResourceHandler { public: + /// @brief Constructor. + ResourceHandler4() = default; /// @brief Destructor. /// /// Releases owned resources. - virtual ~ResourceHandler4() { } + virtual ~ResourceHandler4() = default; /// @brief Tries to acquires a resource. /// diff --git a/src/lib/dhcpsrv/srv_config.cc b/src/lib/dhcpsrv/srv_config.cc index 10bb2d6c58..9efd1a638b 100644 --- a/src/lib/dhcpsrv/srv_config.cc +++ b/src/lib/dhcpsrv/srv_config.cc @@ -64,7 +64,8 @@ SrvConfig::SrvConfig(const uint32_t sequence) decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0), d2_client_config_(new D2ClientConfig()), configured_globals_(Element::createMap()), - cfg_consist_(new CfgConsistency()) { + cfg_consist_(new CfgConsistency()), + lenient_option_parsing_(false) { } std::string diff --git a/src/lib/dhcpsrv/subnet.h b/src/lib/dhcpsrv/subnet.h index 07458b25cf..2fa0449814 100644 --- a/src/lib/dhcpsrv/subnet.h +++ b/src/lib/dhcpsrv/subnet.h @@ -329,7 +329,7 @@ protected: /// /// A virtual destructor is needed because other classes /// derive from this class. - virtual ~Subnet() { }; + virtual ~Subnet() = default; /// @brief keeps the subnet-id value. /// diff --git a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc index 4582df84c0..e598de10a0 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc @@ -3991,7 +3991,7 @@ public: } /// @brief Destructor - virtual ~AllocEngine6ExtendedInfoTest(){}; + virtual ~AllocEngine6ExtendedInfoTest() = default; /// Configuration elements. These are initialized in the constructor /// and are used throughout the tests. diff --git a/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc index c758e476c0..35ff3aefdf 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc @@ -196,32 +196,35 @@ public: /// Stops D2 client (if running), clears configuration and removes /// an instance of the lease manager. virtual ~ExpirationAllocEngineTest() { - // Stop D2 client if running and remove all queued name change - // requests. - D2ClientMgr& mgr = CfgMgr::instance().getD2ClientMgr(); - if (mgr.amSending()) { - mgr.stopSender(); - mgr.clearQueue(); - } + try { + // Stop D2 client if running and remove all queued name change + // requests. + D2ClientMgr& mgr = CfgMgr::instance().getD2ClientMgr(); + if (mgr.amSending()) { + mgr.stopSender(); + mgr.clearQueue(); + } - // Clear configuration. - CfgMgr::instance().clear(); - D2ClientConfigPtr cfg(new D2ClientConfig()); - CfgMgr::instance().setD2ClientConfig(cfg); + // Clear configuration. + CfgMgr::instance().clear(); + D2ClientConfigPtr cfg(new D2ClientConfig()); + CfgMgr::instance().setD2ClientConfig(cfg); - // Remove all statistics. - StatsMgr::instance().resetAll(); + // Remove all statistics. + StatsMgr::instance().resetAll(); - // Kill lease manager. - LeaseMgrFactory::destroy(); + // Kill lease manager. + LeaseMgrFactory::destroy(); - // Remove callouts executed. - callouts_.clear(); + // Remove callouts executed. + callouts_.clear(); - // Unload libraries. - bool status = HooksManager::unloadLibraries(); - if (!status) { - cerr << "(fixture dtor) unloadLibraries failed" << endl; + // Unload libraries. + bool status = HooksManager::unloadLibraries(); + if (!status) { + cerr << "(fixture dtor) unloadLibraries failed" << endl; + } + } catch (...) { } } @@ -1119,8 +1122,11 @@ public: /// /// Clears up static fields that may be modified by hooks. virtual ~ExpirationAllocEngine6Test() { - callout_lease_.reset(); - callout_name_ = string(""); + try { + callout_lease_.reset(); + callout_name_ = string(""); + } catch (...) { + } } /// @brief Creates collection of leases for a test. @@ -1665,8 +1671,11 @@ public: /// /// Clears up static fields that may be modified by hooks. virtual ~ExpirationAllocEngine4Test() { - callout_lease_.reset(); - callout_name_ = string(""); + try { + callout_lease_.reset(); + callout_name_ = string(""); + } catch (...) { + } } /// @brief Creates collection of leases for a test. diff --git a/src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc index 935296dcba..11b66f792c 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc @@ -33,12 +33,15 @@ public: } virtual ~HookAllocEngine6Test() { - resetCalloutBuffers(); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( - "lease6_select"); - bool status = HooksManager::unloadLibraries(); - if (!status) { - cerr << "(fixture dtor) unloadLibraries failed" << endl; + try { + resetCalloutBuffers(); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( + "lease6_select"); + bool status = HooksManager::unloadLibraries(); + if (!status) { + cerr << "(fixture dtor) unloadLibraries failed" << endl; + } + } catch (...) { } } @@ -351,12 +354,15 @@ public: } virtual ~HookAllocEngine4Test() { - resetCalloutBuffers(); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( - "lease4_select"); - bool status = HooksManager::unloadLibraries(); - if (!status) { - cerr << "(fixture dtor) unloadLibraries failed" << endl; + try { + resetCalloutBuffers(); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts( + "lease4_select"); + bool status = HooksManager::unloadLibraries(); + if (!status) { + cerr << "(fixture dtor) unloadLibraries failed" << endl; + } + } catch (...) { } } diff --git a/src/lib/dhcpsrv/tests/alloc_engine_utils.h b/src/lib/dhcpsrv/tests/alloc_engine_utils.h index e6e1accd00..63b3e2f9e3 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine_utils.h +++ b/src/lib/dhcpsrv/tests/alloc_engine_utils.h @@ -500,8 +500,12 @@ public: ASSERT_EQ(lease->cltt_, from_mgr->cltt_); } + /// @brief Destructor virtual ~AllocEngine6Test() { - factory_.destroy(); + try { + factory_.destroy(); + } catch (...) { + } } DuidPtr duid_; ///< client-identifier (value used in tests) @@ -608,8 +612,12 @@ public: void initSubnet(const asiolink::IOAddress& pool_start, const asiolink::IOAddress& pool_end); + /// @brief Destructor. virtual ~AllocEngine4Test() { - factory_.destroy(); + try { + factory_.destroy(); + } catch (...) { + } } ClientIdPtr clientid_; ///< Client-identifier (value used in tests) diff --git a/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc b/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc index 29d039c30a..d27105bd05 100644 --- a/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc +++ b/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc @@ -40,9 +40,11 @@ namespace { /// @c false when setting IP reservations unique/non-unique mode. class NonUniqueHostDataSource : public MemHostDataSource { public: + /// @brief Constructor + NonUniqueHostDataSource() = default; /// @brief Virtual destructor. - virtual ~NonUniqueHostDataSource() {} + virtual ~NonUniqueHostDataSource() = default; /// @brief Configure unique/non-unique IP reservations. /// @@ -72,17 +74,20 @@ public: /// @brief Destructor. virtual ~CBControlDHCPTest() { - // Unregister the factory to be tidy. - ConfigBackendDHCPv4Mgr::instance().unregisterBackendFactory("memfile"); - CfgMgr::instance().clear(); - // Unregister hooks. - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("cb4_updated"); - HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("cb6_updated"); - bool status = HooksManager::unloadLibraries(); - if (!status) { - std::cerr << "(fixture dtor) unloadLibraries failed" << std::endl; + try { + // Unregister the factory to be tidy. + ConfigBackendDHCPv4Mgr::instance().unregisterBackendFactory("memfile"); + CfgMgr::instance().clear(); + // Unregister hooks. + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("cb4_updated"); + HooksManager::preCalloutsLibraryHandle().deregisterAllCallouts("cb6_updated"); + bool status = HooksManager::unloadLibraries(); + if (!status) { + std::cerr << "(fixture dtor) unloadLibraries failed" << std::endl; + } + HostDataSourceFactory::deregisterFactory("test"); + } catch (...) { } - HostDataSourceFactory::deregisterFactory("test"); } /// @brief Creates new CREATE audit entry. diff --git a/src/lib/dhcpsrv/tests/cfg_db_access_unittest.cc b/src/lib/dhcpsrv/tests/cfg_db_access_unittest.cc index 520ccb1060..c9e0dcf118 100644 --- a/src/lib/dhcpsrv/tests/cfg_db_access_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_db_access_unittest.cc @@ -163,9 +163,12 @@ public: /// @brief Destructor. virtual ~CfgMySQLDbAccessTest() { - // If data wipe enabled, delete transient data otherwise destroy the schema - db::test::destroyMySQLSchema(); - LeaseMgrFactory::destroy(); + try { + // If data wipe enabled, delete transient data otherwise destroy the schema + db::test::destroyMySQLSchema(); + LeaseMgrFactory::destroy(); + } catch (...) { + } } }; @@ -259,9 +262,12 @@ public: /// @brief Destructor. virtual ~CfgPgSQLDbAccessTest() { - // If data wipe enabled, delete transient data otherwise destroy the schema - db::test::destroyPgSQLSchema(); - LeaseMgrFactory::destroy(); + try { + // If data wipe enabled, delete transient data otherwise destroy the schema + db::test::destroyPgSQLSchema(); + LeaseMgrFactory::destroy(); + } catch (...) { + } } }; @@ -355,9 +361,12 @@ public: /// @brief Destructor. virtual ~CfgCQLDbAccessTest() { - // If data wipe enabled, delete transient data otherwise destroy the schema - db::test::destroyCqlSchema(); - LeaseMgrFactory::destroy(); + try { + // If data wipe enabled, delete transient data otherwise destroy the schema + db::test::destroyCqlSchema(); + LeaseMgrFactory::destroy(); + } catch (...) { + } } }; diff --git a/src/lib/dhcpsrv/tests/cfg_duid_unittest.cc b/src/lib/dhcpsrv/tests/cfg_duid_unittest.cc index 10da5b9b4f..4edf83beb5 100644 --- a/src/lib/dhcpsrv/tests/cfg_duid_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_duid_unittest.cc @@ -44,7 +44,10 @@ public: /// /// Removes DUID file if present. virtual ~CfgDUIDTest() { - static_cast(remove(absolutePath(DUID_FILE_NAME).c_str())); + try { + static_cast(remove(absolutePath(DUID_FILE_NAME).c_str())); + } catch (...) { + } } /// @brief Returns absolute path to a file used by tests. diff --git a/src/lib/dhcpsrv/tests/cfg_expiration_unittest.cc b/src/lib/dhcpsrv/tests/cfg_expiration_unittest.cc index b7e74d8c52..c0cf18dc38 100644 --- a/src/lib/dhcpsrv/tests/cfg_expiration_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_expiration_unittest.cc @@ -309,7 +309,10 @@ public: /// It stops the @c TimerMgr worker thread and removes any registered /// timers. virtual ~CfgExpirationTimersTest() { - cleanupTimerMgr(); + try { + cleanupTimerMgr(); + } catch (...) { + } } /// @brief Stop @c TimerMgr worker thread and remove the timers. diff --git a/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc b/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc index a4cb460892..aa7c82a066 100644 --- a/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc @@ -94,7 +94,10 @@ CfgHostsTest::CfgHostsTest() { } CfgHostsTest::~CfgHostsTest() { - CfgMgr::instance().setFamily(AF_INET); + try { + CfgMgr::instance().setFamily(AF_INET); + } catch (...) { + } } IOAddress diff --git a/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc b/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc index 72eff79f22..d4f740c356 100644 --- a/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc @@ -21,6 +21,11 @@ namespace { /// @brief Test fixture class for @c MultiThreadingConfigParser class CfgMultiThreadingTest : public ::testing::Test { protected: + /// @brief Constructor + CfgMultiThreadingTest() = default; + + /// @brief Destructor + virtual ~CfgMultiThreadingTest() = default; /// @brief Setup for each test. /// diff --git a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc index 3eeda34c16..5a15dcc954 100644 --- a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc @@ -261,6 +261,7 @@ TEST(ValueStorageTest, StringTesting) { class CfgMgrTest : public ::testing::Test { public: + /// @brief Constructor. CfgMgrTest() { // make sure we start with a clean configuration original_datadir_ = CfgMgr::instance().getDataDir(); @@ -277,11 +278,16 @@ public: return OptionPtr(new Option(Option::V6, D6O_INTERFACE_ID, buffer)); } + /// @brief Destructor. ~CfgMgrTest() { - // clean up after the test - clear(); + try { + // clean up after the test + clear(); + } catch (...) { + } } + /// @brief Clean up function. void clear() { CfgMgr::instance().setFamily(AF_INET); CfgMgr::instance().setDataDir(original_datadir_); diff --git a/src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc b/src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc index 214f7dc17c..89e2ddea92 100644 --- a/src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc +++ b/src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc @@ -99,7 +99,10 @@ public: /// Rolls back all pending transactions. The deletion of hdsptr_ will close /// the database. Then reopen it and delete everything created by the test. virtual ~CqlHostDataSourceTest() { - destroyTest(); + try { + destroyTest(); + } catch (...) { + } } /// @brief Reopen the database @@ -772,6 +775,11 @@ TEST_F(CqlHostDataSourceTest, testMultipleHosts6) { /// CQL as alternate host data source. class CQLHostMgrTest : public HostMgrTest { protected: + /// @brief Constructor + CQLHostMgrTest() = default; + + /// @brief Destructor + virtual ~CQLHostMgrTest() = default; /// @brief Build CQL schema for a test. virtual void SetUp(); diff --git a/src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc index 3d9b7282ac..3983eb6377 100644 --- a/src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc @@ -97,7 +97,10 @@ public: /// Rolls back all pending transactions. The deletion of lmptr_ will close /// the database. Then reopen it and delete everything created by the test. virtual ~CqlLeaseMgrTest() { - destroyTest(); + try { + destroyTest(); + } catch (...) { + } } /// @brief Reopen the database diff --git a/src/lib/dhcpsrv/tests/d2_client_unittest.cc b/src/lib/dhcpsrv/tests/d2_client_unittest.cc index 66c3060119..f246c152d8 100644 --- a/src/lib/dhcpsrv/tests/d2_client_unittest.cc +++ b/src/lib/dhcpsrv/tests/d2_client_unittest.cc @@ -340,6 +340,13 @@ TEST(D2ClientMgr, ipv6Config) { /// @brief Test class for execerising manager functions that are /// influenced by DDNS parameters. class D2ClientMgrParamsTest : public ::testing::Test { +public: + /// @brief Constructor + D2ClientMgrParamsTest() = default; + + /// @brief Destructor + virtual ~D2ClientMgrParamsTest() = default; + private: /// @brief Prepares the class for a test. virtual void SetUp() { diff --git a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc index 2d83e97a51..f3f1e525e7 100644 --- a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc +++ b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc @@ -50,8 +50,7 @@ public: } /// @brief virtual Destructor - virtual ~D2ClientMgrTest(){ - } + virtual ~D2ClientMgrTest() = default; /// @brief Updates the D2ClientMgr's configuration to DDNS enabled. /// diff --git a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc index c08742e2c8..6bad085fac 100644 --- a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc +++ b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc @@ -59,7 +59,10 @@ public: /// @brief Destructor. virtual ~DhcpParserTest() { - resetIfaceCfg(); + try { + resetIfaceCfg(); + } catch (...) { + } } /// @brief Resets selection of the interfaces from previous tests. @@ -168,9 +171,13 @@ public: reset_context(); } + /// @brief Destructor ~ParseConfigTest() { - reset_context(); - CfgMgr::instance().clear(); + try { + reset_context(); + CfgMgr::instance().clear(); + } catch (...) { + } } /// @brief Parses a configuration. diff --git a/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc index 5d19ef3ebd..27db9f8189 100644 --- a/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc @@ -24,6 +24,11 @@ namespace { /// @brief Test fixture class for @c DHCPQueueControlParser class DHCPQueueControlParserTest : public ::testing::Test { protected: + /// @brief Constructor + DHCPQueueControlParserTest() = default; + + /// @brief Destructor + virtual ~DHCPQueueControlParserTest() = default; /// @brief Setup for each test. /// diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc index 64b3220ce1..633be55261 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc @@ -75,11 +75,6 @@ GenericLeaseMgrTest::GenericLeaseMgrTest() } } -GenericLeaseMgrTest::~GenericLeaseMgrTest() { - // Does nothing. The derived classes are expected to clean up, i.e. - // remove the lmptr_ pointer. -} - Lease4Ptr GenericLeaseMgrTest::initializeLease4(std::string address) { Lease4Ptr lease(new Lease4()); diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h index 3b83ebd477..16bc2b7e81 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h @@ -40,7 +40,10 @@ public: GenericLeaseMgrTest(); /// @brief Virtual destructor. - virtual ~GenericLeaseMgrTest(); + /// + /// Does nothing. The derived classes are expected to clean up, i.e. + /// remove the lmptr_ pointer. + virtual ~GenericLeaseMgrTest() = default; /// @brief Reopen the database /// @@ -523,6 +526,7 @@ public: class LeaseMgrDbLostCallbackTest : public ::testing::Test { public: + /// @brief Constructor LeaseMgrDbLostCallbackTest() : db_lost_callback_called_(0), db_recovered_callback_called_(0), db_failed_callback_called_(0), @@ -534,12 +538,16 @@ public: TimerMgr::instance()->setIOService(io_service_); } + /// @brief Destructor virtual ~LeaseMgrDbLostCallbackTest() { - db::DatabaseConnection::db_lost_callback_ = 0; - db::DatabaseConnection::db_recovered_callback_ = 0; - db::DatabaseConnection::db_failed_callback_ = 0; - LeaseMgr::setIOService(isc::asiolink::IOServicePtr()); - TimerMgr::instance()->unregisterTimers(); + try { + db::DatabaseConnection::db_lost_callback_ = 0; + db::DatabaseConnection::db_recovered_callback_ = 0; + db::DatabaseConnection::db_failed_callback_ = 0; + LeaseMgr::setIOService(isc::asiolink::IOServicePtr()); + TimerMgr::instance()->unregisterTimers(); + } catch (...) { + } } /// @brief Prepares the class for a test. diff --git a/src/lib/dhcpsrv/tests/host_cache_unittest.cc b/src/lib/dhcpsrv/tests/host_cache_unittest.cc index c6ad920098..044c0dfe85 100644 --- a/src/lib/dhcpsrv/tests/host_cache_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_cache_unittest.cc @@ -31,11 +31,12 @@ namespace { class TestHostCache : public MemHostDataSource, public CacheHostDataSource { public: - /// Constructor - TestHostCache() : adds_(0), inserts_(0) { } + /// @brief Constructor + TestHostCache() : adds_(0), inserts_(0) { + } - /// Destructor - virtual ~TestHostCache() { } + /// @brief Destructor + virtual ~TestHostCache() = default; /// Override add void add(const HostPtr& host) { @@ -99,11 +100,13 @@ typedef boost::shared_ptr TestHostCachePtr; /// @brief Test data source class. class TestHostDataSource : public MemHostDataSource { public: + /// @brief Constructor + TestHostDataSource() = default; - /// Destructor - virtual ~TestHostDataSource() { } + /// @brief Destructor + virtual ~TestHostDataSource() = default; - /// Type + /// @brief Type string getType() const { return ("test"); } @@ -139,8 +142,11 @@ public: /// @brief Destructor. virtual ~HostCacheTest() { - HostDataSourceFactory::deregisterFactory("test"); - HostDataSourceFactory::deregisterFactory("cache"); + try { + HostDataSourceFactory::deregisterFactory("test"); + HostDataSourceFactory::deregisterFactory("cache"); + } catch (...) { + } } /// @brief Test host cache. @@ -593,10 +599,10 @@ class TestOneBackend : public BaseHostDataSource { public: /// Constructor - TestOneBackend() : value_() { } + TestOneBackend() = default; /// Destructor - virtual ~TestOneBackend() { } + virtual ~TestOneBackend() = default; ConstHostCollection getAll(const Host::IdentifierType&, const uint8_t*, const size_t) const { @@ -738,9 +744,11 @@ typedef boost::shared_ptr TestOneBackendPtr; /// This class looks like a cache but throws when insert() is called. class TestNoCache : public MemHostDataSource, public CacheHostDataSource { public: + /// Constructor + TestNoCache() = default; /// Destructor - virtual ~TestNoCache() { } + virtual ~TestNoCache() = default; /// Override add void add(const HostPtr& host) { @@ -812,8 +820,11 @@ public: /// @brief Destructor. virtual ~NegativeCacheTest() { - HostDataSourceFactory::deregisterFactory("one"); - HostDataSourceFactory::deregisterFactory("nocache"); + try { + HostDataSourceFactory::deregisterFactory("one"); + HostDataSourceFactory::deregisterFactory("nocache"); + } catch (...) { + } } /// @brief Test one backend. diff --git a/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc b/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc index 5f5fa03e11..103550fcd5 100644 --- a/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc @@ -74,6 +74,13 @@ factory0(const DatabaseConnection::ParameterMap&) { // @brief Test fixture class class HostDataSourceFactoryTest : public ::testing::Test { +public: + /// @brief Constructor + HostDataSourceFactoryTest() = default; + + /// @brief Destructor + virtual ~HostDataSourceFactoryTest() = default; + private: // @brief Prepares the class for a test. virtual void SetUp() { diff --git a/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc b/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc index 4a82130fec..ed9c23d593 100644 --- a/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc @@ -43,6 +43,11 @@ namespace { /// @brief Test fixture class for @c HostReservationParser. class HostReservationParserTest : public ::testing::Test { protected: + /// @brief Constructor + HostReservationParserTest() = default; + + /// @brief Destructor + virtual ~HostReservationParserTest() = default; /// @brief Setup for each test. /// @@ -1294,7 +1299,10 @@ public: /// /// Clears current configuration. virtual ~HostReservationIdsParserTest() { - CfgMgr::instance().clear(); + try { + CfgMgr::instance().clear(); + } catch (...) { + } } /// @brief Test verifies that invalid configuration causes an error. diff --git a/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc b/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc index 31c0c796b1..3f51e214c0 100644 --- a/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc @@ -33,6 +33,11 @@ namespace { /// @brief Test fixture class for @c HostReservationsListParser. class HostReservationsListParserTest : public ::testing::Test { protected: + /// @brief Constructor + HostReservationsListParserTest() = default; + + /// @brief Destructor + virtual ~HostReservationsListParserTest() = default; /// @brief Setup for each test. /// diff --git a/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc b/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc index 8e49695122..0493a6f50e 100644 --- a/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc +++ b/src/lib/dhcpsrv/tests/lease_file_loader_unittest.cc @@ -39,7 +39,7 @@ public: /// @brief Destructor /// /// Removes any configuration that may have been added in CfgMgr. - ~LeaseFileLoaderTest(); + virtual ~LeaseFileLoaderTest(); /// @brief Prepends the absolute path to the file specified /// as an argument. @@ -317,7 +317,10 @@ LeaseFileLoaderTest::LeaseFileLoaderTest() } LeaseFileLoaderTest::~LeaseFileLoaderTest() { - CfgMgr::instance().clear(); + try { + CfgMgr::instance().clear(); + } catch (...) { + } } std::string diff --git a/src/lib/dhcpsrv/tests/lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/lease_mgr_unittest.cc index fc8dc31f9d..bd60159bfe 100644 --- a/src/lib/dhcpsrv/tests/lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/lease_mgr_unittest.cc @@ -36,13 +36,10 @@ public: /// dbconfig is a generic way of passing parameters. Parameters /// are passed in the "name=value" format, separated by spaces. /// Values may be enclosed in double quotes, if needed. - ConcreteLeaseMgr(const DatabaseConnection::ParameterMap&) - : LeaseMgr() - {} + ConcreteLeaseMgr() = default; /// @brief Destructor - virtual ~ConcreteLeaseMgr() - {} + virtual ~ConcreteLeaseMgr() = default; /// @brief Adds an IPv4 lease. /// @@ -427,9 +424,7 @@ namespace { // This test checks if getLease6() method is working properly for 0 (NULL), // 1 (return the lease) and more than 1 leases (throw). TEST_F(LeaseMgrTest, getLease6) { - - DatabaseConnection::ParameterMap pmap; - boost::scoped_ptr mgr(new ConcreteLeaseMgr(pmap)); + boost::scoped_ptr mgr(new ConcreteLeaseMgr()); vector leases = createLeases6(); diff --git a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc index 5137b5b0ab..0b04c2bcb5 100644 --- a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc @@ -137,15 +137,18 @@ public: /// /// destroys lease manager backend. virtual ~MemfileLeaseMgrTest() { - // Stop TimerMgr worker thread if it is running. - // Make sure there are no timers registered. - timer_mgr_->unregisterTimers(); - LeaseMgrFactory::destroy(); - // Remove lease files and products of Lease File Cleanup. - removeFiles(getLeaseFilePath("leasefile4_0.csv")); - removeFiles(getLeaseFilePath("leasefile6_0.csv")); - // Disable multi-threading. - MultiThreadingMgr::instance().setMode(false); + try { + // Stop TimerMgr worker thread if it is running. + // Make sure there are no timers registered. + timer_mgr_->unregisterTimers(); + LeaseMgrFactory::destroy(); + // Remove lease files and products of Lease File Cleanup. + removeFiles(getLeaseFilePath("leasefile4_0.csv")); + removeFiles(getLeaseFilePath("leasefile6_0.csv")); + // Disable multi-threading. + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief Remove files being products of Lease File Cleanup. diff --git a/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc b/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc index 1f3b994bbd..5a4a1dcef9 100644 --- a/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc @@ -24,6 +24,11 @@ namespace { /// @brief Test fixture class for @c MultiThreadingConfigParser class MultiThreadingConfigParserTest : public ::testing::Test { protected: + /// @brief Constructor + MultiThreadingConfigParserTest() = default; + + /// @brief Destructor + virtual ~MultiThreadingConfigParserTest() = default; /// @brief Setup for each test. virtual void SetUp(); diff --git a/src/lib/dhcpsrv/tests/mysql_host_data_source_unittest.cc b/src/lib/dhcpsrv/tests/mysql_host_data_source_unittest.cc index 2677ef0136..e18a2f737b 100644 --- a/src/lib/dhcpsrv/tests/mysql_host_data_source_unittest.cc +++ b/src/lib/dhcpsrv/tests/mysql_host_data_source_unittest.cc @@ -92,7 +92,10 @@ public: /// Rolls back all pending transactions. The deletion of hdsptr_ will close /// the database. Then reopen it and delete everything created by the test. virtual ~MySqlHostDataSourceTest() { - destroyTest(); + try { + destroyTest(); + } catch (...) { + } } /// @brief Reopen the database diff --git a/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc index 31d52cf7b5..2a6c6b620a 100644 --- a/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc @@ -89,7 +89,10 @@ public: /// Rolls back all pending transactions. The deletion of lmptr_ will close /// the database. Then reopen it and delete everything created by the test. virtual ~MySqlLeaseMgrTest() { - destroyTest(); + try { + destroyTest(); + } catch (...) { + } } /// @brief Reopen the database diff --git a/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc b/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc index 905df55479..ca6881c015 100644 --- a/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc +++ b/src/lib/dhcpsrv/tests/ncr_generator_unittest.cc @@ -49,6 +49,9 @@ public: : d2_mgr_(CfgMgr::instance().getD2ClientMgr()), lease_() { } + /// @brief Destructor + virtual ~NCRGeneratorTest() = default; + /// @brief Initializes the lease pointer used by the tests and starts D2. /// /// This method initializes the pointer to the lease which will be used diff --git a/src/lib/dhcpsrv/tests/network_state_unittest.cc b/src/lib/dhcpsrv/tests/network_state_unittest.cc index 7edf4581ae..3c75b1fba2 100644 --- a/src/lib/dhcpsrv/tests/network_state_unittest.cc +++ b/src/lib/dhcpsrv/tests/network_state_unittest.cc @@ -34,13 +34,16 @@ public: /// @brief Destructor. virtual ~NetworkStateTest() { - // Cancel timers. - TimerMgr::instance()->unregisterTimers(); - // Make sure IO service will stop when no timers are scheduled. - io_service_->stopWork(); - // Run outstanding tasks. - io_service_->run(); - MultiThreadingMgr::instance().setMode(false); + try { + // Cancel timers. + TimerMgr::instance()->unregisterTimers(); + // Make sure IO service will stop when no timers are scheduled. + io_service_->stopWork(); + // Run outstanding tasks. + io_service_->run(); + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief This test verifies the default is enable state. diff --git a/src/lib/dhcpsrv/tests/pgsql_host_data_source_unittest.cc b/src/lib/dhcpsrv/tests/pgsql_host_data_source_unittest.cc index 607151ab2e..408aba3ae0 100644 --- a/src/lib/dhcpsrv/tests/pgsql_host_data_source_unittest.cc +++ b/src/lib/dhcpsrv/tests/pgsql_host_data_source_unittest.cc @@ -92,7 +92,10 @@ public: /// Rolls back all pending transactions. The deletion of hdsptr_ will close /// the database. Then reopen it and delete everything created by the test. virtual ~PgSqlHostDataSourceTest() { - destroyTest(); + try { + destroyTest(); + } catch (...) { + } } /// @brief Reopen the database @@ -1429,6 +1432,12 @@ TEST_F(PgSqlHostDataSourceTest, testMultipleHosts6MultiThreading) { class PgSQLHostMgrTest : public HostMgrTest { protected: + /// @brief Constructor + PgSQLHostMgrTest() = default; + + /// @brief Destructor + virtual ~PgSQLHostMgrTest() = default; + /// @brief Build PostgreSQL schema for a test. virtual void SetUp(); diff --git a/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc index fbe32275e6..38afe408f5 100644 --- a/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc @@ -89,7 +89,10 @@ public: /// Rolls back all pending transactions. The deletion of lmptr_ will close /// the database. Then reopen it and delete everything created by the test. virtual ~PgSqlLeaseMgrTest() { - destroyTest(); + try { + destroyTest(); + } catch (...) { + } } /// @brief Reopen the database diff --git a/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc b/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc index cb305d6b95..b7e4dc3327 100644 --- a/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc +++ b/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc @@ -26,7 +26,7 @@ using namespace isc::dhcp::test; class SanityChecksTest : public ::testing::Test { public: - + /// @brief Constructor SanityChecksTest() { LeaseMgrFactory::destroy(); } @@ -42,9 +42,13 @@ public: CfgMgr::instance().getCurrentCfg()->getConsistency()->setLeaseSanityCheck(sanity); } + /// @brief Destructor ~SanityChecksTest() { - CfgMgr::instance().clear(); - LeaseMgrFactory::destroy(); + try { + CfgMgr::instance().clear(); + LeaseMgrFactory::destroy(); + } catch (...) { + } } /// @brief Generates a simple IPv4 lease. diff --git a/src/lib/dhcpsrv/tests/shared_network_parser_unittest.cc b/src/lib/dhcpsrv/tests/shared_network_parser_unittest.cc index b91ea2b34c..fc2b7538c9 100644 --- a/src/lib/dhcpsrv/tests/shared_network_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/shared_network_parser_unittest.cc @@ -42,7 +42,7 @@ public: }; /// @brief virtual destructor - virtual ~SharedNetworkParserTest(){}; + virtual ~SharedNetworkParserTest() = default; /// @brief Fetch valid shared network configuration JSON text virtual std::string getWorkingConfig() const = 0; diff --git a/src/lib/dhcpsrv/tests/srv_config_unittest.cc b/src/lib/dhcpsrv/tests/srv_config_unittest.cc index 915bb50540..6f80c050c8 100644 --- a/src/lib/dhcpsrv/tests/srv_config_unittest.cc +++ b/src/lib/dhcpsrv/tests/srv_config_unittest.cc @@ -87,8 +87,7 @@ public: /// @brief Destructor. - virtual ~SrvConfigTest() { - } + virtual ~SrvConfigTest() = default; /// @brief Convenience function which adds IPv4 subnet to the configuration. /// diff --git a/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc b/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc index 00583740c7..3138f107b4 100644 --- a/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc @@ -27,6 +27,13 @@ namespace { /// @brief Test fixture class for @c TimerMgr. class TimerMgrTest : public ::testing::Test { +public: + /// @brief Constructor + TimerMgrTest() = default; + + /// @brief Destructor + virtual ~TimerMgrTest() = default; + private: /// @brief Prepares the class for a test. virtual void SetUp(); diff --git a/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc b/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc index da6dc67d0f..e14b80745d 100644 --- a/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc @@ -23,7 +23,10 @@ GenericBackendTest::GenericBackendTest() { } GenericBackendTest::~GenericBackendTest() { - LibDHCP::clearRuntimeOptionDefs(); + try { + LibDHCP::clearRuntimeOptionDefs(); + } catch (...) { + } } OptionDescriptor diff --git a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc index 12d71f64a6..0162e87fc9 100644 --- a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc @@ -44,10 +44,6 @@ namespace isc { namespace dhcp { namespace test { -GenericHostDataSourceTest::GenericHostDataSourceTest() - : GenericBackendTest(), hdsptr_() { -} - bool GenericHostDataSourceTest::compareHostsForSort4(const ConstHostPtr& host1, const ConstHostPtr& host2) { diff --git a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h index 942ef475a0..c94a8acb05 100644 --- a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h +++ b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h @@ -50,7 +50,7 @@ public: }; /// @brief Default constructor. - GenericHostDataSourceTest(); + GenericHostDataSourceTest() = default; /// @brief Virtual destructor. virtual ~GenericHostDataSourceTest() = default; @@ -537,6 +537,7 @@ public: class HostMgrDbLostCallbackTest : public ::testing::Test { public: + /// @brief Constructor HostMgrDbLostCallbackTest() : db_lost_callback_called_(0), db_recovered_callback_called_(0), db_failed_callback_called_(0), @@ -549,13 +550,17 @@ public: isc::dhcp::CfgMgr::instance().clear(); } + /// @brief Destructor virtual ~HostMgrDbLostCallbackTest() { - isc::db::DatabaseConnection::db_lost_callback_ = 0; - isc::db::DatabaseConnection::db_recovered_callback_ = 0; - isc::db::DatabaseConnection::db_failed_callback_ = 0; - isc::dhcp::HostMgr::setIOService(isc::asiolink::IOServicePtr()); - isc::dhcp::TimerMgr::instance()->unregisterTimers(); - isc::dhcp::CfgMgr::instance().clear(); + try { + isc::db::DatabaseConnection::db_lost_callback_ = 0; + isc::db::DatabaseConnection::db_recovered_callback_ = 0; + isc::db::DatabaseConnection::db_failed_callback_ = 0; + isc::dhcp::HostMgr::setIOService(isc::asiolink::IOServicePtr()); + isc::dhcp::TimerMgr::instance()->unregisterTimers(); + isc::dhcp::CfgMgr::instance().clear(); + } catch (...) { + } } /// @brief Prepares the class for a test. @@ -683,6 +688,11 @@ public: /// @brief Test fixture class for @c HostMgr class. class HostMgrTest : public ::testing::Test { protected: + /// @brief Constructor + HostMgrTest() = default; + + /// @brief Destructor + virtual ~HostMgrTest() = default; /// @brief Prepares the class for a test. /// diff --git a/src/lib/dhcpsrv/testutils/lease_file_io.cc b/src/lib/dhcpsrv/testutils/lease_file_io.cc index d641a695f0..97bbe02989 100644 --- a/src/lib/dhcpsrv/testutils/lease_file_io.cc +++ b/src/lib/dhcpsrv/testutils/lease_file_io.cc @@ -21,8 +21,11 @@ LeaseFileIO::LeaseFileIO(const std::string& filename, const bool recreate) } LeaseFileIO::~LeaseFileIO() { - if (recreate_) { - removeFile(); + try { + if (recreate_) { + removeFile(); + } + } catch (...) { } } diff --git a/src/lib/dhcpsrv/testutils/memory_host_data_source.h b/src/lib/dhcpsrv/testutils/memory_host_data_source.h index b2d06f48f2..089513efe2 100644 --- a/src/lib/dhcpsrv/testutils/memory_host_data_source.h +++ b/src/lib/dhcpsrv/testutils/memory_host_data_source.h @@ -23,9 +23,12 @@ namespace test { /// work, just several are implemented. Those are used in the tests. class MemHostDataSource : public virtual BaseHostDataSource { public: + /// @brief Constructor. + MemHostDataSource() : next_host_id_(0) { + } /// @brief Destructor. - virtual ~MemHostDataSource() { } + virtual ~MemHostDataSource() = default; /// BaseHostDataSource methods. diff --git a/src/lib/dhcpsrv/testutils/test_config_backend.h b/src/lib/dhcpsrv/testutils/test_config_backend.h index d78f97f8fd..0b638e51e9 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend.h +++ b/src/lib/dhcpsrv/testutils/test_config_backend.h @@ -51,7 +51,7 @@ public: } /// @brief virtual Destructor. - virtual ~TestConfigBackend(){}; + virtual ~TestConfigBackend() = default; /// @brief Returns backend type. /// diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h index 1ce5158c61..6d5424e26f 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h +++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h @@ -46,7 +46,7 @@ public: } /// @brief virtual Destructor. - virtual ~TestConfigBackendDHCPv4(){}; + virtual ~TestConfigBackendDHCPv4() = default; /// @brief Registers the backend type with the given backend manager /// diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.h b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.h index c13b50522f..6b796891b5 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.h +++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.h @@ -46,7 +46,7 @@ public: } /// @brief virtual Destructor. - virtual ~TestConfigBackendDHCPv6(){}; + virtual ~TestConfigBackendDHCPv6() = default; /// @brief Registers the backend type with the given backend manager /// diff --git a/src/lib/dhcpsrv/testutils/test_utils.cc b/src/lib/dhcpsrv/testutils/test_utils.cc index 4fe7d86d93..943a4e7d59 100644 --- a/src/lib/dhcpsrv/testutils/test_utils.cc +++ b/src/lib/dhcpsrv/testutils/test_utils.cc @@ -142,9 +142,12 @@ FillFdHoles::FillFdHoles(int limit) : fds_() { } FillFdHoles::~FillFdHoles() { - while (!fds_.empty()) { - static_cast(close(fds_.back())); - fds_.pop_back(); + try { + while (!fds_.empty()) { + static_cast(close(fds_.back())); + fds_.pop_back(); + } + } catch (...) { } } diff --git a/src/lib/dhcpsrv/timer_mgr.cc b/src/lib/dhcpsrv/timer_mgr.cc index f71b768ba0..97db82a66f 100644 --- a/src/lib/dhcpsrv/timer_mgr.cc +++ b/src/lib/dhcpsrv/timer_mgr.cc @@ -448,7 +448,10 @@ TimerMgr::TimerMgr() } TimerMgr::~TimerMgr() { - impl_->unregisterTimers(); + try { + impl_->unregisterTimers(); + } catch (...) { + } } void diff --git a/src/lib/dhcpsrv/writable_host_data_source.h b/src/lib/dhcpsrv/writable_host_data_source.h index 6115d228e9..a17490dfb2 100644 --- a/src/lib/dhcpsrv/writable_host_data_source.h +++ b/src/lib/dhcpsrv/writable_host_data_source.h @@ -20,9 +20,11 @@ namespace dhcp { /// return the const objects. class WritableHostDataSource { public: + /// @brief Constructor + WritableHostDataSource() = default; /// @brief Default destructor implementation. - virtual ~WritableHostDataSource() { } + virtual ~WritableHostDataSource() = default; /// @brief Non-const version of the @c getAll const method. /// diff --git a/src/lib/dns/gen-rdatacode.py.in b/src/lib/dns/gen-rdatacode.py.in index 362f5e077e..8f5dfb187e 100644 --- a/src/lib/dns/gen-rdatacode.py.in +++ b/src/lib/dns/gen-rdatacode.py.in @@ -131,6 +131,7 @@ class OutputBuffer;\n''' class AbstractMessageRenderer;\n\n''' if re.match('\s+// BEGIN_COMMON_MEMBERS$', line): content += ''' + /// \\brief Constructor explicit ''' + type_utxt + '''(const std::string& type_str); ''' + type_utxt + '''(isc::util::InputBuffer& buffer, size_t rdata_len); ''' + type_utxt + '''(const ''' + type_utxt + '''& other); diff --git a/src/lib/dns/master_lexer.cc b/src/lib/dns/master_lexer.cc index 0d1292e0c3..ccd116f657 100644 --- a/src/lib/dns/master_lexer.cc +++ b/src/lib/dns/master_lexer.cc @@ -131,7 +131,10 @@ MasterLexer::MasterLexer() : impl_(new MasterLexerImpl) { } MasterLexer::~MasterLexer() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } bool @@ -361,8 +364,14 @@ State::getParenCount(const MasterLexer& lexer) const { namespace { class CRLF : public State { public: - CRLF() {} - virtual ~CRLF() {} // see the base class for the destructor + /// @brief Constructor + CRLF() = default; + + /// @brief Destructor + /// + /// see the base class for the destructor + virtual ~CRLF() = default; + virtual void handle(MasterLexer& lexer) const { // We've just seen '\r'. If this is part of a sequence of '\r\n', // we combine them as a single END-OF-LINE. Otherwise we treat the @@ -385,22 +394,38 @@ public: class String : public State { public: - String() {} - virtual ~String() {} // see the base class for the destructor + /// @brief Constructor + String() = default; + + /// @brief Destructor + /// + /// see the base class for the destructor + virtual ~String() = default; + virtual void handle(MasterLexer& lexer) const; }; class QString : public State { public: - QString() {} - virtual ~QString() {} // see the base class for the destructor + /// @brief Constructor + QString() = default; + + /// @brief Destructor + /// + /// see the base class for the destructor + virtual ~QString() = default; + virtual void handle(MasterLexer& lexer) const; }; class Number : public State { public: - Number() {} - virtual ~Number() {} + /// @brief Constructor + Number() = default; + + /// @brief Destructor + virtual ~Number() = default; + virtual void handle(MasterLexer& lexer) const; }; diff --git a/src/lib/dns/master_lexer_inputsource.cc b/src/lib/dns/master_lexer_inputsource.cc index 841fc6c1bb..a196143e47 100644 --- a/src/lib/dns/master_lexer_inputsource.cc +++ b/src/lib/dns/master_lexer_inputsource.cc @@ -122,13 +122,15 @@ InputSource::InputSource(const char* filename) : total_pos_(0), name_(filename), input_(openFileStream(file_stream_, filename)), - input_size_(getStreamSize(input_)) -{} + input_size_(getStreamSize(input_)) { +} -InputSource::~InputSource() -{ - if (file_stream_.is_open()) { - file_stream_.close(); +InputSource::~InputSource() { + try { + if (file_stream_.is_open()) { + file_stream_.close(); + } + } catch (...) { } } diff --git a/src/lib/dns/master_lexer_state.h b/src/lib/dns/master_lexer_state.h index d328a70918..931dea7ce4 100644 --- a/src/lib/dns/master_lexer_state.h +++ b/src/lib/dns/master_lexer_state.h @@ -47,11 +47,14 @@ namespace master_lexer_internal { /// this library are expected to use this class. class State { public: + /// \brief Constructor. + State() = default; + /// \brief Virtual destructor. /// /// In our usage this actually doesn't matter, but some compilers complain /// about it and we need to silence them. - virtual ~State() {} + virtual ~State() = default; /// \brief Begin state transitions to get the next token. /// diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc index 568fdea507..1a7c816a05 100644 --- a/src/lib/dns/master_loader.cc +++ b/src/lib/dns/master_loader.cc @@ -1044,7 +1044,10 @@ MasterLoader::MasterLoader(std::istream& stream, } MasterLoader::~MasterLoader() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } bool diff --git a/src/lib/dns/message.cc b/src/lib/dns/message.cc index 1e7bb7b594..db1a4b2c45 100644 --- a/src/lib/dns/message.cc +++ b/src/lib/dns/message.cc @@ -380,11 +380,14 @@ MessageImpl::toWire(AbstractMessageRenderer& renderer, TSIGContext* tsig_ctx) { } Message::Message(Mode mode) : - impl_(new MessageImpl(mode)) -{} + impl_(new MessageImpl(mode)) { +} Message::~Message() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } bool @@ -1042,7 +1045,10 @@ SectionIterator::SectionIterator(const SectionIteratorImpl& impl) { template SectionIterator::~SectionIterator() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } template diff --git a/src/lib/dns/message.h b/src/lib/dns/message.h index da8acfe648..0820fdd358 100644 --- a/src/lib/dns/message.h +++ b/src/lib/dns/message.h @@ -90,10 +90,19 @@ struct SectionIteratorImpl; template class SectionIterator : public std::iterator { public: - SectionIterator() : impl_(NULL) {} + /// @brief Constructor + SectionIterator() : impl_(NULL) { + } + + /// @brief Copy constructor SectionIterator(const SectionIteratorImpl& impl); - ~SectionIterator(); + + /// @brief Copy constructor SectionIterator(const SectionIterator& source); + + /// @brief Destructor + ~SectionIterator(); + void operator=(const SectionIterator& source); SectionIterator& operator++(); SectionIterator operator++(int); diff --git a/src/lib/dns/messagerenderer.cc b/src/lib/dns/messagerenderer.cc index 81b2c92dd2..ffb550bc9a 100644 --- a/src/lib/dns/messagerenderer.cc +++ b/src/lib/dns/messagerenderer.cc @@ -220,11 +220,14 @@ struct MessageRenderer::MessageRendererImpl { MessageRenderer::MessageRenderer() : AbstractMessageRenderer(), - impl_(new MessageRendererImpl) -{} + impl_(new MessageRendererImpl) { +} MessageRenderer::~MessageRenderer() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } void diff --git a/src/lib/dns/messagerenderer.h b/src/lib/dns/messagerenderer.h index 1b8b9c0f96..d68e4ca71f 100644 --- a/src/lib/dns/messagerenderer.h +++ b/src/lib/dns/messagerenderer.h @@ -106,7 +106,7 @@ protected: public: /// \brief The destructor. - virtual ~AbstractMessageRenderer() {} + virtual ~AbstractMessageRenderer() = default; //@} protected: /// \brief Return the output buffer we render into. @@ -359,9 +359,12 @@ public: using AbstractMessageRenderer::CASE_INSENSITIVE; using AbstractMessageRenderer::CASE_SENSITIVE; + /// @brief Constructor MessageRenderer(); + /// @brief Destructor virtual ~MessageRenderer(); + virtual bool isTruncated() const; virtual size_t getLengthLimit() const; virtual CompressMode getCompressMode() const; diff --git a/src/lib/dns/nsec3hash.cc b/src/lib/dns/nsec3hash.cc index 6513f2354e..9002a07e3f 100644 --- a/src/lib/dns/nsec3hash.cc +++ b/src/lib/dns/nsec3hash.cc @@ -58,12 +58,12 @@ private: static const size_t DEFAULT_DIGEST_LENGTH = 32; public: + /// @brief Constructor NSEC3HashRFC5155(uint8_t algorithm, uint16_t iterations, const uint8_t* salt_data, size_t salt_length) : algorithm_(algorithm), iterations_(iterations), salt_data_(NULL), salt_length_(salt_length), - digest_(DEFAULT_DIGEST_LENGTH), obuf_(Name::MAX_WIRE) - { + digest_(DEFAULT_DIGEST_LENGTH), obuf_(Name::MAX_WIRE) { if (algorithm_ != NSEC3_HASH_SHA1) { isc_throw(UnknownNSEC3HashAlgorithm, "Unknown NSEC3 algorithm: " << static_cast(algorithm_)); @@ -78,8 +78,12 @@ public: } } + /// @brief Destructor virtual ~NSEC3HashRFC5155() { - std::free(salt_data_); + try { + std::free(salt_data_); + } catch (...) { + } } virtual std::string calculate(const Name& name) const; diff --git a/src/lib/dns/nsec3hash.h b/src/lib/dns/nsec3hash.h index 26bb715db2..b0ef0a2f20 100644 --- a/src/lib/dns/nsec3hash.h +++ b/src/lib/dns/nsec3hash.h @@ -78,7 +78,7 @@ protected: /// This is defined as protected to prevent this class from being directly /// instantiated even if the class definition is modified (accidentally /// or intentionally) to have no pure virtual methods. - NSEC3Hash() {} + NSEC3Hash() = default; public: /// \brief Factory method of NSECHash from NSEC3PARAM RDATA. @@ -120,7 +120,7 @@ public: const uint8_t* salt_data, size_t salt_length); /// \brief The destructor. - virtual ~NSEC3Hash() {} + virtual ~NSEC3Hash() = default; /// \brief Calculate the NSEC3 hash (Name variant). /// @@ -206,14 +206,14 @@ protected: /// /// Make very sure this isn't directly instantiated by making it protected /// even if this class is modified to lose all pure virtual methods. - NSEC3HashCreator() {} + NSEC3HashCreator() = default; public: /// \brief The destructor. /// /// This does nothing; defined only for allowing derived classes to /// specialize its behavior. - virtual ~NSEC3HashCreator() {} + virtual ~NSEC3HashCreator() = default; /// \brief Factory method of NSECHash from NSEC3PARAM RDATA. /// diff --git a/src/lib/dns/rdata.cc b/src/lib/dns/rdata.cc index 357ccc7cdf..32f57082e3 100644 --- a/src/lib/dns/rdata.cc +++ b/src/lib/dns/rdata.cc @@ -307,17 +307,19 @@ Generic::Generic(const std::string& rdata_string) : Generic::Generic(MasterLexer& lexer, const Name*, MasterLoader::Options, MasterLoaderCallbacks&) : - impl_(constructFromLexer(lexer)) -{ + impl_(constructFromLexer(lexer)) { } Generic::~Generic() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } Generic::Generic(const Generic& source) : - Rdata(), impl_(new GenericImpl(*source.impl_)) -{} + Rdata(), impl_(new GenericImpl(*source.impl_)) { +} Generic& // Our check is better than the usual if (this == &source), diff --git a/src/lib/dns/rdata.h b/src/lib/dns/rdata.h index a6515ef936..a066f44629 100644 --- a/src/lib/dns/rdata.h +++ b/src/lib/dns/rdata.h @@ -136,13 +136,13 @@ protected: /// cases, the derived class wouldn't define a public default constructor /// either, because an \c Rdata object without concrete data isn't /// meaningful. - Rdata() {} + Rdata() = default; private: Rdata(const Rdata& source); void operator=(const Rdata& source); public: /// The destructor. - virtual ~Rdata() {}; + virtual ~Rdata() = default; //@} /// diff --git a/src/lib/dns/rdata/any_255/tsig_250.cc b/src/lib/dns/rdata/any_255/tsig_250.cc index a80d742d09..765bd46940 100644 --- a/src/lib/dns/rdata/any_255/tsig_250.cc +++ b/src/lib/dns/rdata/any_255/tsig_250.cc @@ -362,7 +362,10 @@ TSIG::operator=(const TSIG& source) { } TSIG::~TSIG() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } /// \brief Convert the \c TSIG to a string. diff --git a/src/lib/dns/rdata/generic/caa_257.cc b/src/lib/dns/rdata/generic/caa_257.cc index 7f8b455687..4a5f0722b0 100644 --- a/src/lib/dns/rdata/generic/caa_257.cc +++ b/src/lib/dns/rdata/generic/caa_257.cc @@ -214,7 +214,10 @@ CAA::operator=(const CAA& source) { } CAA::~CAA() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } void diff --git a/src/lib/dns/rdata/generic/caa_257.h b/src/lib/dns/rdata/generic/caa_257.h index 0e81e71c54..5ad0334ded 100644 --- a/src/lib/dns/rdata/generic/caa_257.h +++ b/src/lib/dns/rdata/generic/caa_257.h @@ -28,8 +28,12 @@ public: // BEGIN_COMMON_MEMBERS // END_COMMON_MEMBERS + /// \brief Constructor CAA(uint8_t flags, const std::string& tag, const std::string& value); + CAA& operator=(const CAA& source); + + /// \brief Destructor ~CAA(); /// diff --git a/src/lib/dns/rdata/generic/dlv_32769.cc b/src/lib/dns/rdata/generic/dlv_32769.cc index 66303b7a57..c6ba5d8912 100644 --- a/src/lib/dns/rdata/generic/dlv_32769.cc +++ b/src/lib/dns/rdata/generic/dlv_32769.cc @@ -71,7 +71,10 @@ DLV::operator=(const DLV& source) { /// /// Deallocates an internal resource. DLV::~DLV() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } /// \brief Convert the \c DLV to a string. diff --git a/src/lib/dns/rdata/generic/dlv_32769.h b/src/lib/dns/rdata/generic/dlv_32769.h index 26523de6fe..8b26810d74 100644 --- a/src/lib/dns/rdata/generic/dlv_32769.h +++ b/src/lib/dns/rdata/generic/dlv_32769.h @@ -48,7 +48,7 @@ public: /// intact. DLV& operator=(const DLV& source); - /// \brief The destructor. + /// \brief Destructor ~DLV(); /// \brief Return the value of the Tag field. diff --git a/src/lib/dns/rdata/generic/dnskey_48.cc b/src/lib/dns/rdata/generic/dnskey_48.cc index 7bea847427..7fd3428a46 100644 --- a/src/lib/dns/rdata/generic/dnskey_48.cc +++ b/src/lib/dns/rdata/generic/dnskey_48.cc @@ -218,7 +218,10 @@ DNSKEY::operator=(const DNSKEY& source) { } DNSKEY::~DNSKEY() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string diff --git a/src/lib/dns/rdata/generic/dnskey_48.h b/src/lib/dns/rdata/generic/dnskey_48.h index a5e9efa43f..29c006a47b 100644 --- a/src/lib/dns/rdata/generic/dnskey_48.h +++ b/src/lib/dns/rdata/generic/dnskey_48.h @@ -30,6 +30,8 @@ public: // BEGIN_COMMON_MEMBERS // END_COMMON_MEMBERS DNSKEY& operator=(const DNSKEY& source); + + /// \brief Destructor ~DNSKEY(); /// diff --git a/src/lib/dns/rdata/generic/ds_43.cc b/src/lib/dns/rdata/generic/ds_43.cc index 48c421c4d8..143263b2ce 100644 --- a/src/lib/dns/rdata/generic/ds_43.cc +++ b/src/lib/dns/rdata/generic/ds_43.cc @@ -56,7 +56,10 @@ DS::operator=(const DS& source) { } DS::~DS() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string diff --git a/src/lib/dns/rdata/generic/ds_43.h b/src/lib/dns/rdata/generic/ds_43.h index a20e349ef6..3fec5be1d9 100644 --- a/src/lib/dns/rdata/generic/ds_43.h +++ b/src/lib/dns/rdata/generic/ds_43.h @@ -48,7 +48,7 @@ public: /// intact. DS& operator=(const DS& source); - /// \brief The destructor. + /// \brief Destructor ~DS(); /// \brief Return the value of the Tag field. diff --git a/src/lib/dns/rdata/generic/hinfo_13.cc b/src/lib/dns/rdata/generic/hinfo_13.cc index 3bda21979c..b8342f40ef 100644 --- a/src/lib/dns/rdata/generic/hinfo_13.cc +++ b/src/lib/dns/rdata/generic/hinfo_13.cc @@ -51,8 +51,7 @@ public: } } - HINFOImpl(MasterLexer& lexer) - { + HINFOImpl(MasterLexer& lexer) { parseHINFOData(lexer); } @@ -89,13 +88,23 @@ HINFO::HINFO(MasterLexer& lexer, const Name*, {} HINFO& -HINFO::operator=(const HINFO& source) -{ - impl_.reset(new HINFOImpl(*source.impl_)); +HINFO::operator=(const HINFO& source) { + if (this == &source) { + return (*this); + } + + HINFOImpl* newimpl = new HINFOImpl(*source.impl_); + delete impl_; + impl_ = newimpl; + return (*this); } HINFO::~HINFO() { + try { + delete impl_; + } catch (...) { + } } std::string diff --git a/src/lib/dns/rdata/generic/hinfo_13.h b/src/lib/dns/rdata/generic/hinfo_13.h index acceb14fdb..d9ff6b8415 100644 --- a/src/lib/dns/rdata/generic/hinfo_13.h +++ b/src/lib/dns/rdata/generic/hinfo_13.h @@ -37,6 +37,8 @@ public: // END_COMMON_MEMBERS // HINFO specific methods + + /// \brief Destructor ~HINFO(); HINFO& operator=(const HINFO&); @@ -51,7 +53,7 @@ private: template void toWireHelper(T& outputer) const; - boost::scoped_ptr impl_; + HINFOImpl* impl_; }; diff --git a/src/lib/dns/rdata/generic/naptr_35.cc b/src/lib/dns/rdata/generic/naptr_35.cc index aa2d7f54c6..8885fa28ce 100644 --- a/src/lib/dns/rdata/generic/naptr_35.cc +++ b/src/lib/dns/rdata/generic/naptr_35.cc @@ -136,11 +136,22 @@ NAPTR::NAPTR(const NAPTR& naptr) : Rdata(), NAPTR& NAPTR::operator=(const NAPTR& source) { - impl_.reset(new NAPTRImpl(*source.impl_)); + if (this == &source) { + return (*this); + } + + NAPTRImpl* newimpl = new NAPTRImpl(*source.impl_); + delete impl_; + impl_ = newimpl; + return (*this); } NAPTR::~NAPTR() { + try { + delete impl_; + } catch (...) { + } } void diff --git a/src/lib/dns/rdata/generic/naptr_35.h b/src/lib/dns/rdata/generic/naptr_35.h index c77b95d0a8..0839de1720 100644 --- a/src/lib/dns/rdata/generic/naptr_35.h +++ b/src/lib/dns/rdata/generic/naptr_35.h @@ -35,6 +35,7 @@ public: // END_COMMON_MEMBERS // NAPTR specific methods + /// \brief Destructor ~NAPTR(); NAPTR& operator=(const NAPTR& source); @@ -52,7 +53,7 @@ private: template void toWireHelper(T& outputer) const; - boost::scoped_ptr impl_; + NAPTRImpl* impl_; }; // END_RDATA_NAMESPACE diff --git a/src/lib/dns/rdata/generic/nsec3_50.cc b/src/lib/dns/rdata/generic/nsec3_50.cc index e99c109807..fb02d9508a 100644 --- a/src/lib/dns/rdata/generic/nsec3_50.cc +++ b/src/lib/dns/rdata/generic/nsec3_50.cc @@ -206,7 +206,10 @@ NSEC3::operator=(const NSEC3& source) { } NSEC3::~NSEC3() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string diff --git a/src/lib/dns/rdata/generic/nsec3_50.h b/src/lib/dns/rdata/generic/nsec3_50.h index cf73624f58..7d87e104ae 100644 --- a/src/lib/dns/rdata/generic/nsec3_50.h +++ b/src/lib/dns/rdata/generic/nsec3_50.h @@ -31,6 +31,8 @@ public: // BEGIN_COMMON_MEMBERS // END_COMMON_MEMBERS NSEC3& operator=(const NSEC3& source); + + /// \brief Destructor ~NSEC3(); uint8_t getHashalg() const; diff --git a/src/lib/dns/rdata/generic/nsec3param_51.cc b/src/lib/dns/rdata/generic/nsec3param_51.cc index 2d28a69885..2c16729177 100644 --- a/src/lib/dns/rdata/generic/nsec3param_51.cc +++ b/src/lib/dns/rdata/generic/nsec3param_51.cc @@ -145,7 +145,10 @@ NSEC3PARAM::operator=(const NSEC3PARAM& source) { } NSEC3PARAM::~NSEC3PARAM() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string diff --git a/src/lib/dns/rdata/generic/nsec3param_51.h b/src/lib/dns/rdata/generic/nsec3param_51.h index 1c7bf03251..3621cf20c8 100644 --- a/src/lib/dns/rdata/generic/nsec3param_51.h +++ b/src/lib/dns/rdata/generic/nsec3param_51.h @@ -31,6 +31,8 @@ public: // BEGIN_COMMON_MEMBERS // END_COMMON_MEMBERS NSEC3PARAM& operator=(const NSEC3PARAM& source); + + /// \brief Destructor ~NSEC3PARAM(); /// diff --git a/src/lib/dns/rdata/generic/nsec_47.cc b/src/lib/dns/rdata/generic/nsec_47.cc index f8af0e0142..f5770247d7 100644 --- a/src/lib/dns/rdata/generic/nsec_47.cc +++ b/src/lib/dns/rdata/generic/nsec_47.cc @@ -161,7 +161,10 @@ NSEC::operator=(const NSEC& source) { } NSEC::~NSEC() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string diff --git a/src/lib/dns/rdata/generic/nsec_47.h b/src/lib/dns/rdata/generic/nsec_47.h index 299d381598..46c3ea8cc0 100644 --- a/src/lib/dns/rdata/generic/nsec_47.h +++ b/src/lib/dns/rdata/generic/nsec_47.h @@ -29,6 +29,8 @@ public: // BEGIN_COMMON_MEMBERS // END_COMMON_MEMBERS NSEC& operator=(const NSEC& source); + + /// \brief Destructor ~NSEC(); // specialized methods diff --git a/src/lib/dns/rdata/generic/opt_41.cc b/src/lib/dns/rdata/generic/opt_41.cc index 40cb1c73ae..a78342e563 100644 --- a/src/lib/dns/rdata/generic/opt_41.cc +++ b/src/lib/dns/rdata/generic/opt_41.cc @@ -26,8 +26,7 @@ using namespace isc::util; OPT::PseudoRR::PseudoRR(uint16_t code, boost::shared_ptr >& data) : code_(code), - data_(data) -{ + data_(data) { } uint16_t @@ -56,8 +55,7 @@ struct OPTImpl { /// \brief Default constructor. OPT::OPT() : - impl_(new OPTImpl) -{ + impl_(new OPTImpl) { } /// \brief Constructor from string. @@ -66,8 +64,7 @@ OPT::OPT() : /// /// \throw InvalidRdataText OPT RR cannot be constructed from text. OPT::OPT(const std::string&) : - impl_(NULL) -{ + impl_(NULL) { isc_throw(InvalidRdataText, "OPT RR cannot be constructed from text"); } @@ -78,14 +75,12 @@ OPT::OPT(const std::string&) : /// \throw InvalidRdataText OPT RR cannot be constructed from text. OPT::OPT(MasterLexer&, const Name*, MasterLoader::Options, MasterLoaderCallbacks&) : - impl_(NULL) -{ + impl_(NULL) { isc_throw(InvalidRdataText, "OPT RR cannot be constructed from text"); } OPT::OPT(InputBuffer& buffer, size_t rdata_len) : - impl_(NULL) -{ + impl_(NULL) { std::unique_ptr impl_ptr(new OPTImpl); while (true) { @@ -128,8 +123,7 @@ OPT::OPT(InputBuffer& buffer, size_t rdata_len) : } OPT::OPT(const OPT& other) : - Rdata(), impl_(new OPTImpl(*other.impl_)) -{ + Rdata(), impl_(new OPTImpl(*other.impl_)) { } OPT& @@ -146,7 +140,10 @@ OPT::operator=(const OPT& source) { } OPT::~OPT() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } std::string diff --git a/src/lib/dns/rdata/generic/opt_41.h b/src/lib/dns/rdata/generic/opt_41.h index 0c00aed20c..fabdc472d5 100644 --- a/src/lib/dns/rdata/generic/opt_41.h +++ b/src/lib/dns/rdata/generic/opt_41.h @@ -28,9 +28,12 @@ public: // BEGIN_COMMON_MEMBERS // END_COMMON_MEMBERS - // The default constructor makes sense for OPT as it can be empty. + /// \brief The default constructor makes sense for OPT as it can be empty. OPT(); + OPT& operator=(const OPT& source); + + /// \brief Destructor ~OPT(); /// \brief A class representing a pseudo RR (or option) within an diff --git a/src/lib/dns/rdata/generic/rrsig_46.cc b/src/lib/dns/rdata/generic/rrsig_46.cc index de92c67c34..131cc8d49c 100644 --- a/src/lib/dns/rdata/generic/rrsig_46.cc +++ b/src/lib/dns/rdata/generic/rrsig_46.cc @@ -236,7 +236,10 @@ RRSIG::operator=(const RRSIG& source) { } RRSIG::~RRSIG() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string diff --git a/src/lib/dns/rdata/generic/rrsig_46.h b/src/lib/dns/rdata/generic/rrsig_46.h index aca26bacab..7fb0bb294d 100644 --- a/src/lib/dns/rdata/generic/rrsig_46.h +++ b/src/lib/dns/rdata/generic/rrsig_46.h @@ -34,6 +34,8 @@ public: // BEGIN_COMMON_MEMBERS // END_COMMON_MEMBERS RRSIG& operator=(const RRSIG& source); + + /// \brief Destructor ~RRSIG(); // specialized methods diff --git a/src/lib/dns/rdata/generic/spf_99.cc b/src/lib/dns/rdata/generic/spf_99.cc index f25585ab53..1f2929ffdd 100644 --- a/src/lib/dns/rdata/generic/spf_99.cc +++ b/src/lib/dns/rdata/generic/spf_99.cc @@ -49,7 +49,10 @@ SPF::operator=(const SPF& source) { /// \brief The destructor SPF::~SPF() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } /// \brief Constructor from wire-format data. diff --git a/src/lib/dns/rdata/generic/spf_99.h b/src/lib/dns/rdata/generic/spf_99.h index 3a84d9deb8..935488bd83 100644 --- a/src/lib/dns/rdata/generic/spf_99.h +++ b/src/lib/dns/rdata/generic/spf_99.h @@ -46,7 +46,7 @@ public: /// intact. SPF& operator=(const SPF& source); - /// \brief The destructor. + /// \brief Destructor ~SPF(); /// diff --git a/src/lib/dns/rdata/generic/sshfp_44.cc b/src/lib/dns/rdata/generic/sshfp_44.cc index a08a17fcb0..15e8dbb7b1 100644 --- a/src/lib/dns/rdata/generic/sshfp_44.cc +++ b/src/lib/dns/rdata/generic/sshfp_44.cc @@ -202,7 +202,10 @@ SSHFP::operator=(const SSHFP& source) { } SSHFP::~SSHFP() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } void diff --git a/src/lib/dns/rdata/generic/sshfp_44.h b/src/lib/dns/rdata/generic/sshfp_44.h index 4eae696bdc..489d46b0c6 100644 --- a/src/lib/dns/rdata/generic/sshfp_44.h +++ b/src/lib/dns/rdata/generic/sshfp_44.h @@ -28,9 +28,12 @@ public: // BEGIN_COMMON_MEMBERS // END_COMMON_MEMBERS + /// \brief Constructor SSHFP(uint8_t algorithm, uint8_t fingerprint_type, const std::string& fingerprint); SSHFP& operator=(const SSHFP& source); + + /// \brief Destructor ~SSHFP(); /// diff --git a/src/lib/dns/rdata/generic/tlsa_52.cc b/src/lib/dns/rdata/generic/tlsa_52.cc index 330b7a2c82..2d0e27a95a 100644 --- a/src/lib/dns/rdata/generic/tlsa_52.cc +++ b/src/lib/dns/rdata/generic/tlsa_52.cc @@ -228,7 +228,10 @@ TLSA::operator=(const TLSA& source) { } TLSA::~TLSA() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } void diff --git a/src/lib/dns/rdata/generic/tlsa_52.h b/src/lib/dns/rdata/generic/tlsa_52.h index 007aa43ddc..82bef3da30 100644 --- a/src/lib/dns/rdata/generic/tlsa_52.h +++ b/src/lib/dns/rdata/generic/tlsa_52.h @@ -28,9 +28,12 @@ public: // BEGIN_COMMON_MEMBERS // END_COMMON_MEMBERS + /// \brief Constructor TLSA(uint8_t certificate_usage, uint8_t selector, uint8_t matching_type, const std::string& certificate_assoc_data); TLSA& operator=(const TLSA& source); + + /// \brief Destructor ~TLSA(); /// diff --git a/src/lib/dns/rdata/generic/txt_16.cc b/src/lib/dns/rdata/generic/txt_16.cc index 52d6b6473c..35cdaa0de5 100644 --- a/src/lib/dns/rdata/generic/txt_16.cc +++ b/src/lib/dns/rdata/generic/txt_16.cc @@ -39,7 +39,10 @@ TXT::operator=(const TXT& source) { } TXT::~TXT() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } TXT::TXT(InputBuffer& buffer, size_t rdata_len) : diff --git a/src/lib/dns/rdata/generic/txt_16.h b/src/lib/dns/rdata/generic/txt_16.h index 83979c4765..039db82adf 100644 --- a/src/lib/dns/rdata/generic/txt_16.h +++ b/src/lib/dns/rdata/generic/txt_16.h @@ -30,6 +30,8 @@ public: // END_COMMON_MEMBERS TXT& operator=(const TXT& source); + + /// \brief Destructor ~TXT(); private: diff --git a/src/lib/dns/rdata/in_1/a_1.h b/src/lib/dns/rdata/in_1/a_1.h index 9aaeea8e3f..da0308234f 100644 --- a/src/lib/dns/rdata/in_1/a_1.h +++ b/src/lib/dns/rdata/in_1/a_1.h @@ -22,10 +22,10 @@ public: // BEGIN_COMMON_MEMBERS // END_COMMON_MEMBERS - //We can use the default destructor. - //virtual ~A() {} + // We can use the default destructor. + // virtual ~A() = default // notyet: - //const struct in_addr& getAddress() const { return (addr_); } + // const struct in_addr& getAddress() const { return (addr_); } private: uint32_t addr_; // raw IPv4 address (network byte order) }; diff --git a/src/lib/dns/rdata/in_1/srv_33.cc b/src/lib/dns/rdata/in_1/srv_33.cc index a8a050ca27..6d509fde2c 100644 --- a/src/lib/dns/rdata/in_1/srv_33.cc +++ b/src/lib/dns/rdata/in_1/srv_33.cc @@ -196,7 +196,10 @@ SRV::operator=(const SRV& source) { } SRV::~SRV() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } /// \brief Convert the \c SRV to a string. diff --git a/src/lib/dns/rdata/in_1/srv_33.h b/src/lib/dns/rdata/in_1/srv_33.h index aca210e038..a224b08e0f 100644 --- a/src/lib/dns/rdata/in_1/srv_33.h +++ b/src/lib/dns/rdata/in_1/srv_33.h @@ -42,7 +42,7 @@ public: /// intact. SRV& operator=(const SRV& source); - /// \brief The destructor. + /// \brief Destructor ~SRV(); /// diff --git a/src/lib/dns/rdata_pimpl_holder.h b/src/lib/dns/rdata_pimpl_holder.h index baa343a529..b1831f4ce6 100644 --- a/src/lib/dns/rdata_pimpl_holder.h +++ b/src/lib/dns/rdata_pimpl_holder.h @@ -18,12 +18,17 @@ namespace rdata { template class RdataPimplHolder : boost::noncopyable { public: + /// @brief Constructor RdataPimplHolder(T* obj = NULL) : - obj_(obj) - {} + obj_(obj) { + } + /// @brief Destructor ~RdataPimplHolder() { - delete obj_; + try { + delete obj_; + } catch (...) { + } } void reset(T* obj = NULL) { diff --git a/src/lib/dns/rdataclass.cc b/src/lib/dns/rdataclass.cc index b5c6107b85..536d3c1553 100644 --- a/src/lib/dns/rdataclass.cc +++ b/src/lib/dns/rdataclass.cc @@ -371,7 +371,10 @@ TSIG::operator=(const TSIG& source) { } TSIG::~TSIG() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } /// \brief Convert the \c TSIG to a string. @@ -582,6 +585,8 @@ TSIG::getOtherData() const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -648,6 +653,8 @@ A::compare(const Rdata&) const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -1063,7 +1070,10 @@ CAA::operator=(const CAA& source) { } CAA::~CAA() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } void @@ -1282,6 +1292,8 @@ CNAME::getCname() const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -1349,7 +1361,10 @@ DLV::operator=(const DLV& source) { /// /// Deallocates an internal resource. DLV::~DLV() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } /// \brief Convert the \c DLV to a string. @@ -1751,7 +1766,10 @@ DNSKEY::operator=(const DNSKEY& source) { } DNSKEY::~DNSKEY() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string @@ -1855,6 +1873,8 @@ DNSKEY::getAlgorithm() const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -1907,7 +1927,10 @@ DS::operator=(const DS& source) { } DS::~DS() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string @@ -1996,8 +2019,7 @@ public: } } - HINFOImpl(MasterLexer& lexer) - { + HINFOImpl(MasterLexer& lexer) { parseHINFOData(lexer); } @@ -2034,13 +2056,23 @@ HINFO::HINFO(MasterLexer& lexer, const Name*, {} HINFO& -HINFO::operator=(const HINFO& source) -{ - impl_.reset(new HINFOImpl(*source.impl_)); +HINFO::operator=(const HINFO& source) { + if (this == &source) { + return (*this); + } + + HINFOImpl* newimpl = new HINFOImpl(*source.impl_); + delete impl_; + impl_ = newimpl; + return (*this); } HINFO::~HINFO() { + try { + delete impl_; + } catch (...) { + } } std::string @@ -2102,6 +2134,8 @@ HINFO::toWireHelper(T& outputer) const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -2575,11 +2609,22 @@ NAPTR::NAPTR(const NAPTR& naptr) : Rdata(), NAPTR& NAPTR::operator=(const NAPTR& source) { - impl_.reset(new NAPTRImpl(*source.impl_)); + if (this == &source) { + return (*this); + } + + NAPTRImpl* newimpl = new NAPTRImpl(*source.impl_); + delete impl_; + impl_ = newimpl; + return (*this); } NAPTR::~NAPTR() { + try { + delete impl_; + } catch (...) { + } } void @@ -3030,7 +3075,10 @@ NSEC3::operator=(const NSEC3& source) { } NSEC3::~NSEC3() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string @@ -3316,7 +3364,10 @@ NSEC3PARAM::operator=(const NSEC3PARAM& source) { } NSEC3PARAM::~NSEC3PARAM() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string @@ -3409,6 +3460,8 @@ NSEC3PARAM::getSalt() const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include #include @@ -3566,7 +3619,10 @@ NSEC::operator=(const NSEC& source) { } NSEC::~NSEC() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string @@ -3651,8 +3707,7 @@ namespace generic { OPT::PseudoRR::PseudoRR(uint16_t code, boost::shared_ptr >& data) : code_(code), - data_(data) -{ + data_(data) { } uint16_t @@ -3681,8 +3736,7 @@ struct OPTImpl { /// \brief Default constructor. OPT::OPT() : - impl_(new OPTImpl) -{ + impl_(new OPTImpl) { } /// \brief Constructor from string. @@ -3691,8 +3745,7 @@ OPT::OPT() : /// /// \throw InvalidRdataText OPT RR cannot be constructed from text. OPT::OPT(const std::string&) : - impl_(NULL) -{ + impl_(NULL) { isc_throw(InvalidRdataText, "OPT RR cannot be constructed from text"); } @@ -3703,14 +3756,12 @@ OPT::OPT(const std::string&) : /// \throw InvalidRdataText OPT RR cannot be constructed from text. OPT::OPT(MasterLexer&, const Name*, MasterLoader::Options, MasterLoaderCallbacks&) : - impl_(NULL) -{ + impl_(NULL) { isc_throw(InvalidRdataText, "OPT RR cannot be constructed from text"); } OPT::OPT(InputBuffer& buffer, size_t rdata_len) : - impl_(NULL) -{ + impl_(NULL) { std::unique_ptr impl_ptr(new OPTImpl); while (true) { @@ -3753,8 +3804,7 @@ OPT::OPT(InputBuffer& buffer, size_t rdata_len) : } OPT::OPT(const OPT& other) : - Rdata(), impl_(new OPTImpl(*other.impl_)) -{ + Rdata(), impl_(new OPTImpl(*other.impl_)) { } OPT& @@ -3771,7 +3821,10 @@ OPT::operator=(const OPT& source) { } OPT::~OPT() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } std::string @@ -3977,6 +4030,8 @@ PTR::getPTRName() const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -4373,7 +4428,10 @@ RRSIG::operator=(const RRSIG& source) { } RRSIG::~RRSIG() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } string @@ -4691,6 +4749,8 @@ SOA::compare(const Rdata& other) const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -4736,7 +4796,10 @@ SPF::operator=(const SPF& source) { /// \brief The destructor SPF::~SPF() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } /// \brief Constructor from wire-format data. @@ -5032,7 +5095,10 @@ SSHFP::operator=(const SSHFP& source) { } SSHFP::~SSHFP() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } void @@ -5360,7 +5426,10 @@ TLSA::operator=(const TLSA& source) { } TLSA::~TLSA() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } void @@ -5480,6 +5549,8 @@ TLSA::getDataLength() const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -5515,7 +5586,10 @@ TXT::operator=(const TXT& source) { } TXT::~TXT() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } TXT::TXT(InputBuffer& buffer, size_t rdata_len) : @@ -5577,6 +5651,8 @@ TXT::compare(const Rdata& other) const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -5643,6 +5719,8 @@ A::compare(const Rdata&) const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -5819,6 +5897,8 @@ A::compare(const Rdata& other) const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include #include @@ -5974,6 +6054,8 @@ AAAA::compare(const Rdata& other) const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -6137,6 +6219,8 @@ DHCID::getDigest() const { // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include #include @@ -6329,7 +6413,10 @@ SRV::operator=(const SRV& source) { } SRV::~SRV() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } /// \brief Convert the \c SRV to a string. diff --git a/src/lib/dns/rdataclass.h b/src/lib/dns/rdataclass.h index e8d8d7a2b6..a40a226310 100644 --- a/src/lib/dns/rdataclass.h +++ b/src/lib/dns/rdataclass.h @@ -64,6 +64,7 @@ class TSIG : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit TSIG(const std::string& type_str); TSIG(isc::util::InputBuffer& buffer, size_t rdata_len); TSIG(const TSIG& other); @@ -224,6 +225,7 @@ class A : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit A(const std::string& type_str); A(isc::util::InputBuffer& buffer, size_t rdata_len); A(const A& other); @@ -288,6 +290,7 @@ class AFSDB : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit AFSDB(const std::string& type_str); AFSDB(isc::util::InputBuffer& buffer, size_t rdata_len); AFSDB(const AFSDB& other); @@ -376,7 +379,8 @@ class CAA : public Rdata { public: // BEGIN_COMMON_MEMBERS - explicit CAA(const std::string& caa_str); + /// \brief Constructor + explicit CAA(const std::string& type_str); CAA(isc::util::InputBuffer& buffer, size_t rdata_len); CAA(const CAA& other); CAA( @@ -389,8 +393,12 @@ public: // END_COMMON_MEMBERS + /// \brief Constructor CAA(uint8_t flags, const std::string& tag, const std::string& value); + CAA& operator=(const CAA& source); + + /// \brief Destructor ~CAA(); /// @@ -458,6 +466,7 @@ class CNAME : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit CNAME(const std::string& type_str); CNAME(isc::util::InputBuffer& buffer, size_t rdata_len); CNAME(const CNAME& other); @@ -534,6 +543,7 @@ class DLV : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit DLV(const std::string& type_str); DLV(isc::util::InputBuffer& buffer, size_t rdata_len); DLV(const DLV& other); @@ -558,7 +568,7 @@ public: /// intact. DLV& operator=(const DLV& source); - /// \brief The destructor. + /// \brief Destructor ~DLV(); /// \brief Return the value of the Tag field. @@ -612,6 +622,7 @@ class DNAME : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit DNAME(const std::string& type_str); DNAME(isc::util::InputBuffer& buffer, size_t rdata_len); DNAME(const DNAME& other); @@ -681,6 +692,7 @@ class DNSKEY : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit DNSKEY(const std::string& type_str); DNSKEY(isc::util::InputBuffer& buffer, size_t rdata_len); DNSKEY(const DNSKEY& other); @@ -694,6 +706,8 @@ public: // END_COMMON_MEMBERS DNSKEY& operator=(const DNSKEY& source); + + /// \brief Destructor ~DNSKEY(); /// @@ -771,6 +785,7 @@ class DS : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit DS(const std::string& type_str); DS(isc::util::InputBuffer& buffer, size_t rdata_len); DS(const DS& other); @@ -795,7 +810,7 @@ public: /// intact. DS& operator=(const DS& source); - /// \brief The destructor. + /// \brief Destructor ~DS(); /// \brief Return the value of the Tag field. @@ -862,6 +877,7 @@ class HINFO : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit HINFO(const std::string& type_str); HINFO(isc::util::InputBuffer& buffer, size_t rdata_len); HINFO(const HINFO& other); @@ -876,6 +892,8 @@ public: // END_COMMON_MEMBERS // HINFO specific methods + + /// \brief Destructor ~HINFO(); HINFO& operator=(const HINFO&); @@ -890,7 +908,7 @@ private: template void toWireHelper(T& outputer) const; - boost::scoped_ptr impl_; + HINFOImpl* impl_; }; @@ -942,6 +960,7 @@ class MINFO : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit MINFO(const std::string& type_str); MINFO(isc::util::InputBuffer& buffer, size_t rdata_len); MINFO(const MINFO& other); @@ -1035,6 +1054,7 @@ class MX : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit MX(const std::string& type_str); MX(isc::util::InputBuffer& buffer, size_t rdata_len); MX(const MX& other); @@ -1119,6 +1139,7 @@ class NAPTR : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit NAPTR(const std::string& type_str); NAPTR(isc::util::InputBuffer& buffer, size_t rdata_len); NAPTR(const NAPTR& other); @@ -1133,6 +1154,7 @@ public: // END_COMMON_MEMBERS // NAPTR specific methods + /// \brief Destructor ~NAPTR(); NAPTR& operator=(const NAPTR& source); @@ -1150,7 +1172,7 @@ private: template void toWireHelper(T& outputer) const; - boost::scoped_ptr impl_; + NAPTRImpl* impl_; }; } // end of namespace "generic" @@ -1195,6 +1217,7 @@ class NS : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit NS(const std::string& type_str); NS(isc::util::InputBuffer& buffer, size_t rdata_len); NS(const NS& other); @@ -1269,6 +1292,7 @@ class NSEC3 : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit NSEC3(const std::string& type_str); NSEC3(isc::util::InputBuffer& buffer, size_t rdata_len); NSEC3(const NSEC3& other); @@ -1282,6 +1306,8 @@ public: // END_COMMON_MEMBERS NSEC3& operator=(const NSEC3& source); + + /// \brief Destructor ~NSEC3(); uint8_t getHashalg() const; @@ -1346,6 +1372,7 @@ class NSEC3PARAM : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit NSEC3PARAM(const std::string& type_str); NSEC3PARAM(isc::util::InputBuffer& buffer, size_t rdata_len); NSEC3PARAM(const NSEC3PARAM& other); @@ -1359,6 +1386,8 @@ public: // END_COMMON_MEMBERS NSEC3PARAM& operator=(const NSEC3PARAM& source); + + /// \brief Destructor ~NSEC3PARAM(); /// @@ -1423,6 +1452,7 @@ class NSEC : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit NSEC(const std::string& type_str); NSEC(isc::util::InputBuffer& buffer, size_t rdata_len); NSEC(const NSEC& other); @@ -1436,6 +1466,8 @@ public: // END_COMMON_MEMBERS NSEC& operator=(const NSEC& source); + + /// \brief Destructor ~NSEC(); // specialized methods @@ -1498,6 +1530,7 @@ class OPT : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit OPT(const std::string& type_str); OPT(isc::util::InputBuffer& buffer, size_t rdata_len); OPT(const OPT& other); @@ -1511,9 +1544,12 @@ public: // END_COMMON_MEMBERS - // The default constructor makes sense for OPT as it can be empty. + /// \brief The default constructor makes sense for OPT as it can be empty. OPT(); + OPT& operator=(const OPT& source); + + /// \brief Destructor ~OPT(); /// \brief A class representing a pseudo RR (or option) within an @@ -1606,6 +1642,7 @@ class PTR : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit PTR(const std::string& type_str); PTR(isc::util::InputBuffer& buffer, size_t rdata_len); PTR(const PTR& other); @@ -1679,6 +1716,7 @@ class RP : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit RP(const std::string& type_str); RP(isc::util::InputBuffer& buffer, size_t rdata_len); RP(const RP& other); @@ -1785,6 +1823,7 @@ class RRSIG : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit RRSIG(const std::string& type_str); RRSIG(isc::util::InputBuffer& buffer, size_t rdata_len); RRSIG(const RRSIG& other); @@ -1798,6 +1837,8 @@ public: // END_COMMON_MEMBERS RRSIG& operator=(const RRSIG& source); + + /// \brief Destructor ~RRSIG(); // specialized methods @@ -1852,6 +1893,7 @@ class SOA : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit SOA(const std::string& type_str); SOA(isc::util::InputBuffer& buffer, size_t rdata_len); SOA(const SOA& other); @@ -1937,6 +1979,7 @@ class SPF : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit SPF(const std::string& type_str); SPF(isc::util::InputBuffer& buffer, size_t rdata_len); SPF(const SPF& other); @@ -1961,7 +2004,7 @@ public: /// intact. SPF& operator=(const SPF& source); - /// \brief The destructor. + /// \brief Destructor ~SPF(); /// @@ -2025,6 +2068,7 @@ class SSHFP : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit SSHFP(const std::string& type_str); SSHFP(isc::util::InputBuffer& buffer, size_t rdata_len); SSHFP(const SSHFP& other); @@ -2038,9 +2082,12 @@ public: // END_COMMON_MEMBERS + /// \brief Constructor SSHFP(uint8_t algorithm, uint8_t fingerprint_type, const std::string& fingerprint); SSHFP& operator=(const SSHFP& source); + + /// \brief Destructor ~SSHFP(); /// @@ -2104,7 +2151,8 @@ class TLSA : public Rdata { public: // BEGIN_COMMON_MEMBERS - explicit TLSA(const std::string& tlsa_str); + /// \brief Constructor + explicit TLSA(const std::string& type_str); TLSA(isc::util::InputBuffer& buffer, size_t rdata_len); TLSA(const TLSA& other); TLSA( @@ -2117,9 +2165,12 @@ public: // END_COMMON_MEMBERS + /// \brief Constructor TLSA(uint8_t certificate_usage, uint8_t selector, uint8_t matching_type, const std::string& certificate_assoc_data); TLSA& operator=(const TLSA& source); + + /// \brief Destructor ~TLSA(); /// @@ -2185,6 +2236,7 @@ class TXT : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit TXT(const std::string& type_str); TXT(isc::util::InputBuffer& buffer, size_t rdata_len); TXT(const TXT& other); @@ -2199,6 +2251,8 @@ public: // END_COMMON_MEMBERS TXT& operator=(const TXT& source); + + /// \brief Destructor ~TXT(); private: @@ -2247,6 +2301,7 @@ class A : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit A(const std::string& type_str); A(isc::util::InputBuffer& buffer, size_t rdata_len); A(const A& other); @@ -2302,6 +2357,7 @@ class A : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit A(const std::string& type_str); A(isc::util::InputBuffer& buffer, size_t rdata_len); A(const A& other); @@ -2315,10 +2371,10 @@ public: // END_COMMON_MEMBERS - //We can use the default destructor. - //virtual ~A() {} + // We can use the default destructor. + // virtual ~A() = default // notyet: - //const struct in_addr& getAddress() const { return (addr_); } + // const struct in_addr& getAddress() const { return (addr_); } private: uint32_t addr_; // raw IPv4 address (network byte order) }; @@ -2365,6 +2421,7 @@ class AAAA : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit AAAA(const std::string& type_str); AAAA(isc::util::InputBuffer& buffer, size_t rdata_len); AAAA(const AAAA& other); @@ -2431,6 +2488,7 @@ class DHCID : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit DHCID(const std::string& type_str); DHCID(isc::util::InputBuffer& buffer, size_t rdata_len); DHCID(const DHCID& other); @@ -2509,6 +2567,7 @@ class SRV : public Rdata { public: // BEGIN_COMMON_MEMBERS + /// \brief Constructor explicit SRV(const std::string& type_str); SRV(isc::util::InputBuffer& buffer, size_t rdata_len); SRV(const SRV& other); @@ -2533,7 +2592,7 @@ public: /// intact. SRV& operator=(const SRV& source); - /// \brief The destructor. + /// \brief Destructor ~SRV(); /// diff --git a/src/lib/dns/rdatafields.cc b/src/lib/dns/rdatafields.cc index e02ec8ff87..16213c9d55 100644 --- a/src/lib/dns/rdatafields.cc +++ b/src/lib/dns/rdatafields.cc @@ -64,18 +64,35 @@ namespace { // it's hopefully an acceptable practice. class RdataFieldComposer : public AbstractMessageRenderer { public: + /// @brief Constructor RdataFieldComposer() : truncated_(false), length_limit_(65535), - mode_(CASE_INSENSITIVE), last_data_pos_(0) - {} - virtual ~RdataFieldComposer() {} - virtual bool isTruncated() const { return (truncated_); } - virtual size_t getLengthLimit() const { return (length_limit_); } - virtual CompressMode getCompressMode() const { return (mode_); } - virtual void setTruncated() { truncated_ = true; } - virtual void setLengthLimit(size_t len) { length_limit_ = len; } - virtual void setCompressMode(CompressMode mode) { mode_ = mode; } - virtual void writeName(const LabelSequence&, bool) {} + mode_(CASE_INSENSITIVE), last_data_pos_(0) { + } + + /// @brief Destructor + virtual ~RdataFieldComposer() = default; + + virtual bool isTruncated() const { + return (truncated_); + } + virtual size_t getLengthLimit() const { + return (length_limit_); + } + virtual CompressMode getCompressMode() const { + return (mode_); + } + virtual void setTruncated() { + truncated_ = true; + } + virtual void setLengthLimit(size_t len) { + length_limit_ = len; + } + virtual void setCompressMode(CompressMode mode) { + mode_ = mode; + } + virtual void writeName(const LabelSequence&, bool) { + } virtual void writeName(const Name& name, bool compress) { extendData(); const RdataFields::Type field_type = @@ -148,8 +165,7 @@ RdataFields::RdataFields(const void* fields, const unsigned int fields_length, nfields_(fields_length / sizeof(*fields_)), data_(static_cast(data)), data_length_(data_length), - detail_(NULL) -{ + detail_(NULL) { if ((fields_ == NULL && nfields_ > 0) || (fields_ != NULL && nfields_ == 0)) { isc_throw(InvalidParameter, @@ -176,7 +192,10 @@ RdataFields::RdataFields(const void* fields, const unsigned int fields_length, } RdataFields::~RdataFields() { - delete detail_; + try { + delete detail_; + } catch (...) { + } } RdataFields::FieldSpec diff --git a/src/lib/dns/rdatafields.h b/src/lib/dns/rdatafields.h index c4a64ad798..b59914c6a5 100644 --- a/src/lib/dns/rdatafields.h +++ b/src/lib/dns/rdatafields.h @@ -246,7 +246,7 @@ public: /// \param rdata The RDATA for which the \c RdataFields to be constructed. RdataFields(const Rdata& rdata); - /// Constructor from field parameters. + /// \brief Constructor from field parameters. /// /// The intended usage of this version of constructor is to form a /// structured representation of \c RDATA encoded by the other @@ -295,7 +295,7 @@ public: RdataFields(const void* fields, const unsigned int fields_length, const void* data, const size_t data_length); - /// The destructor. + /// \brief The destructor. ~RdataFields(); //@} diff --git a/src/lib/dns/rrcollator.cc b/src/lib/dns/rrcollator.cc index 8378021675..f58ef72610 100644 --- a/src/lib/dns/rrcollator.cc +++ b/src/lib/dns/rrcollator.cc @@ -80,11 +80,14 @@ RRCollator::Impl::addRR(const Name& name, const RRClass& rrclass, } RRCollator::RRCollator(const AddRRsetCallback& callback) : - impl_(new Impl(callback)) -{} + impl_(new Impl(callback)) { +} RRCollator::~RRCollator() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } AddRRCallback diff --git a/src/lib/dns/rrparamregistry-placeholder.cc b/src/lib/dns/rrparamregistry-placeholder.cc index 455c117d69..89951694ea 100644 --- a/src/lib/dns/rrparamregistry-placeholder.cc +++ b/src/lib/dns/rrparamregistry-placeholder.cc @@ -214,7 +214,10 @@ RRParamRegistry::RRParamRegistry() { } RRParamRegistry::~RRParamRegistry() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } RRParamRegistry& diff --git a/src/lib/dns/rrparamregistry.cc b/src/lib/dns/rrparamregistry.cc index 4850593428..995dff0251 100644 --- a/src/lib/dns/rrparamregistry.cc +++ b/src/lib/dns/rrparamregistry.cc @@ -315,7 +315,10 @@ RRParamRegistry::RRParamRegistry() { } RRParamRegistry::~RRParamRegistry() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } RRParamRegistry& diff --git a/src/lib/dns/rrparamregistry.h b/src/lib/dns/rrparamregistry.h index 27e8a4fc2d..e68202e135 100644 --- a/src/lib/dns/rrparamregistry.h +++ b/src/lib/dns/rrparamregistry.h @@ -64,10 +64,10 @@ protected: /// /// This is intentionally defined as \c protected as this base class should /// never be instantiated (except as part of a derived class). - AbstractRdataFactory() {} + AbstractRdataFactory() = default; public: /// The destructor. - virtual ~AbstractRdataFactory() {}; + virtual ~AbstractRdataFactory() = default; //@} /// @@ -175,8 +175,13 @@ class RRParamRegistry { /// These are intentionally hidden (see the class description). //@{ private: + /// @brief Constructor RRParamRegistry(); + + /// @brief Copy constructor RRParamRegistry(const RRParamRegistry& orig); + + /// @brief Destructor ~RRParamRegistry(); //@} public: diff --git a/src/lib/dns/rrset.cc b/src/lib/dns/rrset.cc index b2170029d4..3d7b4b0af7 100644 --- a/src/lib/dns/rrset.cc +++ b/src/lib/dns/rrset.cc @@ -229,13 +229,15 @@ BasicRRsetImpl::toWire(AbstractMessageRenderer& renderer, size_t limit) const { } BasicRRset::BasicRRset(const Name& name, const RRClass& rrclass, - const RRType& rrtype, const RRTTL& ttl) -{ + const RRType& rrtype, const RRTTL& ttl) { impl_ = new BasicRRsetImpl(name, rrclass, rrtype, ttl); } BasicRRset::~BasicRRset() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } void @@ -349,13 +351,10 @@ BasicRRset::toWire(AbstractMessageRenderer& renderer) const { RRset::RRset(const Name& name, const RRClass& rrclass, const RRType& rrtype, const RRTTL& ttl) : - BasicRRset(name, rrclass, rrtype, ttl) -{ + BasicRRset(name, rrclass, rrtype, ttl) { rrsig_ = RRsetPtr(); } -RRset::~RRset() {} - unsigned int RRset::getRRsigDataCount() const { if (rrsig_) { @@ -418,10 +417,11 @@ class BasicRdataIterator : public RdataIterator { public: /// @brief Constructor. BasicRdataIterator(const std::vector& datavector) : - datavector_(&datavector), it_(datavector_->begin()) {} + datavector_(&datavector), it_(datavector_->begin()) { + } /// @brief Destructor. - ~BasicRdataIterator() {} + ~BasicRdataIterator() = default; /// @brief Set iterator at first position. virtual void first() { diff --git a/src/lib/dns/rrset.h b/src/lib/dns/rrset.h index d17846aa97..93a4c556f1 100644 --- a/src/lib/dns/rrset.h +++ b/src/lib/dns/rrset.h @@ -166,10 +166,10 @@ protected: /// /// This is intentionally defined as \c protected as this base class should /// never be instantiated (except as part of a derived class). - AbstractRRset() {} + AbstractRRset() = default; public: /// The destructor. - virtual ~AbstractRRset() {} + virtual ~AbstractRRset() = default; //@} /// @@ -567,10 +567,10 @@ protected: /// /// This is intentionally defined as \c protected as this base class should /// never be instantiated (except as part of a derived class). - RdataIterator() {} + RdataIterator() = default; public: /// \brief Destructor - virtual ~RdataIterator() {} + virtual ~RdataIterator() = default; private: RdataIterator(const RdataIterator& source); RdataIterator& operator=(const RdataIterator& source); @@ -651,6 +651,7 @@ public: /// \param ttl The TTL of the RRset. BasicRRset(const Name& name, const RRClass& rrclass, const RRType& rrtype, const RRTTL& ttl); + /// \brief The destructor. virtual ~BasicRRset(); //@} @@ -846,10 +847,12 @@ private: /// QNAME/QTYPE/QCLASS as a single object. class RRset : public BasicRRset { public: + /// \brief Constructor RRset(const Name& name, const RRClass& rrclass, const RRType& rrtype, const RRTTL& ttl); - virtual ~RRset(); + /// \brief Destructor + virtual ~RRset() = default; /// \brief Get the wire format length of the \c RRset. /// diff --git a/src/lib/dns/rrset_collection.h b/src/lib/dns/rrset_collection.h index 7fb1e9c78b..4f852e05b2 100644 --- a/src/lib/dns/rrset_collection.h +++ b/src/lib/dns/rrset_collection.h @@ -58,7 +58,7 @@ public: const isc::dns::RRClass& rrclass); /// \brief Destructor - virtual ~RRsetCollection() {} + virtual ~RRsetCollection() = default; /// \brief Add an RRset to the collection. /// diff --git a/src/lib/dns/rrset_collection_base.h b/src/lib/dns/rrset_collection_base.h index ac77756e41..e6ebcc651f 100644 --- a/src/lib/dns/rrset_collection_base.h +++ b/src/lib/dns/rrset_collection_base.h @@ -94,7 +94,7 @@ public: const = 0; /// \brief Destructor - virtual ~RRsetCollectionBase() {} + virtual ~RRsetCollectionBase() = default; protected: class Iter; // forward declaration @@ -112,7 +112,11 @@ protected: /// iterator only. class Iter { public: - virtual ~Iter() {}; + /// @brief Constructor + Iter() = default; + + /// @brief Destructor + virtual ~Iter() = default; /// \brief Returns the \c AbstractRRset currently pointed to by /// the iterator. diff --git a/src/lib/dns/tests/nsec3hash_unittest.cc b/src/lib/dns/tests/nsec3hash_unittest.cc index b47bb4969b..58c56b9144 100644 --- a/src/lib/dns/tests/nsec3hash_unittest.cc +++ b/src/lib/dns/tests/nsec3hash_unittest.cc @@ -43,8 +43,11 @@ protected: } ~NSEC3HashTest() { - // Make sure we reset the hash creator to the default - setNSEC3HashCreator(NULL); + try { + // Make sure we reset the hash creator to the default + setNSEC3HashCreator(NULL); + } catch (...) { + } } // An NSEC3Hash object commonly used in tests. Parameters are borrowed diff --git a/src/lib/dns/tests/rdatafields_unittest.cc b/src/lib/dns/tests/rdatafields_unittest.cc index 0531439574..a9cb076ea0 100644 --- a/src/lib/dns/tests/rdatafields_unittest.cc +++ b/src/lib/dns/tests/rdatafields_unittest.cc @@ -332,9 +332,17 @@ TEST_F(RdataFieldsTest, getFieldSpecWithBadFieldId) { class DummyRdata : public Rdata { public: enum Mode { CLEAR, SKIP, TRIM }; - explicit DummyRdata(Mode mode) : mode_(mode) {} - DummyRdata(const DummyRdata& source) : Rdata(), mode_(source.mode_) {} - virtual ~DummyRdata() {} + /// @brief Constructor + explicit DummyRdata(Mode mode) : mode_(mode) { + } + + /// @brief Copy constructor + DummyRdata(const DummyRdata& source) : Rdata(), mode_(source.mode_) { + } + + /// @brief Destructor + virtual ~DummyRdata() = default; + virtual void toWire(AbstractMessageRenderer& renderer) const { // call the unexpected method corresponding to the test mode. // method parameters don't matter. diff --git a/src/lib/dns/tests/rrparamregistry_unittest.cc b/src/lib/dns/tests/rrparamregistry_unittest.cc index 90574d095d..f160ca575c 100644 --- a/src/lib/dns/tests/rrparamregistry_unittest.cc +++ b/src/lib/dns/tests/rrparamregistry_unittest.cc @@ -30,8 +30,9 @@ using namespace isc::dns::rdata; namespace { class RRParamRegistryTest : public ::testing::Test { protected: - RRParamRegistryTest() - { + + /// @brief Constructor + RRParamRegistryTest() { ostringstream oss1; oss1 << test_class_code; // cppcheck-suppress useInitializationList @@ -41,16 +42,20 @@ protected: oss2 << test_type_code; test_type_unknown_str = "TYPE" + oss2.str(); } - ~RRParamRegistryTest() - { - // cleanup any non well-known parameters that possibly remain - // as a side effect. - RRParamRegistry::getRegistry().removeType(test_type_code); - RRParamRegistry::getRegistry().removeClass(test_class_code); - RRParamRegistry::getRegistry().removeRdataFactory( - RRType(test_type_code), RRClass(test_class_code)); - RRParamRegistry::getRegistry().removeRdataFactory( - RRType(test_type_code)); + + /// @brief Destructor + ~RRParamRegistryTest() { + try { + // cleanup any non well-known parameters that possibly remain + // as a side effect. + RRParamRegistry::getRegistry().removeType(test_type_code); + RRParamRegistry::getRegistry().removeClass(test_class_code); + RRParamRegistry::getRegistry().removeRdataFactory( + RRType(test_type_code), RRClass(test_class_code)); + RRParamRegistry::getRegistry().removeRdataFactory( + RRType(test_type_code)); + } catch (...) { + } } string test_class_unknown_str; diff --git a/src/lib/dns/tests/tsig_unittest.cc b/src/lib/dns/tests/tsig_unittest.cc index 85b75532c9..ac80ceb593 100644 --- a/src/lib/dns/tests/tsig_unittest.cc +++ b/src/lib/dns/tests/tsig_unittest.cc @@ -83,6 +83,7 @@ public: class TSIGTest : public ::testing::Test { protected: + /// @brief Constructor TSIGTest() : tsig_ctx(NULL), qid(0x2d65), test_name("www.example.com"), badkey_name("badkey.example.com"), test_class(RRClass::IN()), @@ -91,8 +92,7 @@ protected: dummy_record(badkey_name, any::TSIG(TSIGKey::HMACMD5_NAME(), 0x4da8877a, TSIGContext::DEFAULT_FUDGE, - 0, NULL, qid, 0, 0, NULL)) - { + 0, NULL, qid, 0, 0, NULL)) { // Make sure we use the system time by default so that we won't be // confused due to other tests that tweak the time. isc::util::detail::gettimeFunction = NULL; @@ -107,8 +107,13 @@ protected: &secret[0], secret.size()))); } + + /// @brief Destructor ~TSIGTest() { - isc::util::detail::gettimeFunction = NULL; + try { + isc::util::detail::gettimeFunction = NULL; + } catch (...) { + } } // Many of the tests below create some DNS message and sign it under diff --git a/src/lib/dns/tests/unittest_util.cc b/src/lib/dns/tests/unittest_util.cc index b234c1cf9d..fa276c8a8c 100644 --- a/src/lib/dns/tests/unittest_util.cc +++ b/src/lib/dns/tests/unittest_util.cc @@ -29,9 +29,14 @@ namespace { class UnitTestUtilConfig { private: // This is a singleton object and cannot be constructed explicitly. - UnitTestUtilConfig() {} - UnitTestUtilConfig(const UnitTestUtilConfig& source); - ~UnitTestUtilConfig() {} + /// @brief Constructor + UnitTestUtilConfig() = default; + + /// @brief Copy constructor + UnitTestUtilConfig(const UnitTestUtilConfig& source) = default; + + /// @brief Destructor + ~UnitTestUtilConfig() = default; public: /// Return a singleton unit test configuration object. On first invocation /// one will be constructed. diff --git a/src/lib/dns/tsig.cc b/src/lib/dns/tsig.cc index 10bc51abbc..9cf59009e1 100644 --- a/src/lib/dns/tsig.cc +++ b/src/lib/dns/tsig.cc @@ -243,8 +243,7 @@ const size_t MESSAGE_HEADER_LEN = 12; void TSIGContext::TSIGContextImpl::digestDNSMessage(HMACPtr hmac, uint16_t qid, const void* data, - size_t data_len) const -{ + size_t data_len) const { OutputBuffer buffer(MESSAGE_HEADER_LEN); const uint8_t* msgptr = static_cast(data); @@ -266,13 +265,11 @@ TSIGContext::TSIGContextImpl::digestDNSMessage(HMACPtr hmac, hmac->update(msgptr, data_len - MESSAGE_HEADER_LEN); } -TSIGContext::TSIGContext(const TSIGKey& key) : impl_(new TSIGContextImpl(key)) -{ +TSIGContext::TSIGContext(const TSIGKey& key) : impl_(new TSIGContextImpl(key)) { } TSIGContext::TSIGContext(const Name& key_name, const Name& algorithm_name, - const TSIGKeyRing& keyring) : impl_(NULL) -{ + const TSIGKeyRing& keyring) : impl_(NULL) { const TSIGKeyRing::FindResult result(keyring.find(key_name, algorithm_name)); if (result.code == TSIGKeyRing::NOTFOUND) { @@ -288,7 +285,10 @@ TSIGContext::TSIGContext(const Name& key_name, const Name& algorithm_name, } TSIGContext::~TSIGContext() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } size_t diff --git a/src/lib/dns/tsigkey.cc b/src/lib/dns/tsigkey.cc index ff355d4fa4..84c76dbbd4 100644 --- a/src/lib/dns/tsigkey.cc +++ b/src/lib/dns/tsigkey.cc @@ -207,7 +207,10 @@ TSIGKey::operator=(const TSIGKey& source) { } TSIGKey::~TSIGKey() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } const Name& @@ -310,7 +313,10 @@ TSIGKeyRing::TSIGKeyRing() : impl_(new TSIGKeyRingImpl) { } TSIGKeyRing::~TSIGKeyRing() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } unsigned int diff --git a/src/lib/eval/eval_context.cc b/src/lib/eval/eval_context.cc index d91fbb0abc..40f9a015e7 100644 --- a/src/lib/eval/eval_context.cc +++ b/src/lib/eval/eval_context.cc @@ -21,11 +21,7 @@ EvalContext::EvalContext(const Option::Universe& option_universe, CheckDefined check_defined) : trace_scanning_(false), trace_parsing_(false), - option_universe_(option_universe), check_defined_(check_defined) -{ -} - -EvalContext::~EvalContext() { + option_universe_(option_universe), check_defined_(check_defined) { } bool diff --git a/src/lib/eval/eval_context.h b/src/lib/eval/eval_context.h index 38f44a5304..809ac8fee6 100644 --- a/src/lib/eval/eval_context.h +++ b/src/lib/eval/eval_context.h @@ -55,7 +55,7 @@ public: CheckDefined check_defined = acceptAll); /// @brief destructor - virtual ~EvalContext(); + virtual ~EvalContext() = default; /// @brief Accept all client class names /// diff --git a/src/lib/eval/tests/dependency_unittest.cc b/src/lib/eval/tests/dependency_unittest.cc index 1f99bfdc7c..5279b422f0 100644 --- a/src/lib/eval/tests/dependency_unittest.cc +++ b/src/lib/eval/tests/dependency_unittest.cc @@ -30,10 +30,19 @@ namespace { class DependencyTest : public ::testing::Test { public: - /// @brief Reset expression and result. + /// @brief Constructor + DependencyTest() : result_(true) { + } + + /// @brief Destructor + /// + /// Reset expression and result. ~DependencyTest() { - e_.reset(); - result_ = false; + try { + e_.reset(); + result_ = false; + } catch (...) { + } } ExpressionPtr e_; ///< An expression @@ -95,4 +104,4 @@ TEST_F(DependencyTest, matching) { EXPECT_TRUE(result_); } -}; +} diff --git a/src/lib/eval/token.h b/src/lib/eval/token.h index 3e4e3be474..ac176fccfa 100644 --- a/src/lib/eval/token.h +++ b/src/lib/eval/token.h @@ -78,7 +78,7 @@ public: virtual void evaluate(Pkt& pkt, ValueStack& values) = 0; /// @brief Virtual destructor - virtual ~Token() {} + virtual ~Token() = default; /// @brief Coverts a (string) value to a boolean /// diff --git a/src/lib/exceptions/exceptions.h b/src/lib/exceptions/exceptions.h index f5368c8458..c218517b94 100644 --- a/src/lib/exceptions/exceptions.h +++ b/src/lib/exceptions/exceptions.h @@ -42,8 +42,8 @@ public: /// @param what a description (type) of the exception. Exception(const char* file, size_t line, const std::string& what); - /// The destructor - virtual ~Exception() throw() {} + /// \brief Destructor + virtual ~Exception() throw() = default; //@} private: /// diff --git a/src/lib/hooks/callout_handle.cc b/src/lib/hooks/callout_handle.cc index e80760ac92..6d48be3750 100644 --- a/src/lib/hooks/callout_handle.cc +++ b/src/lib/hooks/callout_handle.cc @@ -35,28 +35,31 @@ CalloutHandle::CalloutHandle(const boost::shared_ptr& manager, // Destructor CalloutHandle::~CalloutHandle() { - // Call the "context_destroy" hook. We should be OK doing this - although - // the destructor is being called, all the member variables are still in - // existence. - manager_->callCallouts(ServerHooks::CONTEXT_DESTROY, *this); - - // Explicitly clear the argument and context objects. This should free up - // all memory that could have been allocated by libraries that were loaded. - arguments_.clear(); - context_collection_.clear(); - - // Normal destruction of the remaining variables will include the - // destruction of lm_collection_, an action that decrements the reference - // count on the library manager collection (which holds the libraries that - // could have allocated memory in the argument and context members.) When - // that goes to zero, the libraries will be unloaded: at that point nothing - // in the hooks framework will be pointing to memory in the libraries' - // address space. - // - // It is possible that some other data structure in the server (the program - // using the hooks library) still references the address space and attempts - // to access it causing a segmentation fault. That issue is outside the - // scope of this framework and is not addressed by it. + try { + // Call the "context_destroy" hook. We should be OK doing this - although + // the destructor is being called, all the member variables are still in + // existence. + manager_->callCallouts(ServerHooks::CONTEXT_DESTROY, *this); + + // Explicitly clear the argument and context objects. This should free up + // all memory that could have been allocated by libraries that were loaded. + arguments_.clear(); + context_collection_.clear(); + + // Normal destruction of the remaining variables will include the + // destruction of lm_collection_, an action that decrements the reference + // count on the library manager collection (which holds the libraries that + // could have allocated memory in the argument and context members.) When + // that goes to zero, the libraries will be unloaded: at that point nothing + // in the hooks framework will be pointing to memory in the libraries' + // address space. + // + // It is possible that some other data structure in the server (the program + // using the hooks library) still references the address space and attempts + // to access it causing a segmentation fault. That issue is outside the + // scope of this framework and is not addressed by it. + } catch (...) { + } } // Return the name of all argument items. @@ -148,7 +151,10 @@ ScopedCalloutHandleState(const CalloutHandlePtr& callout_handle) } ScopedCalloutHandleState::~ScopedCalloutHandleState() { - resetState(); + try { + resetState(); + } catch (...) { + } } void diff --git a/src/lib/hooks/library_manager.cc b/src/lib/hooks/library_manager.cc index 447c9ebb88..0c9788cf0f 100644 --- a/src/lib/hooks/library_manager.cc +++ b/src/lib/hooks/library_manager.cc @@ -50,20 +50,23 @@ LibraryManager::LibraryManager(const std::string& name, int index, // The only method to do so is "validateLibrary", which takes care not to call // methods requiring a non-NULL manager. LibraryManager::LibraryManager(const std::string& name) - : dl_handle_(NULL), index_(-1), manager_(), library_name_(name) -{} + : dl_handle_(NULL), index_(-1), manager_(), library_name_(name) { +} // Destructor. LibraryManager::~LibraryManager() { - if (index_ >= 0) { - // LibraryManager instantiated to load a library, so ensure that - // it is unloaded before exiting. - static_cast(prepareUnloadLibrary()); - } + try { + if (index_ >= 0) { + // LibraryManager instantiated to load a library, so ensure that + // it is unloaded before exiting. + static_cast(prepareUnloadLibrary()); + } - // LibraryManager instantiated to validate a library, so just ensure - // that it is closed before exiting. - static_cast(closeLibrary()); + // LibraryManager instantiated to validate a library, so just ensure + // that it is closed before exiting. + static_cast(closeLibrary()); + } catch (...) { + } } // Open the library diff --git a/src/lib/hooks/library_manager_collection.h b/src/lib/hooks/library_manager_collection.h index 53a9669a49..d8c28c8e22 100644 --- a/src/lib/hooks/library_manager_collection.h +++ b/src/lib/hooks/library_manager_collection.h @@ -80,7 +80,10 @@ public: /// /// Unloads all loaded libraries. ~LibraryManagerCollection() { - static_cast(unloadLibraries()); + try { + static_cast(unloadLibraries()); + } catch (...) { + } } /// @brief Load libraries diff --git a/src/lib/hooks/tests/hooks_manager_unittest.cc b/src/lib/hooks/tests/hooks_manager_unittest.cc index a36d42ce0d..8838fc4f38 100644 --- a/src/lib/hooks/tests/hooks_manager_unittest.cc +++ b/src/lib/hooks/tests/hooks_manager_unittest.cc @@ -55,12 +55,15 @@ public: /// /// Unload all libraries. ~HooksManagerTest() { - static_cast(remove(MARKER_FILE)); - HooksManager::setTestMode(false); - HooksManager::prepareUnloadLibraries(); - bool status = HooksManager::unloadLibraries(); - if (!status) { - cerr << "(fixture dtor) unloadLibraries failed" << endl; + try { + static_cast(remove(MARKER_FILE)); + HooksManager::setTestMode(false); + HooksManager::prepareUnloadLibraries(); + bool status = HooksManager::unloadLibraries(); + if (!status) { + cerr << "(fixture dtor) unloadLibraries failed" << endl; + } + } catch (...) { } } diff --git a/src/lib/hooks/tests/library_manager_unittest.cc b/src/lib/hooks/tests/library_manager_unittest.cc index c0174a41bf..e9bbce4dd2 100644 --- a/src/lib/hooks/tests/library_manager_unittest.cc +++ b/src/lib/hooks/tests/library_manager_unittest.cc @@ -61,10 +61,13 @@ public: /// /// Ensures a marker file is removed after each test. ~LibraryManagerTest() { - static_cast(remove(MARKER_FILE)); + try { + static_cast(remove(MARKER_FILE)); - // Disable multi-threading. - MultiThreadingMgr::instance().setMode(false); + // Disable multi-threading. + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief Marker file present diff --git a/src/lib/http/auth_config.h b/src/lib/http/auth_config.h index 3f76033f01..1e315f9995 100644 --- a/src/lib/http/auth_config.h +++ b/src/lib/http/auth_config.h @@ -23,8 +23,11 @@ class HttpAuthConfig : public isc::data::UserContext, public isc::data::CfgToElement { public: + /// @brief Constructor. + HttpAuthConfig() = default; + /// @brief Destructor. - virtual ~HttpAuthConfig() { } + virtual ~HttpAuthConfig() = default; /// @brief Set the realm. /// diff --git a/src/lib/http/basic_auth_config.h b/src/lib/http/basic_auth_config.h index 80417d7dd7..6d83a20608 100644 --- a/src/lib/http/basic_auth_config.h +++ b/src/lib/http/basic_auth_config.h @@ -66,9 +66,11 @@ typedef std::list BasicHttpAuthClientList; /// @brief Basic HTTP authentication configuration. class BasicHttpAuthConfig : public HttpAuthConfig { public: + /// @brief Constructor + BasicHttpAuthConfig() = default; /// @brief Destructor. - virtual ~BasicHttpAuthConfig() { } + virtual ~BasicHttpAuthConfig() = default; /// @brief Add a client configuration. /// diff --git a/src/lib/http/client.cc b/src/lib/http/client.cc index 6067898ad3..379cba4dbe 100644 --- a/src/lib/http/client.cc +++ b/src/lib/http/client.cc @@ -487,7 +487,10 @@ public: /// /// Closes all connections. ~ConnectionPool() { - closeAll(); + try { + closeAll(); + } catch (...) { + } } /// @brief Process next queued request for the given URL and TLS context. @@ -818,7 +821,10 @@ private: /// @brief Destructor ~Destination() { - closeAllConnections(); + try { + closeAllConnections(); + } catch (...) { + } } /// @brief Adds a new connection @@ -1103,7 +1109,10 @@ Connection::Connection(IOService& io_service, } Connection::~Connection() { - close(); + try { + close(); + } catch (...) { + } } void @@ -1775,7 +1784,10 @@ public: /// /// Calls stop(). ~HttpClientImpl() { - stop(); + try { + stop(); + } catch (...) { + } } /// @brief Starts running the client's thread pool, if multi-threaded. @@ -1914,9 +1926,6 @@ HttpClient::HttpClient(IOService& io_service, size_t thread_pool_size, defer_thread_start)); } -HttpClient::~HttpClient() { -} - void HttpClient::asyncSendRequest(const Url& url, const TlsContextPtr& tls_context, diff --git a/src/lib/http/client.h b/src/lib/http/client.h index 34a0a23acc..bafca5efaf 100644 --- a/src/lib/http/client.h +++ b/src/lib/http/client.h @@ -145,11 +145,12 @@ public: /// the thread pool threads will be created and started, with the /// operational state being RUNNING. Applicable only when thread-pool size /// is greater than zero. - explicit HttpClient(asiolink::IOService& io_service, size_t thread_pool_size = 0, + explicit HttpClient(asiolink::IOService& io_service, + size_t thread_pool_size = 0, bool defer_thread_start = false); /// @brief Destructor. - ~HttpClient(); + ~HttpClient() = default; /// @brief Queues new asynchronous HTTP request for a given URL. /// diff --git a/src/lib/http/connection.cc b/src/lib/http/connection.cc index ba238ac431..52c4f49a0e 100644 --- a/src/lib/http/connection.cc +++ b/src/lib/http/connection.cc @@ -89,7 +89,10 @@ HttpConnection::HttpConnection(asiolink::IOService& io_service, } HttpConnection::~HttpConnection() { - close(); + try { + close(); + } catch (...) { + } } void diff --git a/src/lib/http/http_message.cc b/src/lib/http/http_message.cc index ce012cafae..6c34583838 100644 --- a/src/lib/http/http_message.cc +++ b/src/lib/http/http_message.cc @@ -17,9 +17,6 @@ HttpMessage::HttpMessage(const HttpMessage::Direction& direction) created_(false), finalized_(false), headers_() { } -HttpMessage::~HttpMessage() { -} - void HttpMessage::requireHttpVersion(const HttpVersion& version) { required_versions_.insert(version); diff --git a/src/lib/http/http_message.h b/src/lib/http/http_message.h index 3634c80fa7..6d63e422b8 100644 --- a/src/lib/http/http_message.h +++ b/src/lib/http/http_message.h @@ -74,7 +74,7 @@ public: explicit HttpMessage(const Direction& direction); /// @brief Destructor. - virtual ~HttpMessage(); + virtual ~HttpMessage() = default; /// @brief Returns HTTP message direction. Direction getDirection() const { diff --git a/src/lib/http/http_thread_pool.cc b/src/lib/http/http_thread_pool.cc index 7e649f5f39..a08a0f078a 100644 --- a/src/lib/http/http_thread_pool.cc +++ b/src/lib/http/http_thread_pool.cc @@ -51,7 +51,10 @@ HttpThreadPool::HttpThreadPool(IOServicePtr io_service, size_t pool_size, } HttpThreadPool::~HttpThreadPool() { - stop(); + try { + stop(); + } catch (...) { + } } void diff --git a/src/lib/http/listener.cc b/src/lib/http/listener.cc index 2e6d2e1c62..53346bf95d 100644 --- a/src/lib/http/listener.cc +++ b/src/lib/http/listener.cc @@ -29,7 +29,10 @@ HttpListener::HttpListener(IOService& io_service, } HttpListener::~HttpListener() { - stop(); + try { + stop(); + } catch (...) { + } } IOAddress diff --git a/src/lib/http/listener_impl.h b/src/lib/http/listener_impl.h index 4ad1960844..b6b2a1c0dd 100644 --- a/src/lib/http/listener_impl.h +++ b/src/lib/http/listener_impl.h @@ -53,8 +53,7 @@ public: const long idle_timeout); /// @brief Virtual destructor. - virtual ~HttpListenerImpl() { - } + virtual ~HttpListenerImpl() = default; /// @brief Returns reference to the current listener endpoint. const asiolink::TCPEndpoint& getEndpoint() const; diff --git a/src/lib/http/response_creator.h b/src/lib/http/response_creator.h index ac212fe5de..fb00ff1cc3 100644 --- a/src/lib/http/response_creator.h +++ b/src/lib/http/response_creator.h @@ -37,11 +37,13 @@ typedef boost::shared_ptr HttpResponseCreatorPtr; /// @c createHttpResponse method. class HttpResponseCreator { public: + /// @brief Constructor. + HttpResponseCreator() = default; /// @brief Destructor. /// /// Classes with virtual functions need virtual destructors. - virtual ~HttpResponseCreator() { }; + virtual ~HttpResponseCreator() = default; /// @brief Create HTTP response from HTTP request received. /// @@ -104,7 +106,6 @@ protected: /// @return Pointer to an object representing HTTP response. virtual HttpResponsePtr createDynamicHttpResponse(HttpRequestPtr request) = 0; - }; } // namespace http diff --git a/src/lib/http/response_creator_factory.h b/src/lib/http/response_creator_factory.h index c2fc9178a5..e8c0f91f65 100644 --- a/src/lib/http/response_creator_factory.h +++ b/src/lib/http/response_creator_factory.h @@ -34,9 +34,11 @@ namespace http { /// if creating new instance for each request is not required or undesired. class HttpResponseCreatorFactory { public: + /// @brief Constructor. + HttpResponseCreatorFactory() = default; /// @brief Virtual destructor. - virtual ~HttpResponseCreatorFactory() { } + virtual ~HttpResponseCreatorFactory() = default; /// @brief Returns an instance of the @ref HttpResponseCreator. /// @@ -46,7 +48,6 @@ public: /// @return Pointer to the instance of the @ref HttpResponseCreator to /// be used to generate HTTP response. virtual HttpResponseCreatorPtr create() const = 0; - }; /// @brief Pointer to the @ref HttpResponseCreatorFactory. diff --git a/src/lib/http/tests/client_mt_unittests.cc b/src/lib/http/tests/client_mt_unittests.cc index df09d1ad3e..82e1b60cce 100644 --- a/src/lib/http/tests/client_mt_unittests.cc +++ b/src/lib/http/tests/client_mt_unittests.cc @@ -207,17 +207,20 @@ public: /// @brief Destructor. ~MtHttpClientTest() { - // Stop the client. - if (client_) { - client_->stop(); - } + try { + // Stop the client. + if (client_) { + client_->stop(); + } - // Stop all listeners. - for (const auto& listener : listeners_) { - listener->stop(); - } + // Stop all listeners. + for (const auto& listener : listeners_) { + listener->stop(); + } - MultiThreadingMgr::instance().setMode(false); + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief Callback function to invoke upon test timeout. diff --git a/src/lib/http/tests/connection_pool_unittests.cc b/src/lib/http/tests/connection_pool_unittests.cc index b8337c3d36..f25a6eb180 100644 --- a/src/lib/http/tests/connection_pool_unittests.cc +++ b/src/lib/http/tests/connection_pool_unittests.cc @@ -114,7 +114,10 @@ public: /// @brief Destructor. ~HttpConnectionPoolTest() { - MultiThreadingMgr::instance().setMode(false); + try { + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief Verifies that connections can be added to the pool and removed. diff --git a/src/lib/http/tests/http_thread_pool_unittests.cc b/src/lib/http/tests/http_thread_pool_unittests.cc index fcc088bd77..610c282cc0 100644 --- a/src/lib/http/tests/http_thread_pool_unittests.cc +++ b/src/lib/http/tests/http_thread_pool_unittests.cc @@ -34,7 +34,10 @@ public: /// @brief Destructor. virtual ~HttpThreadPoolTest() { - io_service_->stop(); + try { + io_service_->stop(); + } catch (...) { + } } /// @brief IOService instance used by thread pools. diff --git a/src/lib/http/tests/request_test.h b/src/lib/http/tests/request_test.h index f73b31f786..e3891ef126 100644 --- a/src/lib/http/tests/request_test.h +++ b/src/lib/http/tests/request_test.h @@ -37,8 +37,7 @@ public: /// @brief Destructor. /// /// Does nothing. - virtual ~HttpRequestTestBase() { - } + virtual ~HttpRequestTestBase() = default; /// @brief Initializes HTTP request context with basic information. /// diff --git a/src/lib/http/tests/server_client_unittests.cc b/src/lib/http/tests/server_client_unittests.cc index 4b466a0e3f..879274c527 100644 --- a/src/lib/http/tests/server_client_unittests.cc +++ b/src/lib/http/tests/server_client_unittests.cc @@ -409,9 +409,12 @@ public: /// /// Removes active HTTP clients. virtual ~HttpListenerTest() { - for (auto client = clients_.begin(); client != clients_.end(); - ++client) { - (*client)->close(); + try { + for (auto client = clients_.begin(); client != clients_.end(); + ++client) { + (*client)->close(); + } + } catch (...) { } } @@ -1019,11 +1022,14 @@ public: /// @brief Destructor. ~HttpClientTest() { - listener_.stop(); - listener2_.stop(); - listener3_.stop(); - io_service_.poll(); - MultiThreadingMgr::instance().setMode(false); + try { + listener_.stop(); + listener2_.stop(); + listener3_.stop(); + io_service_.poll(); + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief Creates HTTP request with JSON body. diff --git a/src/lib/http/tests/test_http_client.h b/src/lib/http/tests/test_http_client.h index f95b11189c..9b2d8c2b1f 100644 --- a/src/lib/http/tests/test_http_client.h +++ b/src/lib/http/tests/test_http_client.h @@ -43,7 +43,10 @@ public: /// /// Closes the underlying socket if it is open. ~TestHttpClient() { - close(); + try { + close(); + } catch (...) { + } } /// @brief Send HTTP request specified in textual format. diff --git a/src/lib/http/tests/tls_client_unittests.cc b/src/lib/http/tests/tls_client_unittests.cc index 4a64898bfd..f8e667efd0 100644 --- a/src/lib/http/tests/tls_client_unittests.cc +++ b/src/lib/http/tests/tls_client_unittests.cc @@ -303,11 +303,14 @@ public: /// @brief Destructor. ~HttpsClientTest() { - listener_->stop(); - listener2_->stop(); - listener3_->stop(); - io_service_.poll(); - MultiThreadingMgr::instance().setMode(false); + try { + listener_->stop(); + listener2_->stop(); + listener3_->stop(); + io_service_.poll(); + MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } /// @brief Creates HTTP request with JSON body. diff --git a/src/lib/http/tests/tls_server_unittests.cc b/src/lib/http/tests/tls_server_unittests.cc index 87c89579ee..579ed10dc8 100644 --- a/src/lib/http/tests/tls_server_unittests.cc +++ b/src/lib/http/tests/tls_server_unittests.cc @@ -416,7 +416,10 @@ public: /// /// Closes the underlying socket if it is open. ~TestHttpClient() { - close(); + try { + close(); + } catch (...) { + } } /// @brief Send HTTP request specified in textual format. @@ -657,9 +660,12 @@ public: /// /// Removes active HTTP clients. virtual ~HttpsListenerTest() { - for (auto client = clients_.begin(); client != clients_.end(); - ++client) { - (*client)->close(); + try { + for (auto client = clients_.begin(); client != clients_.end(); + ++client) { + (*client)->close(); + } + } catch (...) { } } diff --git a/src/lib/log/interprocess/interprocess_sync.h b/src/lib/log/interprocess/interprocess_sync.h index 0692ee15b7..f510c13ec5 100644 --- a/src/lib/log/interprocess/interprocess_sync.h +++ b/src/lib/log/interprocess/interprocess_sync.h @@ -50,11 +50,11 @@ public: /// identical among the various processes that need to be /// synchronized for the same task. InterprocessSync(const std::string& task_name) : - task_name_(task_name), is_locked_(false) - {} + task_name_(task_name), is_locked_(false) { + } /// \brief Destructor - virtual ~InterprocessSync() {} + virtual ~InterprocessSync() = default; protected: /// \brief Acquire the lock (blocks if something else has acquired a @@ -92,13 +92,17 @@ public: /// \param sync The sync object which has to be locked/unlocked by /// this locker object. InterprocessSyncLocker(InterprocessSync& sync) : - sync_(sync) - {} + sync_(sync) { + } /// \brief Destructor ~InterprocessSyncLocker() { - if (isLocked()) - unlock(); + try { + if (isLocked()) { + unlock(); + } + } catch (...) { + } } /// \brief Acquire the lock (blocks if something else has acquired a diff --git a/src/lib/log/interprocess/interprocess_sync_file.cc b/src/lib/log/interprocess/interprocess_sync_file.cc index ed6a5b7e2f..49aa0c8a50 100644 --- a/src/lib/log/interprocess/interprocess_sync_file.cc +++ b/src/lib/log/interprocess/interprocess_sync_file.cc @@ -29,11 +29,14 @@ namespace log { namespace interprocess { InterprocessSyncFile::~InterprocessSyncFile() { - if (fd_ != -1) { - // This will also release any applied locks. - close(fd_); - // The lockfile will continue to exist, and we must not delete - // it. + try { + if (fd_ != -1) { + // This will also release any applied locks. + close(fd_); + // The lockfile will continue to exist, and we must not delete + // it. + } + } catch (...) { } } diff --git a/src/lib/log/interprocess/interprocess_sync_null.cc b/src/lib/log/interprocess/interprocess_sync_null.cc index ccd9e32a7c..9464d5ff69 100644 --- a/src/lib/log/interprocess/interprocess_sync_null.cc +++ b/src/lib/log/interprocess/interprocess_sync_null.cc @@ -12,9 +12,6 @@ namespace isc { namespace log { namespace interprocess { -InterprocessSyncNull::~InterprocessSyncNull() { -} - bool InterprocessSyncNull::lock() { is_locked_ = true; diff --git a/src/lib/log/interprocess/interprocess_sync_null.h b/src/lib/log/interprocess/interprocess_sync_null.h index 8b0c57b3f9..461dc4d48e 100644 --- a/src/lib/log/interprocess/interprocess_sync_null.h +++ b/src/lib/log/interprocess/interprocess_sync_null.h @@ -32,7 +32,7 @@ public: {} /// \brief Destructor - virtual ~InterprocessSyncNull(); + virtual ~InterprocessSyncNull() = default; protected: /// \brief Acquire the lock (never blocks) diff --git a/src/lib/log/log_formatter.h b/src/lib/log/log_formatter.h index 7fc67f14dc..be51d7188a 100644 --- a/src/lib/log/log_formatter.h +++ b/src/lib/log/log_formatter.h @@ -156,13 +156,16 @@ public: // /// This is the place where output happens if the formatter is active. ~Formatter() { - if (logger_) { - try { - checkExcessPlaceholders(*message_, ++nextPlaceholder_); - logger_->output(severity_, *message_); - } catch (...) { - // Catch and ignore all exceptions here. + try { + if (logger_) { + try { + checkExcessPlaceholders(*message_, ++nextPlaceholder_); + logger_->output(severity_, *message_); + } catch (...) { + // Catch and ignore all exceptions here. + } } + } catch (...) { } } diff --git a/src/lib/log/logger.cc b/src/lib/log/logger.cc index d0cd19609f..ff0b5e4b4b 100644 --- a/src/lib/log/logger.cc +++ b/src/lib/log/logger.cc @@ -49,12 +49,15 @@ Logger::initLoggerImpl() { // Destructor. Logger::~Logger() { - delete loggerptr_; - - // The next statement is required for the Kea hooks framework, where a - // statically-linked Kea loads and unloads multiple libraries. See the hooks - // documentation for more details. - loggerptr_ = 0; + try { + delete loggerptr_; + + // The next statement is required for the Kea hooks framework, where a + // statically-linked Kea loads and unloads multiple libraries. See the hooks + // documentation for more details. + loggerptr_ = 0; + } catch (...) { + } } // Get Version diff --git a/src/lib/log/logger_impl.cc b/src/lib/log/logger_impl.cc index 853cba056d..57b0e9cf0b 100644 --- a/src/lib/log/logger_impl.cc +++ b/src/lib/log/logger_impl.cc @@ -79,7 +79,10 @@ LoggerImpl::LoggerImpl(const string& name) : // Destructor. (Here because of virtual declaration.) LoggerImpl::~LoggerImpl() { - delete sync_; + try { + delete sync_; + } catch (...) { + } } /// \brief Version diff --git a/src/lib/log/logger_manager.cc b/src/lib/log/logger_manager.cc index 1890706898..0aa7ee8166 100644 --- a/src/lib/log/logger_manager.cc +++ b/src/lib/log/logger_manager.cc @@ -72,7 +72,10 @@ LoggerManager::LoggerManager() { // Destructor - get rid of the implementation class LoggerManager::~LoggerManager() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } // Initialize processing diff --git a/src/lib/log/message_dictionary.cc b/src/lib/log/message_dictionary.cc index 12511b0607..fb2da76eb5 100644 --- a/src/lib/log/message_dictionary.cc +++ b/src/lib/log/message_dictionary.cc @@ -15,16 +15,6 @@ using namespace std; namespace isc { namespace log { -// Constructor - -MessageDictionary::MessageDictionary() : dictionary_(), empty_("") { -} - -// (Virtual) Destructor - -MessageDictionary::~MessageDictionary() { -} - // Add message and note if ID already exists bool diff --git a/src/lib/log/message_dictionary.h b/src/lib/log/message_dictionary.h index 6afc0f084d..4aca5ec824 100644 --- a/src/lib/log/message_dictionary.h +++ b/src/lib/log/message_dictionary.h @@ -51,10 +51,10 @@ public: typedef Dictionary::const_iterator const_iterator; /// \brief Constructor - MessageDictionary(); + MessageDictionary() = default; /// \brief Virtual Destructor - virtual ~MessageDictionary(); + virtual ~MessageDictionary() = default; /// \brief Add Message /// diff --git a/src/lib/log/message_exception.h b/src/lib/log/message_exception.h index f5c77cf4bb..cf045f700a 100644 --- a/src/lib/log/message_exception.h +++ b/src/lib/log/message_exception.h @@ -84,7 +84,7 @@ public: } /// \brief Destructor - ~MessageException() {} + ~MessageException() = default; /// \brief Return Message ID /// diff --git a/src/lib/log/message_initializer.cc b/src/lib/log/message_initializer.cc index a7c85ed2e6..82301efb79 100644 --- a/src/lib/log/message_initializer.cc +++ b/src/lib/log/message_initializer.cc @@ -56,35 +56,38 @@ MessageInitializer::MessageInitializer(const char* values[]) } MessageInitializer::~MessageInitializer() { - // Search for the pointer to pending messages belonging to our instance. - LoggerValuesList::iterator my_messages = std::find(global_logger_values_->begin(), - global_logger_values_->end(), - values_); - bool pending = (my_messages != global_logger_values_->end()); - // Our messages are still pending, so let's remove them from the list - // of pending messages. - if (pending) { - global_logger_values_->erase(my_messages); - - } else { - // Our messages are not pending, so they might have been loaded to - // the dictionary and/or duplicates. - int i = 0; - while (values_[i]) { - // Check if the unloaded message is registered as duplicate. If it is, - // remove it from the duplicates list. - LoggerDuplicatesList::iterator dup = - std::find(global_logger_duplicates_->begin(), - global_logger_duplicates_->end(), - values_[i]); - if (dup != global_logger_duplicates_->end()) { - global_logger_duplicates_->erase(dup); - - } else { - global_dictionary_->erase(values_[i], values_[i + 1]); + try { + // Search for the pointer to pending messages belonging to our instance. + LoggerValuesList::iterator my_messages = std::find(global_logger_values_->begin(), + global_logger_values_->end(), + values_); + bool pending = (my_messages != global_logger_values_->end()); + // Our messages are still pending, so let's remove them from the list + // of pending messages. + if (pending) { + global_logger_values_->erase(my_messages); + + } else { + // Our messages are not pending, so they might have been loaded to + // the dictionary and/or duplicates. + int i = 0; + while (values_[i]) { + // Check if the unloaded message is registered as duplicate. If it is, + // remove it from the duplicates list. + LoggerDuplicatesList::iterator dup = + std::find(global_logger_duplicates_->begin(), + global_logger_duplicates_->end(), + values_[i]); + if (dup != global_logger_duplicates_->end()) { + global_logger_duplicates_->erase(dup); + + } else { + global_dictionary_->erase(values_[i], values_[i + 1]); + } + i += 2; } - i += 2; } + } catch (...) { } } diff --git a/src/lib/log/message_reader.h b/src/lib/log/message_reader.h index 65fdb2bf0e..518ff72029 100644 --- a/src/lib/log/message_reader.h +++ b/src/lib/log/message_reader.h @@ -53,12 +53,11 @@ public: /// The ownership of the dictionary object is not transferred - the caller /// is responsible for managing the lifetime of the dictionary. MessageReader(MessageDictionary* dictionary = NULL) : - dictionary_(dictionary), lineno_(0) - {} + dictionary_(dictionary), lineno_(0) { + } /// \brief Virtual Destructor - virtual ~MessageReader() - {} + virtual ~MessageReader() = default; /// \brief Get Dictionary /// diff --git a/src/lib/log/tests/buffer_appender_unittest.cc b/src/lib/log/tests/buffer_appender_unittest.cc index f52d8339b0..50424127c0 100644 --- a/src/lib/log/tests/buffer_appender_unittest.cc +++ b/src/lib/log/tests/buffer_appender_unittest.cc @@ -36,28 +36,32 @@ public: class BufferAppenderTest : public ::testing::Test { protected: + /// @brief Constructor BufferAppenderTest() : buffer_appender1(new TestBufferAppender()), appender1(buffer_appender1), buffer_appender2(new TestBufferAppender()), appender2(buffer_appender2), - logger(log4cplus::Logger::getInstance("buffer")) - { + logger(log4cplus::Logger::getInstance("buffer")) { logger.setLogLevel(log4cplus::TRACE_LOG_LEVEL); } + /// @brief Destructor ~BufferAppenderTest() { - // If any log messages are left, we don't care, get rid of them, - // by flushing them to a null appender - // Given the 'messages should not get lost' approach of the logging - // system, not flushing them to a null appender would cause them - // to be dumped to stdout as the test is destroyed, making - // unnecessarily messy test output. - log4cplus::SharedAppenderPtr null_appender( - new log4cplus::NullAppender()); - logger.removeAllAppenders(); - logger.addAppender(null_appender); - buffer_appender1->flush(); - buffer_appender2->flush(); + try { + // If any log messages are left, we don't care, get rid of them, + // by flushing them to a null appender + // Given the 'messages should not get lost' approach of the logging + // system, not flushing them to a null appender would cause them + // to be dumped to stdout as the test is destroyed, making + // unnecessarily messy test output. + log4cplus::SharedAppenderPtr null_appender( + new log4cplus::NullAppender()); + logger.removeAllAppenders(); + logger.addAppender(null_appender); + buffer_appender1->flush(); + buffer_appender2->flush(); + } catch (...) { + } } TestBufferAppender* buffer_appender1; diff --git a/src/lib/log/tests/logger_level_impl_unittest.cc b/src/lib/log/tests/logger_level_impl_unittest.cc index c82be69b17..8279cbf059 100644 --- a/src/lib/log/tests/logger_level_impl_unittest.cc +++ b/src/lib/log/tests/logger_level_impl_unittest.cc @@ -22,13 +22,14 @@ using namespace std; class LoggerLevelImplTest : public ::testing::Test { protected: + /// @brief Constructor LoggerLevelImplTest() { // Ensure logging set to default for unit tests setDefaultLoggingOutput(); } - ~LoggerLevelImplTest() - {} + /// @brief Destructor + ~LoggerLevelImplTest() = default; }; diff --git a/src/lib/log/tests/logger_level_unittest.cc b/src/lib/log/tests/logger_level_unittest.cc index ccaecd9015..5af2fe8221 100644 --- a/src/lib/log/tests/logger_level_unittest.cc +++ b/src/lib/log/tests/logger_level_unittest.cc @@ -22,13 +22,19 @@ using namespace std; class LoggerLevelTest : public ::testing::Test { protected: + /// @brief Constructor LoggerLevelTest() { // Logger initialization is done in main(). As logging tests may // alter the default logging output, it is reset here. setDefaultLoggingOutput(); } + + /// @brief Destructor ~LoggerLevelTest() { - LoggerManager::reset(); + try { + LoggerManager::reset(); + } catch (...) { + } } }; diff --git a/src/lib/log/tests/logger_lock_test.cc b/src/lib/log/tests/logger_lock_test.cc index 9908800eca..82a18a16b7 100644 --- a/src/lib/log/tests/logger_lock_test.cc +++ b/src/lib/log/tests/logger_lock_test.cc @@ -44,10 +44,14 @@ public: /// /// Unlocks the mutex. ~CheckMutex() { - mutex_.unlock(); + try { + mutex_.unlock(); + } catch (...) { + } } private: + /// @brief The mutex used for testing mutex& mutex_; }; diff --git a/src/lib/log/tests/logger_manager_unittest.cc b/src/lib/log/tests/logger_manager_unittest.cc index dc6046820c..05e62056f1 100644 --- a/src/lib/log/tests/logger_manager_unittest.cc +++ b/src/lib/log/tests/logger_manager_unittest.cc @@ -41,12 +41,17 @@ using namespace std; /// \brief LoggerManager Test class LoggerManagerTest : public ::testing::Test { public: + /// @brief Constructor LoggerManagerTest() { // Initialization of logging is done in main() } + /// @brief Destructor ~LoggerManagerTest() { - LoggerManager::reset(); + try { + LoggerManager::reset(); + } catch (...) { + } } }; @@ -73,12 +78,15 @@ public: // Destructor, remove the file. This is only a test, so ignore failures ~SpecificationForFileLogger() { - if (! name_.empty()) { - static_cast(remove(name_.c_str())); - - // Depending on the log4cplus version, a lock file may also be - // created. - static_cast(remove((name_ + ".lock").c_str())); + try { + if (!name_.empty()) { + static_cast(remove(name_.c_str())); + + // Depending on the log4cplus version, a lock file may also be + // created. + static_cast(remove((name_ + ".lock").c_str())); + } + } catch (...) { } } @@ -327,6 +335,7 @@ namespace { // begin unnamed namespace class RegexHolder { public: + /// @brief Constructor RegexHolder(const char* expr, const int flags = REG_EXTENDED) { const int rc = regcomp(®ex_, expr, flags); if (rc) { @@ -335,8 +344,12 @@ public: } } + /// @brief Destructor ~RegexHolder() { - regfree(®ex_); + try { + regfree(®ex_); + } catch (...) { + } } regex_t* operator*() { diff --git a/src/lib/log/tests/logger_name_unittest.cc b/src/lib/log/tests/logger_name_unittest.cc index 9048bf2662..1306c4e7d0 100644 --- a/src/lib/log/tests/logger_name_unittest.cc +++ b/src/lib/log/tests/logger_name_unittest.cc @@ -25,11 +25,18 @@ using namespace isc::log; class LoggerNameTest : public ::testing::Test { public: + + /// @brief Constructor LoggerNameTest() : - name_(getRootLoggerName()) - {} + name_(getRootLoggerName()) { + } + + /// @brief Destructor ~LoggerNameTest() { - setRootLoggerName(name_); + try { + setRootLoggerName(name_); + } catch (...) { + } } private: diff --git a/src/lib/log/tests/logger_support_unittest.cc b/src/lib/log/tests/logger_support_unittest.cc index 3f2943c6a4..6ad14d2409 100644 --- a/src/lib/log/tests/logger_support_unittest.cc +++ b/src/lib/log/tests/logger_support_unittest.cc @@ -14,13 +14,15 @@ using namespace isc::log; class LoggerSupportTest : public ::testing::Test { protected: + /// @brief Constructor LoggerSupportTest() { // Logger initialization is done in main(). As logging tests may // alter the default logging output, it is reset here. setDefaultLoggingOutput(); } - ~LoggerSupportTest() { - } + + /// @brief Destructor + ~LoggerSupportTest() = default; }; // Check that the initialized flag can be manipulated. This is a bit chicken- diff --git a/src/lib/log/tests/logger_unittest.cc b/src/lib/log/tests/logger_unittest.cc index 8f06a4203d..5b76933ba5 100644 --- a/src/lib/log/tests/logger_unittest.cc +++ b/src/lib/log/tests/logger_unittest.cc @@ -32,11 +32,17 @@ using namespace std; class LoggerTest : public ::testing::Test { public: + /// @brief Constructor LoggerTest() { // Initialization of logging is done in main() } + + /// @brief Destructor ~LoggerTest() { - LoggerManager::reset(); + try { + LoggerManager::reset(); + } catch (...) { + } } }; diff --git a/src/lib/log/tests/message_reader_unittest.cc b/src/lib/log/tests/message_reader_unittest.cc index 4dd64353b9..a6fd1cf265 100644 --- a/src/lib/log/tests/message_reader_unittest.cc +++ b/src/lib/log/tests/message_reader_unittest.cc @@ -21,14 +21,18 @@ using namespace std; class MessageReaderTest : public ::testing::Test { protected: - MessageReaderTest() : dictionary_(), reader_() - { + /// @brief Constructor + MessageReaderTest() : dictionary_(), reader_() { dictionary_ = new MessageDictionary(); reader_.setDictionary(dictionary_); } + /// @brief Destructor ~MessageReaderTest() { - delete dictionary_; + try { + delete dictionary_; + } catch (...) { + } } MessageDictionary* dictionary_; // Dictionary to add messages to diff --git a/src/lib/mysql/mysql_connection.cc b/src/lib/mysql/mysql_connection.cc index 02ca83da09..e32c1951f0 100644 --- a/src/lib/mysql/mysql_connection.cc +++ b/src/lib/mysql/mysql_connection.cc @@ -34,10 +34,13 @@ MySqlTransaction::MySqlTransaction(MySqlConnection& conn) } MySqlTransaction::~MySqlTransaction() { - // Rollback if the MySqlTransaction::commit wasn't explicitly - // called. - if (!committed_) { - conn_.rollback(); + try { + // Rollback if the MySqlTransaction::commit wasn't explicitly + // called. + if (!committed_) { + conn_.rollback(); + } + } catch (...) { } } @@ -362,17 +365,20 @@ void MySqlConnection::clearStatements() { /// @brief Destructor MySqlConnection::~MySqlConnection() { - // Free up the prepared statements, ignoring errors. (What would we do - // about them? We're destroying this object and are not really concerned - // with errors on a database connection that is about to go away.) - for (int i = 0; i < statements_.size(); ++i) { - if (statements_[i] != NULL) { - (void) mysql_stmt_close(statements_[i]); - statements_[i] = NULL; + try { + // Free up the prepared statements, ignoring errors. (What would we do + // about them? We're destroying this object and are not really concerned + // with errors on a database connection that is about to go away.) + for (int i = 0; i < statements_.size(); ++i) { + if (statements_[i] != NULL) { + (void) mysql_stmt_close(statements_[i]); + statements_[i] = NULL; + } } + statements_.clear(); + text_statements_.clear(); + } catch (...) { } - statements_.clear(); - text_statements_.clear(); } // Time conversion methods. diff --git a/src/lib/mysql/mysql_connection.h b/src/lib/mysql/mysql_connection.h index 2bd49280c1..6f82d0eef3 100644 --- a/src/lib/mysql/mysql_connection.h +++ b/src/lib/mysql/mysql_connection.h @@ -53,18 +53,22 @@ public: /// way, any error from mysql_stmt_free_result is ignored. (Generating /// an exception is not much help, as it will only confuse things if the /// method calling mysql_stmt_fetch is exiting via an exception.) - MySqlFreeResult(MYSQL_STMT* statement) : statement_(statement) - {} + MySqlFreeResult(MYSQL_STMT* statement) : statement_(statement) { + } /// @brief Destructor /// /// Frees up fetch context if a fetch has been successfully executed. ~MySqlFreeResult() { - (void) mysql_stmt_free_result(statement_); + try { + (void) mysql_stmt_free_result(statement_); + } catch (...) { + } } private: - MYSQL_STMT* statement_; ///< Statement for which results are freed + /// @brief Statement for which results are freed + MYSQL_STMT* statement_; }; /// @brief MySQL Selection Statements @@ -147,8 +151,11 @@ public: /// /// Frees up resources allocated by the initialization of MySql. ~MySqlHolder() { - if (mysql_ != NULL) { - mysql_close(mysql_); + try { + if (mysql_ != NULL) { + mysql_close(mysql_); + } + } catch (...) { } } diff --git a/src/lib/mysql/tests/mysql_connection_unittest.cc b/src/lib/mysql/tests/mysql_connection_unittest.cc index 06e610be4d..a9248a82b3 100644 --- a/src/lib/mysql/tests/mysql_connection_unittest.cc +++ b/src/lib/mysql/tests/mysql_connection_unittest.cc @@ -20,11 +20,16 @@ namespace { /// @brief RAII wrapper over MYSQL_RES obtained from MySQL library functions like /// mysql_use_result(). struct MySqlResult { + /// @brief Constructor MySqlResult(MYSQL_RES* result) : result_(result) { } + /// @brief Destructor ~MySqlResult() { - mysql_free_result(result_); + try { + mysql_free_result(result_); + } catch (...) { + } } MYSQL_RES* const result_; @@ -109,8 +114,11 @@ public: /// /// Removes test table from the database. virtual ~MySqlConnectionTest() { - conn_.rollback(); - dropTestTable(); + try { + conn_.rollback(); + dropTestTable(); + } catch (...) { + } } /// @brief Creates test table @c mysql_connection_test. @@ -577,7 +585,10 @@ public: /// @brief Destructor. virtual ~MySqlSchemaTest() { - destroyMySQLSchema(); + try { + destroyMySQLSchema(); + } catch (...) { + } } }; diff --git a/src/lib/pgsql/pgsql_connection.cc b/src/lib/pgsql/pgsql_connection.cc index b3b48bdb2a..72fbc8073d 100644 --- a/src/lib/pgsql/pgsql_connection.cc +++ b/src/lib/pgsql/pgsql_connection.cc @@ -64,8 +64,11 @@ PgSqlResult::rowCheck(int row) const { } PgSqlResult::~PgSqlResult() { - if (result_) { - PQclear(result_); + try { + if (result_) { + PQclear(result_); + } + } catch (...) { } } @@ -104,9 +107,12 @@ PgSqlTransaction::PgSqlTransaction(PgSqlConnection& conn) } PgSqlTransaction::~PgSqlTransaction() { - // If commit() wasn't explicitly called, rollback. - if (!committed_) { - conn_.rollback(); + try { + // If commit() wasn't explicitly called, rollback. + if (!committed_) { + conn_.rollback(); + } + } catch (...) { } } @@ -117,16 +123,19 @@ PgSqlTransaction::commit() { } PgSqlConnection::~PgSqlConnection() { - if (conn_) { - // Deallocate the prepared queries. - if (PQstatus(conn_) == CONNECTION_OK) { - PgSqlResult r(PQexec(conn_, "DEALLOCATE all")); - if (PQresultStatus(r) != PGRES_COMMAND_OK) { - // Highly unlikely but we'll log it and go on. - DB_LOG_ERROR(PGSQL_DEALLOC_ERROR) - .arg(PQerrorMessage(conn_)); + try { + if (conn_) { + // Deallocate the prepared queries. + if (PQstatus(conn_) == CONNECTION_OK) { + PgSqlResult r(PQexec(conn_, "DEALLOCATE all")); + if (PQresultStatus(r) != PGRES_COMMAND_OK) { + // Highly unlikely but we'll log it and go on. + DB_LOG_ERROR(PGSQL_DEALLOC_ERROR) + .arg(PQerrorMessage(conn_)); + } } } + } catch (...) { } } @@ -138,7 +147,7 @@ PgSqlConnection::getVersion(const ParameterMap& parameters) { // Open the database. conn.openDatabase(); - const char* version_sql = "SELECT version, minor FROM schema_version;"; + const char* version_sql = "SELECT version, minor FROM schema_version;"; PgSqlResult r(PQexec(conn.conn_, version_sql)); if (PQresultStatus(r) != PGRES_TUPLES_OK) { isc_throw(DbOperationError, "unable to execute PostgreSQL statement <" diff --git a/src/lib/pgsql/pgsql_connection.h b/src/lib/pgsql/pgsql_connection.h index 449fd4870a..ba7253f952 100644 --- a/src/lib/pgsql/pgsql_connection.h +++ b/src/lib/pgsql/pgsql_connection.h @@ -161,9 +161,14 @@ public: } private: - PGresult* result_; ///< Result set to be freed - int rows_; ///< Number of rows in the result set - int cols_; ///< Number of columns in the result set + /// @brief Result set to be freed + PGresult* result_; + + /// @brief Number of rows in the result set + int rows_; + + /// @brief Number of columns in the result set + int cols_; }; @@ -192,8 +197,11 @@ public: /// /// Frees up resources allocated by the connection. ~PgSqlHolder() { - if (pgconn_ != NULL) { - PQfinish(pgconn_); + try { + if (pgconn_ != NULL) { + PQfinish(pgconn_); + } + } catch (...) { } } @@ -226,7 +234,8 @@ public: } private: - PGconn* pgconn_; ///< Postgresql connection + /// @brief Postgresql connection + PGconn* pgconn_; }; /// @brief Forward declaration to @ref PgSqlConnection. diff --git a/src/lib/pgsql/pgsql_exchange.cc b/src/lib/pgsql/pgsql_exchange.cc index d65aa6dee6..a24269235c 100644 --- a/src/lib/pgsql/pgsql_exchange.cc +++ b/src/lib/pgsql/pgsql_exchange.cc @@ -150,7 +150,7 @@ time_t PgSqlExchange::convertFromDatabaseTime(const std::string& db_time_val) { // Convert string time value to time_t time_t new_time; - try { + try { new_time = (boost::lexical_cast(db_time_val)); } catch (const std::exception& ex) { isc_throw(BadValue, "Database time value is invalid: " << db_time_val); @@ -297,5 +297,5 @@ PgSqlExchange::dumpRow(const PgSqlResult& r, int row) { return (stream.str()); } -}; // end of isc::db namespace -}; // end of isc namespace +} // end of isc::db namespace +} // end of isc namespace diff --git a/src/lib/pgsql/pgsql_exchange.h b/src/lib/pgsql/pgsql_exchange.h index 8d166e3af6..bd69e91037 100644 --- a/src/lib/pgsql/pgsql_exchange.h +++ b/src/lib/pgsql/pgsql_exchange.h @@ -70,7 +70,6 @@ struct PsqlBindArray { /// @return Returns true if there are no entries in the array, false /// otherwise. bool empty() const { - return (values_.empty()); } @@ -186,7 +185,6 @@ struct PsqlBindArray { private: /// @brief vector of strings which supplied the values std::vector bound_strs_; - }; /// @brief Defines a smart pointer to PsqlBindArray @@ -200,10 +198,11 @@ typedef boost::shared_ptr PsqlBindArrayPtr; class PgSqlExchange { public: /// @brief Constructor - PgSqlExchange(const size_t num_columns = 0) : columns_(num_columns) {} + PgSqlExchange(const size_t num_columns = 0) : columns_(num_columns) { + } /// @brief Destructor - virtual ~PgSqlExchange(){} + virtual ~PgSqlExchange() = default; /// @brief Converts time_t value to a text representation in local time. /// @@ -396,7 +395,7 @@ protected: std::vectorcolumns_; }; -}; // end of isc::db namespace -}; // end of isc namespace +} // end of isc::db namespace +} // end of isc namespace #endif // PGSQL_EXCHANGE_H diff --git a/src/lib/pgsql/tests/pgsql_exchange_unittest.cc b/src/lib/pgsql/tests/pgsql_exchange_unittest.cc index 9b93e69608..00f087d2f6 100644 --- a/src/lib/pgsql/tests/pgsql_exchange_unittest.cc +++ b/src/lib/pgsql/tests/pgsql_exchange_unittest.cc @@ -159,7 +159,10 @@ public: /// Destroys the table. The database resources are freed and the connection /// closed by the destruction of conn_. virtual ~PgSqlBasicsTest () { - destroySchema(); + try { + destroySchema(); + } catch (...) { + } } /// @brief Gets the expected name of the column for a given column index diff --git a/src/lib/process/cb_ctl_base.h b/src/lib/process/cb_ctl_base.h index 7baf8dd725..7d51ae42a8 100644 --- a/src/lib/process/cb_ctl_base.h +++ b/src/lib/process/cb_ctl_base.h @@ -103,7 +103,10 @@ public: /// /// It is always needed when there are virtual methods. virtual ~CBControlBase() { - databaseConfigDisconnect(); + try { + databaseConfigDisconnect(); + } catch (...) { + } } /// @brief Resets the state of this object. diff --git a/src/lib/process/d_cfg_mgr.cc b/src/lib/process/d_cfg_mgr.cc index 4a67183128..cc52aebf9b 100644 --- a/src/lib/process/d_cfg_mgr.cc +++ b/src/lib/process/d_cfg_mgr.cc @@ -39,9 +39,6 @@ DCfgMgrBase::DCfgMgrBase(ConfigPtr context) { setContext(context); } -DCfgMgrBase::~DCfgMgrBase() { -} - void DCfgMgrBase::resetContext() { ConfigPtr context = createNewContext(); diff --git a/src/lib/process/d_cfg_mgr.h b/src/lib/process/d_cfg_mgr.h index 204f7b29bc..a9d8d8eee0 100644 --- a/src/lib/process/d_cfg_mgr.h +++ b/src/lib/process/d_cfg_mgr.h @@ -116,7 +116,7 @@ public: DCfgMgrBase(ConfigPtr context); /// @brief Destructor - virtual ~DCfgMgrBase(); + virtual ~DCfgMgrBase() = default; /// @brief Acts as the receiver of new configurations. /// diff --git a/src/lib/process/d_controller.cc b/src/lib/process/d_controller.cc index 72bf80e027..d3ac21a1c6 100644 --- a/src/lib/process/d_controller.cc +++ b/src/lib/process/d_controller.cc @@ -804,9 +804,6 @@ DControllerBase::usage(const std::string & text) { std::cerr << getUsageText() << std::endl; } -DControllerBase::~DControllerBase() { -} - // Refer to config_report so it will be embedded in the binary const char* const* d_config_report = isc::detail::config_report; diff --git a/src/lib/process/d_controller.h b/src/lib/process/d_controller.h index 1a1c6a6acf..4423219983 100644 --- a/src/lib/process/d_controller.h +++ b/src/lib/process/d_controller.h @@ -111,7 +111,7 @@ public: DControllerBase(const char* app_name, const char* bin_name); /// @brief Destructor - virtual ~DControllerBase(); + virtual ~DControllerBase() = default; /// @brief returns Kea version on stdout and exit. /// redeclaration/redefinition. @ref isc::process::Daemon::getVersion() diff --git a/src/lib/process/d_process.h b/src/lib/process/d_process.h index e7e6546546..7eb47b9f2c 100644 --- a/src/lib/process/d_process.h +++ b/src/lib/process/d_process.h @@ -151,7 +151,7 @@ public: bool check_only = false) = 0; /// @brief Destructor - virtual ~DProcessBase(){}; + virtual ~DProcessBase() = default; /// @brief Checks if the process has been instructed to shut down. /// diff --git a/src/lib/process/daemon.cc b/src/lib/process/daemon.cc index c2589c92a1..bebfb585d9 100644 --- a/src/lib/process/daemon.cc +++ b/src/lib/process/daemon.cc @@ -52,8 +52,11 @@ Daemon::Daemon() } Daemon::~Daemon() { - if (pid_file_ && am_file_author_) { - pid_file_->deleteFile(); + try { + if (pid_file_ && am_file_author_) { + pid_file_->deleteFile(); + } + } catch (...) { } } diff --git a/src/lib/process/tests/cb_ctl_base_unittests.cc b/src/lib/process/tests/cb_ctl_base_unittests.cc index 58d0aa065f..5ede396a03 100644 --- a/src/lib/process/tests/cb_ctl_base_unittests.cc +++ b/src/lib/process/tests/cb_ctl_base_unittests.cc @@ -369,7 +369,10 @@ public: /// /// Removes audit entries created in the test. ~CBControlBaseTest() { - CBControlBackend::clearAuditEntries(); + try { + CBControlBackend::clearAuditEntries(); + } catch (...) { + } } /// @brief Initialize posix time values used in tests. diff --git a/src/lib/process/tests/d_cfg_mgr_unittests.cc b/src/lib/process/tests/d_cfg_mgr_unittests.cc index faa3e92897..dc1420d3c3 100644 --- a/src/lib/process/tests/d_cfg_mgr_unittests.cc +++ b/src/lib/process/tests/d_cfg_mgr_unittests.cc @@ -37,8 +37,7 @@ public: } /// @brief Destructor - virtual ~DCtorTestCfgMgr() { - } + virtual ~DCtorTestCfgMgr() = default; /// @brief Dummy implementation as this method is abstract. virtual ConfigPtr createNewContext() { @@ -60,12 +59,11 @@ class DStubCfgMgrTest : public ConfigParseTest { public: /// @brief Constructor - DStubCfgMgrTest():cfg_mgr_(new DStubCfgMgr) { + DStubCfgMgrTest() : cfg_mgr_(new DStubCfgMgr) { } /// @brief Destructor - ~DStubCfgMgrTest() { - } + ~DStubCfgMgrTest() = default; /// @brief Convenience method which returns a DStubContextPtr to the /// configuration context. diff --git a/src/lib/process/tests/daemon_unittest.cc b/src/lib/process/tests/daemon_unittest.cc index bd80e25a65..d2fea0ba72 100644 --- a/src/lib/process/tests/daemon_unittest.cc +++ b/src/lib/process/tests/daemon_unittest.cc @@ -63,12 +63,15 @@ public: /// settings (when configureLogger is called), the logging is reset to /// the default after each test completes. ~DaemonTest() { - isc::log::setDefaultLoggingOutput(); - // Restore KEA_PIDFILE_DIR environment variable value - if (env_copy_.empty()) { - static_cast(unsetenv("KEA_PIDFILE_DIR")); - } else { - static_cast(setenv("KEA_PIDFILE_DIR", env_copy_.c_str(), 1)); + try { + isc::log::setDefaultLoggingOutput(); + // Restore KEA_PIDFILE_DIR environment variable value + if (env_copy_.empty()) { + static_cast(unsetenv("KEA_PIDFILE_DIR")); + } else { + static_cast(setenv("KEA_PIDFILE_DIR", env_copy_.c_str(), 1)); + } + } catch (...) { } } diff --git a/src/lib/process/tests/log_parser_unittests.cc b/src/lib/process/tests/log_parser_unittests.cc index 14acdbd1a1..6d12801a28 100644 --- a/src/lib/process/tests/log_parser_unittests.cc +++ b/src/lib/process/tests/log_parser_unittests.cc @@ -28,17 +28,21 @@ namespace { /// has the name "kea") but as the only other logger mentioned here ("wombat") /// is not used elsewhere, that is sufficient. class LoggingTest : public ::testing::Test { - public: - /// @brief Constructor - LoggingTest() {} - - /// @brief Destructor - /// - /// Reset root logger back to defaults. - ~LoggingTest() { +public: + + /// @brief Constructor + LoggingTest() = default; + + /// @brief Destructor + /// + /// Reset root logger back to defaults. + ~LoggingTest() { + try { isc::log::initLogger(); wipeFiles(); + } catch (...) { } + } /// @brief Generates a log file name suffixed with a rotation number /// @param rotation number to the append to the end of the file diff --git a/src/lib/process/tests/logging_info_unittests.cc b/src/lib/process/tests/logging_info_unittests.cc index 865d6426b3..091c8df9a9 100644 --- a/src/lib/process/tests/logging_info_unittests.cc +++ b/src/lib/process/tests/logging_info_unittests.cc @@ -50,6 +50,11 @@ TEST(LoggingDestination, equals) { /// @brief Test fixture class for testing @c LoggingInfo. class LoggingInfoTest : public ::testing::Test { public: + /// @brief Constructor + LoggingInfoTest() = default; + + /// @brief Destructor + virtual ~LoggingInfoTest() = default; /// @brief Setup the test. virtual void SetUp() { diff --git a/src/lib/process/testutils/d_test_stubs.cc b/src/lib/process/testutils/d_test_stubs.cc index 1186729e06..9c9b700f1d 100644 --- a/src/lib/process/testutils/d_test_stubs.cc +++ b/src/lib/process/testutils/d_test_stubs.cc @@ -76,7 +76,10 @@ DStubProcess::configure(isc::data::ConstElementPtr config_set, bool check_only) } DStubProcess::~DStubProcess() { - Daemon::setVerbose(false); + try { + Daemon::setVerbose(false); + } catch (...) { + } }; //************************** DStubController ************************* @@ -164,9 +167,6 @@ DStubController::parseFile(const std::string& /*file_name*/) { return (elements); } -DStubController::~DStubController() { -} - //************************** DControllerTest ************************* void @@ -294,20 +294,11 @@ const char* DControllerTest::CFG_TEST_FILE = "d2-test-config.json"; //************************** DStubContext ************************* -DStubContext::DStubContext() { -} - -DStubContext::~DStubContext() { -} - ConfigPtr DStubContext::clone() { return (ConfigPtr(new DStubContext(*this))); } -DStubContext::DStubContext(const DStubContext& rhs): ConfigBase(rhs) { -} - isc::data::ElementPtr DStubContext::toElement() const { return (isc::data::Element::createMap()); @@ -319,9 +310,6 @@ DStubCfgMgr::DStubCfgMgr() : DCfgMgrBase(ConfigPtr(new DStubContext())) { } -DStubCfgMgr::~DStubCfgMgr() { -} - ConfigPtr DStubCfgMgr::createNewContext() { return (ConfigPtr (new DStubContext())); diff --git a/src/lib/process/testutils/d_test_stubs.h b/src/lib/process/testutils/d_test_stubs.h index 9881ee4dca..421a6419a1 100644 --- a/src/lib/process/testutils/d_test_stubs.h +++ b/src/lib/process/testutils/d_test_stubs.h @@ -303,7 +303,8 @@ private: bool use_alternate_parser_; public: - virtual ~DStubController(); + /// @brief Destructor + virtual ~DStubController() = default; }; /// @brief Defines a pointer to a DStubController. @@ -339,17 +340,20 @@ public: /// Note the controller singleton is destroyed. This is essential to ensure /// a clean start between tests. virtual ~DControllerTest() { - // Some unit tests update the logging configuration which has a side - // effect that all subsequent tests print the output to stdout. This - // is to ensure that the logging settings are back to default. - isc::log::setDefaultLoggingOutput(); - - if (write_timer_) { - write_timer_->cancel(); + try { + // Some unit tests update the logging configuration which has a side + // effect that all subsequent tests print the output to stdout. This + // is to ensure that the logging settings are back to default. + isc::log::setDefaultLoggingOutput(); + + if (write_timer_) { + write_timer_->cancel(); + } + + getController().reset(); + static_cast(remove(CFG_TEST_FILE)); + } catch (...) { } - - getController().reset(); - static_cast(remove(CFG_TEST_FILE)); } /// @brief Convenience method that destructs and then recreates the @@ -595,10 +599,10 @@ class DStubContext : public ConfigBase { public: /// @brief Constructor - DStubContext(); + DStubContext() = default; /// @brief Destructor - virtual ~DStubContext(); + virtual ~DStubContext() = default; /// @brief Creates a clone of a DStubContext. /// @@ -607,7 +611,7 @@ public: protected: /// @brief Copy constructor - DStubContext(const DStubContext& rhs); + DStubContext(const DStubContext& rhs) = default; private: /// @brief Private assignment operator, not implemented. @@ -645,7 +649,7 @@ public: DStubCfgMgr(); /// @brief Destructor - virtual ~DStubCfgMgr(); + virtual ~DStubCfgMgr() = default; /// @brief Pretends to parse the config /// @@ -681,12 +685,10 @@ class ConfigParseTest : public ::testing::Test { public: /// @brief Constructor - ConfigParseTest(){ - } + ConfigParseTest() = default; /// @brief Destructor - ~ConfigParseTest() { - } + ~ConfigParseTest() = default; /// @brief Converts a given JSON string into an Element set and stores the /// result the member variable, config_set_. diff --git a/src/lib/stats/tests/stats_mgr_unittest.cc b/src/lib/stats/tests/stats_mgr_unittest.cc index 734d134c8d..61c005d45e 100644 --- a/src/lib/stats/tests/stats_mgr_unittest.cc +++ b/src/lib/stats/tests/stats_mgr_unittest.cc @@ -38,6 +38,7 @@ static const StatsDuration& dur1245(hours(1) + minutes(2) + seconds(45)); class StatsMgrTest : public ::testing::Test { public: /// @brief Constructor + /// /// Makes sure that the Statistics Manager is instantiated. StatsMgrTest() { StatsMgr::instance(); @@ -45,11 +46,15 @@ public: } /// @brief Destructor + /// /// Removes all statistics and restores class defaults. ~StatsMgrTest() { - StatsMgr::instance().removeAll(); - StatsMgr::instance().setMaxSampleAgeDefault(StatsDuration::zero()); - StatsMgr::instance().setMaxSampleCountDefault(20); + try { + StatsMgr::instance().removeAll(); + StatsMgr::instance().setMaxSampleAgeDefault(StatsDuration::zero()); + StatsMgr::instance().setMaxSampleCountDefault(20); + } catch (...) { + } } }; diff --git a/src/lib/testutils/log_utils.cc b/src/lib/testutils/log_utils.cc index 5052319038..ac847ea14a 100644 --- a/src/lib/testutils/log_utils.cc +++ b/src/lib/testutils/log_utils.cc @@ -42,7 +42,10 @@ LogContentTest::LogContentTest() } LogContentTest:: ~LogContentTest() { - remFile(); + try { + remFile(); + } catch (...) { + } } bool LogContentTest::checkFile() { diff --git a/src/lib/testutils/log_utils.h b/src/lib/testutils/log_utils.h index 9735e5ae8d..224c6189d0 100644 --- a/src/lib/testutils/log_utils.h +++ b/src/lib/testutils/log_utils.h @@ -40,7 +40,9 @@ namespace test { class LogContentTest : public ::testing::Test { public: - /// @brief Initializes the logger setup for using + /// @brief Constructor + /// + /// Initializes the logger setup for using /// in checking log statements /// /// @todo add support to adjust the severity and debug level @@ -48,6 +50,7 @@ public: /// get logged. LogContentTest(); + /// @brief Destructor virtual ~LogContentTest(); /// @brief check that the requested strings are in the diff --git a/src/lib/testutils/multi_threading_utils.h b/src/lib/testutils/multi_threading_utils.h index 8754208198..fd9cf24f86 100644 --- a/src/lib/testutils/multi_threading_utils.h +++ b/src/lib/testutils/multi_threading_utils.h @@ -28,7 +28,10 @@ public: /// @brief Destructor (disable multi threading). ~MultiThreadingTest() { - isc::util::MultiThreadingMgr::instance().setMode(false); + try { + isc::util::MultiThreadingMgr::instance().setMode(false); + } catch (...) { + } } }; diff --git a/src/lib/testutils/sandbox.h b/src/lib/testutils/sandbox.h index 8dfb5720ff..2ce1ea20ae 100644 --- a/src/lib/testutils/sandbox.h +++ b/src/lib/testutils/sandbox.h @@ -46,11 +46,14 @@ public: /// @brief Destructor, it deletes temporary folder with its content. ~Sandbox() { - // Delete content of path_ recursively. - if (nftw(path_.c_str(), Sandbox::rmFile, 10, FTW_DEPTH | FTW_MOUNT | FTW_PHYS) < 0) { - auto msg = "Some error occurred while deleting unit test sandbox " + path_; - std::perror(msg.c_str()); - exit(1); + try { + // Delete content of path_ recursively. + if (nftw(path_.c_str(), Sandbox::rmFile, 10, FTW_DEPTH | FTW_MOUNT | FTW_PHYS) < 0) { + auto msg = "Some error occurred while deleting unit test sandbox " + path_; + std::perror(msg.c_str()); + exit(1); + } + } catch (...) { } } diff --git a/src/lib/testutils/unix_control_client.cc b/src/lib/testutils/unix_control_client.cc index f0f8dfaaab..4dce8696d0 100644 --- a/src/lib/testutils/unix_control_client.cc +++ b/src/lib/testutils/unix_control_client.cc @@ -23,7 +23,10 @@ UnixControlClient::UnixControlClient() { } UnixControlClient::~UnixControlClient() { - disconnectFromServer(); + try { + disconnectFromServer(); + } catch (...) { + } } /// @brief Closes the Control Channel socket diff --git a/src/lib/util/buffer.h b/src/lib/util/buffer.h index 128db99980..73d6a227e4 100644 --- a/src/lib/util/buffer.h +++ b/src/lib/util/buffer.h @@ -303,8 +303,7 @@ public: OutputBuffer(size_t len) : buffer_(NULL), size_(0), - allocated_(len) - { + allocated_(len) { // We use malloc and free instead of C++ new[] and delete[]. // This way we can use realloc, which may in fact do it without a copy. if (allocated_ != 0) { @@ -325,8 +324,7 @@ public: OutputBuffer(const OutputBuffer& other) : buffer_(NULL), size_(other.size_), - allocated_(other.allocated_) - { + allocated_(other.allocated_) { if (allocated_ != 0) { buffer_ = static_cast(malloc(allocated_)); if (buffer_ == NULL) { @@ -337,8 +335,11 @@ public: } /// \brief Destructor - ~ OutputBuffer() { - free(buffer_); + ~OutputBuffer() { + try { + free(buffer_); + } catch (...) { + } } //@} diff --git a/src/lib/util/csv_file.cc b/src/lib/util/csv_file.cc index f402038d18..f74a90b8f0 100644 --- a/src/lib/util/csv_file.cc +++ b/src/lib/util/csv_file.cc @@ -116,7 +116,10 @@ CSVFile::CSVFile(const std::string& filename) } CSVFile::~CSVFile() { - close(); + try { + close(); + } catch (...) { + } } void diff --git a/src/lib/util/io/socketsession.cc b/src/lib/util/io/socketsession.cc index 573931a30e..b391070522 100644 --- a/src/lib/util/io/socketsession.cc +++ b/src/lib/util/io/socketsession.cc @@ -76,7 +76,9 @@ const size_t INITIAL_BUFSIZE = 512; const int SOCKSESSION_BUFSIZE = (DEFAULT_HEADER_BUFLEN + MAX_DATASIZE) * 2; struct SocketSessionForwarder::ForwarderImpl { - ForwarderImpl() : fd_(-1), buf_(DEFAULT_HEADER_BUFLEN) {} + ForwarderImpl() : sock_un_len_(0), fd_(-1), buf_(DEFAULT_HEADER_BUFLEN) { + memset(&sock_un_, 0, sizeof(sock_un_)); + } struct sockaddr_un sock_un_; socklen_t sock_un_len_; int fd_; @@ -118,10 +120,13 @@ SocketSessionForwarder::SocketSessionForwarder(const std::string& unix_file) : } SocketSessionForwarder::~SocketSessionForwarder() { - if (impl_->fd_ != -1) { - close(); + try { + if (impl_->fd_ != -1) { + close(); + } + delete impl_; + } catch (...) { } - delete impl_; } void @@ -303,12 +308,14 @@ struct SocketSessionReceiver::ReceiverImpl { }; SocketSessionReceiver::SocketSessionReceiver(int fd) : - impl_(new ReceiverImpl(fd)) -{ + impl_(new ReceiverImpl(fd)) { } SocketSessionReceiver::~SocketSessionReceiver() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } namespace { @@ -328,17 +335,26 @@ readFail(int actual_len, int expected_len) { // SocketSessionReceiver::pop that ensures the socket is closed unless it // can be safely passed to the caller via release(). struct ScopedSocket : boost::noncopyable { - ScopedSocket(int fd) : fd_(fd) {} + /// @brief Constructor + ScopedSocket(int fd) : fd_(fd) { + } + + /// @brief Destructor ~ScopedSocket() { - if (fd_ >= 0) { - close(fd_); + try { + if (fd_ >= 0) { + close(fd_); + } + } catch (...) { } } + int release() { const int fd = fd_; fd_ = -1; return (fd); } + int fd_; }; } diff --git a/src/lib/util/io/socketsession.h b/src/lib/util/io/socketsession.h index 52e33de64d..49f692a760 100644 --- a/src/lib/util/io/socketsession.h +++ b/src/lib/util/io/socketsession.h @@ -171,10 +171,13 @@ public: /// See description of \c SocketSessionForwarder for the expected interface. class BaseSocketSessionForwarder { protected: - BaseSocketSessionForwarder() {} + /// @brief Constructor + BaseSocketSessionForwarder() = default; public: - virtual ~BaseSocketSessionForwarder() {} + /// @brief Destructor + virtual ~BaseSocketSessionForwarder() = default; + virtual void connectToReceiver() = 0; virtual void close() = 0; virtual void push(int sock, int family, int type, int protocol, diff --git a/src/lib/util/labeled_value.cc b/src/lib/util/labeled_value.cc index 9fa184ad9d..54800bb0ed 100644 --- a/src/lib/util/labeled_value.cc +++ b/src/lib/util/labeled_value.cc @@ -20,9 +20,6 @@ LabeledValue::LabeledValue(const int value, const std::string& label) } } -LabeledValue::~LabeledValue(){ -} - int LabeledValue::getValue() const { return (value_); @@ -57,12 +54,6 @@ std::ostream& operator<<(std::ostream& os, const LabeledValue& vlp) { const char* LabeledValueSet::UNDEFINED_LABEL = "UNDEFINED"; -LabeledValueSet::LabeledValueSet(){ -} - -LabeledValueSet::~LabeledValueSet() { -} - void LabeledValueSet::add(LabeledValuePtr entry) { if (!entry) { diff --git a/src/lib/util/labeled_value.h b/src/lib/util/labeled_value.h index e85b537904..48249ba2b4 100644 --- a/src/lib/util/labeled_value.h +++ b/src/lib/util/labeled_value.h @@ -50,7 +50,7 @@ public: /// @brief Destructor. /// /// Destructor is virtual to permit derivations. - virtual ~LabeledValue(); + virtual ~LabeledValue() = default; /// @brief Gets the integer value of this instance. /// @@ -119,12 +119,12 @@ public: /// @brief Constructor /// /// Constructs an empty set. - LabeledValueSet(); + LabeledValueSet() = default; /// @brief Destructor /// /// Destructor is virtual to permit derivations. - virtual ~LabeledValueSet(); + virtual ~LabeledValueSet() = default; /// @brief Adds the given entry to the set /// diff --git a/src/lib/util/memory_segment.h b/src/lib/util/memory_segment.h index c9ae97f9de..f14bb35010 100644 --- a/src/lib/util/memory_segment.h +++ b/src/lib/util/memory_segment.h @@ -53,8 +53,11 @@ public: /// MemorySegmentLocal should be used in code. class MemorySegment { public: + /// \brief Constructor + MemorySegment() = default; + /// \brief Destructor - virtual ~MemorySegment() {} + virtual ~MemorySegment() = default; /// \brief Allocate/acquire a fragment of memory. /// diff --git a/src/lib/util/memory_segment_local.h b/src/lib/util/memory_segment_local.h index 2c0ee53db6..eda19ba716 100644 --- a/src/lib/util/memory_segment_local.h +++ b/src/lib/util/memory_segment_local.h @@ -29,7 +29,7 @@ public: } /// \brief Destructor - virtual ~MemorySegmentLocal() {} + virtual ~MemorySegmentLocal() = default; /// \brief Allocate/acquire a segment of memory. The source of the /// memory is libc's malloc(). diff --git a/src/lib/util/multi_threading_mgr.cc b/src/lib/util/multi_threading_mgr.cc index 4b2c2d3df7..cc6df6c391 100644 --- a/src/lib/util/multi_threading_mgr.cc +++ b/src/lib/util/multi_threading_mgr.cc @@ -15,9 +15,6 @@ MultiThreadingMgr::MultiThreadingMgr() : enabled_(false), critical_section_count_(0), thread_pool_size_(0) { } -MultiThreadingMgr::~MultiThreadingMgr() { -} - MultiThreadingMgr& MultiThreadingMgr::instance() { static MultiThreadingMgr manager; @@ -178,7 +175,10 @@ MultiThreadingCriticalSection::MultiThreadingCriticalSection() { } MultiThreadingCriticalSection::~MultiThreadingCriticalSection() { - MultiThreadingMgr::instance().exitCriticalSection(); + try { + MultiThreadingMgr::instance().exitCriticalSection(); + } catch (...) { + } } void diff --git a/src/lib/util/multi_threading_mgr.h b/src/lib/util/multi_threading_mgr.h index 2fe8e50790..859e4a5135 100644 --- a/src/lib/util/multi_threading_mgr.h +++ b/src/lib/util/multi_threading_mgr.h @@ -234,7 +234,7 @@ protected: MultiThreadingMgr(); /// @brief Destructor. - virtual ~MultiThreadingMgr(); + virtual ~MultiThreadingMgr() = default; private: diff --git a/src/lib/util/pid_file.cc b/src/lib/util/pid_file.cc index ef519b3d87..5e438bdc44 100644 --- a/src/lib/util/pid_file.cc +++ b/src/lib/util/pid_file.cc @@ -19,9 +19,6 @@ PIDFile::PIDFile(const std::string& filename) : filename_(filename) { } -PIDFile::~PIDFile() { -} - int PIDFile::check() const { std::ifstream fs(filename_.c_str()); diff --git a/src/lib/util/pid_file.h b/src/lib/util/pid_file.h index a30640d5ff..73fc57cf52 100644 --- a/src/lib/util/pid_file.h +++ b/src/lib/util/pid_file.h @@ -45,7 +45,7 @@ public: PIDFile(const std::string& filename); /// @brief Destructor - ~PIDFile(); + ~PIDFile() = default; /// @brief Read the PID in from the file and check it. /// diff --git a/src/lib/util/readwrite_mutex.h b/src/lib/util/readwrite_mutex.h index f8766d5af4..8ec5589589 100644 --- a/src/lib/util/readwrite_mutex.h +++ b/src/lib/util/readwrite_mutex.h @@ -47,7 +47,10 @@ public: /// @note: do not check that state is 0 as there is nothing very /// useful to do in this case... virtual ~ReadWriteMutex() { - std::lock_guard lk(mutex_); + try { + std::lock_guard lk(mutex_); + } catch (...) { + } } /// @brief Lock write. @@ -149,7 +152,10 @@ public: /// @brief Destructor. virtual ~ReadLockGuard() { - rw_mutex_.readUnlock(); + try { + rw_mutex_.readUnlock(); + } catch (...) { + } } private: @@ -173,7 +179,10 @@ public: /// @brief Destructor. virtual ~WriteLockGuard() { - rw_mutex_.writeUnlock(); + try { + rw_mutex_.writeUnlock(); + } catch (...) { + } } private: diff --git a/src/lib/util/state_model.cc b/src/lib/util/state_model.cc index 6c9a13d8a2..be23db4ee6 100644 --- a/src/lib/util/state_model.cc +++ b/src/lib/util/state_model.cc @@ -19,9 +19,6 @@ State::State(const int value, const std::string& label, StateHandler handler, was_paused_(false) { } -State::~State() { -} - void State::run() { (handler_)(); @@ -39,12 +36,6 @@ State::shouldPause() { /********************************** StateSet *******************************/ -StateSet::StateSet() { -} - -StateSet::~StateSet() { -} - void StateSet::add(const int value, const std::string& label, StateHandler handler, const StatePausing& state_pausing) { @@ -93,9 +84,6 @@ StateModel::StateModel() : events_(), states_(), dictionaries_initted_(false), paused_(false), mutex_(new std::mutex) { } -StateModel::~StateModel(){ -} - void StateModel::startModel(const int start_state) { // Initialize dictionaries of events and states. diff --git a/src/lib/util/state_model.h b/src/lib/util/state_model.h index da297da95d..2574f2faef 100644 --- a/src/lib/util/state_model.h +++ b/src/lib/util/state_model.h @@ -81,7 +81,7 @@ public: const StatePausing& state_pausing = STATE_PAUSE_NEVER); /// @brief Destructor - virtual ~State(); + virtual ~State() = default; /// @brief Invokes the State's handler. void run(); @@ -118,10 +118,10 @@ typedef boost::shared_ptr StatePtr; class StateSet : public LabeledValueSet { public: /// @brief Constructor - StateSet(); + StateSet() = default; /// @brief Destructor - virtual ~StateSet(); + virtual ~StateSet() = default; /// @brief Adds a state definition to the set of states. /// @@ -308,7 +308,7 @@ public: StateModel(); /// @brief Destructor - virtual ~StateModel(); + virtual ~StateModel() = default; /// @brief Begins execution of the model. /// diff --git a/src/lib/util/stopwatch.cc b/src/lib/util/stopwatch.cc index f75c6cdf4c..cdee4b1aca 100644 --- a/src/lib/util/stopwatch.cc +++ b/src/lib/util/stopwatch.cc @@ -23,7 +23,10 @@ Stopwatch::Stopwatch(const bool autostart) } Stopwatch::~Stopwatch() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } void diff --git a/src/lib/util/stopwatch_impl.cc b/src/lib/util/stopwatch_impl.cc index 8f6bc653dd..d9d90e2bfc 100644 --- a/src/lib/util/stopwatch_impl.cc +++ b/src/lib/util/stopwatch_impl.cc @@ -22,9 +22,6 @@ StopwatchImpl::StopwatchImpl() cumulative_time_(microseconds(0)) { } -StopwatchImpl::~StopwatchImpl() { -} - void StopwatchImpl::start() { // If stopwatch is "stopped", start it. diff --git a/src/lib/util/stopwatch_impl.h b/src/lib/util/stopwatch_impl.h index 3c1ee9cfb4..7e3a02cdbb 100644 --- a/src/lib/util/stopwatch_impl.h +++ b/src/lib/util/stopwatch_impl.h @@ -38,7 +38,7 @@ public: /// /// This destructor is virtual because the @c StopwatchImpl::getCurrentTime /// is virtual. - virtual ~StopwatchImpl(); + virtual ~StopwatchImpl() = default; /// @brief Starts the stopwatch. /// diff --git a/src/lib/util/strutil.cc b/src/lib/util/strutil.cc index 7eaabdc4d5..a685786781 100644 --- a/src/lib/util/strutil.cc +++ b/src/lib/util/strutil.cc @@ -309,6 +309,7 @@ decodeFormattedHexString(const std::string& hex_string, class StringSanitizerImpl { public: + /// @brief Constructor StringSanitizerImpl(const std::string& char_set, const std::string& char_replacement) : char_set_(char_set), char_replacement_(char_replacement) { if (char_set.size() > StringSanitizer::MAX_DATA_SIZE) { @@ -342,9 +343,12 @@ public: /// @brief Destructor. ~StringSanitizerImpl() { + try { #ifndef USE_REGEX - regfree(&scrub_exp_); + regfree(&scrub_exp_); #endif + } catch (...) { + } } std::string scrub(const std::string& original) { @@ -440,7 +444,10 @@ StringSanitizer::StringSanitizer(const std::string& char_set, } StringSanitizer::~StringSanitizer() { - delete impl_; + try { + delete impl_; + } catch (...) { + } } std::string diff --git a/src/lib/util/tests/csv_file_unittest.cc b/src/lib/util/tests/csv_file_unittest.cc index fbc75c961b..1565e60a50 100644 --- a/src/lib/util/tests/csv_file_unittest.cc +++ b/src/lib/util/tests/csv_file_unittest.cc @@ -243,7 +243,10 @@ CSVFileTest::CSVFileTest() } CSVFileTest::~CSVFileTest() { - static_cast(removeFile()); + try { + static_cast(removeFile()); + } catch (...) { + } } std::string diff --git a/src/lib/util/tests/fd_tests.cc b/src/lib/util/tests/fd_tests.cc index f2ffb98e97..44e773ce30 100644 --- a/src/lib/util/tests/fd_tests.cc +++ b/src/lib/util/tests/fd_tests.cc @@ -24,19 +24,25 @@ namespace { const size_t TEST_DATA_SIZE = 8 * 1024 * 1024; class FDTest : public ::testing::Test { - public: - unsigned char *data, *buffer; - FDTest() : - // We do not care what is inside, we just need it to be the same - data(new unsigned char[TEST_DATA_SIZE]), - buffer(NULL) - { - memset(data, 0, TEST_DATA_SIZE); - } - ~ FDTest() { +public: + unsigned char *data, *buffer; + + /// @brief Constructor + FDTest() : + // We do not care what is inside, we just need it to be the same + data(new unsigned char[TEST_DATA_SIZE]), + buffer(NULL) { + memset(data, 0, TEST_DATA_SIZE); + } + + /// @brief Destructor + ~FDTest() { + try { delete[] data; delete[] buffer; + } catch (...) { } + } }; // Test we read what was sent diff --git a/src/lib/util/tests/pid_file_unittest.cc b/src/lib/util/tests/pid_file_unittest.cc index 08b1881eb7..8f7b78bd9e 100644 --- a/src/lib/util/tests/pid_file_unittest.cc +++ b/src/lib/util/tests/pid_file_unittest.cc @@ -20,6 +20,12 @@ const char* TESTNAME = "pid_file.test"; class PIDFileTest : public ::testing::Test { public: + /// @brief Constructor + PIDFileTest() = default; + + /// @brief Destructor + virtual ~PIDFileTest() = default; + /// @brief Prepends the absolute path to the file specified /// as an argument. /// diff --git a/src/lib/util/tests/random_number_generator_unittest.cc b/src/lib/util/tests/random_number_generator_unittest.cc index 5710c95f05..b0edc288d5 100644 --- a/src/lib/util/tests/random_number_generator_unittest.cc +++ b/src/lib/util/tests/random_number_generator_unittest.cc @@ -27,11 +27,12 @@ using namespace std; /// Or maybe we can trust the boost implementation class UniformRandomIntegerGeneratorTest : public ::testing::Test { public: - UniformRandomIntegerGeneratorTest(): - gen_(min_, max_) - { + /// @brief Constructor + UniformRandomIntegerGeneratorTest() : gen_(min_, max_) { } - virtual ~UniformRandomIntegerGeneratorTest(){} + + /// @brief Destructor + virtual ~UniformRandomIntegerGeneratorTest() = default; int gen() { return (gen_()); } int max() const { return (max_); } @@ -79,11 +80,11 @@ TEST_F(UniformRandomIntegerGeneratorTest, IntegerRange) { /// \brief Test Fixture Class for weighted random number generator class WeightedRandomIntegerGeneratorTest : public ::testing::Test { public: - WeightedRandomIntegerGeneratorTest() - { } + /// @brief Constructor + WeightedRandomIntegerGeneratorTest() = default; - virtual ~WeightedRandomIntegerGeneratorTest() - { } + /// @brief Destructor + virtual ~WeightedRandomIntegerGeneratorTest() = default; }; // Test of the weighted random number generator constructor diff --git a/src/lib/util/tests/state_model_unittest.cc b/src/lib/util/tests/state_model_unittest.cc index eaaba738f4..bc4860ab39 100644 --- a/src/lib/util/tests/state_model_unittest.cc +++ b/src/lib/util/tests/state_model_unittest.cc @@ -70,8 +70,7 @@ public: failure_explanation_("") { } /// @brief Destructor - virtual ~StateModelTest() { - } + virtual ~StateModelTest() = default; /// @brief Fetches the value of the dummy called flag. bool getDummyCalled() { diff --git a/src/lib/util/tests/time_utilities_unittest.cc b/src/lib/util/tests/time_utilities_unittest.cc index 1637a7a19e..892f48e0e6 100644 --- a/src/lib/util/tests/time_utilities_unittest.cc +++ b/src/lib/util/tests/time_utilities_unittest.cc @@ -30,8 +30,15 @@ namespace { class DNSSECTimeTest : public ::testing::Test { protected: + /// @brief Constructor + DNSSECTimeTest() = default; + + /// @brief Destructor ~DNSSECTimeTest() { - detail::gettimeFunction = NULL; + try { + detail::gettimeFunction = NULL; + } catch (...) { + } } }; diff --git a/src/lib/util/tests/versioned_csv_file_unittest.cc b/src/lib/util/tests/versioned_csv_file_unittest.cc index 36a1f913e8..4b6286f66d 100644 --- a/src/lib/util/tests/versioned_csv_file_unittest.cc +++ b/src/lib/util/tests/versioned_csv_file_unittest.cc @@ -77,7 +77,10 @@ VersionedCSVFileTest::VersionedCSVFileTest() } VersionedCSVFileTest::~VersionedCSVFileTest() { - static_cast(removeFile()); + try { + static_cast(removeFile()); + } catch (...) { + } } std::string diff --git a/src/lib/util/tests/watched_thread_unittest.cc b/src/lib/util/tests/watched_thread_unittest.cc index dd01550772..a5565ee1fc 100644 --- a/src/lib/util/tests/watched_thread_unittest.cc +++ b/src/lib/util/tests/watched_thread_unittest.cc @@ -28,11 +28,10 @@ public: static const int WORKER_MAX_PASSES; /// @brief Constructor. - WatchedThreadTest() {} + WatchedThreadTest() = default; /// @brief Destructor. - ~WatchedThreadTest() { - } + ~WatchedThreadTest() = default; /// @brief Sleeps for a given number of event periods sleep /// Each period is 50 ms. diff --git a/src/lib/util/thread_pool.h b/src/lib/util/thread_pool.h index 7313ea73f0..9b979d2b7d 100644 --- a/src/lib/util/thread_pool.h +++ b/src/lib/util/thread_pool.h @@ -45,12 +45,14 @@ struct ThreadPool { typedef typename boost::shared_ptr WorkItemPtr; /// @brief Constructor - ThreadPool() { - } + ThreadPool() = default; /// @brief Destructor ~ThreadPool() { - reset(); + try { + reset(); + } catch (...) { + } } /// @brief reset the thread pool stopping threads and clearing the internal @@ -249,8 +251,11 @@ private: /// /// Destroys the thread pool queue ~ThreadPoolQueue() { - disable(); - clear(); + try { + disable(); + clear(); + } catch (...) { + } } /// @brief set maximum number of work items in the queue diff --git a/src/lib/util/unlock_guard.h b/src/lib/util/unlock_guard.h index 30be51486c..b1d0f29281 100644 --- a/src/lib/util/unlock_guard.h +++ b/src/lib/util/unlock_guard.h @@ -33,7 +33,10 @@ public: /// /// Lock mutex object on destructor. ~UnlockGuard() { - lock_.lock(); + try { + lock_.lock(); + } catch (...) { + } } private: diff --git a/src/lib/util/versioned_csv_file.cc b/src/lib/util/versioned_csv_file.cc index 8c48f66e10..4e5085a270 100644 --- a/src/lib/util/versioned_csv_file.cc +++ b/src/lib/util/versioned_csv_file.cc @@ -17,9 +17,6 @@ VersionedCSVFile::VersionedCSVFile(const std::string& filename) input_schema_state_(CURRENT) { } -VersionedCSVFile::~VersionedCSVFile() { -} - void VersionedCSVFile::addColumn(const std::string& name, const std::string& version, diff --git a/src/lib/util/versioned_csv_file.h b/src/lib/util/versioned_csv_file.h index cfd18d945c..53a2ed9b4c 100644 --- a/src/lib/util/versioned_csv_file.h +++ b/src/lib/util/versioned_csv_file.h @@ -32,10 +32,10 @@ public: VersionedColumn(const std::string& name, const std::string& version, const std::string& default_value = "") : name_(name), version_(version), default_value_(default_value) { - }; + } /// @brief Destructor - virtual ~VersionedColumn(){}; + virtual ~VersionedColumn() = default; /// @brief Name of the column. std::string name_; @@ -135,7 +135,7 @@ public: VersionedCSVFile(const std::string& filename); /// @brief Destructor - virtual ~VersionedCSVFile(); + virtual ~VersionedCSVFile() = default; /// @brief Adds metadata for a single column to the schema. /// diff --git a/src/lib/util/watch_socket.cc b/src/lib/util/watch_socket.cc index 6ffb396083..2ea3566c4b 100644 --- a/src/lib/util/watch_socket.cc +++ b/src/lib/util/watch_socket.cc @@ -57,7 +57,10 @@ WatchSocket::WatchSocket() } WatchSocket::~WatchSocket() { - closeSocket(); + try { + closeSocket(); + } catch (...) { + } } void diff --git a/src/lib/util/watched_thread.h b/src/lib/util/watched_thread.h index 47b72642f2..a2f479e011 100644 --- a/src/lib/util/watched_thread.h +++ b/src/lib/util/watched_thread.h @@ -39,10 +39,10 @@ public: }; /// @brief Constructor - WatchedThread(){}; + WatchedThread() = default; /// @brief Virtual destructor - virtual ~WatchedThread(){} + virtual ~WatchedThread() = default; /// @brief Fetches the fd of a watch socket /// diff --git a/src/lib/yang/adaptor.cc b/src/lib/yang/adaptor.cc index 597f233055..60c0615396 100644 --- a/src/lib/yang/adaptor.cc +++ b/src/lib/yang/adaptor.cc @@ -17,12 +17,6 @@ using namespace isc::data; namespace isc { namespace yang { -Adaptor::Adaptor() { -} - -Adaptor::~Adaptor() { -} - ConstElementPtr Adaptor::getContext(ConstElementPtr parent) { diff --git a/src/lib/yang/adaptor.h b/src/lib/yang/adaptor.h index fa1bbd6884..1b955a368b 100644 --- a/src/lib/yang/adaptor.h +++ b/src/lib/yang/adaptor.h @@ -31,10 +31,10 @@ class Adaptor { public: /// @brief Constructor. - Adaptor(); + Adaptor() = default; /// @brief Destructor. - virtual ~Adaptor(); + virtual ~Adaptor() = default; /// @brief Get user context. /// diff --git a/src/lib/yang/adaptor_config.cc b/src/lib/yang/adaptor_config.cc index 0128792a6a..c9d3975ec0 100644 --- a/src/lib/yang/adaptor_config.cc +++ b/src/lib/yang/adaptor_config.cc @@ -20,12 +20,6 @@ const string DHCP6_SPACE = "dhcp6"; namespace isc { namespace yang { -AdaptorConfig::AdaptorConfig() { -} - -AdaptorConfig::~AdaptorConfig() { -} - bool AdaptorConfig::subnetsCollectID(ConstElementPtr subnets, SubnetIDSet& set) { bool have_ids = true; diff --git a/src/lib/yang/adaptor_config.h b/src/lib/yang/adaptor_config.h index d849a611ee..2992537ae1 100644 --- a/src/lib/yang/adaptor_config.h +++ b/src/lib/yang/adaptor_config.h @@ -22,15 +22,14 @@ namespace yang { /// as preProcess4 and preProcess6 class methods, filling some required /// (by YANG) fields (e.g. subnet IDs, or option code and space), or /// transforming a hand-written JSON configuration into a canonical form. -class AdaptorConfig : public AdaptorHost, public AdaptorOption, - public AdaptorSubnet { +class AdaptorConfig : public AdaptorHost, public AdaptorOption, public AdaptorSubnet { public: /// @brief Constructor. - AdaptorConfig(); + AdaptorConfig() = default; /// @brief Destructor. - virtual ~AdaptorConfig(); + virtual ~AdaptorConfig() = default; /// @brief Pre process a DHCPv4 configuration. /// diff --git a/src/lib/yang/adaptor_host.cc b/src/lib/yang/adaptor_host.cc index c02896af0e..6f6639301b 100644 --- a/src/lib/yang/adaptor_host.cc +++ b/src/lib/yang/adaptor_host.cc @@ -23,12 +23,6 @@ const string AdaptorHost::STD_CHARACTERS = "0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-.@_"; -AdaptorHost::AdaptorHost() { -} - -AdaptorHost::~AdaptorHost() { -} - void AdaptorHost::quoteIdentifier(ElementPtr host) { ConstElementPtr flex_id = host->get("flex-id"); diff --git a/src/lib/yang/adaptor_host.h b/src/lib/yang/adaptor_host.h index 918b4bf7b2..33b5ad548d 100644 --- a/src/lib/yang/adaptor_host.h +++ b/src/lib/yang/adaptor_host.h @@ -26,10 +26,10 @@ public: static const std::string STD_CHARACTERS; /// @brief Constructor. - AdaptorHost(); + AdaptorHost() = default; /// @brief Destructor. - virtual ~AdaptorHost(); + virtual ~AdaptorHost() = default; /// @brief Quote when needed a host identifier. /// diff --git a/src/lib/yang/adaptor_option.cc b/src/lib/yang/adaptor_option.cc index db61ac366f..b27c3333d8 100644 --- a/src/lib/yang/adaptor_option.cc +++ b/src/lib/yang/adaptor_option.cc @@ -17,12 +17,6 @@ using namespace isc::dhcp; namespace isc { namespace yang { -AdaptorOption::AdaptorOption() { -} - -AdaptorOption::~AdaptorOption() { -} - void AdaptorOption::setSpace(ElementPtr option, const string& space) { if (!option->contains("space")) { diff --git a/src/lib/yang/adaptor_option.h b/src/lib/yang/adaptor_option.h index e3c53f18e2..0535c1b8b6 100644 --- a/src/lib/yang/adaptor_option.h +++ b/src/lib/yang/adaptor_option.h @@ -46,10 +46,10 @@ class AdaptorOption { public: /// @brief Constructor. - AdaptorOption(); + AdaptorOption() = default; /// @brief Destructor. - virtual ~AdaptorOption(); + virtual ~AdaptorOption() = default; /// @brief Set space. /// diff --git a/src/lib/yang/adaptor_pool.cc b/src/lib/yang/adaptor_pool.cc index a6586332dc..d6b67bf61b 100644 --- a/src/lib/yang/adaptor_pool.cc +++ b/src/lib/yang/adaptor_pool.cc @@ -15,12 +15,6 @@ using namespace isc::data; namespace isc { namespace yang { -AdaptorPool::AdaptorPool() { -} - -AdaptorPool::~AdaptorPool() { -} - void AdaptorPool::canonizePool(ElementPtr pool) { const string& orig = pool->get("pool")->stringValue(); diff --git a/src/lib/yang/adaptor_pool.h b/src/lib/yang/adaptor_pool.h index f8e72bf2c4..27df546780 100644 --- a/src/lib/yang/adaptor_pool.h +++ b/src/lib/yang/adaptor_pool.h @@ -29,10 +29,10 @@ class AdaptorPool { public: /// @brief Constructor. - AdaptorPool(); + AdaptorPool() = default; /// @brief Destructor. - virtual ~AdaptorPool(); + virtual ~AdaptorPool() = default; /// @brief Canonize pool. /// diff --git a/src/lib/yang/adaptor_subnet.cc b/src/lib/yang/adaptor_subnet.cc index bb352b979f..303706a465 100644 --- a/src/lib/yang/adaptor_subnet.cc +++ b/src/lib/yang/adaptor_subnet.cc @@ -15,12 +15,6 @@ using namespace isc::dhcp; namespace isc { namespace yang { -AdaptorSubnet::AdaptorSubnet() { -} - -AdaptorSubnet::~AdaptorSubnet() { -} - bool AdaptorSubnet::collectID(ConstElementPtr subnet, SubnetIDSet& set) { ConstElementPtr id = subnet->get("id"); diff --git a/src/lib/yang/adaptor_subnet.h b/src/lib/yang/adaptor_subnet.h index 0bfcae00ef..64071c3463 100644 --- a/src/lib/yang/adaptor_subnet.h +++ b/src/lib/yang/adaptor_subnet.h @@ -31,10 +31,10 @@ class AdaptorSubnet { public: /// @brief Constructor. - AdaptorSubnet(); + AdaptorSubnet() = default; /// @brief Destructor. - virtual ~AdaptorSubnet(); + virtual ~AdaptorSubnet() = default; /// @brief Collect a subnet ID. /// diff --git a/src/lib/yang/tests/config_unittests.cc b/src/lib/yang/tests/config_unittests.cc index f749a3060a..531fa18d04 100644 --- a/src/lib/yang/tests/config_unittests.cc +++ b/src/lib/yang/tests/config_unittests.cc @@ -62,9 +62,12 @@ public: /// @brief Virtual destructor. virtual ~ConfigTest() { - session_.reset(); - connection_.reset(); - model_.clear(); + try { + session_.reset(); + connection_.reset(); + model_.clear(); + } catch (...) { + } } /// @brief Set model. diff --git a/src/lib/yang/tests/sysrepo_setup.h b/src/lib/yang/tests/sysrepo_setup.h index 855431f411..81b5064e8f 100644 --- a/src/lib/yang/tests/sysrepo_setup.h +++ b/src/lib/yang/tests/sysrepo_setup.h @@ -50,9 +50,12 @@ public: /// /// Destroy all objects. virtual ~GenericTranslatorTest() { - t_obj_.reset(); - sess_.reset(); - conn_.reset(); + try { + t_obj_.reset(); + sess_.reset(); + conn_.reset(); + } catch (...) { + } } /// @brief Sysrepo connection. diff --git a/src/lib/yang/tests/translator_class_unittests.cc b/src/lib/yang/tests/translator_class_unittests.cc index 30191b259c..2a57275a9c 100644 --- a/src/lib/yang/tests/translator_class_unittests.cc +++ b/src/lib/yang/tests/translator_class_unittests.cc @@ -33,10 +33,10 @@ class TranslatorClassesTest : public: /// Constructor. - TranslatorClassesTest() { } + TranslatorClassesTest() = default; /// Destructor (does nothing). - virtual ~TranslatorClassesTest() { } + virtual ~TranslatorClassesTest() = default; }; // This test verifies that an empty client class list can be properly diff --git a/src/lib/yang/tests/translator_control_socket_unittests.cc b/src/lib/yang/tests/translator_control_socket_unittests.cc index 5ceef861b4..8f10177589 100644 --- a/src/lib/yang/tests/translator_control_socket_unittests.cc +++ b/src/lib/yang/tests/translator_control_socket_unittests.cc @@ -32,10 +32,10 @@ class TranslatorControlSocketTest : public: /// Constructor. - TranslatorControlSocketTest() { } + TranslatorControlSocketTest() = default; /// Destructor (does nothing). - virtual ~TranslatorControlSocketTest() { } + virtual ~TranslatorControlSocketTest() = default; }; // This test verifies that an empty control socket can be properly diff --git a/src/lib/yang/tests/translator_database_unittests.cc b/src/lib/yang/tests/translator_database_unittests.cc index bf71051a03..b6e387c69c 100644 --- a/src/lib/yang/tests/translator_database_unittests.cc +++ b/src/lib/yang/tests/translator_database_unittests.cc @@ -32,10 +32,10 @@ class TranslatorDatabaseTest : public: /// Constructor. - TranslatorDatabaseTest() { } + TranslatorDatabaseTest() = default; /// Destructor (does nothing). - virtual ~TranslatorDatabaseTest() { } + virtual ~TranslatorDatabaseTest() = default; }; // This test verifies that an empty database can be properly @@ -149,10 +149,10 @@ class TranslatorDatabasesTest : public: /// Constructor. - TranslatorDatabasesTest() { } + TranslatorDatabasesTest() = default; /// Destructor (does nothing). - virtual ~TranslatorDatabasesTest() { } + virtual ~TranslatorDatabasesTest() = default; }; // This test verifies that an empty database list can be properly diff --git a/src/lib/yang/tests/translator_host_unittests.cc b/src/lib/yang/tests/translator_host_unittests.cc index 375d775832..84d2093d2c 100644 --- a/src/lib/yang/tests/translator_host_unittests.cc +++ b/src/lib/yang/tests/translator_host_unittests.cc @@ -33,10 +33,10 @@ class TranslatorHostsTest : public: /// Constructor. - TranslatorHostsTest() { } + TranslatorHostsTest() = default; /// Destructor (does nothing). - virtual ~TranslatorHostsTest() { } + virtual ~TranslatorHostsTest() = default; }; // This test verifies that an empty host reservation list can be properly diff --git a/src/lib/yang/tests/translator_logger_unittests.cc b/src/lib/yang/tests/translator_logger_unittests.cc index cc8100a8e0..a78963e8f9 100644 --- a/src/lib/yang/tests/translator_logger_unittests.cc +++ b/src/lib/yang/tests/translator_logger_unittests.cc @@ -32,10 +32,10 @@ class TranslatorLoggersTest : public: /// Constructor. - TranslatorLoggersTest() { } + TranslatorLoggersTest() = default; /// Destructor (does nothing). - virtual ~TranslatorLoggersTest() { } + virtual ~TranslatorLoggersTest() = default; }; // This test verifies that an empty logger list can be properly diff --git a/src/lib/yang/tests/translator_option_data_unittests.cc b/src/lib/yang/tests/translator_option_data_unittests.cc index e95030a763..6e55a790a6 100644 --- a/src/lib/yang/tests/translator_option_data_unittests.cc +++ b/src/lib/yang/tests/translator_option_data_unittests.cc @@ -33,10 +33,10 @@ class TranslatorOptionDataListTest : public: /// Constructor. - TranslatorOptionDataListTest() { } + TranslatorOptionDataListTest() = default; /// Destructor (does nothing). - virtual ~TranslatorOptionDataListTest() { } + virtual ~TranslatorOptionDataListTest() = default; }; // This test verifies that an empty option data list can be properly diff --git a/src/lib/yang/tests/translator_option_def_unittests.cc b/src/lib/yang/tests/translator_option_def_unittests.cc index 515d9ec303..14c35e336c 100644 --- a/src/lib/yang/tests/translator_option_def_unittests.cc +++ b/src/lib/yang/tests/translator_option_def_unittests.cc @@ -33,10 +33,10 @@ class TranslatorOptionDefListTest : public: /// Constructor. - TranslatorOptionDefListTest() { } + TranslatorOptionDefListTest() = default; /// Destructor (does nothing). - virtual ~TranslatorOptionDefListTest() { } + virtual ~TranslatorOptionDefListTest() = default; }; // This test verifies that an empty option definition list can be properly diff --git a/src/lib/yang/tests/translator_pd_pool_unittests.cc b/src/lib/yang/tests/translator_pd_pool_unittests.cc index 1be28b16c8..49aa5de339 100644 --- a/src/lib/yang/tests/translator_pd_pool_unittests.cc +++ b/src/lib/yang/tests/translator_pd_pool_unittests.cc @@ -33,10 +33,10 @@ class TranslatorPdPoolsTest : public: /// Constructor. - TranslatorPdPoolsTest() { } + TranslatorPdPoolsTest() = default; /// Destructor (does nothing). - virtual ~TranslatorPdPoolsTest() { } + virtual ~TranslatorPdPoolsTest() = default; }; // This test verifies that an empty pd pool list can be properly diff --git a/src/lib/yang/tests/translator_pool_unittests.cc b/src/lib/yang/tests/translator_pool_unittests.cc index e18f2e1174..3a3a31feeb 100644 --- a/src/lib/yang/tests/translator_pool_unittests.cc +++ b/src/lib/yang/tests/translator_pool_unittests.cc @@ -33,10 +33,10 @@ class TranslatorPoolsTest : public: /// Constructor. - TranslatorPoolsTest() { } + TranslatorPoolsTest() = default; /// Destructor (does nothing). - virtual ~TranslatorPoolsTest() { } + virtual ~TranslatorPoolsTest() = default; }; // This test verifies that an empty pool list can be properly diff --git a/src/lib/yang/tests/translator_shared_network_unittests.cc b/src/lib/yang/tests/translator_shared_network_unittests.cc index ad255e75ba..e1d6dfa847 100644 --- a/src/lib/yang/tests/translator_shared_network_unittests.cc +++ b/src/lib/yang/tests/translator_shared_network_unittests.cc @@ -32,10 +32,10 @@ class TranslatorSharedNetworksTest : public: /// Constructor. - TranslatorSharedNetworksTest() { } + TranslatorSharedNetworksTest() = default; /// Destructor (does nothing). - virtual ~TranslatorSharedNetworksTest() { } + virtual ~TranslatorSharedNetworksTest() = default; }; // This test verifies that an empty shared network list can be properly diff --git a/src/lib/yang/tests/translator_subnet_unittests.cc b/src/lib/yang/tests/translator_subnet_unittests.cc index f2d31fd1b4..2270fa05ca 100644 --- a/src/lib/yang/tests/translator_subnet_unittests.cc +++ b/src/lib/yang/tests/translator_subnet_unittests.cc @@ -32,10 +32,10 @@ class TranslatorSubnetsTest : public: /// Constructor. - TranslatorSubnetsTest() { } + TranslatorSubnetsTest() = default; /// Destructor (does nothing). - virtual ~TranslatorSubnetsTest() { } + virtual ~TranslatorSubnetsTest() = default; }; // This test verifies that an empty subnet list can be properly diff --git a/src/lib/yang/translator.cc b/src/lib/yang/translator.cc index 531be3569e..1eb9e3bb55 100644 --- a/src/lib/yang/translator.cc +++ b/src/lib/yang/translator.cc @@ -44,9 +44,6 @@ TranslatorBasic::TranslatorBasic(S_Session session, const string& model) : session_(session), model_(model) { } -TranslatorBasic::~TranslatorBasic() { -} - ElementPtr #ifndef HAVE_PRE_0_7_6_SYSREPO TranslatorBasic::value(sysrepo::S_Val s_val) { diff --git a/src/lib/yang/translator.h b/src/lib/yang/translator.h index 5c3313e424..046a0801c3 100644 --- a/src/lib/yang/translator.h +++ b/src/lib/yang/translator.h @@ -38,7 +38,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorBasic(); + virtual ~TranslatorBasic() = default; /// @brief Translate basic value from YANG to JSON. /// diff --git a/src/lib/yang/translator_class.cc b/src/lib/yang/translator_class.cc index 88f97cd461..3a44e29e1e 100644 --- a/src/lib/yang/translator_class.cc +++ b/src/lib/yang/translator_class.cc @@ -28,9 +28,6 @@ TranslatorClass::TranslatorClass(S_Session session, const string& model) TranslatorOptionDefList(session, model) { } -TranslatorClass::~TranslatorClass() { -} - ElementPtr TranslatorClass::getClass(const string& xpath) { try { @@ -173,9 +170,6 @@ TranslatorClasses::TranslatorClasses(S_Session session, const string& model) TranslatorClass(session, model) { } -TranslatorClasses::~TranslatorClasses() { -} - ConstElementPtr TranslatorClasses::getClasses(const string& xpath) { try { diff --git a/src/lib/yang/translator_class.h b/src/lib/yang/translator_class.h index 3e641c4100..fa5e413f77 100644 --- a/src/lib/yang/translator_class.h +++ b/src/lib/yang/translator_class.h @@ -84,7 +84,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorClass(); + virtual ~TranslatorClass() = default; /// @brief Get and translate a client class from YANG to JSON. /// @@ -134,7 +134,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorClasses(); + virtual ~TranslatorClasses() = default; /// @brief Get and translate client classes from YANG to JSON. /// diff --git a/src/lib/yang/translator_config.cc b/src/lib/yang/translator_config.cc index 898d662e81..e3249562a0 100644 --- a/src/lib/yang/translator_config.cc +++ b/src/lib/yang/translator_config.cc @@ -45,9 +45,6 @@ TranslatorConfig::TranslatorConfig(S_Session session, const string& model) TranslatorLoggers(session, model) { } -TranslatorConfig::~TranslatorConfig() { -} - ElementPtr TranslatorConfig::getConfig() { try { diff --git a/src/lib/yang/translator_config.h b/src/lib/yang/translator_config.h index bb3290649f..8452e8c8f4 100644 --- a/src/lib/yang/translator_config.h +++ b/src/lib/yang/translator_config.h @@ -395,7 +395,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorConfig(); + virtual ~TranslatorConfig() = default; /// @brief Get and translate the whole DHCP server configuration /// from YANG to JSON. diff --git a/src/lib/yang/translator_control_socket.cc b/src/lib/yang/translator_control_socket.cc index 65757e583e..a32c6a59e5 100644 --- a/src/lib/yang/translator_control_socket.cc +++ b/src/lib/yang/translator_control_socket.cc @@ -25,9 +25,6 @@ TranslatorControlSocket::TranslatorControlSocket(S_Session session, : TranslatorBasic(session, model) { } -TranslatorControlSocket::~TranslatorControlSocket() { -} - ConstElementPtr TranslatorControlSocket::getControlSocket(const string& xpath) { try { diff --git a/src/lib/yang/translator_control_socket.h b/src/lib/yang/translator_control_socket.h index 236d17bdd6..e367881be4 100644 --- a/src/lib/yang/translator_control_socket.h +++ b/src/lib/yang/translator_control_socket.h @@ -82,7 +82,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorControlSocket(); + virtual ~TranslatorControlSocket() = default; /// @brief Get and translate a control socket from YANG to JSON. /// diff --git a/src/lib/yang/translator_database.cc b/src/lib/yang/translator_database.cc index 3527a79fba..0c78291582 100644 --- a/src/lib/yang/translator_database.cc +++ b/src/lib/yang/translator_database.cc @@ -24,9 +24,6 @@ TranslatorDatabase::TranslatorDatabase(S_Session session, const string& model) : TranslatorBasic(session, model) { } -TranslatorDatabase::~TranslatorDatabase() { -} - ElementPtr TranslatorDatabase::getDatabase(const string& xpath) { try { @@ -258,9 +255,6 @@ TranslatorDatabases::TranslatorDatabases(S_Session session, TranslatorDatabase(session, model) { } -TranslatorDatabases::~TranslatorDatabases() { -} - ConstElementPtr TranslatorDatabases::getDatabases(const string& xpath) { try { diff --git a/src/lib/yang/translator_database.h b/src/lib/yang/translator_database.h index 0f86bd91e0..8c4c8799b8 100644 --- a/src/lib/yang/translator_database.h +++ b/src/lib/yang/translator_database.h @@ -121,7 +121,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorDatabase(); + virtual ~TranslatorDatabase() = default; /// @brief Get and translate a database access from YANG to JSON. /// @@ -178,7 +178,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorDatabases(); + virtual ~TranslatorDatabases() = default; /// @brief Get and translate database accesses from YANG to JSON. /// diff --git a/src/lib/yang/translator_host.cc b/src/lib/yang/translator_host.cc index 9b164c8ecb..639a150d00 100644 --- a/src/lib/yang/translator_host.cc +++ b/src/lib/yang/translator_host.cc @@ -26,9 +26,6 @@ TranslatorHost::TranslatorHost(S_Session session, const string& model) TranslatorOptionDataList(session, model) { } -TranslatorHost::~TranslatorHost() { -} - ElementPtr TranslatorHost::getHost(const string& xpath) { try { @@ -188,9 +185,6 @@ TranslatorHosts::TranslatorHosts(S_Session session, const string& model) TranslatorHost(session, model) { } -TranslatorHosts::~TranslatorHosts() { -} - ElementPtr TranslatorHosts::getHosts(const string& xpath) { try { diff --git a/src/lib/yang/translator_host.h b/src/lib/yang/translator_host.h index 3677f7094b..747231d89c 100644 --- a/src/lib/yang/translator_host.h +++ b/src/lib/yang/translator_host.h @@ -123,7 +123,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorHost(); + virtual ~TranslatorHost() = default; /// @brief Get and translate a host reservation from YANG to JSON. /// @@ -174,7 +174,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorHosts(); + virtual ~TranslatorHosts() = default; /// @brief Get and translate host reservations from YANG to JSON. /// diff --git a/src/lib/yang/translator_logger.cc b/src/lib/yang/translator_logger.cc index e4a21d244e..aace300476 100644 --- a/src/lib/yang/translator_logger.cc +++ b/src/lib/yang/translator_logger.cc @@ -24,9 +24,6 @@ TranslatorLogger::TranslatorLogger(S_Session session, const string& model) : TranslatorBasic(session, model) { } -TranslatorLogger::~TranslatorLogger() { -} - ElementPtr TranslatorLogger::getLogger(const string& xpath) { try { @@ -212,9 +209,6 @@ TranslatorLoggers::TranslatorLoggers(S_Session session, const string& model) TranslatorLogger(session, model) { } -TranslatorLoggers::~TranslatorLoggers() { -} - ConstElementPtr TranslatorLoggers::getLoggers(const string& xpath) { try { diff --git a/src/lib/yang/translator_logger.h b/src/lib/yang/translator_logger.h index 5aca5315ef..777c5f6014 100644 --- a/src/lib/yang/translator_logger.h +++ b/src/lib/yang/translator_logger.h @@ -106,7 +106,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorLogger(); + virtual ~TranslatorLogger() = default; /// @brief Get and translate a logger from YANG to JSON. /// @@ -184,7 +184,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorLoggers(); + virtual ~TranslatorLoggers() = default; /// @brief Get and translate loggeres from YANG to JSON. /// diff --git a/src/lib/yang/translator_option_data.cc b/src/lib/yang/translator_option_data.cc index 644cf79469..3ebe3dafce 100644 --- a/src/lib/yang/translator_option_data.cc +++ b/src/lib/yang/translator_option_data.cc @@ -25,9 +25,6 @@ TranslatorOptionData::TranslatorOptionData(S_Session session, : TranslatorBasic(session, model) { } -TranslatorOptionData::~TranslatorOptionData() { -} - ElementPtr TranslatorOptionData::getOptionData(const string& xpath) { try { @@ -131,9 +128,6 @@ TranslatorOptionDataList::TranslatorOptionDataList(S_Session session, TranslatorOptionData(session, model) { } -TranslatorOptionDataList::~TranslatorOptionDataList() { -} - ConstElementPtr TranslatorOptionDataList::getOptionDataList(const string& xpath) { try { diff --git a/src/lib/yang/translator_option_data.h b/src/lib/yang/translator_option_data.h index 69c444e6ac..b3676ba368 100644 --- a/src/lib/yang/translator_option_data.h +++ b/src/lib/yang/translator_option_data.h @@ -86,7 +86,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorOptionData(); + virtual ~TranslatorOptionData() = default; /// @brief Get and translate an option data from YANG to JSON. /// @@ -138,7 +138,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorOptionDataList(); + virtual ~TranslatorOptionDataList() = default; /// @brief Get and translate option data list from YANG to JSON. /// diff --git a/src/lib/yang/translator_option_def.cc b/src/lib/yang/translator_option_def.cc index 8153859c26..9ca3c5945b 100644 --- a/src/lib/yang/translator_option_def.cc +++ b/src/lib/yang/translator_option_def.cc @@ -25,9 +25,6 @@ TranslatorOptionDef::TranslatorOptionDef(S_Session session, : TranslatorBasic(session, model) { } -TranslatorOptionDef::~TranslatorOptionDef() { -} - ElementPtr TranslatorOptionDef::getOptionDef(const string& xpath) { try { @@ -140,9 +137,6 @@ TranslatorOptionDefList::TranslatorOptionDefList(S_Session session, TranslatorOptionDef(session, model) { } -TranslatorOptionDefList::~TranslatorOptionDefList() { -} - ConstElementPtr TranslatorOptionDefList::getOptionDefList(const string& xpath) { try { diff --git a/src/lib/yang/translator_option_def.h b/src/lib/yang/translator_option_def.h index b3332edd25..7ab502b46f 100644 --- a/src/lib/yang/translator_option_def.h +++ b/src/lib/yang/translator_option_def.h @@ -89,7 +89,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorOptionDef(); + virtual ~TranslatorOptionDef() = default; /// @brief Get and translate an option definition from YANG to JSON. /// @@ -143,7 +143,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorOptionDefList(); + virtual ~TranslatorOptionDefList() = default; /// @brief Get and translate option definition list from YANG to JSON. /// diff --git a/src/lib/yang/translator_pd_pool.cc b/src/lib/yang/translator_pd_pool.cc index 081558be1f..c7f19ccca7 100644 --- a/src/lib/yang/translator_pd_pool.cc +++ b/src/lib/yang/translator_pd_pool.cc @@ -27,9 +27,6 @@ TranslatorPdPool::TranslatorPdPool(S_Session session, const string& model) TranslatorOptionDataList(session, model) { } -TranslatorPdPool::~TranslatorPdPool() { -} - ElementPtr TranslatorPdPool::getPdPool(const string& xpath) { try { @@ -293,9 +290,6 @@ TranslatorPdPools::TranslatorPdPools(S_Session session, const string& model) TranslatorPdPool(session, model) { } -TranslatorPdPools::~TranslatorPdPools() { -} - ElementPtr TranslatorPdPools::getPdPools(const string& xpath) { try { diff --git a/src/lib/yang/translator_pd_pool.h b/src/lib/yang/translator_pd_pool.h index fae6bbeda6..d9f381ba51 100644 --- a/src/lib/yang/translator_pd_pool.h +++ b/src/lib/yang/translator_pd_pool.h @@ -127,7 +127,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorPdPool(); + virtual ~TranslatorPdPool() = default; /// @brief Get and translate a pd-pool from YANG to JSON. /// @@ -194,7 +194,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorPdPools(); + virtual ~TranslatorPdPools() = default; /// @brief Get and translate pd-pools from YANG to JSON. /// diff --git a/src/lib/yang/translator_pool.cc b/src/lib/yang/translator_pool.cc index 905e2b6b18..639ffa337a 100644 --- a/src/lib/yang/translator_pool.cc +++ b/src/lib/yang/translator_pool.cc @@ -30,9 +30,6 @@ TranslatorPool::TranslatorPool(S_Session session, const string& model) TranslatorOptionDataList(session, model) { } -TranslatorPool::~TranslatorPool() { -} - ElementPtr TranslatorPool::getPool(const string& xpath) { try { @@ -272,9 +269,6 @@ TranslatorPools::TranslatorPools(S_Session session, const string& model) TranslatorPool(session, model) { } -TranslatorPools::~TranslatorPools() { -} - ElementPtr TranslatorPools::getPools(const string& xpath) { try { diff --git a/src/lib/yang/translator_pool.h b/src/lib/yang/translator_pool.h index 0f2fa7530e..ab09e3f4c8 100644 --- a/src/lib/yang/translator_pool.h +++ b/src/lib/yang/translator_pool.h @@ -135,7 +135,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorPool(); + virtual ~TranslatorPool() = default; /// @brief Get and translate a pool from YANG to JSON. /// @@ -209,7 +209,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorPools(); + virtual ~TranslatorPools() = default; /// @brief Get and translate pools from YANG to JSON. /// diff --git a/src/lib/yang/translator_shared_network.cc b/src/lib/yang/translator_shared_network.cc index 9ba195f761..0fecad01b7 100644 --- a/src/lib/yang/translator_shared_network.cc +++ b/src/lib/yang/translator_shared_network.cc @@ -35,9 +35,6 @@ TranslatorSharedNetwork::TranslatorSharedNetwork(S_Session session, TranslatorSubnets(session, model) { } -TranslatorSharedNetwork::~TranslatorSharedNetwork() { -} - ElementPtr TranslatorSharedNetwork::getSharedNetwork(const string& xpath) { try { @@ -344,9 +341,6 @@ TranslatorSharedNetworks::TranslatorSharedNetworks(S_Session session, TranslatorSharedNetwork(session, model) { } -TranslatorSharedNetworks::~TranslatorSharedNetworks() { -} - ElementPtr TranslatorSharedNetworks::getSharedNetworks(const string& xpath) { try { diff --git a/src/lib/yang/translator_shared_network.h b/src/lib/yang/translator_shared_network.h index 316e9b8bb1..e271582a6a 100644 --- a/src/lib/yang/translator_shared_network.h +++ b/src/lib/yang/translator_shared_network.h @@ -156,7 +156,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorSharedNetwork(); + virtual ~TranslatorSharedNetwork() = default; /// @brief Get and translate a shared network from YANG to JSON. /// @@ -214,7 +214,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorSharedNetworks(); + virtual ~TranslatorSharedNetworks() = default; /// @brief Get and translate shared networks from YANG to JSON. /// diff --git a/src/lib/yang/translator_subnet.cc b/src/lib/yang/translator_subnet.cc index 1d8ac030b7..43aead8fba 100644 --- a/src/lib/yang/translator_subnet.cc +++ b/src/lib/yang/translator_subnet.cc @@ -32,9 +32,6 @@ TranslatorSubnet::TranslatorSubnet(S_Session session, const string& model) TranslatorHosts(session, model) { } -TranslatorSubnet::~TranslatorSubnet() { -} - ElementPtr TranslatorSubnet::getSubnet(const string& xpath) { try { @@ -459,9 +456,6 @@ TranslatorSubnets::TranslatorSubnets(S_Session session, const string& model) TranslatorSubnet(session, model) { } -TranslatorSubnets::~TranslatorSubnets() { -} - ElementPtr TranslatorSubnets::getSubnets(const string& xpath) { try { diff --git a/src/lib/yang/translator_subnet.h b/src/lib/yang/translator_subnet.h index 1d493d6f80..6adb66a6ad 100644 --- a/src/lib/yang/translator_subnet.h +++ b/src/lib/yang/translator_subnet.h @@ -266,7 +266,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorSubnet(); + virtual ~TranslatorSubnet() = default; /// @brief Get and translate a subnet from YANG to JSON. /// @@ -329,7 +329,7 @@ public: #endif /// @brief Destructor. - virtual ~TranslatorSubnets(); + virtual ~TranslatorSubnets() = default; /// @brief Get and translate subnets from YANG to JSON. /// -- GitLab From cf9767499eb49fff4da5f563ddd116258247ae37 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Thu, 3 Jun 2021 20:15:18 +0300 Subject: [PATCH 5/6] [#1845] code cleanup --- src/bin/agent/ca_process.h | 5 +++-- src/bin/agent/parser_context.h | 5 ++--- src/bin/agent/tests/ca_process_unittests.cc | 2 +- src/bin/agent/tests/get_config_unittest.cc | 1 + src/bin/d2/d2_cfg_mgr.h | 6 ++++-- src/bin/d2/d2_config.h | 7 ++++--- src/bin/d2/dns_client.h | 1 + src/bin/d2/parser_context.h | 3 +-- src/bin/d2/simple_remove.h | 1 - src/bin/d2/tests/d2_cfg_mgr_unittests.cc | 1 + src/bin/d2/tests/d2_command_unittest.cc | 1 + src/bin/d2/tests/d2_simple_parser_unittest.cc | 8 +++++--- src/bin/d2/tests/d2_update_message_unittests.cc | 2 +- src/bin/d2/tests/d2_update_mgr_unittests.cc | 1 + src/bin/d2/tests/dns_client_unittests.cc | 2 +- src/bin/d2/tests/get_config_unittest.cc | 1 + src/bin/d2/tests/nc_add_unittests.cc | 3 ++- src/bin/d2/tests/nc_remove_unittests.cc | 2 ++ src/bin/d2/tests/nc_trans_unittests.cc | 3 ++- src/bin/d2/tests/simple_add_unittests.cc | 2 ++ src/bin/d2/tests/simple_remove_unittests.cc | 2 ++ src/bin/dhcp4/client_handler.cc | 4 ---- src/bin/dhcp4/client_handler.h | 2 +- src/bin/dhcp4/dhcp4to6_ipc.h | 1 + src/bin/dhcp4/parser_context.h | 7 +++---- src/bin/dhcp4/tests/config_parser_unittest.cc | 3 +-- src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc | 2 +- src/bin/dhcp4/tests/d2_unittest.h | 6 +++--- src/bin/dhcp4/tests/dhcp4_test_utils.h | 1 - src/bin/dhcp4/tests/dora_unittest.cc | 3 +++ src/bin/dhcp4/tests/get_config_unittest.cc | 1 + src/bin/dhcp4/tests/get_config_unittest.cc.skel | 1 + src/bin/dhcp4/tests/hooks_unittest.cc | 2 +- src/bin/dhcp4/tests/kea_controller_unittest.cc | 1 + src/bin/dhcp6/client_handler.cc | 3 --- src/bin/dhcp6/client_handler.h | 2 +- src/bin/dhcp6/dhcp6to4_ipc.h | 1 + src/bin/dhcp6/parser_context.h | 7 +++---- src/bin/dhcp6/tests/config_parser_unittest.cc | 1 + src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc | 3 ++- src/bin/dhcp6/tests/d2_unittest.h | 6 +++--- src/bin/dhcp6/tests/dhcp6_test_utils.h | 1 + src/bin/dhcp6/tests/get_config_unittest.cc | 1 + src/bin/dhcp6/tests/get_config_unittest.cc.skel | 1 + src/bin/dhcp6/tests/hooks_unittest.cc | 2 +- src/bin/dhcp6/tests/infrequest_unittest.cc | 1 + src/bin/dhcp6/tests/kea_controller_unittest.cc | 3 ++- src/bin/dhcp6/tests/sarr_unittest.cc | 1 + src/bin/lfc/lfc_controller.h | 4 ++-- src/bin/netconf/netconf.h | 1 + src/bin/netconf/netconf_config.h | 8 ++++---- src/bin/netconf/netconf_process.h | 5 +++-- src/bin/netconf/parser_context.h | 3 +-- src/bin/netconf/tests/control_socket_unittests.cc | 2 ++ src/bin/netconf/tests/get_config_unittest.cc | 1 + src/bin/netconf/tests/netconf_process_unittests.cc | 1 + src/bin/netconf/tests/netconf_unittests.cc | 2 ++ src/bin/perfdhcp/abstract_scen.h | 6 ++---- src/bin/perfdhcp/receiver.h | 1 + src/bin/perfdhcp/test_control.h | 1 + src/bin/perfdhcp/tests/command_options_helper.h | 1 + src/hooks/dhcp/flex_option/flex_option.h | 1 + .../flex_option/libloadtests/load_unload_unittests.cc | 1 + .../dhcp/flex_option/tests/flex_option_unittests.cc | 1 + src/hooks/dhcp/high_availability/ha_impl.h | 1 - .../high_availability/libloadtests/close_unittests.cc | 1 + .../libloadtests/load_unload_unittests.cc | 1 + .../high_availability/tests/query_filter_unittest.cc | 1 + src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc | 1 + .../dhcp/mysql_cb/tests/mysql_cb_dhcp4_mgr_unittest.cc | 1 + .../dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc | 1 + .../dhcp/mysql_cb/tests/mysql_cb_dhcp6_mgr_unittest.cc | 1 + .../dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc | 1 + .../run_script/libloadtests/load_unload_unittests.cc | 1 + src/hooks/dhcp/run_script/run_script.h | 2 ++ src/hooks/dhcp/stat_cmds/tests/stat_cmds_unittest.cc | 1 + src/hooks/dhcp/user_chk/user.h | 1 + src/hooks/dhcp/user_chk/user_data_source.h | 1 + src/hooks/dhcp/user_chk/user_registry.h | 1 + src/lib/asiodns/io_fetch.h | 1 + src/lib/asiolink/botan_boost_tls.cc | 3 +++ src/lib/asiolink/botan_boost_tls.h | 3 +-- src/lib/asiolink/common_tls.h | 4 +++- src/lib/asiolink/io_asio_socket.h | 2 ++ src/lib/asiolink/io_endpoint.h | 2 ++ src/lib/asiolink/io_service.cc | 1 + src/lib/asiolink/io_service.h | 1 + src/lib/asiolink/io_service_signal.cc | 1 + src/lib/asiolink/io_service_signal.h | 1 + src/lib/asiolink/io_socket.h | 2 ++ src/lib/asiolink/tcp_endpoint.h | 5 +++-- src/lib/asiolink/tests/interval_timer_unittest.cc | 1 + src/lib/asiolink/tests/tls_unittest.cc | 2 ++ src/lib/asiolink/testutils/timed_signal.h | 1 + src/lib/asiolink/udp_endpoint.h | 5 +++-- src/lib/cc/cfg_to_element.h | 4 ++++ src/lib/cc/data.h | 9 ++++++--- src/lib/cc/tests/data_file_unittests.cc | 2 +- src/lib/config/cmd_http_listener.h | 1 + src/lib/config/command_mgr.cc | 6 ++---- src/lib/cql/cql_exchange.h | 2 ++ src/lib/cql/sql_common.h | 1 + src/lib/cql/tests/cql_connection_unittest.cc | 1 + src/lib/cryptolink/botan_hmac.cc | 1 + src/lib/cryptolink/botan_link.cc | 3 +++ src/lib/cryptolink/crypto_hash.h | 2 ++ src/lib/cryptolink/crypto_hmac.h | 2 ++ src/lib/cryptolink/crypto_rng.h | 1 + src/lib/cryptolink/cryptolink.h | 8 +++++--- src/lib/cryptolink/openssl_hmac.cc | 1 + src/lib/cryptolink/openssl_link.cc | 1 + src/lib/database/dbaccess_parser.h | 1 + src/lib/database/tests/database_connection_unittest.cc | 1 + src/lib/database/tests/dbaccess_parser_unittest.cc | 7 ++++--- src/lib/dhcp/iface_mgr.h | 4 ++-- src/lib/dhcp/iface_mgr_linux.cc | 3 +-- src/lib/dhcp/option.h | 1 - src/lib/dhcp/packet_queue.h | 7 ++++--- src/lib/dhcp/packet_queue_mgr4.h | 2 +- src/lib/dhcp/packet_queue_mgr6.h | 2 +- src/lib/dhcp/packet_queue_ring.h | 2 ++ src/lib/dhcp/pkt.h | 4 ++-- src/lib/dhcp/pkt_filter.h | 5 ++++- src/lib/dhcp/pkt_filter6.h | 3 +++ src/lib/dhcp/tests/duid_factory_unittest.cc | 2 +- src/lib/dhcp/tests/iface_mgr_test_config.h | 6 +++--- src/lib/dhcp/tests/iface_mgr_unittest.cc | 2 ++ src/lib/dhcp/tests/libdhcp++_unittest.cc | 1 + src/lib/dhcp/tests/packet_queue4_unittest.cc | 1 + src/lib/dhcp/tests/packet_queue6_unittest.cc | 1 + src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc | 1 + src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc | 1 + src/lib/dhcp/tests/pkt_filter6_test_utils.cc | 1 - src/lib/dhcp/tests/pkt_filter6_test_utils.h | 6 +++--- src/lib/dhcp/tests/pkt_filter_test_utils.cc | 1 - src/lib/dhcp/tests/pkt_filter_test_utils.h | 6 +++--- src/lib/dhcp_ddns/ncr_io.h | 8 ++++++++ src/lib/dhcp_ddns/ncr_udp.cc | 4 ++-- src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc | 10 ++++++++-- src/lib/dhcp_ddns/tests/ncr_unittests.cc | 1 + src/lib/dhcpsrv/cache_host_data_source.h | 1 + src/lib/dhcpsrv/cfg_hosts.h | 1 + src/lib/dhcpsrv/client_class_def.h | 1 + src/lib/dhcpsrv/config_backend_dhcp4.h | 1 + src/lib/dhcpsrv/config_backend_dhcp6.h | 1 + src/lib/dhcpsrv/cql_host_data_source.cc | 2 ++ src/lib/dhcpsrv/cql_host_data_source.h | 1 + src/lib/dhcpsrv/d2_client_mgr.cc | 5 ++--- src/lib/dhcpsrv/d2_client_mgr.h | 1 + src/lib/dhcpsrv/dhcp4o6_ipc.cc | 5 ++--- src/lib/dhcpsrv/dhcp4o6_ipc.h | 1 + src/lib/dhcpsrv/host_data_source_factory.cc | 3 +++ src/lib/dhcpsrv/lease.h | 4 ++-- src/lib/dhcpsrv/lease_file_stats.h | 1 + src/lib/dhcpsrv/lease_mgr.h | 1 + src/lib/dhcpsrv/memfile_lease_mgr.cc | 3 +++ src/lib/dhcpsrv/parsers/host_reservation_parser.h | 1 - src/lib/dhcpsrv/pgsql_host_data_source.h | 2 +- src/lib/dhcpsrv/pgsql_lease_mgr.cc | 1 + src/lib/dhcpsrv/pool.h | 2 +- src/lib/dhcpsrv/resource_handler.h | 1 + src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc | 1 + .../dhcpsrv/tests/alloc_engine_expiration_unittest.cc | 3 ++- src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc | 6 ++++++ src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc | 1 + src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc | 1 - src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc | 1 + src/lib/dhcpsrv/tests/cfgmgr_unittest.cc | 1 + src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc | 1 + src/lib/dhcpsrv/tests/d2_client_unittest.cc | 1 + src/lib/dhcpsrv/tests/d2_udp_unittest.cc | 3 +++ src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc | 4 +++- .../tests/dhcp_queue_control_parser_unittest.cc | 4 ++-- src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h | 1 + src/lib/dhcpsrv/tests/host_cache_unittest.cc | 4 +++- .../dhcpsrv/tests/host_data_source_factory_unittest.cc | 3 ++- .../dhcpsrv/tests/host_reservation_parser_unittest.cc | 1 + .../tests/host_reservations_list_parser_unittest.cc | 1 + .../tests/multi_threading_config_parser_unittest.cc | 1 + src/lib/dhcpsrv/tests/sanity_checks_unittest.cc | 1 + .../dhcpsrv/tests/shared_network_parser_unittest.cc | 3 +++ src/lib/dhcpsrv/tests/srv_config_unittest.cc | 2 +- src/lib/dhcpsrv/tests/timer_mgr_unittest.cc | 1 + src/lib/dhcpsrv/testutils/generic_backend_unittest.cc | 1 - .../testutils/generic_host_data_source_unittest.h | 2 ++ src/lib/dhcpsrv/testutils/lease_file_io.h | 1 + src/lib/dhcpsrv/testutils/memory_host_data_source.h | 1 + src/lib/dhcpsrv/testutils/test_config_backend.h | 1 + src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h | 1 + src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.h | 1 + src/lib/dhcpsrv/testutils/test_utils.h | 1 + src/lib/dhcpsrv/writable_host_data_source.h | 1 + src/lib/dns/master_lexer.cc | 4 ++++ src/lib/dns/master_lexer_state.h | 1 + src/lib/dns/message.h | 5 +++++ src/lib/dns/messagerenderer.h | 6 ++++-- src/lib/dns/nsec3hash.cc | 2 ++ src/lib/dns/nsec3hash.h | 3 +++ src/lib/dns/rdata.h | 5 +++++ src/lib/dns/rdata_pimpl_holder.h | 1 + src/lib/dns/rdatafields.cc | 2 ++ src/lib/dns/rdatafields.h | 1 + src/lib/dns/rrparamregistry.h | 5 +++++ src/lib/dns/rrset.cc | 1 + src/lib/dns/rrset.h | 8 ++++++++ src/lib/dns/rrset_collection.h | 3 ++- src/lib/dns/rrset_collection_base.h | 4 ++++ src/lib/dns/tests/nsec3hash_unittest.cc | 3 +++ src/lib/dns/tests/rdatafields_unittest.cc | 1 + src/lib/dns/tests/tsig_unittest.cc | 1 + src/lib/dns/tests/unittest_util.cc | 2 ++ src/lib/dns/tsigkey.h | 2 ++ src/lib/eval/token.h | 3 +++ src/lib/exceptions/exceptions.h | 1 + src/lib/hooks/callout_handle.h | 2 -- src/lib/hooks/library_manager.h | 1 + src/lib/hooks/library_manager_collection.h | 1 + src/lib/hooks/tests/hooks_manager_unittest.cc | 2 +- src/lib/hooks/tests/library_manager_unittest.cc | 1 + src/lib/http/basic_auth_config.h | 1 + src/lib/http/client.cc | 2 ++ src/lib/http/response_creator.h | 1 + src/lib/http/response_creator_factory.h | 1 + src/lib/http/tests/http_thread_pool_unittests.cc | 1 + 224 files changed, 383 insertions(+), 143 deletions(-) diff --git a/src/bin/agent/ca_process.h b/src/bin/agent/ca_process.h index e1a943c68c..acc8f643cc 100644 --- a/src/bin/agent/ca_process.h +++ b/src/bin/agent/ca_process.h @@ -31,6 +31,7 @@ namespace agent { /// instructs the agent to start a specific service. class CtrlAgentProcess : public process::DProcessBase { public: + /// @brief Constructor /// /// @param name name is a text label for the process. Generally used @@ -149,7 +150,7 @@ private: /// @brief Defines a shared pointer to CtrlAgentProcess. typedef boost::shared_ptr CtrlAgentProcessPtr; -}; // namespace isc::agent -}; // namespace isc +} // namespace isc::agent +} // namespace isc #endif // CTRL_AGENT_PROCESS_H diff --git a/src/bin/agent/parser_context.h b/src/bin/agent/parser_context.h index b53a7085e3..a17b1b11f5 100644 --- a/src/bin/agent/parser_context.h +++ b/src/bin/agent/parser_context.h @@ -33,8 +33,7 @@ namespace agent { /// parse only content of the Control-agent object, which is a subset /// of full grammar (this will be very useful for unit-tests to not duplicate /// unnecessary parts of the config file). -class ParserContext -{ +class ParserContext { public: /// @brief Defines currently supported scopes @@ -59,7 +58,7 @@ public: /// @brief Default constructor. ParserContext(); - /// @brief destructor + /// @brief destructor. virtual ~ParserContext() = default; /// @brief JSON elements being parsed. diff --git a/src/bin/agent/tests/ca_process_unittests.cc b/src/bin/agent/tests/ca_process_unittests.cc index 56f8a762c5..1f90c072ec 100644 --- a/src/bin/agent/tests/ca_process_unittests.cc +++ b/src/bin/agent/tests/ca_process_unittests.cc @@ -25,6 +25,7 @@ namespace { /// @brief CtrlAgentProcess test fixture class. class CtrlAgentProcessTest : public CtrlAgentProcess, public ::testing::Test { public: + /// @brief Constructor CtrlAgentProcessTest() : CtrlAgentProcess("agent-test", @@ -85,5 +86,4 @@ TEST_F(CtrlAgentProcessTest, shutdown) { elapsed.total_milliseconds() <= 400); } - } diff --git a/src/bin/agent/tests/get_config_unittest.cc b/src/bin/agent/tests/get_config_unittest.cc index 3050caa1a4..feded55ed5 100644 --- a/src/bin/agent/tests/get_config_unittest.cc +++ b/src/bin/agent/tests/get_config_unittest.cc @@ -120,6 +120,7 @@ public: /// Test fixture class class CtrlAgentGetCfgTest : public ConfigParseTest { public: + /// @brief Constructor CtrlAgentGetCfgTest() : rcode_(-1) { diff --git a/src/bin/d2/d2_cfg_mgr.h b/src/bin/d2/d2_cfg_mgr.h index 0b84ea80e3..8a7e085a98 100644 --- a/src/bin/d2/d2_cfg_mgr.h +++ b/src/bin/d2/d2_cfg_mgr.h @@ -32,6 +32,7 @@ typedef boost::shared_ptr D2CfgContextPtr; /// It is derived from the context base class, ConfigBase. class D2CfgContext : public process::ConfigBase { public: + /// @brief Constructor D2CfgContext(); @@ -144,6 +145,7 @@ typedef boost::shared_ptr DdnsDomainListMgrPtr; /// and retrieving the information on demand. class D2CfgMgr : public process::DCfgMgrBase { public: + /// @brief Reverse zone suffix added to IPv4 addresses for reverse lookups /// @todo This should be configurable. static const char* IPV4_REV_ZONE_SUFFIX; @@ -318,7 +320,7 @@ protected: typedef boost::shared_ptr D2CfgMgrPtr; -}; // end of isc::d2 namespace -}; // end of isc namespace +} // end of isc::d2 namespace +} // end of isc namespace #endif // D2_CFG_MGR_H diff --git a/src/bin/d2/d2_config.h b/src/bin/d2/d2_config.h index 81d876c04f..807aa36f2a 100644 --- a/src/bin/d2/d2_config.h +++ b/src/bin/d2/d2_config.h @@ -141,6 +141,7 @@ public: /// @brief Acts as a storage vault for D2 global scalar parameters class D2Params { public: + /// @brief Constructor /// /// @param ip_address IP address at which D2 should listen for NCRs @@ -529,6 +530,7 @@ typedef boost::shared_ptr DnsServerInfoStoragePtr; /// validation and matching capabilities. class DdnsDomain : public isc::data::UserContext, public isc::data::CfgToElement { public: + /// @brief Constructor /// /// @param name is the domain name of the domain. @@ -889,8 +891,7 @@ public: const TSIGKeyInfoMapPtr keys); }; - -}; // end of isc::d2 namespace -}; // end of isc namespace +} // end of isc::d2 namespace +} // end of isc namespace #endif // D2_CONFIG_H diff --git a/src/bin/d2/dns_client.h b/src/bin/d2/dns_client.h index fd98f05aba..ded999f07b 100644 --- a/src/bin/d2/dns_client.h +++ b/src/bin/d2/dns_client.h @@ -76,6 +76,7 @@ public: /// exchange is complete (@see @c DNSClient). class Callback { public: + // @brief Constructor. Callback() = default; diff --git a/src/bin/d2/parser_context.h b/src/bin/d2/parser_context.h index 0d596cf56f..6fd342dd3d 100644 --- a/src/bin/d2/parser_context.h +++ b/src/bin/d2/parser_context.h @@ -32,8 +32,7 @@ public: }; /// @brief Evaluation context, an interface to the expression evaluation. -class D2ParserContext -{ +class D2ParserContext { public: /// @brief Defines currently supported scopes diff --git a/src/bin/d2/simple_remove.h b/src/bin/d2/simple_remove.h index c5beb136ac..9f481d54a0 100644 --- a/src/bin/d2/simple_remove.h +++ b/src/bin/d2/simple_remove.h @@ -345,7 +345,6 @@ protected: /// @brief Defines a pointer to a SimpleRemoveTransaction. typedef boost::shared_ptr SimpleRemoveTransactionPtr; - } // namespace isc::d2 } // namespace isc #endif diff --git a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc index fca3e7cccf..4b30d2eb9a 100644 --- a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc @@ -43,6 +43,7 @@ std::string testDataFile(const std::string& name) { /// results, and accessing the configuration context. class D2CfgMgrTest : public ConfigParseTest { public: + /// @brief Constructor D2CfgMgrTest() : cfg_mgr_(new D2CfgMgr()), d2_params_() { } diff --git a/src/bin/d2/tests/d2_command_unittest.cc b/src/bin/d2/tests/d2_command_unittest.cc index 35079c8aae..ae7b2b3b08 100644 --- a/src/bin/d2/tests/d2_command_unittest.cc +++ b/src/bin/d2/tests/d2_command_unittest.cc @@ -70,6 +70,7 @@ public: } private: + /// @brief Constructor NakedD2Controller() = default; }; diff --git a/src/bin/d2/tests/d2_simple_parser_unittest.cc b/src/bin/d2/tests/d2_simple_parser_unittest.cc index ce3a021b0a..6c0005f711 100644 --- a/src/bin/d2/tests/d2_simple_parser_unittest.cc +++ b/src/bin/d2/tests/d2_simple_parser_unittest.cc @@ -304,6 +304,7 @@ TEST_F(D2SimpleParserTest, globalD2Defaults) { /// @brief Test fixture class for testing TSIGKeyInfo parsing. class TSIGKeyInfoParserTest : public D2SimpleParserTest { public: + /// @brief Constructor TSIGKeyInfoParserTest() : D2SimpleParserTest(D2ParserContext::PARSER_TSIG_KEY) { @@ -348,10 +349,10 @@ public: TSIGKeyInfoPtr key_; }; - /// @brief Test fixture class for testing TSIGKeyInfo list parsing. class TSIGKeyInfoListParserTest : public D2SimpleParserTest { public: + /// @brief Constructor TSIGKeyInfoListParserTest() : D2SimpleParserTest(D2ParserContext::PARSER_TSIG_KEYS) { @@ -400,6 +401,7 @@ public: /// @brief Test fixture class for testing DnsServerInfo parsing. class DnsServerInfoParserTest : public D2SimpleParserTest { public: + /// @brief Constructor DnsServerInfoParserTest() : D2SimpleParserTest(D2ParserContext::PARSER_DNS_SERVER) { @@ -492,7 +494,6 @@ public: DnsServerInfoStoragePtr servers_; }; - /// @brief Test fixture class for testing DDnsDomain parsing. class DdnsDomainParserTest : public D2SimpleParserTest { public: @@ -559,6 +560,7 @@ public: class DdnsDomainListParserTest : public DdnsDomainParserTest { public: + /// @brief Constructor DdnsDomainListParserTest() // We need the list context type to parse lists correctly @@ -1189,4 +1191,4 @@ TEST_F(DdnsDomainListParserTest, duplicateDomain) { "Duplicate domain specified:example.com (:1:115)"); } -}; +} diff --git a/src/bin/d2/tests/d2_update_message_unittests.cc b/src/bin/d2/tests/d2_update_message_unittests.cc index 851253f0ab..6d137e199c 100644 --- a/src/bin/d2/tests/d2_update_message_unittests.cc +++ b/src/bin/d2/tests/d2_update_message_unittests.cc @@ -28,6 +28,7 @@ namespace { /// @brief Test fixture class for testing D2UpdateMessage object class D2UpdateMessageTest : public ::testing::Test { public: + /// @brief Constructor // // Does nothing. @@ -692,5 +693,4 @@ TEST_F(D2UpdateMessageTest, allValidTSIG) { } } - } // End of anonymous namespace diff --git a/src/bin/d2/tests/d2_update_mgr_unittests.cc b/src/bin/d2/tests/d2_update_mgr_unittests.cc index b3921f19ad..3223db39e6 100644 --- a/src/bin/d2/tests/d2_update_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_update_mgr_unittests.cc @@ -35,6 +35,7 @@ namespace { /// they can be invoked directly in test routines. class D2UpdateMgrWrapper : public D2UpdateMgr { public: + /// @brief Constructor /// /// Parameters match those needed by D2UpdateMgr. diff --git a/src/bin/d2/tests/dns_client_unittests.cc b/src/bin/d2/tests/dns_client_unittests.cc index e33c7c3536..c639528a25 100644 --- a/src/bin/d2/tests/dns_client_unittests.cc +++ b/src/bin/d2/tests/dns_client_unittests.cc @@ -561,4 +561,4 @@ TEST_F(DNSClientTest, DISABLED_concurrentSendReceive) { runSendReceiveTest(false, true); } -} // End of anonymous namespace +} // end of anonymous namespace diff --git a/src/bin/d2/tests/get_config_unittest.cc b/src/bin/d2/tests/get_config_unittest.cc index 82498a718f..a598db36ab 100644 --- a/src/bin/d2/tests/get_config_unittest.cc +++ b/src/bin/d2/tests/get_config_unittest.cc @@ -100,6 +100,7 @@ parseDHCPDDNS(const std::string& in, bool verbose = false) { /// Test fixture class class D2GetConfigTest : public ConfigParseTest { public: + /// @brief Constructor D2GetConfigTest() : rcode_(-1) { diff --git a/src/bin/d2/tests/nc_add_unittests.cc b/src/bin/d2/tests/nc_add_unittests.cc index ae527320cd..34e5caae8c 100644 --- a/src/bin/d2/tests/nc_add_unittests.cc +++ b/src/bin/d2/tests/nc_add_unittests.cc @@ -25,6 +25,7 @@ namespace { // to protected methods. class NameAddStub : public NameAddTransaction { public: + /// @brief Constructor NameAddStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, @@ -184,6 +185,7 @@ typedef boost::shared_ptr NameAddStubPtr; /// aspects of NameAddTransaction. class NameAddTransactionTest : public TransactionTest { public: + /// @brief Constructor NameAddTransactionTest() = default; @@ -1784,5 +1786,4 @@ TEST_F(NameAddTransactionTest, replacingRevPtrsHandler_BuildRequestException) { name_add->getNextEvent()); } - } diff --git a/src/bin/d2/tests/nc_remove_unittests.cc b/src/bin/d2/tests/nc_remove_unittests.cc index 418622d043..3ed69e7d35 100644 --- a/src/bin/d2/tests/nc_remove_unittests.cc +++ b/src/bin/d2/tests/nc_remove_unittests.cc @@ -26,6 +26,7 @@ namespace { // to protected methods. class NameRemoveStub : public NameRemoveTransaction { public: + /// @brief Constructor NameRemoveStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, @@ -185,6 +186,7 @@ typedef boost::shared_ptr NameRemoveStubPtr; /// aspects of NameRemoveTransaction. class NameRemoveTransactionTest : public TransactionTest { public: + /// @brief Constructor NameRemoveTransactionTest() = default; diff --git a/src/bin/d2/tests/nc_trans_unittests.cc b/src/bin/d2/tests/nc_trans_unittests.cc index 74588b9f98..e865a3ab75 100644 --- a/src/bin/d2/tests/nc_trans_unittests.cc +++ b/src/bin/d2/tests/nc_trans_unittests.cc @@ -267,6 +267,7 @@ typedef boost::shared_ptr NameChangeStubPtr; /// aspects of NameChangeTransaction. class NameChangeTransactionTest : public TransactionTest { public: + /// @brief Constructor NameChangeTransactionTest() = default; @@ -1266,4 +1267,4 @@ TEST_F(NameChangeTransactionTest, addPtrRdata) { EXPECT_EQ(ncr->getFqdn(), rdata_it->getCurrent().toText()); } -}; // anonymous namespace +} // anonymous namespace diff --git a/src/bin/d2/tests/simple_add_unittests.cc b/src/bin/d2/tests/simple_add_unittests.cc index 1037ab14de..3a8818d8d3 100644 --- a/src/bin/d2/tests/simple_add_unittests.cc +++ b/src/bin/d2/tests/simple_add_unittests.cc @@ -25,6 +25,7 @@ namespace { // to protected methods. class SimpleAddStub : public SimpleAddTransaction { public: + /// @brief Constructor SimpleAddStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, @@ -182,6 +183,7 @@ typedef boost::shared_ptr SimpleAddStubPtr; /// aspects of SimpleAddTransaction. class SimpleAddTransactionTest : public TransactionTest { public: + /// @brief Constructor SimpleAddTransactionTest() = default; diff --git a/src/bin/d2/tests/simple_remove_unittests.cc b/src/bin/d2/tests/simple_remove_unittests.cc index caa86e8d67..b26a023d47 100644 --- a/src/bin/d2/tests/simple_remove_unittests.cc +++ b/src/bin/d2/tests/simple_remove_unittests.cc @@ -26,6 +26,7 @@ namespace { // to protected methods. class SimpleRemoveStub : public SimpleRemoveTransaction { public: + /// @brief Constructor SimpleRemoveStub(asiolink::IOServicePtr& io_service, dhcp_ddns::NameChangeRequestPtr& ncr, @@ -183,6 +184,7 @@ typedef boost::shared_ptr SimpleRemoveStubPtr; /// aspects of SimpleRemoveTransaction. class SimpleRemoveTransactionTest : public TransactionTest { public: + /// @brief Constructor SimpleRemoveTransactionTest() = default; diff --git a/src/bin/dhcp4/client_handler.cc b/src/bin/dhcp4/client_handler.cc index 5586fe5279..b9b7bca8a8 100644 --- a/src/bin/dhcp4/client_handler.cc +++ b/src/bin/dhcp4/client_handler.cc @@ -131,10 +131,6 @@ ClientHandler::del(const HWAddrPtr& hwaddr) { clients_hwaddr_.erase(it); } -ClientHandler::ClientHandler() - : client_(), locked_client_id_(), locked_hwaddr_() { -} - ClientHandler::~ClientHandler() { try { bool unlocked = false; diff --git a/src/bin/dhcp4/client_handler.h b/src/bin/dhcp4/client_handler.h index 9b2b0c0e2d..6cbab444cb 100644 --- a/src/bin/dhcp4/client_handler.h +++ b/src/bin/dhcp4/client_handler.h @@ -188,7 +188,7 @@ public: /// Public interface. /// @brief Constructor. - ClientHandler(); + ClientHandler() = default; /// @brief Destructor. /// diff --git a/src/bin/dhcp4/dhcp4to6_ipc.h b/src/bin/dhcp4/dhcp4to6_ipc.h index 3e45a1b631..8645d1183d 100644 --- a/src/bin/dhcp4/dhcp4to6_ipc.h +++ b/src/bin/dhcp4/dhcp4to6_ipc.h @@ -22,6 +22,7 @@ namespace dhcp { /// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv4 server side class Dhcp4to6Ipc : public Dhcp4o6IpcBase { protected: + /// @brief Constructor /// /// Default constructor diff --git a/src/bin/dhcp4/parser_context.h b/src/bin/dhcp4/parser_context.h index 502c4bee8a..8787b43f0e 100644 --- a/src/bin/dhcp4/parser_context.h +++ b/src/bin/dhcp4/parser_context.h @@ -32,8 +32,7 @@ public: }; /// @brief Evaluation context, an interface to the expression evaluation. -class Parser4Context -{ +class Parser4Context { public: /// @brief Defines currently supported scopes @@ -396,7 +395,7 @@ public: isc::data::ElementPtr parseCommon(); }; -}; // end of isc::eval namespace -}; // end of isc namespace +} // end of isc::eval namespace +} // end of isc namespace #endif diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index 22507fb9c9..84ef17c459 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -276,6 +276,7 @@ protected: } public: + /// @brief Constructor Dhcp4ParserTest() : rcode_(-1) { @@ -287,8 +288,6 @@ public: resetConfiguration(); } -public: - // Checks if the result of DHCP server configuration has // expected code (0 for success, other for failures). // Also stores result in rcode_ and comment_. diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index 1a38394584..69344abd34 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -1985,4 +1985,4 @@ TEST_F(CtrlChannelDhcpv4SrvTest, connectionTimeoutNoData) { "\"Connection over control channel timed out\" }", response); } -} // End of anonymous namespace +} // end of anonymous namespace diff --git a/src/bin/dhcp4/tests/d2_unittest.h b/src/bin/dhcp4/tests/d2_unittest.h index 5b4cbceefe..62376eded7 100644 --- a/src/bin/dhcp4/tests/d2_unittest.h +++ b/src/bin/dhcp4/tests/d2_unittest.h @@ -107,8 +107,8 @@ public: D2Dhcpv4Srv srv_; }; -}; // end of isc::dhcp::test namespace -}; // end of isc::dhcp namespace -}; // end of isc namespace +} // end of isc::dhcp::test namespace +} // end of isc::dhcp namespace +} // end of isc namespace #endif // D2_UNITTEST_H diff --git a/src/bin/dhcp4/tests/dhcp4_test_utils.h b/src/bin/dhcp4/tests/dhcp4_test_utils.h index 2b46882495..ad0aec2ec6 100644 --- a/src/bin/dhcp4/tests/dhcp4_test_utils.h +++ b/src/bin/dhcp4/tests/dhcp4_test_utils.h @@ -301,7 +301,6 @@ private: /// @brief Holds the original data directory. std::string original_datadir_; - }; class Dhcpv4SrvTest : public BaseServerTest { diff --git a/src/bin/dhcp4/tests/dora_unittest.cc b/src/bin/dhcp4/tests/dora_unittest.cc index 10602b1047..8bc32086ef 100644 --- a/src/bin/dhcp4/tests/dora_unittest.cc +++ b/src/bin/dhcp4/tests/dora_unittest.cc @@ -2701,6 +2701,7 @@ TEST_F(DORATest, storeExtendedInfoDisabledMultiThreading) { /// @brief Test fixture class for the test utilizing MySQL database backend. class DORAMySQLTest : public DORATest { public: + /// @brief Constructor. /// /// Recreates MySQL schema for a test. @@ -2747,6 +2748,7 @@ TEST_F(DORAMySQLTest, multiStageBootMultiThreading) { /// @brief Test fixture class for the test utilizing PostgreSQL database backend. class DORAPgSQLTest : public DORATest { public: + /// @brief Constructor. /// /// Recreates PgSQL schema for a test. @@ -2792,6 +2794,7 @@ TEST_F(DORAPgSQLTest, multiStageBootMultiThreading) { // --with-cql. class DORACQLTest : public DORATest { public: + /// @brief Constructor. /// /// Recreates CQL schema for a test. diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc b/src/bin/dhcp4/tests/get_config_unittest.cc index e302e0f0b9..b092416aa5 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc +++ b/src/bin/dhcp4/tests/get_config_unittest.cc @@ -11308,6 +11308,7 @@ namespace { /// Test fixture class (code from Dhcp4ParserTest) class Dhcp4GetConfigTest : public ::testing::TestWithParam { public: + /// @brief Constructor Dhcp4GetConfigTest() : rcode_(-1) { diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc.skel b/src/bin/dhcp4/tests/get_config_unittest.cc.skel index 322c7eaad7..3a47a1ab1a 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc.skel +++ b/src/bin/dhcp4/tests/get_config_unittest.cc.skel @@ -165,6 +165,7 @@ namespace { /// Test fixture class (code from Dhcp4ParserTest) class Dhcp4GetConfigTest : public ::testing::TestWithParam { public: + /// @brief Constructor Dhcp4GetConfigTest() : rcode_(-1) { diff --git a/src/bin/dhcp4/tests/hooks_unittest.cc b/src/bin/dhcp4/tests/hooks_unittest.cc index af49f3dc27..41c801dae1 100644 --- a/src/bin/dhcp4/tests/hooks_unittest.cc +++ b/src/bin/dhcp4/tests/hooks_unittest.cc @@ -99,7 +99,6 @@ const uint8_t dummySname[] = "Lorem ipsum dolor sit amet, consectetur " /// fields are declared static. It is still better to keep them as /// one class rather than unrelated collection of global objects. class HooksDhcpv4SrvTest : public Dhcpv4SrvTest { - public: /// @brief Constructor creates Dhcpv4Srv and prepares buffers for callouts @@ -871,6 +870,7 @@ bool HooksDhcpv4SrvTest::callback_resp_options_copy_; /// @brief Fixture class used to do basic library load/unload tests class LoadUnloadDhcpv4SrvTest : public ::testing::Test { public: + /// @brief Pointer to the tested server object boost::shared_ptr server_; diff --git a/src/bin/dhcp4/tests/kea_controller_unittest.cc b/src/bin/dhcp4/tests/kea_controller_unittest.cc index f815d63907..174b4fb90a 100644 --- a/src/bin/dhcp4/tests/kea_controller_unittest.cc +++ b/src/bin/dhcp4/tests/kea_controller_unittest.cc @@ -196,6 +196,7 @@ public: /// near future. class JSONFileBackendTest : public isc::dhcp::test::BaseServerTest { public: + /// @brief Constructor JSONFileBackendTest() = default; diff --git a/src/bin/dhcp6/client_handler.cc b/src/bin/dhcp6/client_handler.cc index c932f03e2e..f1cbd62ffb 100644 --- a/src/bin/dhcp6/client_handler.cc +++ b/src/bin/dhcp6/client_handler.cc @@ -71,9 +71,6 @@ ClientHandler::del(const DuidPtr& duid) { clients_.erase(duid->getDuid()); } -ClientHandler::ClientHandler() : client_(), locked_() { -} - ClientHandler::~ClientHandler() { try { if (locked_) { diff --git a/src/bin/dhcp6/client_handler.h b/src/bin/dhcp6/client_handler.h index 175c0a19d5..7c5c7b7530 100644 --- a/src/bin/dhcp6/client_handler.h +++ b/src/bin/dhcp6/client_handler.h @@ -129,7 +129,7 @@ public: /// Public interface. /// @brief Constructor. - ClientHandler(); + ClientHandler() = default; /// @brief Destructor. /// diff --git a/src/bin/dhcp6/dhcp6to4_ipc.h b/src/bin/dhcp6/dhcp6to4_ipc.h index 340b895abc..31919e8ae7 100644 --- a/src/bin/dhcp6/dhcp6to4_ipc.h +++ b/src/bin/dhcp6/dhcp6to4_ipc.h @@ -20,6 +20,7 @@ namespace dhcp { /// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv6 server side class Dhcp6to4Ipc : public Dhcp4o6IpcBase { protected: + /// @brief Constructor /// /// Default constructor diff --git a/src/bin/dhcp6/parser_context.h b/src/bin/dhcp6/parser_context.h index 4431427b1d..aa22f1f556 100644 --- a/src/bin/dhcp6/parser_context.h +++ b/src/bin/dhcp6/parser_context.h @@ -32,8 +32,7 @@ public: }; /// @brief Evaluation context, an interface to the expression evaluation. -class Parser6Context -{ +class Parser6Context { public: /// @brief Defines currently supported scopes @@ -402,7 +401,7 @@ public: isc::data::ElementPtr parseCommon(); }; -}; // end of isc::eval namespace -}; // end of isc namespace +} // end of isc::eval namespace +} // end of isc namespace #endif diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index 99b59d883c..d9499c52a3 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -362,6 +362,7 @@ protected: } public: + /// @brief Constructor Dhcp6ParserTest() :rcode_(-1), srv_(0) { // srv_(0) means to not open any sockets. We don't want to diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc index 81c514b9eb..e0ebe6337d 100644 --- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc @@ -101,6 +101,7 @@ const size_t DEFAULT_CONNECTION_TIMEOUT = 10000; class CtrlDhcpv6SrvTest : public BaseServerTest { public: + /// @brief Constructor CtrlDhcpv6SrvTest() : BaseServerTest() { @@ -2017,4 +2018,4 @@ TEST_F(CtrlChannelDhcpv6SrvTest, connectionTimeoutNoData) { "\"Connection over control channel timed out\" }", response); } -} // End of anonymous namespace +} // end of anonymous namespace diff --git a/src/bin/dhcp6/tests/d2_unittest.h b/src/bin/dhcp6/tests/d2_unittest.h index 6de78364a8..f7d57d740f 100644 --- a/src/bin/dhcp6/tests/d2_unittest.h +++ b/src/bin/dhcp6/tests/d2_unittest.h @@ -106,8 +106,8 @@ public: D2Dhcpv6Srv srv_; }; -}; // end of isc::dhcp::test namespace -}; // end of isc::dhcp namespace -}; // end of isc namespace +} // end of isc::dhcp::test namespace +} // end of isc::dhcp namespace +} // end of isc namespace #endif // D2_UNITTEST_H diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.h b/src/bin/dhcp6/tests/dhcp6_test_utils.h index ae93c9840b..e66bf0de7e 100644 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.h +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.h @@ -134,6 +134,7 @@ private: /// @brief "naked" Dhcpv6Srv class that exposes internal members class NakedDhcpv6Srv: public isc::dhcp::Dhcpv6Srv { public: + /// @brief Constructor NakedDhcpv6Srv(uint16_t port) : isc::dhcp::Dhcpv6Srv(port) { // Open the "memfile" database for leases diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc b/src/bin/dhcp6/tests/get_config_unittest.cc index 0df457c5f8..3712ac270c 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc +++ b/src/bin/dhcp6/tests/get_config_unittest.cc @@ -9861,6 +9861,7 @@ namespace { /// Test fixture class (code from Dhcp6ParserTest) class Dhcp6GetConfigTest : public ::testing::TestWithParam { public: + /// @brief Constructor Dhcp6GetConfigTest() : rcode_(-1), srv_(0) { // srv_(0) means to not open any sockets. We don't want to diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc.skel b/src/bin/dhcp6/tests/get_config_unittest.cc.skel index 9ced625d70..47c01260a8 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc.skel +++ b/src/bin/dhcp6/tests/get_config_unittest.cc.skel @@ -166,6 +166,7 @@ namespace { /// Test fixture class (code from Dhcp6ParserTest) class Dhcp6GetConfigTest : public ::testing::TestWithParam { public: + /// @brief Constructor Dhcp6GetConfigTest() : rcode_(-1), srv_(0) { // srv_(0) means to not open any sockets. We don't want to diff --git a/src/bin/dhcp6/tests/hooks_unittest.cc b/src/bin/dhcp6/tests/hooks_unittest.cc index e8c3c8b440..f0c0c4080a 100644 --- a/src/bin/dhcp6/tests/hooks_unittest.cc +++ b/src/bin/dhcp6/tests/hooks_unittest.cc @@ -113,7 +113,6 @@ TEST_F(Dhcpv6SrvTest, Hooks) { /// fields are declared static. It is still better to keep them as /// one class rather than unrelated collection of global objects. class HooksDhcpv6SrvTest : public Dhcpv6SrvTest { - public: /// @brief Constructor creates Dhcpv6Srv and prepares buffers for callouts @@ -985,6 +984,7 @@ bool HooksDhcpv6SrvTest::callback_resp_options_copy_; /// @brief Fixture class used to do basic library load/unload tests class LoadUnloadDhcpv6SrvTest : public Dhcpv6SrvTest { public: + /// @brief Pointer to the tested server object boost::shared_ptr server_; diff --git a/src/bin/dhcp6/tests/infrequest_unittest.cc b/src/bin/dhcp6/tests/infrequest_unittest.cc index b3d19f2db8..c9417acb56 100644 --- a/src/bin/dhcp6/tests/infrequest_unittest.cc +++ b/src/bin/dhcp6/tests/infrequest_unittest.cc @@ -112,6 +112,7 @@ const char* CONFIGS[] = { /// Request-Reply. class InfRequestTest : public Dhcpv6SrvTest { public: + /// @brief Constructor. /// /// Sets up fake interfaces. diff --git a/src/bin/dhcp6/tests/kea_controller_unittest.cc b/src/bin/dhcp6/tests/kea_controller_unittest.cc index 44969e2ea9..4b7a228dea 100644 --- a/src/bin/dhcp6/tests/kea_controller_unittest.cc +++ b/src/bin/dhcp6/tests/kea_controller_unittest.cc @@ -188,6 +188,7 @@ public: class JSONFileBackendTest : public dhcp::test::BaseServerTest { public: + /// @brief Constructor JSONFileBackendTest() : BaseServerTest() { @@ -1085,4 +1086,4 @@ TEST_F(JSONFileBackendMySQLTest, reconfigureBackendMemfileToMySQL) { #endif -} // End of anonymous namespace +} // end of anonymous namespace diff --git a/src/bin/dhcp6/tests/sarr_unittest.cc b/src/bin/dhcp6/tests/sarr_unittest.cc index 1bf5d637c2..89efb02852 100644 --- a/src/bin/dhcp6/tests/sarr_unittest.cc +++ b/src/bin/dhcp6/tests/sarr_unittest.cc @@ -221,6 +221,7 @@ const char* CONFIGS[] = { /// Request-Reply and 2-way exchange: Solicit-Reply. class SARRTest : public Dhcpv6SrvTest { public: + /// @brief Constructor. /// /// Sets up fake interfaces. diff --git a/src/bin/lfc/lfc_controller.h b/src/bin/lfc/lfc_controller.h index f2f00686eb..dba8c7aa39 100644 --- a/src/bin/lfc/lfc_controller.h +++ b/src/bin/lfc/lfc_controller.h @@ -197,7 +197,7 @@ private: void startLogger(const bool test_mode) const; }; -}; // namespace isc::lfc -}; // namespace isc +} // namespace isc::lfc +} // namespace isc #endif // LFC_CONTROLLER_H diff --git a/src/bin/netconf/netconf.h b/src/bin/netconf/netconf.h index 125c5a7b1a..adc103f4b9 100644 --- a/src/bin/netconf/netconf.h +++ b/src/bin/netconf/netconf.h @@ -44,6 +44,7 @@ typedef boost::shared_ptr NetconfAgentPtr; /// - on shutdown close subscriptions. class NetconfAgent { public: + /// @brief Constructor. NetconfAgent(); diff --git a/src/bin/netconf/netconf_config.h b/src/bin/netconf/netconf_config.h index cd0ebb6df5..b81ad8dc1b 100644 --- a/src/bin/netconf/netconf_config.h +++ b/src/bin/netconf/netconf_config.h @@ -67,8 +67,7 @@ namespace netconf { /// /// Acts as a storage class containing the basic attributes which /// describe a Control Socket. -class CfgControlSocket : public isc::data::UserContext, - public isc::data::CfgToElement { +class CfgControlSocket : public isc::data::UserContext, public isc::data::CfgToElement { public: /// @brief Defines the list of possible constrol socket types. enum Type { @@ -149,6 +148,7 @@ typedef boost::shared_ptr CfgControlSocketPtr; /// the Control Socket which describe a Managed CfgServer. class CfgServer : public isc::data::UserContext, public isc::data::CfgToElement { public: + /// @brief Constructor. /// /// @param model The model name. @@ -301,7 +301,7 @@ public: CfgServerPtr parse(data::ConstElementPtr server_config); }; -}; // end of isc::netconf namespace -}; // end of isc namespace +} // end of isc::netconf namespace +} // end of isc namespace #endif // NETCONF_CONFIG_H diff --git a/src/bin/netconf/netconf_process.h b/src/bin/netconf/netconf_process.h index 3c90712ef3..356278da27 100644 --- a/src/bin/netconf/netconf_process.h +++ b/src/bin/netconf/netconf_process.h @@ -24,6 +24,7 @@ namespace netconf { /// to JSON commands sent to the respective Kea servers. class NetconfProcess : public process::DProcessBase { public: + /// @brief Constructor /// /// @param name name is a text label for the process. Generally used @@ -103,7 +104,7 @@ private: /// @brief Defines a shared pointer to NetconfProcess. typedef boost::shared_ptr NetconfProcessPtr; -}; // namespace isc::netconf -}; // namespace isc +} // namespace isc::netconf +} // namespace isc #endif // NETCONF_PROCESS_H diff --git a/src/bin/netconf/parser_context.h b/src/bin/netconf/parser_context.h index f6103a4e7d..267e698cb9 100644 --- a/src/bin/netconf/parser_context.h +++ b/src/bin/netconf/parser_context.h @@ -34,8 +34,7 @@ namespace netconf { /// parse only content of the Netconf-agent object, which is a subset /// of full grammar (this will be very useful for unit-tests to not duplicate /// unnecessary parts of the config file). -class ParserContext -{ +class ParserContext { public: /// @brief Defines currently supported scopes diff --git a/src/bin/netconf/tests/control_socket_unittests.cc b/src/bin/netconf/tests/control_socket_unittests.cc index eb2a0e25c0..86868c1bba 100644 --- a/src/bin/netconf/tests/control_socket_unittests.cc +++ b/src/bin/netconf/tests/control_socket_unittests.cc @@ -45,6 +45,7 @@ typedef boost::shared_ptr ThreadPtr; /// This class exposes the constructor taking the output stream. class TestStdoutControlSocket : public StdoutControlSocket { public: + /// @brief Constructor. /// /// @param ctrl_sock The control socket configuration. @@ -506,6 +507,7 @@ public: /// @brief Test fixture class for http control sockets. class HttpControlSocketTest : public ThreadedTest { public: + /// @brief Constructor. HttpControlSocketTest() : ThreadedTest(), done_(false) { } diff --git a/src/bin/netconf/tests/get_config_unittest.cc b/src/bin/netconf/tests/get_config_unittest.cc index 07fb601346..2956d4e856 100644 --- a/src/bin/netconf/tests/get_config_unittest.cc +++ b/src/bin/netconf/tests/get_config_unittest.cc @@ -120,6 +120,7 @@ public: /// Test fixture class class NetconfGetCfgTest : public ConfigParseTest { public: + /// @brief Constructor NetconfGetCfgTest() : rcode_(-1) { diff --git a/src/bin/netconf/tests/netconf_process_unittests.cc b/src/bin/netconf/tests/netconf_process_unittests.cc index 4d82c59174..257b53b433 100644 --- a/src/bin/netconf/tests/netconf_process_unittests.cc +++ b/src/bin/netconf/tests/netconf_process_unittests.cc @@ -25,6 +25,7 @@ namespace { /// @brief NetconfProcess test fixture class. class NetconfProcessTest : public NetconfProcess, public ::testing::Test { public: + /// @brief Constructor NetconfProcessTest() : NetconfProcess("netconf-test", diff --git a/src/bin/netconf/tests/netconf_unittests.cc b/src/bin/netconf/tests/netconf_unittests.cc index 711a0b038f..14e01f2fdb 100644 --- a/src/bin/netconf/tests/netconf_unittests.cc +++ b/src/bin/netconf/tests/netconf_unittests.cc @@ -51,6 +51,7 @@ typedef boost::shared_ptr ThreadPtr; /// @brief Test version of the NetconfAgent class. class NakedNetconfAgent : public NetconfAgent { public: + /// @brief Constructor. NakedNetconfAgent() = default; @@ -177,6 +178,7 @@ public: /// @brief Special test fixture for logging tests. class NetconfAgentLogTest : public dhcp::test::LogContentTest { public: + /// @brief Constructor. NetconfAgentLogTest() : io_service_(new IOService()), diff --git a/src/bin/perfdhcp/abstract_scen.h b/src/bin/perfdhcp/abstract_scen.h index 1951915ea0..f2b4ba2afe 100644 --- a/src/bin/perfdhcp/abstract_scen.h +++ b/src/bin/perfdhcp/abstract_scen.h @@ -20,14 +20,13 @@ namespace perfdhcp { /// This class must be inherited by scenario classes. class AbstractScen : public boost::noncopyable { public: + /// \brief Default and the only constructor of AbstractScen. /// /// \param options reference to command options, /// \param socket reference to a socket. AbstractScen(CommandOptions& options, BasePerfSocket &socket) : - options_(options), - tc_(options, socket) - { + options_(options), tc_(options, socket) { if (options_.getIpVersion() == 4) { stage1_xchg_ = ExchangeType::DO; stage2_xchg_ = ExchangeType::RA; @@ -57,7 +56,6 @@ protected: ExchangeType stage2_xchg_; }; - } } diff --git a/src/bin/perfdhcp/receiver.h b/src/bin/perfdhcp/receiver.h index 3b704125ee..79b6c2b1f4 100644 --- a/src/bin/perfdhcp/receiver.h +++ b/src/bin/perfdhcp/receiver.h @@ -53,6 +53,7 @@ private: uint8_t ip_version_; public: + /// \brief Constructor. /// /// \param socket A socket for receiving packets. diff --git a/src/bin/perfdhcp/test_control.h b/src/bin/perfdhcp/test_control.h index 2e2d3fc471..304c783a3d 100644 --- a/src/bin/perfdhcp/test_control.h +++ b/src/bin/perfdhcp/test_control.h @@ -140,6 +140,7 @@ public: /// (e.g. sequential or based on random function). class NumberGenerator { public: + /// \brief Constructor. NumberGenerator() = default; diff --git a/src/bin/perfdhcp/tests/command_options_helper.h b/src/bin/perfdhcp/tests/command_options_helper.h index aad4374ffb..fd956370e5 100644 --- a/src/bin/perfdhcp/tests/command_options_helper.h +++ b/src/bin/perfdhcp/tests/command_options_helper.h @@ -41,6 +41,7 @@ public: /// allocated for this array is freed at the end o the scope. class ArgvPtr { public: + /// \brief Constructor. /// /// \param argv array of C-strings. diff --git a/src/hooks/dhcp/flex_option/flex_option.h b/src/hooks/dhcp/flex_option/flex_option.h index b59e1c769f..24335cbfb6 100644 --- a/src/hooks/dhcp/flex_option/flex_option.h +++ b/src/hooks/dhcp/flex_option/flex_option.h @@ -52,6 +52,7 @@ public: /// Per option configuration. class OptionConfig { public: + /// @brief Constructor. /// /// @param code the option code. diff --git a/src/hooks/dhcp/flex_option/libloadtests/load_unload_unittests.cc b/src/hooks/dhcp/flex_option/libloadtests/load_unload_unittests.cc index 8157d01689..78027fb1bb 100644 --- a/src/hooks/dhcp/flex_option/libloadtests/load_unload_unittests.cc +++ b/src/hooks/dhcp/flex_option/libloadtests/load_unload_unittests.cc @@ -29,6 +29,7 @@ namespace { /// @brief Test fixture for testing loading and unloading the flex-option library class LibLoadTest : public ::testing::Test { public: + /// @brief Constructor LibLoadTest() { reset(); diff --git a/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc b/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc index 57ccaca0d4..e0ea1ac091 100644 --- a/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc +++ b/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc @@ -67,6 +67,7 @@ typedef boost::shared_ptr TestFlexOptionImplPtr; /// @brief Test fixture for testing the Flex Option library. class FlexOptionTest : public ::testing::Test { public: + /// @brief Constructor. FlexOptionTest() { impl_.reset(new TestFlexOptionImpl()); diff --git a/src/hooks/dhcp/high_availability/ha_impl.h b/src/hooks/dhcp/high_availability/ha_impl.h index 60dd3bb77f..ac95548d6b 100644 --- a/src/hooks/dhcp/high_availability/ha_impl.h +++ b/src/hooks/dhcp/high_availability/ha_impl.h @@ -171,7 +171,6 @@ protected: /// @brief Pointer to the high availability service (state machine). HAServicePtr service_; - }; /// @brief Pointer to the High Availability hooks library implementation. diff --git a/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc b/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc index 4653026f06..25e0f35341 100644 --- a/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc +++ b/src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc @@ -100,6 +100,7 @@ TestHooks testHooks; /// @brief Test fixture for testing closing the HA library class CloseHATest : public ::testing::Test { public: + /// @brief Constructor CloseHATest() = default; diff --git a/src/hooks/dhcp/high_availability/libloadtests/load_unload_unittests.cc b/src/hooks/dhcp/high_availability/libloadtests/load_unload_unittests.cc index 06aaecf2ed..938bca6814 100644 --- a/src/hooks/dhcp/high_availability/libloadtests/load_unload_unittests.cc +++ b/src/hooks/dhcp/high_availability/libloadtests/load_unload_unittests.cc @@ -32,6 +32,7 @@ namespace { /// @brief Test fixture for testing loading and unloading the HA library class LibLoadTest : public ::testing::Test { public: + /// @brief Constructor LibLoadTest() { reset(); diff --git a/src/hooks/dhcp/high_availability/tests/query_filter_unittest.cc b/src/hooks/dhcp/high_availability/tests/query_filter_unittest.cc index 33a2069046..7da8764527 100644 --- a/src/hooks/dhcp/high_availability/tests/query_filter_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/query_filter_unittest.cc @@ -32,6 +32,7 @@ namespace { /// @brief Test fixture class for @c QueryFilter class. class QueryFilterTest : public HATest { public: + /// @brief Constructor. QueryFilterTest() { MultiThreadingMgr::instance().setMode(false); diff --git a/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc b/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc index a00768c4df..5b8974b9ea 100644 --- a/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc +++ b/src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc @@ -47,6 +47,7 @@ constexpr time_t DEC_2030_TIME = 1923222072; /// @brief Test fixture for testing loading and unloading the flex-id library class LibLoadTest : public ::testing::Test { public: + /// @brief Constructor LibLoadTest(std::string lib_filename) : lib_name_(lib_filename) { diff --git a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_mgr_unittest.cc b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_mgr_unittest.cc index f953832d62..7f54fe24ce 100644 --- a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_mgr_unittest.cc +++ b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_mgr_unittest.cc @@ -24,6 +24,7 @@ namespace { /// @brief Test fixture class for @c MySqlConfigBackendDHCPv4Mgr. class MySqlConfigBackendDHCPv4MgrTest : public GenericBackendTest { public: + /// @brief Constructor. MySqlConfigBackendDHCPv4MgrTest() { // Recreate a fresh mgr. diff --git a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc index 4139ac59d3..43df3678b1 100644 --- a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc +++ b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc @@ -4167,6 +4167,7 @@ TEST_F(MySqlConfigBackendDHCPv4Test, multipleAuditEntries) { class MySqlConfigBackendDHCPv4DbLostCallbackTest : public ::testing::Test { public: + /// @brief Constructor MySqlConfigBackendDHCPv4DbLostCallbackTest() : db_lost_callback_called_(0), db_recovered_callback_called_(0), diff --git a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_mgr_unittest.cc b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_mgr_unittest.cc index 15d8468542..bba0a84820 100644 --- a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_mgr_unittest.cc +++ b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_mgr_unittest.cc @@ -24,6 +24,7 @@ namespace { /// @brief Test fixture class for @c MySqlConfigBackendDHCPv6Mgr. class MySqlConfigBackendDHCPv6MgrTest : public GenericBackendTest { public: + /// @brief Constructor. MySqlConfigBackendDHCPv6MgrTest() { // Recreate a fresh mgr. diff --git a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc index b6a5e22282..f70d697cd3 100644 --- a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc +++ b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc @@ -4342,6 +4342,7 @@ TEST_F(MySqlConfigBackendDHCPv6Test, multipleAuditEntries) { class MySqlConfigBackendDHCPv6DbLostCallbackTest : public ::testing::Test { public: + /// @brief Constructor MySqlConfigBackendDHCPv6DbLostCallbackTest() : db_lost_callback_called_(0), db_recovered_callback_called_(0), diff --git a/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc b/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc index c89983674f..de7cb234e3 100644 --- a/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc +++ b/src/hooks/dhcp/run_script/libloadtests/load_unload_unittests.cc @@ -28,6 +28,7 @@ namespace { /// @brief Test fixture for testing loading and unloading the RunScript library. class LibLoadTest : public ::testing::Test { public: + /// @brief Constructor LibLoadTest() { reset(); diff --git a/src/hooks/dhcp/run_script/run_script.h b/src/hooks/dhcp/run_script/run_script.h index 4fd370c7b1..f2a878636d 100644 --- a/src/hooks/dhcp/run_script/run_script.h +++ b/src/hooks/dhcp/run_script/run_script.h @@ -24,6 +24,7 @@ namespace run_script { /// @brief Run Script implementation. class RunScriptImpl { public: + /// @brief Constructor. RunScriptImpl(); @@ -236,4 +237,5 @@ typedef boost::shared_ptr RunScriptImplPtr; } // namespace run_script } // namespace isc + #endif diff --git a/src/hooks/dhcp/stat_cmds/tests/stat_cmds_unittest.cc b/src/hooks/dhcp/stat_cmds/tests/stat_cmds_unittest.cc index edd6dc0789..2b7baf0df4 100644 --- a/src/hooks/dhcp/stat_cmds/tests/stat_cmds_unittest.cc +++ b/src/hooks/dhcp/stat_cmds/tests/stat_cmds_unittest.cc @@ -36,6 +36,7 @@ namespace { /// @brief Test fixture for testing loading and unloading the library class LibLoadTest : public ::testing::Test { public: + /// @brief Constructor LibLoadTest(std::string lib_filename) : lib_name_(lib_filename), start_time_(second_clock::universal_time()) { diff --git a/src/hooks/dhcp/user_chk/user.h b/src/hooks/dhcp/user_chk/user.h index a50c11bc37..b2f277b517 100644 --- a/src/hooks/dhcp/user_chk/user.h +++ b/src/hooks/dhcp/user_chk/user.h @@ -38,6 +38,7 @@ public: /// @brief Defines the text label hardware address id type. static const char* HW_ADDRESS_STR; + /// @brief Define the text label DUID id type. static const char* DUID_STR; diff --git a/src/hooks/dhcp/user_chk/user_data_source.h b/src/hooks/dhcp/user_chk/user_data_source.h index 109a0201b9..0505c9e677 100644 --- a/src/hooks/dhcp/user_chk/user_data_source.h +++ b/src/hooks/dhcp/user_chk/user_data_source.h @@ -25,6 +25,7 @@ public: /// from an IO source such as a file. class UserDataSource { public: + /// @brief Constructor. UserDataSource() = default; diff --git a/src/hooks/dhcp/user_chk/user_registry.h b/src/hooks/dhcp/user_chk/user_registry.h index 358958e685..db9ff44e58 100644 --- a/src/hooks/dhcp/user_chk/user_registry.h +++ b/src/hooks/dhcp/user_chk/user_registry.h @@ -37,6 +37,7 @@ typedef std::map UserMap; /// may be updated by loading it from a data source, such as a file. class UserRegistry { public: + /// @brief Constructor /// /// Creates a new registry with an empty list of users and no data source. diff --git a/src/lib/asiodns/io_fetch.h b/src/lib/asiodns/io_fetch.h index 4754e1d499..d7c3d163d2 100644 --- a/src/lib/asiodns/io_fetch.h +++ b/src/lib/asiodns/io_fetch.h @@ -97,6 +97,7 @@ public: /// This is an abstract class. class Callback { public: + /// \brief Default Constructor Callback() = default; diff --git a/src/lib/asiolink/botan_boost_tls.cc b/src/lib/asiolink/botan_boost_tls.cc index 927e9da907..29babbfbcd 100644 --- a/src/lib/asiolink/botan_boost_tls.cc +++ b/src/lib/asiolink/botan_boost_tls.cc @@ -31,6 +31,7 @@ using KeaCertificateStoreFile = Botan::Flatfile_Certificate_Store; // Class of Kea credential managers. class KeaCredentialsManager : public Botan::Credentials_Manager { public: + // Constructor. KeaCredentialsManager() : store_(), use_stores_(true), certs_(), key_() { } @@ -144,6 +145,7 @@ public: // Use Strict_Policy? class KeaPolicy : public Botan::TLS::Default_Policy { public: + // Constructor. KeaPolicy() : prefer_rsa_(true) { } @@ -195,6 +197,7 @@ KeaPolicy::AllowedSignatureMethodsECDSA = { "ECDSA", "RSA", "DSA" }; // Class of Botan TLS context implementations. class TlsContextImpl { public: + // Constructor. TlsContextImpl() : cred_mgr_(), rng_(), sess_mgr_(), policy_() { } diff --git a/src/lib/asiolink/botan_boost_tls.h b/src/lib/asiolink/botan_boost_tls.h index 28ec9ba832..416756a059 100644 --- a/src/lib/asiolink/botan_boost_tls.h +++ b/src/lib/asiolink/botan_boost_tls.h @@ -116,8 +116,7 @@ TlsStreamBase(IOService& service, TlsContextPtr context) /// /// @tparam callback The callback. template -class TlsStream : public TlsStreamBase -{ +class TlsStream : public TlsStreamBase { public: /// @brief Type of the base. diff --git a/src/lib/asiolink/common_tls.h b/src/lib/asiolink/common_tls.h index 6bf23e76d9..47f4d376df 100644 --- a/src/lib/asiolink/common_tls.h +++ b/src/lib/asiolink/common_tls.h @@ -39,13 +39,15 @@ typedef boost::shared_ptr TlsContextPtr; /// @brief TLS context base class. class TlsContextBase : private boost::noncopyable { public: + /// @brief Destructor. virtual ~TlsContextBase() = default; /// @brief Create a fresh context. /// /// @param role The TLS role client or server. - explicit TlsContextBase(TlsRole role) : role_(role) { } + explicit TlsContextBase(TlsRole role) : role_(role) { + } /// @brief Returns the role. TlsRole getRole() const { diff --git a/src/lib/asiolink/io_asio_socket.h b/src/lib/asiolink/io_asio_socket.h index b3d6183576..ce7de7731f 100644 --- a/src/lib/asiolink/io_asio_socket.h +++ b/src/lib/asiolink/io_asio_socket.h @@ -99,12 +99,14 @@ private: IOAsioSocket(const IOAsioSocket& source); IOAsioSocket& operator=(const IOAsioSocket& source); protected: + /// \brief The default constructor. /// /// This is intentionally defined as \c protected as this base class /// should never be instantiated (except as part of a derived class). IOAsioSocket() = default; public: + /// The destructor. virtual ~IOAsioSocket() = default; //@} diff --git a/src/lib/asiolink/io_endpoint.h b/src/lib/asiolink/io_endpoint.h index ea926969a7..611a64c3db 100644 --- a/src/lib/asiolink/io_endpoint.h +++ b/src/lib/asiolink/io_endpoint.h @@ -46,12 +46,14 @@ private: IOEndpoint(const IOEndpoint& source); IOEndpoint& operator=(const IOEndpoint& source); protected: + /// \brief The default constructor. /// /// This is intentionally defined as \c protected as this base class /// should never be instantiated (except as part of a derived class). IOEndpoint() = default; public: + /// The destructor. virtual ~IOEndpoint() = default; //@} diff --git a/src/lib/asiolink/io_service.cc b/src/lib/asiolink/io_service.cc index 449e27ac3b..69a2be103e 100644 --- a/src/lib/asiolink/io_service.cc +++ b/src/lib/asiolink/io_service.cc @@ -44,6 +44,7 @@ private: IOServiceImpl(const IOService& source); IOServiceImpl& operator=(const IOService& source); public: + /// \brief The constructor IOServiceImpl() : io_service_(), diff --git a/src/lib/asiolink/io_service.h b/src/lib/asiolink/io_service.h index 2dd7d318ef..e06247ff45 100644 --- a/src/lib/asiolink/io_service.h +++ b/src/lib/asiolink/io_service.h @@ -41,6 +41,7 @@ private: IOService(const IOService& source); IOService& operator=(const IOService& source); public: + /// \brief The constructor IOService(); diff --git a/src/lib/asiolink/io_service_signal.cc b/src/lib/asiolink/io_service_signal.cc index 95fc8a6be9..ffe1fb8105 100644 --- a/src/lib/asiolink/io_service_signal.cc +++ b/src/lib/asiolink/io_service_signal.cc @@ -23,6 +23,7 @@ namespace asiolink { class IOSignalSetImpl : public boost::enable_shared_from_this, public boost::noncopyable { public: + /// @brief Constructor. /// /// @param io_service the process IO service. diff --git a/src/lib/asiolink/io_service_signal.h b/src/lib/asiolink/io_service_signal.h index b078ce405a..eec561a177 100644 --- a/src/lib/asiolink/io_service_signal.h +++ b/src/lib/asiolink/io_service_signal.h @@ -25,6 +25,7 @@ class IOSignalSetImpl; /// as a ready event with a callback using boost ASIO. class IOSignalSet { public: + /// @brief Constructor. /// /// @param io_service IOService to which to send the signal. diff --git a/src/lib/asiolink/io_socket.h b/src/lib/asiolink/io_socket.h index 6bd17c293f..147b21d36c 100644 --- a/src/lib/asiolink/io_socket.h +++ b/src/lib/asiolink/io_socket.h @@ -55,12 +55,14 @@ private: IOSocket(const IOSocket& source); IOSocket& operator=(const IOSocket& source); protected: + /// \brief The default constructor. /// /// This is intentionally defined as \c protected as this base class /// should never be instantiated (except as part of a derived class). IOSocket() = default; public: + /// The destructor. virtual ~IOSocket() = default; //@} diff --git a/src/lib/asiolink/tcp_endpoint.h b/src/lib/asiolink/tcp_endpoint.h index a5d47ed84a..573ff8ac36 100644 --- a/src/lib/asiolink/tcp_endpoint.h +++ b/src/lib/asiolink/tcp_endpoint.h @@ -22,6 +22,7 @@ namespace asiolink { /// Other notes about \c TCPEndpoint applies to this class, too. class TCPEndpoint : public IOEndpoint { public: + /// /// \name Constructors and Destructor. /// @@ -65,8 +66,8 @@ public: /// \param asio_endpoint The ASIO representation of the TCP endpoint. TCPEndpoint(const boost::asio::ip::tcp::endpoint& asio_endpoint) : asio_endpoint_placeholder_(new boost::asio::ip::tcp::endpoint(asio_endpoint)), - asio_endpoint_(*asio_endpoint_placeholder_) { - } + asio_endpoint_(*asio_endpoint_placeholder_) + {} /// \brief The destructor. virtual ~TCPEndpoint() { diff --git a/src/lib/asiolink/tests/interval_timer_unittest.cc b/src/lib/asiolink/tests/interval_timer_unittest.cc index 3510966263..f52f0d2e86 100644 --- a/src/lib/asiolink/tests/interval_timer_unittest.cc +++ b/src/lib/asiolink/tests/interval_timer_unittest.cc @@ -24,6 +24,7 @@ using namespace isc::asiolink; // or not. class IntervalTimerTest : public ::testing::Test { protected: + /// @brief Constructor IntervalTimerTest() : io_service_(), timer_called_(false), timer_cancel_success_(false) { diff --git a/src/lib/asiolink/tests/tls_unittest.cc b/src/lib/asiolink/tests/tls_unittest.cc index c57ab1384b..43b0ce365c 100644 --- a/src/lib/asiolink/tests/tls_unittest.cc +++ b/src/lib/asiolink/tests/tls_unittest.cc @@ -46,6 +46,7 @@ const char KEA_TLS_CHECK_VERBOSE[] = "KEA_TLS_CHECK_VERBOSE"; /// @brief Test TLS context class exposing protected methods. class TestTlsContext : public TlsContext { public: + /// @brief Constructor. /// /// @param role The TLS role client or server. @@ -69,6 +70,7 @@ public: /// @brief State part. class State { public: + /// @brief Constructor. State() : called_(false), error_code_() { } diff --git a/src/lib/asiolink/testutils/timed_signal.h b/src/lib/asiolink/testutils/timed_signal.h index 7c5758e73f..e9bd5ae384 100644 --- a/src/lib/asiolink/testutils/timed_signal.h +++ b/src/lib/asiolink/testutils/timed_signal.h @@ -23,6 +23,7 @@ namespace test { /// send (raise) the signal to the current process. class TimedSignal { public: + /// @brief Constructor /// /// @param io_service IOService to run the timer diff --git a/src/lib/asiolink/udp_endpoint.h b/src/lib/asiolink/udp_endpoint.h index bf955546c6..caa4a68519 100644 --- a/src/lib/asiolink/udp_endpoint.h +++ b/src/lib/asiolink/udp_endpoint.h @@ -22,6 +22,7 @@ namespace asiolink { /// Other notes about \c TCPEndpoint applies to this class, too. class UDPEndpoint : public IOEndpoint { public: + /// /// \name Constructors and Destructor. /// @@ -65,8 +66,8 @@ public: /// \param asio_endpoint The ASIO representation of the TCP endpoint. UDPEndpoint(const boost::asio::ip::udp::endpoint& asio_endpoint) : asio_endpoint_placeholder_(new boost::asio::ip::udp::endpoint(asio_endpoint)), - asio_endpoint_(*asio_endpoint_placeholder_) { - } + asio_endpoint_(*asio_endpoint_placeholder_) + {} /// \brief The destructor. virtual ~UDPEndpoint() { diff --git a/src/lib/cc/cfg_to_element.h b/src/lib/cc/cfg_to_element.h index 275e231626..5097331e3e 100644 --- a/src/lib/cc/cfg_to_element.h +++ b/src/lib/cc/cfg_to_element.h @@ -27,6 +27,10 @@ namespace data { /// @brief Abstract class for configuration Cfg_* classes /// struct CfgToElement { + + /// Constructor + CfgToElement() = default; + /// Destructor virtual ~CfgToElement() = default; diff --git a/src/lib/cc/data.h b/src/lib/cc/data.h index 65989fd6ad..de85e0424c 100644 --- a/src/lib/cc/data.h +++ b/src/lib/cc/data.h @@ -15,7 +15,8 @@ #include #include -namespace isc { namespace data { +namespace isc { +namespace data { class Element; // todo: describe the rationale behind ElementPtr? @@ -64,7 +65,6 @@ public: /// the type in question. /// class Element { - public: /// @brief Represents the position of the data element within a /// configuration string. @@ -815,7 +815,10 @@ std::ostream& operator<<(std::ostream& out, const Element& e); bool operator==(const Element& a, const Element& b); bool operator!=(const Element& a, const Element& b); -} } + +} +} + #endif // ISC_DATA_H // Local Variables: diff --git a/src/lib/cc/tests/data_file_unittests.cc b/src/lib/cc/tests/data_file_unittests.cc index 1937d253dc..4422c5194f 100644 --- a/src/lib/cc/tests/data_file_unittests.cc +++ b/src/lib/cc/tests/data_file_unittests.cc @@ -101,4 +101,4 @@ TEST_F(DataFileTest, readFileError) { EXPECT_THROW(Element::fromJSONFile("no-such-file.txt"), isc::InvalidOperation); } -}; +} diff --git a/src/lib/config/cmd_http_listener.h b/src/lib/config/cmd_http_listener.h index 4b1f414218..b03a202f30 100644 --- a/src/lib/config/cmd_http_listener.h +++ b/src/lib/config/cmd_http_listener.h @@ -31,6 +31,7 @@ namespace config { /// is (or will be) enabled when creating instances of this class. class CmdHttpListener { public: + /// @brief Constructor CmdHttpListener(const asiolink::IOAddress& address, const uint16_t port, const uint16_t thread_pool_size = 1); diff --git a/src/lib/config/command_mgr.cc b/src/lib/config/command_mgr.cc index 2ce24ca129..29825d5b74 100644 --- a/src/lib/config/command_mgr.cc +++ b/src/lib/config/command_mgr.cc @@ -647,7 +647,6 @@ CommandMgr::getControlSocketFD() { return (impl_->acceptor_ ? impl_->acceptor_->getNative() : -1); } - CommandMgr& CommandMgr::instance() { static CommandMgr cmd_mgr; @@ -664,6 +663,5 @@ CommandMgr::setConnectionTimeout(const long timeout) { impl_->timeout_ = timeout; } - -}; // end of isc::config -}; // end of isc +} // end of isc::config +} // end of isc diff --git a/src/lib/cql/cql_exchange.h b/src/lib/cql/cql_exchange.h index 1173097800..c05552ff66 100644 --- a/src/lib/cql/cql_exchange.h +++ b/src/lib/cql/cql_exchange.h @@ -60,6 +60,7 @@ public: // @brief Representation of a Cassandra User Defined Type class Udt : public AnyArray { public: + /// @brief Parameterized constructor Udt(const CqlConnection& connection, const std::string& name); @@ -244,6 +245,7 @@ public: /// @brief Exchange used to retrieve schema version from the keyspace. class CqlVersionExchange : public virtual CqlExchange { public: + /// @brief Constructor /// /// Specifies table columns. diff --git a/src/lib/cql/sql_common.h b/src/lib/cql/sql_common.h index 786fd1b9c7..84a1bc83ec 100644 --- a/src/lib/cql/sql_common.h +++ b/src/lib/cql/sql_common.h @@ -41,6 +41,7 @@ enum ExchangeDataType { /// @brief Base class for backend exchanges. class SqlExchange { public: + /// @brief Constructor SqlExchange() = default; diff --git a/src/lib/cql/tests/cql_connection_unittest.cc b/src/lib/cql/tests/cql_connection_unittest.cc index ebf06d4e82..7f97c1d942 100644 --- a/src/lib/cql/tests/cql_connection_unittest.cc +++ b/src/lib/cql/tests/cql_connection_unittest.cc @@ -27,6 +27,7 @@ using isc::db::CqlConnection; class CqlConnectionTest { public: + /// @brief Constructor CqlConnectionTest() = default; diff --git a/src/lib/cryptolink/botan_hmac.cc b/src/lib/cryptolink/botan_hmac.cc index 70d7a04f5c..471227e64e 100644 --- a/src/lib/cryptolink/botan_hmac.cc +++ b/src/lib/cryptolink/botan_hmac.cc @@ -23,6 +23,7 @@ namespace cryptolink { /// of the HMAC corresponding method. class HMACImpl { public: + /// @brief Constructor from a secret and a hash algorithm /// /// See constructor of the @ref isc::cryptolink::HMAC class for details. diff --git a/src/lib/cryptolink/botan_link.cc b/src/lib/cryptolink/botan_link.cc index ee3d8355b2..b70dd62c62 100644 --- a/src/lib/cryptolink/botan_link.cc +++ b/src/lib/cryptolink/botan_link.cc @@ -33,10 +33,13 @@ CryptoLink::~CryptoLink() { /// \brief Botan implementation of RNG. class RNGImpl : public RNG { public: + + /// @brief Constructor RNGImpl() { rng.reset(new Botan::AutoSeeded_RNG()); } + /// @brief Destructor ~RNGImpl() = default; private: diff --git a/src/lib/cryptolink/crypto_hash.h b/src/lib/cryptolink/crypto_hash.h index f5ea3fade5..44165d8efe 100644 --- a/src/lib/cryptolink/crypto_hash.h +++ b/src/lib/cryptolink/crypto_hash.h @@ -26,6 +26,7 @@ class HashImpl; /// class Hash : private boost::noncopyable { private: + /// \brief Constructor from a hash algorithm /// /// \exception UnsupportedAlgorithmException if the given algorithm @@ -39,6 +40,7 @@ private: friend Hash* CryptoLink::createHash(const HashAlgorithm); public: + /// \brief Destructor ~Hash(); diff --git a/src/lib/cryptolink/crypto_hmac.h b/src/lib/cryptolink/crypto_hmac.h index 5c7bffee61..bbdae6c021 100644 --- a/src/lib/cryptolink/crypto_hmac.h +++ b/src/lib/cryptolink/crypto_hmac.h @@ -26,6 +26,7 @@ class HMACImpl; /// class HMAC : private boost::noncopyable { private: + /// \brief Constructor from a secret and a hash algorithm /// /// \exception UnsupportedAlgorithmException if the given algorithm @@ -49,6 +50,7 @@ private: const HashAlgorithm); public: + /// \brief Destructor ~HMAC(); diff --git a/src/lib/cryptolink/crypto_rng.h b/src/lib/cryptolink/crypto_rng.h index 860ca1d0ac..11d6fd13d6 100644 --- a/src/lib/cryptolink/crypto_rng.h +++ b/src/lib/cryptolink/crypto_rng.h @@ -21,6 +21,7 @@ namespace cryptolink { /// class RNG : private boost::noncopyable { public: + /// \brief Constructor from a Random Number Generator /// /// \exception LibraryError if there was any unexpected exception diff --git a/src/lib/cryptolink/cryptolink.h b/src/lib/cryptolink/cryptolink.h index 0960c74630..199a328397 100644 --- a/src/lib/cryptolink/cryptolink.h +++ b/src/lib/cryptolink/cryptolink.h @@ -228,9 +228,11 @@ private: static CryptoLink& getCryptoLinkInternal(); /// @brief Constructor - // To prevent people constructing their own, we make the constructor - // private too. - CryptoLink() : impl_(NULL) {} + /// + /// To prevent people constructing their own, we make the constructor + /// private too. + CryptoLink() : impl_(NULL) { + } /// @brief Destructor ~CryptoLink(); diff --git a/src/lib/cryptolink/openssl_hmac.cc b/src/lib/cryptolink/openssl_hmac.cc index f24931de44..51d9b2fc0e 100644 --- a/src/lib/cryptolink/openssl_hmac.cc +++ b/src/lib/cryptolink/openssl_hmac.cc @@ -26,6 +26,7 @@ namespace cryptolink { /// of the HMAC corresponding method. class HMACImpl { public: + /// @brief Constructor from a secret and a hash algorithm /// /// See constructor of the @ref isc::cryptolink::HMAC class for details. diff --git a/src/lib/cryptolink/openssl_link.cc b/src/lib/cryptolink/openssl_link.cc index c1eab33884..60f33d3980 100644 --- a/src/lib/cryptolink/openssl_link.cc +++ b/src/lib/cryptolink/openssl_link.cc @@ -31,6 +31,7 @@ CryptoLink::~CryptoLink() { /// \brief OpenSSL implementation of RNG. class RNGImpl : public RNG { public: + /// @brief Constructor RNGImpl() = default; diff --git a/src/lib/database/dbaccess_parser.h b/src/lib/database/dbaccess_parser.h index d9d3fca635..7aaab24f92 100644 --- a/src/lib/database/dbaccess_parser.h +++ b/src/lib/database/dbaccess_parser.h @@ -24,6 +24,7 @@ namespace db { /// "config-database" elements, and comprises a map of strings. class DbAccessParser: public isc::data::SimpleParser { public: + /// @brief Constructor DbAccessParser() = default; diff --git a/src/lib/database/tests/database_connection_unittest.cc b/src/lib/database/tests/database_connection_unittest.cc index be5e6f14f9..5b0c0204a4 100644 --- a/src/lib/database/tests/database_connection_unittest.cc +++ b/src/lib/database/tests/database_connection_unittest.cc @@ -21,6 +21,7 @@ namespace ph = std::placeholders; /// @brief Test fixture for exercising DbLostCallback invocation class DatabaseConnectionCallbackTest : public ::testing::Test { public: + /// Constructor DatabaseConnectionCallbackTest() : db_reconnect_ctl_(0) { diff --git a/src/lib/database/tests/dbaccess_parser_unittest.cc b/src/lib/database/tests/dbaccess_parser_unittest.cc index 0ffed3171c..b9e59b8575 100644 --- a/src/lib/database/tests/dbaccess_parser_unittest.cc +++ b/src/lib/database/tests/dbaccess_parser_unittest.cc @@ -28,9 +28,10 @@ namespace { /// @brief Database Access Parser test fixture class class DbAccessParserTest : public ::testing::Test { public: + /// @brief Constructor - DbAccessParserTest() { - } + DbAccessParserTest() = default; + /// @brief Destructor /// /// As some of the tests have the side-effect of altering the logging @@ -749,4 +750,4 @@ TEST_F(DbAccessParserTest, multipleHost) { config2); } -}; // Anonymous namespace +} // Anonymous namespace diff --git a/src/lib/dhcp/iface_mgr.h b/src/lib/dhcp/iface_mgr.h index 8ab0592123..fe90d28a7c 100644 --- a/src/lib/dhcp/iface_mgr.h +++ b/src/lib/dhcp/iface_mgr.h @@ -1563,7 +1563,7 @@ private: isc::util::WatchedThreadPtr dhcp_receiver_; }; -}; // namespace isc::dhcp -}; // namespace isc +} // namespace isc::dhcp +} // namespace isc #endif // IFACE_MGR_H diff --git a/src/lib/dhcp/iface_mgr_linux.cc b/src/lib/dhcp/iface_mgr_linux.cc index 7990f48257..247169833d 100644 --- a/src/lib/dhcp/iface_mgr_linux.cc +++ b/src/lib/dhcp/iface_mgr_linux.cc @@ -53,8 +53,7 @@ namespace { /// /// See IfaceMgr::detectIfaces() (Linux implementation, towards the end of this /// file) for example usage. -class Netlink -{ +class Netlink { public: /// @brief Holds pointers to netlink messages. diff --git a/src/lib/dhcp/option.h b/src/lib/dhcp/option.h index c010514ec4..cd58a3c532 100644 --- a/src/lib/dhcp/option.h +++ b/src/lib/dhcp/option.h @@ -81,7 +81,6 @@ public: /// defines option universe DHCPv4 or DHCPv6 enum Universe { V4, V6 }; - /// @brief a factory function prototype /// /// @param u option universe (DHCPv4 or DHCPv6) diff --git a/src/lib/dhcp/packet_queue.h b/src/lib/dhcp/packet_queue.h index 30a349f544..bb8ab17e1f 100644 --- a/src/lib/dhcp/packet_queue.h +++ b/src/lib/dhcp/packet_queue.h @@ -55,7 +55,8 @@ public: /// queue. It is the logical name used to register queue /// implementations. explicit PacketQueue(const std::string& queue_type) - : queue_type_(queue_type) {} + : queue_type_(queue_type) { + } /// Virtual destructor virtual ~PacketQueue() = default; @@ -136,7 +137,7 @@ typedef boost::shared_ptr> PacketQueue4Ptr; /// DHCPv6 packet queue factories. typedef boost::shared_ptr> PacketQueue6Ptr; -}; // namespace isc::dhcp -}; // namespace isc +} // namespace isc::dhcp +} // namespace isc #endif // PACKET_QUEUE_H diff --git a/src/lib/dhcp/packet_queue_mgr4.h b/src/lib/dhcp/packet_queue_mgr4.h index e7965eff77..60805df32b 100644 --- a/src/lib/dhcp/packet_queue_mgr4.h +++ b/src/lib/dhcp/packet_queue_mgr4.h @@ -25,7 +25,7 @@ public: /// @brief Logical name of the pre-registered, default queue implementation static const std::string DEFAULT_QUEUE_TYPE4; - /// @brief constructor. + /// @brief Constructor. /// /// It registers a default factory for DHCPv4 queues. PacketQueueMgr4(); diff --git a/src/lib/dhcp/packet_queue_mgr6.h b/src/lib/dhcp/packet_queue_mgr6.h index 3d3c642a78..66c90eba37 100644 --- a/src/lib/dhcp/packet_queue_mgr6.h +++ b/src/lib/dhcp/packet_queue_mgr6.h @@ -25,7 +25,7 @@ public: /// @brief Logical name of the pre-registered, default queue implementation static const std::string DEFAULT_QUEUE_TYPE6; - /// @brief constructor. + /// @brief Constructor. /// /// It registers a default factory for DHCPv6 queues. PacketQueueMgr6(); diff --git a/src/lib/dhcp/packet_queue_ring.h b/src/lib/dhcp/packet_queue_ring.h index 5aeec6a2f5..823e54391b 100644 --- a/src/lib/dhcp/packet_queue_ring.h +++ b/src/lib/dhcp/packet_queue_ring.h @@ -225,6 +225,7 @@ private: /// class PacketQueueRing4 : public PacketQueueRing { public: + /// @brief Constructor /// /// @param queue_type logical name of the queue implementation @@ -245,6 +246,7 @@ public: /// class PacketQueueRing6 : public PacketQueueRing { public: + /// @brief Constructor /// /// @param queue_type logical name of the queue implementation diff --git a/src/lib/dhcp/pkt.h b/src/lib/dhcp/pkt.h index c2840132c4..e584aecf58 100644 --- a/src/lib/dhcp/pkt.h +++ b/src/lib/dhcp/pkt.h @@ -798,7 +798,7 @@ private: /// @brief A pointer to either Pkt4 or Pkt6 packet typedef boost::shared_ptr PktPtr; -}; // namespace isc::dhcp -}; // namespace isc +} // namespace isc::dhcp +} // namespace isc #endif diff --git a/src/lib/dhcp/pkt_filter.h b/src/lib/dhcp/pkt_filter.h index 6c055cbf08..8f67070e9f 100644 --- a/src/lib/dhcp/pkt_filter.h +++ b/src/lib/dhcp/pkt_filter.h @@ -44,7 +44,10 @@ class Iface; class PktFilter { public: - /// @brief Virtual Destructor + /// @brief Constructor. + PktFilter() = default; + + /// @brief Virtual Destructor. virtual ~PktFilter() = default; /// @brief Check if packet can be sent to the host without address directly. diff --git a/src/lib/dhcp/pkt_filter6.h b/src/lib/dhcp/pkt_filter6.h index a35476c7ae..7e3ad469a2 100644 --- a/src/lib/dhcp/pkt_filter6.h +++ b/src/lib/dhcp/pkt_filter6.h @@ -70,6 +70,9 @@ class Iface; class PktFilter6 { public: + /// @brief Constructor. + PktFilter6() = default; + /// @brief Virtual Destructor. virtual ~PktFilter6() = default; diff --git a/src/lib/dhcp/tests/duid_factory_unittest.cc b/src/lib/dhcp/tests/duid_factory_unittest.cc index af0c620ded..0d6c075414 100644 --- a/src/lib/dhcp/tests/duid_factory_unittest.cc +++ b/src/lib/dhcp/tests/duid_factory_unittest.cc @@ -529,4 +529,4 @@ TEST_F(DUIDFactoryTest, override) { testEN("000009BF", "12131415"); } -} // End anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/dhcp/tests/iface_mgr_test_config.h b/src/lib/dhcp/tests/iface_mgr_test_config.h index 26167e8f2d..a6795a38ba 100644 --- a/src/lib/dhcp/tests/iface_mgr_test_config.h +++ b/src/lib/dhcp/tests/iface_mgr_test_config.h @@ -267,8 +267,8 @@ private: PktFilter6Ptr packet_filter6_; }; -}; -}; -}; +} +} +} #endif // IFACE_MGR_TEST_CONFIG_H diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc index 7288438523..70d450140d 100644 --- a/src/lib/dhcp/tests/iface_mgr_unittest.cc +++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc @@ -357,11 +357,13 @@ public: /// test failure path. class IfaceMgrTest : public ::testing::Test { public: + /// @brief Constructor. IfaceMgrTest() : errors_count_(0) { } + /// @brief Destructor. ~IfaceMgrTest() = default; /// @brief Tests the number of IPv6 sockets on interface diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc index 07954b2c75..7f0cb93f12 100644 --- a/src/lib/dhcp/tests/libdhcp++_unittest.cc +++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc @@ -55,6 +55,7 @@ const uint16_t OPTION_CM_MAC = 1026; class LibDhcpTest : public ::testing::Test { public: + /// @brief Constructor. /// /// Removes runtime option definitions. diff --git a/src/lib/dhcp/tests/packet_queue4_unittest.cc b/src/lib/dhcp/tests/packet_queue4_unittest.cc index 23671e3eab..77c5bf4c52 100644 --- a/src/lib/dhcp/tests/packet_queue4_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue4_unittest.cc @@ -28,6 +28,7 @@ namespace { /// mechanics. class TestQueue4 : public PacketQueueRing4 { public: + /// @brief Constructor /// /// @param queue_size maximum number of packets the queue can hold diff --git a/src/lib/dhcp/tests/packet_queue6_unittest.cc b/src/lib/dhcp/tests/packet_queue6_unittest.cc index 8b4f7abf1f..a1e69d14a1 100644 --- a/src/lib/dhcp/tests/packet_queue6_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue6_unittest.cc @@ -29,6 +29,7 @@ namespace { /// mechanics. class TestQueue6 : public PacketQueueRing6 { public: + /// @brief Constructor /// /// @param queue_size maximum number of packets the queue can hold diff --git a/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc b/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc index 22b17f1299..d35acb1b34 100644 --- a/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc @@ -37,6 +37,7 @@ namespace { /// @brief Test fixture for exercising the DHCPv4 Packet Queue Manager (PQM) class PacketQueueMgr4Test : public ::testing::Test { public: + /// @brief Constructor /// /// Note that it instantiates the PQM singleton. diff --git a/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc b/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc index d65ea85b5f..a07004adbe 100644 --- a/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc @@ -23,6 +23,7 @@ namespace { /// @brief Test fixture for exercising the DHCPv6 Packet Queue Manager (PQM) class PacketQueueMgr6Test : public ::testing::Test { public: + /// @brief Constructor /// /// Note that it instantiates the PQM singleton. diff --git a/src/lib/dhcp/tests/pkt_filter6_test_utils.cc b/src/lib/dhcp/tests/pkt_filter6_test_utils.cc index 9fd0681979..8dfc1c76a2 100644 --- a/src/lib/dhcp/tests/pkt_filter6_test_utils.cc +++ b/src/lib/dhcp/tests/pkt_filter6_test_utils.cc @@ -203,7 +203,6 @@ PktFilter6Stub::send(const Iface&, uint16_t, const Pkt6Ptr&) { return (0); } - } // end of isc::dhcp::test namespace } // end of isc::dhcp namespace } // end of isc namespace diff --git a/src/lib/dhcp/tests/pkt_filter6_test_utils.h b/src/lib/dhcp/tests/pkt_filter6_test_utils.h index 398b3a1ac1..513eb0305f 100644 --- a/src/lib/dhcp/tests/pkt_filter6_test_utils.h +++ b/src/lib/dhcp/tests/pkt_filter6_test_utils.h @@ -145,8 +145,8 @@ public: }; -}; // end of isc::dhcp::test namespace -}; // end of isc::dhcp namespace -}; // end of isc namespace +} // end of isc::dhcp::test namespace +} // end of isc::dhcp namespace +} // end of isc namespace #endif // PKT_FILTER6_TEST_UTILS_H diff --git a/src/lib/dhcp/tests/pkt_filter_test_utils.cc b/src/lib/dhcp/tests/pkt_filter_test_utils.cc index 3d4c712197..d082371672 100644 --- a/src/lib/dhcp/tests/pkt_filter_test_utils.cc +++ b/src/lib/dhcp/tests/pkt_filter_test_utils.cc @@ -193,7 +193,6 @@ PktFilterStub::send(const Iface&, uint16_t, const Pkt4Ptr&) { return (0); } - } // end of isc::dhcp::test namespace } // end of isc::dhcp namespace } // end of isc namespace diff --git a/src/lib/dhcp/tests/pkt_filter_test_utils.h b/src/lib/dhcp/tests/pkt_filter_test_utils.h index 253df184d2..d71fadf756 100644 --- a/src/lib/dhcp/tests/pkt_filter_test_utils.h +++ b/src/lib/dhcp/tests/pkt_filter_test_utils.h @@ -163,8 +163,8 @@ public: }; -}; // end of isc::dhcp::test namespace -}; // end of isc::dhcp namespace -}; // end of isc namespace +} // end of isc::dhcp::test namespace +} // end of isc::dhcp namespace +} // end of isc namespace #endif // PKT_FILTER_TEST_UTILS_H diff --git a/src/lib/dhcp_ddns/ncr_io.h b/src/lib/dhcp_ddns/ncr_io.h index 01352c3982..6883394a2d 100644 --- a/src/lib/dhcp_ddns/ncr_io.h +++ b/src/lib/dhcp_ddns/ncr_io.h @@ -183,6 +183,9 @@ public: class RequestReceiveHandler { public: + /// @brief Constructor + RequestReceiveHandler() = default; + /// @brief Function operator implementing a NCR receive callback. /// /// This method allows the application to receive the inbound @@ -198,6 +201,7 @@ public: virtual void operator ()(const Result result, NameChangeRequestPtr& ncr) = 0; + /// @brief Destructor virtual ~RequestReceiveHandler() = default; }; @@ -486,6 +490,9 @@ public: class RequestSendHandler { public: + /// @brief Constructor + RequestSendHandler() = default; + /// @brief Function operator implementing a NCR send callback. /// /// This method allows the application to receive the outcome of @@ -500,6 +507,7 @@ public: virtual void operator ()(const Result result, NameChangeRequestPtr& ncr) = 0; + /// @brief Destructor virtual ~RequestSendHandler() = default; }; diff --git a/src/lib/dhcp_ddns/ncr_udp.cc b/src/lib/dhcp_ddns/ncr_udp.cc index 3cbfa403f5..bc3a1ce24b 100644 --- a/src/lib/dhcp_ddns/ncr_udp.cc +++ b/src/lib/dhcp_ddns/ncr_udp.cc @@ -382,5 +382,5 @@ NameChangeUDPSender::closeWatchSocket() { } } -}; // end of isc::dhcp_ddns namespace -}; // end of isc namespace +} // end of isc::dhcp_ddns namespace +} // end of isc namespace diff --git a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc index f39df8f08d..c0d1b9567b 100644 --- a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc +++ b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc @@ -165,8 +165,8 @@ public: /// @brief Constructor // - // Instantiates the listener member and the test timer. The timer is used - // to ensure a test doesn't go awry and hang forever. + /// Instantiates the listener member and the test timer. The timer is used + /// to ensure a test doesn't go awry and hang forever. NameChangeUDPListenerTest() : io_service_(), result_(NameChangeListener::SUCCESS), test_timer_(io_service_) { @@ -180,6 +180,7 @@ public: TEST_TIMEOUT); } + /// @brief Destructor virtual ~NameChangeUDPListenerTest() = default; /// @brief Converts JSON string into an NCR and sends it to the listener. @@ -290,11 +291,14 @@ public: /// @brief Text fixture for testing NameChangeUDPListener class NameChangeUDPSenderBasicTest : public virtual ::testing::Test { public: + + /// @brief Constructor NameChangeUDPSenderBasicTest() { // Disable multi-threading MultiThreadingMgr::instance().setMode(false); } + /// @brief Destructor ~NameChangeUDPSenderBasicTest() { try { // Disable multi-threading @@ -966,6 +970,7 @@ public: std::vector sent_ncrs_; std::vector received_ncrs_; + /// @brief Constructor NameChangeUDPTest() : io_service_(), recv_result_(NameChangeListener::SUCCESS), send_result_(NameChangeSender::SUCCESS), test_timer_(io_service_) { @@ -988,6 +993,7 @@ public: MultiThreadingMgr::instance().setMode(false); } + /// @brief Destructor ~NameChangeUDPTest() { try { // Disable multi-threading diff --git a/src/lib/dhcp_ddns/tests/ncr_unittests.cc b/src/lib/dhcp_ddns/tests/ncr_unittests.cc index dd25996d9f..a774134fae 100644 --- a/src/lib/dhcp_ddns/tests/ncr_unittests.cc +++ b/src/lib/dhcp_ddns/tests/ncr_unittests.cc @@ -337,6 +337,7 @@ TEST(NameChangeRequestTest, dhcidTest) { /// @brief Test fixture class for testing DHCID creation. class DhcidTest : public ::testing::Test { public: + /// @brief Constructor DhcidTest() { const uint8_t fqdn_data[] = { diff --git a/src/lib/dhcpsrv/cache_host_data_source.h b/src/lib/dhcpsrv/cache_host_data_source.h index f5c604656d..2dd32d8554 100644 --- a/src/lib/dhcpsrv/cache_host_data_source.h +++ b/src/lib/dhcpsrv/cache_host_data_source.h @@ -17,6 +17,7 @@ namespace dhcp { /// Only the insert() method is required to use the cache. class CacheHostDataSource : public virtual BaseHostDataSource { public: + /// @brief Constructor. CacheHostDataSource() = default; diff --git a/src/lib/dhcpsrv/cfg_hosts.h b/src/lib/dhcpsrv/cfg_hosts.h index 3ab7343b50..ca6add6bce 100644 --- a/src/lib/dhcpsrv/cfg_hosts.h +++ b/src/lib/dhcpsrv/cfg_hosts.h @@ -37,6 +37,7 @@ namespace dhcp { class CfgHosts : public BaseHostDataSource, public WritableHostDataSource, public isc::data::CfgToElement { public: + /// @brief Constructor. CfgHosts() = default; diff --git a/src/lib/dhcpsrv/client_class_def.h b/src/lib/dhcpsrv/client_class_def.h index 85003eb01c..7885911365 100644 --- a/src/lib/dhcpsrv/client_class_def.h +++ b/src/lib/dhcpsrv/client_class_def.h @@ -46,6 +46,7 @@ public: /// @brief Embodies a single client class definition class ClientClassDef : public data::UserContext, public isc::data::CfgToElement { public: + /// @brief Constructor /// /// @param name Name to assign to this class diff --git a/src/lib/dhcpsrv/config_backend_dhcp4.h b/src/lib/dhcpsrv/config_backend_dhcp4.h index 5b19beedb2..435d5f6592 100644 --- a/src/lib/dhcpsrv/config_backend_dhcp4.h +++ b/src/lib/dhcpsrv/config_backend_dhcp4.h @@ -84,6 +84,7 @@ namespace dhcp { /// however, be properly documented. class ConfigBackendDHCPv4 : public cb::BaseConfigBackend { public: + /// @brief Constructor ConfigBackendDHCPv4() = default; diff --git a/src/lib/dhcpsrv/config_backend_dhcp6.h b/src/lib/dhcpsrv/config_backend_dhcp6.h index 068188a406..4608ddbaa0 100644 --- a/src/lib/dhcpsrv/config_backend_dhcp6.h +++ b/src/lib/dhcpsrv/config_backend_dhcp6.h @@ -85,6 +85,7 @@ namespace dhcp { /// however, be properly documented. class ConfigBackendDHCPv6 : public cb::BaseConfigBackend { public: + /// @brief Constructor ConfigBackendDHCPv6() = default; diff --git a/src/lib/dhcpsrv/cql_host_data_source.cc b/src/lib/dhcpsrv/cql_host_data_source.cc index a55fda64ae..ae0d59ae65 100644 --- a/src/lib/dhcpsrv/cql_host_data_source.cc +++ b/src/lib/dhcpsrv/cql_host_data_source.cc @@ -125,6 +125,7 @@ namespace dhcp { /// hosts table. class CqlHostExchange : public virtual CqlExchange { public: + /// @brief Constructor /// /// Specifies table columns. @@ -2044,6 +2045,7 @@ CqlHostExchange::retrieveOption() const { /// This class is encapsulate all the Cassandra communication details. class CqlHostDataSourceImpl { public: + /// @brief Constructor. /// /// This constructor opens database connection and initializes diff --git a/src/lib/dhcpsrv/cql_host_data_source.h b/src/lib/dhcpsrv/cql_host_data_source.h index c8480fe9e5..40d0a3cd45 100644 --- a/src/lib/dhcpsrv/cql_host_data_source.h +++ b/src/lib/dhcpsrv/cql_host_data_source.h @@ -58,6 +58,7 @@ typedef boost::shared_ptr CqlHostDataSourceImplPtr; /// cases. class CqlHostDataSource : public BaseHostDataSource { public: + /// @brief Constructor /// /// Uses the following keywords in the parameters passed to it to diff --git a/src/lib/dhcpsrv/d2_client_mgr.cc b/src/lib/dhcpsrv/d2_client_mgr.cc index 3d24bf097f..34a1035570 100644 --- a/src/lib/dhcpsrv/d2_client_mgr.cc +++ b/src/lib/dhcpsrv/d2_client_mgr.cc @@ -389,6 +389,5 @@ D2ClientMgr::runReadyIO() { name_change_sender_->runReadyIO(); } -}; // namespace dhcp - -}; // namespace isc +} // namespace dhcp +} // namespace isc diff --git a/src/lib/dhcpsrv/d2_client_mgr.h b/src/lib/dhcpsrv/d2_client_mgr.h index bfa611d8ad..df373b0d0a 100644 --- a/src/lib/dhcpsrv/d2_client_mgr.h +++ b/src/lib/dhcpsrv/d2_client_mgr.h @@ -79,6 +79,7 @@ std::function Lease6CollectionPtr; std::ostream& operator<<(std::ostream& os, const Lease& lease); -}; // end of isc::dhcp namespace -}; // end of isc namespace +} // end of isc::dhcp namespace +} // end of isc namespace #endif // LEASE_H diff --git a/src/lib/dhcpsrv/lease_file_stats.h b/src/lib/dhcpsrv/lease_file_stats.h index 16eed843b4..9498147b2f 100644 --- a/src/lib/dhcpsrv/lease_file_stats.h +++ b/src/lib/dhcpsrv/lease_file_stats.h @@ -17,6 +17,7 @@ namespace dhcp { /// but it may be expanded in the future. class LeaseFileStats { public: + /// @brief Constructor /// /// Initializes the stats variables to zeros diff --git a/src/lib/dhcpsrv/lease_mgr.h b/src/lib/dhcpsrv/lease_mgr.h index fe3fe3db33..d593c90724 100644 --- a/src/lib/dhcpsrv/lease_mgr.h +++ b/src/lib/dhcpsrv/lease_mgr.h @@ -221,6 +221,7 @@ typedef boost::shared_ptr LeaseStatsRowPtr; /// of those classes for details. class LeaseMgr { public: + /// @brief Constructor LeaseMgr() = default; diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index 9d35c81e9e..44e8a68ca8 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -259,6 +259,7 @@ LFCSetup::getExitStatus() const { /// class MemfileLeaseStatsQuery : public LeaseStatsQuery { public: + /// @brief Constructor for all subnets query /// MemfileLeaseStatsQuery() @@ -327,6 +328,7 @@ protected: /// class MemfileLeaseStatsQuery4 : public MemfileLeaseStatsQuery { public: + /// @brief Constructor for an all subnets query /// /// @param storage4 A pointer to the v4 lease storage to be counted @@ -469,6 +471,7 @@ private: /// class MemfileLeaseStatsQuery6 : public MemfileLeaseStatsQuery { public: + /// @brief Constructor /// /// @param storage6 A pointer to the v6 lease storage to be counted diff --git a/src/lib/dhcpsrv/parsers/host_reservation_parser.h b/src/lib/dhcpsrv/parsers/host_reservation_parser.h index 6d19729d87..caf717e817 100644 --- a/src/lib/dhcpsrv/parsers/host_reservation_parser.h +++ b/src/lib/dhcpsrv/parsers/host_reservation_parser.h @@ -227,7 +227,6 @@ protected: virtual bool isSupportedIdentifier(const std::string& id_name) const; }; - } } // end of namespace isc diff --git a/src/lib/dhcpsrv/pgsql_host_data_source.h b/src/lib/dhcpsrv/pgsql_host_data_source.h index 6964f986d3..0969987608 100644 --- a/src/lib/dhcpsrv/pgsql_host_data_source.h +++ b/src/lib/dhcpsrv/pgsql_host_data_source.h @@ -67,7 +67,7 @@ public: /// @throw isc::db::DbOpenError Error opening the database /// @throw isc::db::DbOperationError An operation on the open database has /// failed. - PgSqlHostDataSource(const db::DatabaseConnection::ParameterMap& parameters); + PgSqlHostDataSource(const db::DatabaseConnection::ParameterMap& parameters); /// @brief Virtual destructor. /// diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.cc b/src/lib/dhcpsrv/pgsql_lease_mgr.cc index e2da025e79..da52357e5e 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.cc +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.cc @@ -374,6 +374,7 @@ namespace dhcp { /// database. class PgSqlLeaseExchange : public PgSqlExchange { public: + /// @brief Constructor PgSqlLeaseExchange() : addr_str_(""), hwaddr_length_(0), hwaddr_(hwaddr_length_), diff --git a/src/lib/dhcpsrv/pool.h b/src/lib/dhcpsrv/pool.h index 7f7e078e71..1a7c9c4e96 100644 --- a/src/lib/dhcpsrv/pool.h +++ b/src/lib/dhcpsrv/pool.h @@ -28,8 +28,8 @@ namespace dhcp { /// Stores information about pool of IPv4 or IPv6 addresses. /// That is a basic component of a configuration. class Pool : public isc::data::UserContext, public isc::data::CfgToElement { - public: + /// @note: /// PoolType enum was removed. Please use Lease::Type instead diff --git a/src/lib/dhcpsrv/resource_handler.h b/src/lib/dhcpsrv/resource_handler.h index 8170b39aaa..14fbae4b56 100644 --- a/src/lib/dhcpsrv/resource_handler.h +++ b/src/lib/dhcpsrv/resource_handler.h @@ -171,6 +171,7 @@ private: /// @brief Resource race avoidance RAII handler for DHCPv4. class ResourceHandler4 : public ResourceHandler { public: + /// @brief Constructor. ResourceHandler4() = default; diff --git a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc index e598de10a0..01718d25ed 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc @@ -3957,6 +3957,7 @@ TEST_F(AllocEngine6Test, bothHostReservedPrefix) { /// extended info tests. class AllocEngine6ExtendedInfoTest : public AllocEngine6Test { public: + /// @brief Constructor AllocEngine6ExtendedInfoTest() : engine_(AllocEngine::ALLOC_ITERATIVE, 100, true), duid1_(), duid2_(), diff --git a/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc index 35ff3aefdf..aed0e8b6be 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc @@ -161,6 +161,7 @@ public: /// @brief Type definition for the lease algorithm. typedef std::function LeaseAlgorithmFun; + /// @brief type definition for the lease index algorithm. typedef std::function IndexAlgorithmFun; @@ -2329,4 +2330,4 @@ TEST_F(ExpirationAllocEngine4Test, reclaimDeclinedHook2) { testReclaimDeclinedHook(true); // true = use skip callout } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc index 11b66f792c..c819b66eef 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc @@ -28,10 +28,13 @@ namespace test { /// the data that is accessible via callouts. class HookAllocEngine6Test : public AllocEngine6Test { public: + + /// @brief Constructor HookAllocEngine6Test() { resetCalloutBuffers(); } + /// @brief Destructor virtual ~HookAllocEngine6Test() { try { resetCalloutBuffers(); @@ -347,12 +350,15 @@ TEST_F(HookAllocEngine6Test, skip_lease6_select) { /// src/bin/dhcp4/tests/dhcp4_srv_unittest.cc class HookAllocEngine4Test : public AllocEngine4Test { public: + + /// @brief Constructor HookAllocEngine4Test() { // The default context is not used in these tests. ctx_.callout_handle_.reset(); resetCalloutBuffers(); } + /// @brief Destructor virtual ~HookAllocEngine4Test() { try { resetCalloutBuffers(); diff --git a/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc b/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc index d27105bd05..e8ecb5eb8a 100644 --- a/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc +++ b/src/lib/dhcpsrv/tests/cb_ctl_dhcp_unittest.cc @@ -40,6 +40,7 @@ namespace { /// @c false when setting IP reservations unique/non-unique mode. class NonUniqueHostDataSource : public MemHostDataSource { public: + /// @brief Constructor NonUniqueHostDataSource() = default; diff --git a/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc b/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc index aa7c82a066..e7e43c62e9 100644 --- a/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc @@ -1203,5 +1203,4 @@ TEST_F(CfgHostsTest, duplicatesSubnet6DUID) { "foo.example.com")))); } - } // end of anonymous namespace diff --git a/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc b/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc index d4f740c356..9fd037e7dc 100644 --- a/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_multi_threading_unittest.cc @@ -21,6 +21,7 @@ namespace { /// @brief Test fixture class for @c MultiThreadingConfigParser class CfgMultiThreadingTest : public ::testing::Test { protected: + /// @brief Constructor CfgMultiThreadingTest() = default; diff --git a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc index 5a15dcc954..26c969e85f 100644 --- a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc @@ -261,6 +261,7 @@ TEST(ValueStorageTest, StringTesting) { class CfgMgrTest : public ::testing::Test { public: + /// @brief Constructor. CfgMgrTest() { // make sure we start with a clean configuration diff --git a/src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc b/src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc index 89e2ddea92..f8cf618b05 100644 --- a/src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc +++ b/src/lib/dhcpsrv/tests/cql_host_data_source_unittest.cc @@ -775,6 +775,7 @@ TEST_F(CqlHostDataSourceTest, testMultipleHosts6) { /// CQL as alternate host data source. class CQLHostMgrTest : public HostMgrTest { protected: + /// @brief Constructor CQLHostMgrTest() = default; diff --git a/src/lib/dhcpsrv/tests/d2_client_unittest.cc b/src/lib/dhcpsrv/tests/d2_client_unittest.cc index f246c152d8..07a1131af4 100644 --- a/src/lib/dhcpsrv/tests/d2_client_unittest.cc +++ b/src/lib/dhcpsrv/tests/d2_client_unittest.cc @@ -341,6 +341,7 @@ TEST(D2ClientMgr, ipv6Config) { /// influenced by DDNS parameters. class D2ClientMgrParamsTest : public ::testing::Test { public: + /// @brief Constructor D2ClientMgrParamsTest() = default; diff --git a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc index f3f1e525e7..74a6693e16 100644 --- a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc +++ b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc @@ -36,10 +36,13 @@ class D2ClientMgrTest : public D2ClientMgr, public ::testing::Test { public: /// @brief If true simulates a send which completed with a failed status. bool simulate_send_failure_; + /// @brief If true causes an exception throw in the client error handler. bool error_handler_throw_; + /// @brief Tracks the number times the completion handler is called. int callback_count_; + /// @brief Tracks the number of times the client error handler was called. int error_handler_count_; diff --git a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc index 6bad085fac..0178ee86ae 100644 --- a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc +++ b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc @@ -52,6 +52,7 @@ namespace { /// @brief DHCP Parser test fixture class class DhcpParserTest : public ::testing::Test { public: + /// @brief Constructor DhcpParserTest() { resetIfaceCfg(); @@ -165,6 +166,7 @@ TEST_F(DhcpParserTest, MacSourcesDuplicate) { /// by dhcp servers. class ParseConfigTest : public ::testing::Test { public: + /// @brief Constructor ParseConfigTest() :family_(AF_INET6) { @@ -3080,4 +3082,4 @@ TEST_F(ParseConfigTest, defaultSharedNetwork6) { // (see CtrlDhcpv4SrvTest.commandSocketBasic in // src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc). -}; // Anonymous namespace +} // Anonymous namespace diff --git a/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc index 27db9f8189..80d9babece 100644 --- a/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/dhcp_queue_control_parser_unittest.cc @@ -24,6 +24,7 @@ namespace { /// @brief Test fixture class for @c DHCPQueueControlParser class DHCPQueueControlParserTest : public ::testing::Test { protected: + /// @brief Constructor DHCPQueueControlParserTest() = default; @@ -39,7 +40,6 @@ protected: /// /// Clears the configuration in the @c CfgMgr. virtual void TearDown(); - }; void @@ -210,4 +210,4 @@ TEST_F(DHCPQueueControlParserTest, multiThreading) { EXPECT_EQ("false", queue_control->get("enable-queue")->str()); } -}; // anonymous namespace +} // anonymous namespace diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h index 16bc2b7e81..7f739bcb61 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h @@ -526,6 +526,7 @@ public: class LeaseMgrDbLostCallbackTest : public ::testing::Test { public: + /// @brief Constructor LeaseMgrDbLostCallbackTest() : db_lost_callback_called_(0), db_recovered_callback_called_(0), diff --git a/src/lib/dhcpsrv/tests/host_cache_unittest.cc b/src/lib/dhcpsrv/tests/host_cache_unittest.cc index 044c0dfe85..2b1f064441 100644 --- a/src/lib/dhcpsrv/tests/host_cache_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_cache_unittest.cc @@ -100,6 +100,7 @@ typedef boost::shared_ptr TestHostCachePtr; /// @brief Test data source class. class TestHostDataSource : public MemHostDataSource { public: + /// @brief Constructor TestHostDataSource() = default; @@ -744,6 +745,7 @@ typedef boost::shared_ptr TestOneBackendPtr; /// This class looks like a cache but throws when insert() is called. class TestNoCache : public MemHostDataSource, public CacheHostDataSource { public: + /// Constructor TestNoCache() = default; @@ -1004,4 +1006,4 @@ TEST_F(NegativeCacheTest, get6withNegativeCaching) { testGet6(); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc b/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc index 103550fcd5..dea212823f 100644 --- a/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_data_source_factory_unittest.cc @@ -75,6 +75,7 @@ factory0(const DatabaseConnection::ParameterMap&) { // @brief Test fixture class class HostDataSourceFactoryTest : public ::testing::Test { public: + /// @brief Constructor HostDataSourceFactoryTest() = default; @@ -199,4 +200,4 @@ TEST_F(HostDataSourceFactoryTest, multiple) { EXPECT_FALSE(HostDataSourceFactory::del(sources_, "mem2")); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc b/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc index ed9c23d593..f4f4b94ef8 100644 --- a/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc @@ -43,6 +43,7 @@ namespace { /// @brief Test fixture class for @c HostReservationParser. class HostReservationParserTest : public ::testing::Test { protected: + /// @brief Constructor HostReservationParserTest() = default; diff --git a/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc b/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc index 3f51e214c0..d881e22be7 100644 --- a/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc @@ -33,6 +33,7 @@ namespace { /// @brief Test fixture class for @c HostReservationsListParser. class HostReservationsListParserTest : public ::testing::Test { protected: + /// @brief Constructor HostReservationsListParserTest() = default; diff --git a/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc b/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc index 5a4a1dcef9..d99e375b9f 100644 --- a/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/multi_threading_config_parser_unittest.cc @@ -24,6 +24,7 @@ namespace { /// @brief Test fixture class for @c MultiThreadingConfigParser class MultiThreadingConfigParserTest : public ::testing::Test { protected: + /// @brief Constructor MultiThreadingConfigParserTest() = default; diff --git a/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc b/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc index b7e4dc3327..14f0f105f5 100644 --- a/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc +++ b/src/lib/dhcpsrv/tests/sanity_checks_unittest.cc @@ -26,6 +26,7 @@ using namespace isc::dhcp::test; class SanityChecksTest : public ::testing::Test { public: + /// @brief Constructor SanityChecksTest() { LeaseMgrFactory::destroy(); diff --git a/src/lib/dhcpsrv/tests/shared_network_parser_unittest.cc b/src/lib/dhcpsrv/tests/shared_network_parser_unittest.cc index fc2b7538c9..e6af5b0e3e 100644 --- a/src/lib/dhcpsrv/tests/shared_network_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/shared_network_parser_unittest.cc @@ -41,6 +41,9 @@ public: IOAddressList addresses_; }; + /// @brief constructor + SharedNetworkParserTest() = default; + /// @brief virtual destructor virtual ~SharedNetworkParserTest() = default; diff --git a/src/lib/dhcpsrv/tests/srv_config_unittest.cc b/src/lib/dhcpsrv/tests/srv_config_unittest.cc index 6f80c050c8..f9993e781c 100644 --- a/src/lib/dhcpsrv/tests/srv_config_unittest.cc +++ b/src/lib/dhcpsrv/tests/srv_config_unittest.cc @@ -40,6 +40,7 @@ const int TEST_SUBNETS_NUM = 3; /// @brief Test fixture class for testing configuration data storage. class SrvConfigTest : public ::testing::Test { public: + /// @brief Constructor. /// /// Creates IPv4 and IPv6 subnets for unit test. The number of subnets @@ -85,7 +86,6 @@ public: "", false, false, CfgOptionPtr()); } - /// @brief Destructor. virtual ~SrvConfigTest() = default; diff --git a/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc b/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc index 3138f107b4..d38cb05f37 100644 --- a/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc @@ -28,6 +28,7 @@ namespace { /// @brief Test fixture class for @c TimerMgr. class TimerMgrTest : public ::testing::Test { public: + /// @brief Constructor TimerMgrTest() = default; diff --git a/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc b/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc index e14b80745d..ec8dd24ae4 100644 --- a/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc @@ -126,7 +126,6 @@ GenericBackendTest::checkConfiguredGlobal(const SrvConfigPtr& srv_cfg, checkConfiguredGlobal(srv_cfg, exp_global->getName(), exp_global->getElementValue()); } - } // end of namespace isc::dhcp::test } // end of namespace isc::dhcp } // end of namespace isc diff --git a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h index c94a8acb05..749ca428b6 100644 --- a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h +++ b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.h @@ -537,6 +537,7 @@ public: class HostMgrDbLostCallbackTest : public ::testing::Test { public: + /// @brief Constructor HostMgrDbLostCallbackTest() : db_lost_callback_called_(0), db_recovered_callback_called_(0), @@ -688,6 +689,7 @@ public: /// @brief Test fixture class for @c HostMgr class. class HostMgrTest : public ::testing::Test { protected: + /// @brief Constructor HostMgrTest() = default; diff --git a/src/lib/dhcpsrv/testutils/lease_file_io.h b/src/lib/dhcpsrv/testutils/lease_file_io.h index 25efd96d14..67d3bea4f7 100644 --- a/src/lib/dhcpsrv/testutils/lease_file_io.h +++ b/src/lib/dhcpsrv/testutils/lease_file_io.h @@ -21,6 +21,7 @@ namespace test { /// of the existing file and remove existing file (cleanup after unit test). class LeaseFileIO { public: + /// @brief Constructor /// /// @param filename Absolute path to the file. diff --git a/src/lib/dhcpsrv/testutils/memory_host_data_source.h b/src/lib/dhcpsrv/testutils/memory_host_data_source.h index 089513efe2..69e68233e6 100644 --- a/src/lib/dhcpsrv/testutils/memory_host_data_source.h +++ b/src/lib/dhcpsrv/testutils/memory_host_data_source.h @@ -23,6 +23,7 @@ namespace test { /// work, just several are implemented. Those are used in the tests. class MemHostDataSource : public virtual BaseHostDataSource { public: + /// @brief Constructor. MemHostDataSource() : next_host_id_(0) { } diff --git a/src/lib/dhcpsrv/testutils/test_config_backend.h b/src/lib/dhcpsrv/testutils/test_config_backend.h index 0b638e51e9..5eb0dfe079 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend.h +++ b/src/lib/dhcpsrv/testutils/test_config_backend.h @@ -25,6 +25,7 @@ typedef boost::shared_ptr StampedElementPtr; template class TestConfigBackend : public ConfigBackendType { public: + /// @brief Constructor /// /// @param params database connection parameters diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h index 6d5424e26f..3fcf79dac8 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h +++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.h @@ -38,6 +38,7 @@ namespace test { /// This backend stores server configuration information in memory. class TestConfigBackendDHCPv4 : public TestConfigBackend { public: + /// @brief Constructor /// /// @param params Database connection parameters. diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.h b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.h index 6b796891b5..3579da004f 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.h +++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp6.h @@ -38,6 +38,7 @@ namespace test { /// This backend stores server configuration information in memory. class TestConfigBackendDHCPv6 : public TestConfigBackend { public: + /// @brief Constructor /// /// @param params Database connection parameters. diff --git a/src/lib/dhcpsrv/testutils/test_utils.h b/src/lib/dhcpsrv/testutils/test_utils.h index 02af9ba467..6613d99a58 100644 --- a/src/lib/dhcpsrv/testutils/test_utils.h +++ b/src/lib/dhcpsrv/testutils/test_utils.h @@ -59,6 +59,7 @@ int findLastSocketFd(); /// of scope closes all file descriptors which were opened by the constructor. class FillFdHoles { public: + /// @brief Constructor /// /// Holes between 0 and the specified limit will be filled by opening diff --git a/src/lib/dhcpsrv/writable_host_data_source.h b/src/lib/dhcpsrv/writable_host_data_source.h index a17490dfb2..7632af7e0e 100644 --- a/src/lib/dhcpsrv/writable_host_data_source.h +++ b/src/lib/dhcpsrv/writable_host_data_source.h @@ -20,6 +20,7 @@ namespace dhcp { /// return the const objects. class WritableHostDataSource { public: + /// @brief Constructor WritableHostDataSource() = default; diff --git a/src/lib/dns/master_lexer.cc b/src/lib/dns/master_lexer.cc index ccd116f657..abc2b6951b 100644 --- a/src/lib/dns/master_lexer.cc +++ b/src/lib/dns/master_lexer.cc @@ -364,6 +364,7 @@ State::getParenCount(const MasterLexer& lexer) const { namespace { class CRLF : public State { public: + /// @brief Constructor CRLF() = default; @@ -394,6 +395,7 @@ public: class String : public State { public: + /// @brief Constructor String() = default; @@ -407,6 +409,7 @@ public: class QString : public State { public: + /// @brief Constructor QString() = default; @@ -420,6 +423,7 @@ public: class Number : public State { public: + /// @brief Constructor Number() = default; diff --git a/src/lib/dns/master_lexer_state.h b/src/lib/dns/master_lexer_state.h index 931dea7ce4..5bba5c850b 100644 --- a/src/lib/dns/master_lexer_state.h +++ b/src/lib/dns/master_lexer_state.h @@ -47,6 +47,7 @@ namespace master_lexer_internal { /// this library are expected to use this class. class State { public: + /// \brief Constructor. State() = default; diff --git a/src/lib/dns/message.h b/src/lib/dns/message.h index 0820fdd358..96df207b70 100644 --- a/src/lib/dns/message.h +++ b/src/lib/dns/message.h @@ -90,6 +90,7 @@ struct SectionIteratorImpl; template class SectionIterator : public std::iterator { public: + /// @brief Constructor SectionIterator() : impl_(NULL) { } @@ -256,15 +257,19 @@ public: /// mode from \c PARSE to \c RENDER, and vice versa. //@{ public: + /// \brief The constructor. /// The mode of the message is specified by the \c mode parameter. Message(Mode mode); + /// \brief The destructor. ~Message(); + private: Message(const Message& source); Message& operator=(const Message& source); //@} + public: /// \brief Return whether the specified header flag bit is set in the /// header section. diff --git a/src/lib/dns/messagerenderer.h b/src/lib/dns/messagerenderer.h index d68e4ca71f..1a65dbe123 100644 --- a/src/lib/dns/messagerenderer.h +++ b/src/lib/dns/messagerenderer.h @@ -94,8 +94,9 @@ public: CASE_INSENSITIVE, //!< Compress names case-insensitive manner (default) CASE_SENSITIVE //!< Compress names case-sensitive manner }; + protected: - /// + /// \name Constructors and Destructor //@{ /// \brief The default constructor. @@ -105,6 +106,7 @@ protected: AbstractMessageRenderer(); public: + /// \brief The destructor. virtual ~AbstractMessageRenderer() = default; //@} @@ -354,7 +356,7 @@ public: /// pre-existing portion of the buffer contains DNS names, these names won't /// be considered for name compression. class MessageRenderer : public AbstractMessageRenderer, - public boost::noncopyable { // Can crash if copied + public boost::noncopyable { // Can crash if copied public: using AbstractMessageRenderer::CASE_INSENSITIVE; using AbstractMessageRenderer::CASE_SENSITIVE; diff --git a/src/lib/dns/nsec3hash.cc b/src/lib/dns/nsec3hash.cc index 9002a07e3f..77f8ed9730 100644 --- a/src/lib/dns/nsec3hash.cc +++ b/src/lib/dns/nsec3hash.cc @@ -54,10 +54,12 @@ class NSEC3HashRFC5155 : boost::noncopyable, public NSEC3Hash { private: // This is the algorithm number for SHA1/NSEC3 as defined in RFC5155. static const uint8_t NSEC3_HASH_SHA1 = 1; + // For digest_ allocation static const size_t DEFAULT_DIGEST_LENGTH = 32; public: + /// @brief Constructor NSEC3HashRFC5155(uint8_t algorithm, uint16_t iterations, const uint8_t* salt_data, size_t salt_length) : diff --git a/src/lib/dns/nsec3hash.h b/src/lib/dns/nsec3hash.h index b0ef0a2f20..1de944772a 100644 --- a/src/lib/dns/nsec3hash.h +++ b/src/lib/dns/nsec3hash.h @@ -73,6 +73,7 @@ public: /// the internal resources for different sets of parameters. class NSEC3Hash { protected: + /// \brief The default constructor. /// /// This is defined as protected to prevent this class from being directly @@ -202,6 +203,7 @@ public: /// this condition can be loosened. class NSEC3HashCreator { protected: + /// \brief The default constructor. /// /// Make very sure this isn't directly instantiated by making it protected @@ -209,6 +211,7 @@ protected: NSEC3HashCreator() = default; public: + /// \brief The destructor. /// /// This does nothing; defined only for allowing derived classes to diff --git a/src/lib/dns/rdata.h b/src/lib/dns/rdata.h index a066f44629..2bba41ad08 100644 --- a/src/lib/dns/rdata.h +++ b/src/lib/dns/rdata.h @@ -129,6 +129,7 @@ class Rdata { /// own versions of these methods. //@{ protected: + /// The default constructor. /// /// This is intentionally defined as \c protected as this base class should @@ -137,10 +138,12 @@ protected: /// either, because an \c Rdata object without concrete data isn't /// meaningful. Rdata() = default; + private: Rdata(const Rdata& source); void operator=(const Rdata& source); public: + /// The destructor. virtual ~Rdata() = default; //@} @@ -248,6 +251,7 @@ struct GenericImpl; /// assuming any structure. class Generic : public Rdata { public: + /// /// \name Constructors, Assignment Operator and Destructor. /// @@ -290,6 +294,7 @@ public: /// \param rdata_len The length in buffer of the \c Rdata. In bytes. Generic(isc::util::InputBuffer& buffer, size_t rdata_len); + /// /// \brief Constructor from master lexer. /// Generic(MasterLexer& lexer, const Name* name, diff --git a/src/lib/dns/rdata_pimpl_holder.h b/src/lib/dns/rdata_pimpl_holder.h index b1831f4ce6..2f33538b2f 100644 --- a/src/lib/dns/rdata_pimpl_holder.h +++ b/src/lib/dns/rdata_pimpl_holder.h @@ -18,6 +18,7 @@ namespace rdata { template class RdataPimplHolder : boost::noncopyable { public: + /// @brief Constructor RdataPimplHolder(T* obj = NULL) : obj_(obj) { diff --git a/src/lib/dns/rdatafields.cc b/src/lib/dns/rdatafields.cc index 16213c9d55..f3c8f38c39 100644 --- a/src/lib/dns/rdatafields.cc +++ b/src/lib/dns/rdatafields.cc @@ -64,6 +64,7 @@ namespace { // it's hopefully an acceptable practice. class RdataFieldComposer : public AbstractMessageRenderer { public: + /// @brief Constructor RdataFieldComposer() : truncated_(false), length_limit_(65535), @@ -230,6 +231,7 @@ void RdataFields::toWire(OutputBuffer& buffer) const { buffer.writeData(data_, data_length_); } + } // end of namespace rdata } // end of namespace dns } // end of namespace isc diff --git a/src/lib/dns/rdatafields.h b/src/lib/dns/rdatafields.h index b59914c6a5..167a4ebc29 100644 --- a/src/lib/dns/rdatafields.h +++ b/src/lib/dns/rdatafields.h @@ -223,6 +223,7 @@ private: RdataFields& operator=(const RdataFields& source); public: + /// Constructor from Rdata. /// /// This constructor converts the data of a given \c Rdata object into diff --git a/src/lib/dns/rrparamregistry.h b/src/lib/dns/rrparamregistry.h index e68202e135..a2c82adf8d 100644 --- a/src/lib/dns/rrparamregistry.h +++ b/src/lib/dns/rrparamregistry.h @@ -60,12 +60,15 @@ class AbstractRdataFactory { /// //@{ protected: + /// The default constructor /// /// This is intentionally defined as \c protected as this base class should /// never be instantiated (except as part of a derived class). AbstractRdataFactory() = default; + public: + /// The destructor. virtual ~AbstractRdataFactory() = default; //@} @@ -175,6 +178,7 @@ class RRParamRegistry { /// These are intentionally hidden (see the class description). //@{ private: + /// @brief Constructor RRParamRegistry(); @@ -184,6 +188,7 @@ private: /// @brief Destructor ~RRParamRegistry(); //@} + public: /// /// \brief Return the singleton instance of \c RRParamRegistry. diff --git a/src/lib/dns/rrset.cc b/src/lib/dns/rrset.cc index 3d7b4b0af7..ef273ca553 100644 --- a/src/lib/dns/rrset.cc +++ b/src/lib/dns/rrset.cc @@ -415,6 +415,7 @@ namespace { class BasicRdataIterator : public RdataIterator { public: + /// @brief Constructor. BasicRdataIterator(const std::vector& datavector) : datavector_(&datavector), it_(datavector_->begin()) { diff --git a/src/lib/dns/rrset.h b/src/lib/dns/rrset.h index 93a4c556f1..2bbc082df5 100644 --- a/src/lib/dns/rrset.h +++ b/src/lib/dns/rrset.h @@ -162,12 +162,15 @@ private: AbstractRRset(const AbstractRRset& source); AbstractRRset& operator=(const AbstractRRset& source); protected: + /// \brief The default constructor. /// /// This is intentionally defined as \c protected as this base class should /// never be instantiated (except as part of a derived class). AbstractRRset() = default; + public: + /// The destructor. virtual ~AbstractRRset() = default; //@} @@ -563,12 +566,15 @@ class RdataIterator { /// defined as private to make it explicit that this is a pure base class. //@{ protected: + /// \brief The default constructor. /// /// This is intentionally defined as \c protected as this base class should /// never be instantiated (except as part of a derived class). RdataIterator() = default; + public: + /// \brief Destructor virtual ~RdataIterator() = default; private: @@ -639,6 +645,7 @@ private: BasicRRset(const BasicRRset& source); BasicRRset& operator=(const BasicRRset& source); public: + /// \brief Constructor from (mostly) fixed parameters of the RRset. /// /// This constructor is normally expected to be exception free, but @@ -847,6 +854,7 @@ private: /// QNAME/QTYPE/QCLASS as a single object. class RRset : public BasicRRset { public: + /// \brief Constructor RRset(const Name& name, const RRClass& rrclass, const RRType& rrtype, const RRTTL& ttl); diff --git a/src/lib/dns/rrset_collection.h b/src/lib/dns/rrset_collection.h index 4f852e05b2..ba0306df4f 100644 --- a/src/lib/dns/rrset_collection.h +++ b/src/lib/dns/rrset_collection.h @@ -22,12 +22,13 @@ namespace dns { /// container. class RRsetCollection : public RRsetCollectionBase { public: + /// \brief Constructor. /// /// This constructor creates an empty collection without any data in /// it. RRsets can be added to the collection with the \c addRRset() /// method. - RRsetCollection() {} + RRsetCollection() = default; /// \brief Constructor. /// diff --git a/src/lib/dns/rrset_collection_base.h b/src/lib/dns/rrset_collection_base.h index e6ebcc651f..85ffa3d8d7 100644 --- a/src/lib/dns/rrset_collection_base.h +++ b/src/lib/dns/rrset_collection_base.h @@ -93,6 +93,9 @@ public: const isc::dns::RRType& rrtype) const = 0; + /// \brief Constructor + RRsetCollectionBase() = default; + /// \brief Destructor virtual ~RRsetCollectionBase() = default; @@ -112,6 +115,7 @@ protected: /// iterator only. class Iter { public: + /// @brief Constructor Iter() = default; diff --git a/src/lib/dns/tests/nsec3hash_unittest.cc b/src/lib/dns/tests/nsec3hash_unittest.cc index 58c56b9144..2fff8c71c1 100644 --- a/src/lib/dns/tests/nsec3hash_unittest.cc +++ b/src/lib/dns/tests/nsec3hash_unittest.cc @@ -32,6 +32,8 @@ const char* const nsec3_common = "2T7B4G4VSA5SMI47K61MV5BV1A22BOJR A RRSIG"; class NSEC3HashTest : public ::testing::Test { protected: + + /// @brief Constructor NSEC3HashTest() : test_hash(NSEC3Hash::create(generic::NSEC3PARAM("1 0 12 aabbccdd"))), test_hash_nsec3(NSEC3Hash::create(generic::NSEC3 @@ -42,6 +44,7 @@ protected: test_hash_args.reset(NSEC3Hash::create(1, 12, salt, sizeof(salt))); } + /// @brief Destructor ~NSEC3HashTest() { try { // Make sure we reset the hash creator to the default diff --git a/src/lib/dns/tests/rdatafields_unittest.cc b/src/lib/dns/tests/rdatafields_unittest.cc index a9cb076ea0..98b2ae356f 100644 --- a/src/lib/dns/tests/rdatafields_unittest.cc +++ b/src/lib/dns/tests/rdatafields_unittest.cc @@ -332,6 +332,7 @@ TEST_F(RdataFieldsTest, getFieldSpecWithBadFieldId) { class DummyRdata : public Rdata { public: enum Mode { CLEAR, SKIP, TRIM }; + /// @brief Constructor explicit DummyRdata(Mode mode) : mode_(mode) { } diff --git a/src/lib/dns/tests/tsig_unittest.cc b/src/lib/dns/tests/tsig_unittest.cc index ac80ceb593..aa0ec6cbfc 100644 --- a/src/lib/dns/tests/tsig_unittest.cc +++ b/src/lib/dns/tests/tsig_unittest.cc @@ -83,6 +83,7 @@ public: class TSIGTest : public ::testing::Test { protected: + /// @brief Constructor TSIGTest() : tsig_ctx(NULL), qid(0x2d65), test_name("www.example.com"), diff --git a/src/lib/dns/tests/unittest_util.cc b/src/lib/dns/tests/unittest_util.cc index fa276c8a8c..c3d756a690 100644 --- a/src/lib/dns/tests/unittest_util.cc +++ b/src/lib/dns/tests/unittest_util.cc @@ -28,6 +28,7 @@ using isc::UnitTestUtil; namespace { class UnitTestUtilConfig { private: + // This is a singleton object and cannot be constructed explicitly. /// @brief Constructor UnitTestUtilConfig() = default; @@ -37,6 +38,7 @@ private: /// @brief Destructor ~UnitTestUtilConfig() = default; + public: /// Return a singleton unit test configuration object. On first invocation /// one will be constructed. diff --git a/src/lib/dns/tsigkey.h b/src/lib/dns/tsigkey.h index 2b8e3d6cf2..dcadddaae1 100644 --- a/src/lib/dns/tsigkey.h +++ b/src/lib/dns/tsigkey.h @@ -55,6 +55,7 @@ class Name; /// and more intuitive representations (e.g. strings) for algorithms. class TSIGKey { public: + /// /// \name Constructors, Assignment Operator and Destructor. /// @@ -292,6 +293,7 @@ private: TSIGKeyRing(const TSIGKeyRing& source); TSIGKeyRing& operator=(const TSIGKeyRing& source); public: + /// \brief The default constructor. /// /// This constructor never throws an exception. diff --git a/src/lib/eval/token.h b/src/lib/eval/token.h index ac176fccfa..249702873a 100644 --- a/src/lib/eval/token.h +++ b/src/lib/eval/token.h @@ -77,6 +77,9 @@ public: /// @param values - stack of values with previously evaluated tokens virtual void evaluate(Pkt& pkt, ValueStack& values) = 0; + /// @brief Constructor + Token() = default; + /// @brief Virtual destructor virtual ~Token() = default; diff --git a/src/lib/exceptions/exceptions.h b/src/lib/exceptions/exceptions.h index c218517b94..bc2b022323 100644 --- a/src/lib/exceptions/exceptions.h +++ b/src/lib/exceptions/exceptions.h @@ -22,6 +22,7 @@ namespace isc { /// class Exception : public std::exception { public: + /// /// \name Constructors and Destructor /// diff --git a/src/lib/hooks/callout_handle.h b/src/lib/hooks/callout_handle.h index b9e018b7c0..26030c8c8b 100644 --- a/src/lib/hooks/callout_handle.h +++ b/src/lib/hooks/callout_handle.h @@ -89,7 +89,6 @@ public: NEXT_STEP_PARK = 3 ///< park the packet }; - /// Typedef to allow abbreviation of iterator specification in methods. /// The std::string is the argument name and the "boost::any" is the /// corresponding value associated with it. @@ -504,5 +503,4 @@ private: } // namespace hooks } // namespace isc - #endif // CALLOUT_HANDLE_H diff --git a/src/lib/hooks/library_manager.h b/src/lib/hooks/library_manager.h index f3a376fa62..bdc10584bb 100644 --- a/src/lib/hooks/library_manager.h +++ b/src/lib/hooks/library_manager.h @@ -72,6 +72,7 @@ class LibraryManager; class LibraryManager { public: + /// @brief Constructor /// /// This constructor is used by external agencies (i.e. the diff --git a/src/lib/hooks/library_manager_collection.h b/src/lib/hooks/library_manager_collection.h index d8c28c8e22..433fad912c 100644 --- a/src/lib/hooks/library_manager_collection.h +++ b/src/lib/hooks/library_manager_collection.h @@ -69,6 +69,7 @@ class LibraryManager; class LibraryManagerCollection { public: + /// @brief Constructor /// /// @param libraries List of libraries that this collection will manage. diff --git a/src/lib/hooks/tests/hooks_manager_unittest.cc b/src/lib/hooks/tests/hooks_manager_unittest.cc index 8838fc4f38..7009c16a42 100644 --- a/src/lib/hooks/tests/hooks_manager_unittest.cc +++ b/src/lib/hooks/tests/hooks_manager_unittest.cc @@ -36,6 +36,7 @@ namespace { class HooksManagerTest : public ::testing::Test, public HooksCommonTestClass { public: + /// @brief Constructor /// /// Reset the hooks manager. The hooks manager is a singleton, so needs @@ -1080,5 +1081,4 @@ TEST_F(HooksManagerTest, UnloadBeforeUnpark) { EXPECT_FALSE(unparked); } - } // Anonymous namespace diff --git a/src/lib/hooks/tests/library_manager_unittest.cc b/src/lib/hooks/tests/library_manager_unittest.cc index e9bbce4dd2..c0546d9eef 100644 --- a/src/lib/hooks/tests/library_manager_unittest.cc +++ b/src/lib/hooks/tests/library_manager_unittest.cc @@ -42,6 +42,7 @@ namespace { class LibraryManagerTest : public ::testing::Test, public HooksCommonTestClass { public: + /// @brief Constructor /// /// Initializes the CalloutManager object used in the tests. It sets it diff --git a/src/lib/http/basic_auth_config.h b/src/lib/http/basic_auth_config.h index 6d83a20608..dd80af4170 100644 --- a/src/lib/http/basic_auth_config.h +++ b/src/lib/http/basic_auth_config.h @@ -66,6 +66,7 @@ typedef std::list BasicHttpAuthClientList; /// @brief Basic HTTP authentication configuration. class BasicHttpAuthConfig : public HttpAuthConfig { public: + /// @brief Constructor BasicHttpAuthConfig() = default; diff --git a/src/lib/http/client.cc b/src/lib/http/client.cc index 379cba4dbe..050e806eef 100644 --- a/src/lib/http/client.cc +++ b/src/lib/http/client.cc @@ -808,6 +808,7 @@ private: /// @brief Encapsulates connections and requests for a given URL class Destination { public: + /// @brief Constructor /// /// @param url server URL of this destination @@ -1733,6 +1734,7 @@ namespace http { /// @brief HttpClient implementation. class HttpClientImpl { public: + /// @brief Constructor. /// /// If single-threading: diff --git a/src/lib/http/response_creator.h b/src/lib/http/response_creator.h index fb00ff1cc3..6369244cc3 100644 --- a/src/lib/http/response_creator.h +++ b/src/lib/http/response_creator.h @@ -37,6 +37,7 @@ typedef boost::shared_ptr HttpResponseCreatorPtr; /// @c createHttpResponse method. class HttpResponseCreator { public: + /// @brief Constructor. HttpResponseCreator() = default; diff --git a/src/lib/http/response_creator_factory.h b/src/lib/http/response_creator_factory.h index e8c0f91f65..e7348894c3 100644 --- a/src/lib/http/response_creator_factory.h +++ b/src/lib/http/response_creator_factory.h @@ -34,6 +34,7 @@ namespace http { /// if creating new instance for each request is not required or undesired. class HttpResponseCreatorFactory { public: + /// @brief Constructor. HttpResponseCreatorFactory() = default; diff --git a/src/lib/http/tests/http_thread_pool_unittests.cc b/src/lib/http/tests/http_thread_pool_unittests.cc index 610c282cc0..cf623e7e9a 100644 --- a/src/lib/http/tests/http_thread_pool_unittests.cc +++ b/src/lib/http/tests/http_thread_pool_unittests.cc @@ -27,6 +27,7 @@ const long TEST_TIMEOUT = 10000; /// @brief Simple test fixture for testing HttpThreadPool. class HttpThreadPoolTest : public ::testing::Test { public: + /// @brief Constructor. HttpThreadPoolTest() : io_service_(new IOService()) { -- GitLab From d0a9b7555ec484a6734735e9d7d7d074f20211a2 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Thu, 3 Jun 2021 20:59:59 +0300 Subject: [PATCH 6/6] [#1845] code cleanup --- src/lib/log/buffer_appender_impl.h | 4 +++- src/lib/log/interprocess/interprocess_sync.h | 2 ++ src/lib/log/interprocess/interprocess_sync_file.h | 1 + src/lib/log/interprocess/interprocess_sync_null.h | 1 + src/lib/log/log_formatter.h | 2 +- src/lib/log/logger.h | 1 - src/lib/log/logger_impl.h | 4 ---- src/lib/log/logger_manager.h | 2 +- src/lib/log/message_reader.h | 2 -- src/lib/log/tests/buffer_appender_unittest.cc | 1 + src/lib/log/tests/logger_level_impl_unittest.cc | 1 + src/lib/log/tests/logger_level_unittest.cc | 1 + src/lib/log/tests/logger_manager_unittest.cc | 2 ++ src/lib/log/tests/logger_support_unittest.cc | 1 + src/lib/log/tests/logger_unittest.cc | 1 + src/lib/log/tests/message_reader_unittest.cc | 1 + src/lib/mysql/tests/mysql_connection_unittest.cc | 2 ++ src/lib/pgsql/pgsql_connection.h | 1 + src/lib/pgsql/pgsql_exchange.h | 1 + src/lib/pgsql/tests/pgsql_exchange_unittest.cc | 2 +- src/lib/process/d_cfg_mgr.h | 1 + src/lib/process/d_controller.h | 1 + src/lib/process/d_process.h | 1 + src/lib/process/daemon.h | 2 +- src/lib/process/tests/d_cfg_mgr_unittests.cc | 1 + src/lib/process/tests/daemon_unittest.cc | 3 ++- src/lib/process/tests/log_parser_unittests.cc | 2 +- src/lib/process/tests/logging_info_unittests.cc | 1 + src/lib/process/testutils/d_test_stubs.h | 3 +++ src/lib/stats/tests/stats_mgr_unittest.cc | 1 + src/lib/testutils/sandbox.h | 6 +++--- src/lib/testutils/unix_control_client.cc | 6 +++--- src/lib/testutils/unix_control_client.h | 6 +++--- src/lib/util/buffer.h | 1 + src/lib/util/csv_file.cc | 1 - src/lib/util/io/socketsession.cc | 1 + src/lib/util/io/socketsession.h | 7 +++++-- src/lib/util/memory_segment.h | 1 + src/lib/util/memory_segment_local.h | 1 + src/lib/util/pid_file.h | 1 + src/lib/util/state_model.h | 2 ++ src/lib/util/strutil.cc | 1 + src/lib/util/tests/pid_file_unittest.cc | 2 ++ src/lib/util/tests/random_number_generator_unittest.cc | 2 ++ src/lib/util/tests/state_model_unittest.cc | 1 + src/lib/util/tests/time_utilities_unittest.cc | 1 + src/lib/util/thread_pool.h | 1 + src/lib/util/unlock_guard.h | 1 + src/lib/util/versioned_csv_file.h | 2 +- src/lib/yang/adaptor.h | 4 ++-- src/lib/yang/adaptor_config.h | 4 ++-- src/lib/yang/adaptor_host.h | 4 ++-- src/lib/yang/adaptor_option.h | 4 ++-- src/lib/yang/adaptor_pool.h | 4 ++-- src/lib/yang/adaptor_subnet.h | 4 ++-- src/lib/yang/tests/config_unittests.cc | 2 +- src/lib/yang/tests/translator_class_unittests.cc | 2 +- src/lib/yang/tests/translator_control_socket_unittests.cc | 2 +- src/lib/yang/tests/translator_database_unittests.cc | 2 +- src/lib/yang/tests/translator_host_unittests.cc | 2 +- src/lib/yang/tests/translator_logger_unittests.cc | 2 +- src/lib/yang/tests/translator_option_data_unittests.cc | 2 +- src/lib/yang/tests/translator_option_def_unittests.cc | 2 +- src/lib/yang/tests/translator_pd_pool_unittests.cc | 2 +- src/lib/yang/tests/translator_pool_unittests.cc | 2 +- src/lib/yang/tests/translator_shared_network_unittests.cc | 2 +- src/lib/yang/tests/translator_subnet_unittests.cc | 2 +- src/lib/yang/translator.h | 4 ++-- src/lib/yang/translator_class.h | 4 ++-- src/lib/yang/translator_config.h | 4 ++-- src/lib/yang/translator_control_socket.h | 4 ++-- src/lib/yang/translator_database.h | 4 ++-- src/lib/yang/translator_host.h | 4 ++-- src/lib/yang/translator_logger.h | 4 ++-- src/lib/yang/translator_option_data.h | 4 ++-- src/lib/yang/translator_option_def.h | 4 ++-- src/lib/yang/translator_pd_pool.h | 4 ++-- src/lib/yang/translator_pool.h | 4 ++-- src/lib/yang/translator_shared_network.h | 4 ++-- src/lib/yang/translator_subnet.h | 4 ++-- 80 files changed, 116 insertions(+), 77 deletions(-) diff --git a/src/lib/log/buffer_appender_impl.h b/src/lib/log/buffer_appender_impl.h index 10290b5bd6..cbaa8ce5c5 100644 --- a/src/lib/log/buffer_appender_impl.h +++ b/src/lib/log/buffer_appender_impl.h @@ -64,10 +64,12 @@ typedef std::vector LogEventList; /// it will dump any event it has left to stdout. class BufferAppender : public log4cplus::Appender { public: + /// \brief Constructor /// /// Constructs a BufferAppender that buffers log evens - BufferAppender() : flushed_(false) {} + BufferAppender() : flushed_(false) { + } /// \brief Destructor /// diff --git a/src/lib/log/interprocess/interprocess_sync.h b/src/lib/log/interprocess/interprocess_sync.h index f510c13ec5..6f8f7965a3 100644 --- a/src/lib/log/interprocess/interprocess_sync.h +++ b/src/lib/log/interprocess/interprocess_sync.h @@ -42,6 +42,7 @@ class InterprocessSync { friend class InterprocessSyncLocker; public: + /// \brief Constructor /// /// Creates an interprocess synchronization object @@ -85,6 +86,7 @@ protected: /// the description of InterprocessSync. class InterprocessSyncLocker { public: + /// \brief Constructor /// /// Creates a lock manager around a interprocess synchronization object diff --git a/src/lib/log/interprocess/interprocess_sync_file.h b/src/lib/log/interprocess/interprocess_sync_file.h index 9613e7f18e..722d8c7c49 100644 --- a/src/lib/log/interprocess/interprocess_sync_file.h +++ b/src/lib/log/interprocess/interprocess_sync_file.h @@ -41,6 +41,7 @@ public: /// processes may have locks on them. class InterprocessSyncFile : public InterprocessSync { public: + /// \brief Constructor /// /// Creates a file-based interprocess synchronization object diff --git a/src/lib/log/interprocess/interprocess_sync_null.h b/src/lib/log/interprocess/interprocess_sync_null.h index 461dc4d48e..fcc94f7681 100644 --- a/src/lib/log/interprocess/interprocess_sync_null.h +++ b/src/lib/log/interprocess/interprocess_sync_null.h @@ -20,6 +20,7 @@ namespace interprocess { /// InterprocessSync class documentation for usage. class InterprocessSyncNull : public InterprocessSync { public: + /// \brief Constructor /// /// Creates a null interprocess synchronization object diff --git a/src/lib/log/log_formatter.h b/src/lib/log/log_formatter.h index be51d7188a..d9bec1833b 100644 --- a/src/lib/log/log_formatter.h +++ b/src/lib/log/log_formatter.h @@ -118,8 +118,8 @@ private: /// \brief Which will be the next placeholder to replace unsigned nextPlaceholder_; - public: + /// \brief Constructor of "active" formatter /// /// This will create a formatter. If the arguments are set, it diff --git a/src/lib/log/logger.h b/src/lib/log/logger.h index 5983b2450b..77cb7a2ea3 100644 --- a/src/lib/log/logger.h +++ b/src/lib/log/logger.h @@ -357,5 +357,4 @@ private: } // namespace log } // namespace isc - #endif // LOGGER_H diff --git a/src/lib/log/logger_impl.h b/src/lib/log/logger_impl.h index b41bbcb16f..4ccf515e47 100644 --- a/src/lib/log/logger_impl.h +++ b/src/lib/log/logger_impl.h @@ -65,7 +65,6 @@ public: /// \param name Name of the logger. LoggerImpl(const std::string& name); - /// \brief Destructor virtual ~LoggerImpl(); @@ -73,13 +72,11 @@ public: /// \brief Version static std::string getVersion(); - /// \brief Get the full name of the logger (including the root name) virtual std::string getName() { return (name_); } - /// \brief Set Severity Level for Logger /// /// Sets the level at which this logger will log messages. If none is set, @@ -196,5 +193,4 @@ private: } // namespace log } // namespace isc - #endif // LOGGER_IMPL_H diff --git a/src/lib/log/logger_manager.h b/src/lib/log/logger_manager.h index 1ddea6dd01..6640a0a4c4 100644 --- a/src/lib/log/logger_manager.h +++ b/src/lib/log/logger_manager.h @@ -38,6 +38,7 @@ class LoggerManagerImpl; class LoggerManager : public boost::noncopyable { public: + /// \brief Constructor LoggerManager(); @@ -169,5 +170,4 @@ private: } // namespace log } // namespace isc - #endif // LOGGER_MANAGER_H diff --git a/src/lib/log/message_reader.h b/src/lib/log/message_reader.h index 518ff72029..9d813a85ba 100644 --- a/src/lib/log/message_reader.h +++ b/src/lib/log/message_reader.h @@ -190,8 +190,6 @@ private: /// \return true if the name is invalid, false if it is valid. bool invalidSymbol(const std::string& symbol); - - /// Attributes MessageDictionary* dictionary_; ///< Dictionary to add messages to MessageIDCollection not_added_; ///< List of IDs not added diff --git a/src/lib/log/tests/buffer_appender_unittest.cc b/src/lib/log/tests/buffer_appender_unittest.cc index 50424127c0..da2f626820 100644 --- a/src/lib/log/tests/buffer_appender_unittest.cc +++ b/src/lib/log/tests/buffer_appender_unittest.cc @@ -36,6 +36,7 @@ public: class BufferAppenderTest : public ::testing::Test { protected: + /// @brief Constructor BufferAppenderTest() : buffer_appender1(new TestBufferAppender()), appender1(buffer_appender1), diff --git a/src/lib/log/tests/logger_level_impl_unittest.cc b/src/lib/log/tests/logger_level_impl_unittest.cc index 8279cbf059..9e9c721e13 100644 --- a/src/lib/log/tests/logger_level_impl_unittest.cc +++ b/src/lib/log/tests/logger_level_impl_unittest.cc @@ -22,6 +22,7 @@ using namespace std; class LoggerLevelImplTest : public ::testing::Test { protected: + /// @brief Constructor LoggerLevelImplTest() { // Ensure logging set to default for unit tests diff --git a/src/lib/log/tests/logger_level_unittest.cc b/src/lib/log/tests/logger_level_unittest.cc index 5af2fe8221..d7cf415d66 100644 --- a/src/lib/log/tests/logger_level_unittest.cc +++ b/src/lib/log/tests/logger_level_unittest.cc @@ -22,6 +22,7 @@ using namespace std; class LoggerLevelTest : public ::testing::Test { protected: + /// @brief Constructor LoggerLevelTest() { // Logger initialization is done in main(). As logging tests may diff --git a/src/lib/log/tests/logger_manager_unittest.cc b/src/lib/log/tests/logger_manager_unittest.cc index 05e62056f1..674f81e508 100644 --- a/src/lib/log/tests/logger_manager_unittest.cc +++ b/src/lib/log/tests/logger_manager_unittest.cc @@ -41,6 +41,7 @@ using namespace std; /// \brief LoggerManager Test class LoggerManagerTest : public ::testing::Test { public: + /// @brief Constructor LoggerManagerTest() { // Initialization of logging is done in main() @@ -335,6 +336,7 @@ namespace { // begin unnamed namespace class RegexHolder { public: + /// @brief Constructor RegexHolder(const char* expr, const int flags = REG_EXTENDED) { const int rc = regcomp(®ex_, expr, flags); diff --git a/src/lib/log/tests/logger_support_unittest.cc b/src/lib/log/tests/logger_support_unittest.cc index 6ad14d2409..4d072b5f13 100644 --- a/src/lib/log/tests/logger_support_unittest.cc +++ b/src/lib/log/tests/logger_support_unittest.cc @@ -14,6 +14,7 @@ using namespace isc::log; class LoggerSupportTest : public ::testing::Test { protected: + /// @brief Constructor LoggerSupportTest() { // Logger initialization is done in main(). As logging tests may diff --git a/src/lib/log/tests/logger_unittest.cc b/src/lib/log/tests/logger_unittest.cc index 5b76933ba5..65cd35bf36 100644 --- a/src/lib/log/tests/logger_unittest.cc +++ b/src/lib/log/tests/logger_unittest.cc @@ -32,6 +32,7 @@ using namespace std; class LoggerTest : public ::testing::Test { public: + /// @brief Constructor LoggerTest() { // Initialization of logging is done in main() diff --git a/src/lib/log/tests/message_reader_unittest.cc b/src/lib/log/tests/message_reader_unittest.cc index a6fd1cf265..8800312b39 100644 --- a/src/lib/log/tests/message_reader_unittest.cc +++ b/src/lib/log/tests/message_reader_unittest.cc @@ -21,6 +21,7 @@ using namespace std; class MessageReaderTest : public ::testing::Test { protected: + /// @brief Constructor MessageReaderTest() : dictionary_(), reader_() { dictionary_ = new MessageDictionary(); diff --git a/src/lib/mysql/tests/mysql_connection_unittest.cc b/src/lib/mysql/tests/mysql_connection_unittest.cc index a9248a82b3..c21db726a5 100644 --- a/src/lib/mysql/tests/mysql_connection_unittest.cc +++ b/src/lib/mysql/tests/mysql_connection_unittest.cc @@ -20,6 +20,7 @@ namespace { /// @brief RAII wrapper over MYSQL_RES obtained from MySQL library functions like /// mysql_use_result(). struct MySqlResult { + /// @brief Constructor MySqlResult(MYSQL_RES* result) : result_(result) { } @@ -577,6 +578,7 @@ TEST_F(MySqlConnectionWithPrimaryKeyTest, deleteByValue) { /// @brief Test fixture class for @c MySqlConnection class methods. class MySqlSchemaTest : public ::testing::Test { public: + /// @brief Constructor. MySqlSchemaTest() { // Ensure we have the proper schema. diff --git a/src/lib/pgsql/pgsql_connection.h b/src/lib/pgsql/pgsql_connection.h index ba7253f952..99bbd6b31a 100644 --- a/src/lib/pgsql/pgsql_connection.h +++ b/src/lib/pgsql/pgsql_connection.h @@ -85,6 +85,7 @@ const size_t OID_TIMESTAMP = 1114; class PgSqlResult : public boost::noncopyable { public: + /// @brief Constructor /// /// Store the pointer to the result set to being fetched. Set row diff --git a/src/lib/pgsql/pgsql_exchange.h b/src/lib/pgsql/pgsql_exchange.h index bd69e91037..cca4db5175 100644 --- a/src/lib/pgsql/pgsql_exchange.h +++ b/src/lib/pgsql/pgsql_exchange.h @@ -197,6 +197,7 @@ typedef boost::shared_ptr PsqlBindArrayPtr; /// database, and for retrieving column values from rows of a result set. class PgSqlExchange { public: + /// @brief Constructor PgSqlExchange(const size_t num_columns = 0) : columns_(num_columns) { } diff --git a/src/lib/pgsql/tests/pgsql_exchange_unittest.cc b/src/lib/pgsql/tests/pgsql_exchange_unittest.cc index 00f087d2f6..945b36bb6b 100644 --- a/src/lib/pgsql/tests/pgsql_exchange_unittest.cc +++ b/src/lib/pgsql/tests/pgsql_exchange_unittest.cc @@ -923,4 +923,4 @@ TEST_F(PgSqlBasicsTest, timeStampTest) { MAX_DB_TIME), BadValue); } -}; // namespace +} // namespace diff --git a/src/lib/process/d_cfg_mgr.h b/src/lib/process/d_cfg_mgr.h index a9d8d8eee0..71d3ff51e8 100644 --- a/src/lib/process/d_cfg_mgr.h +++ b/src/lib/process/d_cfg_mgr.h @@ -107,6 +107,7 @@ public: /// for example use of this approach. class DCfgMgrBase { public: + /// @brief Constructor /// /// @param context is a pointer to the configuration context the manager diff --git a/src/lib/process/d_controller.h b/src/lib/process/d_controller.h index 4423219983..9c4f342a2c 100644 --- a/src/lib/process/d_controller.h +++ b/src/lib/process/d_controller.h @@ -103,6 +103,7 @@ typedef boost::shared_ptr DControllerBasePtr; /// member in order for it to be available for static callback functions. class DControllerBase : public Daemon { public: + /// @brief Constructor /// /// @param app_name is display name of the application under control. This diff --git a/src/lib/process/d_process.h b/src/lib/process/d_process.h index 7eb47b9f2c..acd5853d61 100644 --- a/src/lib/process/d_process.h +++ b/src/lib/process/d_process.h @@ -80,6 +80,7 @@ static const int COMMAND_INVALID = 2; /// application. class DProcessBase { public: + /// @brief Constructor /// /// @param app_name is a text label for the process. Generally used diff --git a/src/lib/process/daemon.h b/src/lib/process/daemon.h index d64445a77c..ed0d9823a8 100644 --- a/src/lib/process/daemon.h +++ b/src/lib/process/daemon.h @@ -46,8 +46,8 @@ public: /// the whole operation of the server. Nothing, however, enforces the /// singleton status of the object. class Daemon : public boost::noncopyable { - public: + /// @brief Default constructor /// /// Initializes the object installing custom signal handlers for the diff --git a/src/lib/process/tests/d_cfg_mgr_unittests.cc b/src/lib/process/tests/d_cfg_mgr_unittests.cc index dc1420d3c3..967d3f8b79 100644 --- a/src/lib/process/tests/d_cfg_mgr_unittests.cc +++ b/src/lib/process/tests/d_cfg_mgr_unittests.cc @@ -31,6 +31,7 @@ namespace { /// during construction. class DCtorTestCfgMgr : public DCfgMgrBase { public: + /// @brief Constructor - Note that is passes in an empty configuration /// pointer to the base class constructor. DCtorTestCfgMgr() : DCfgMgrBase(ConfigPtr()) { diff --git a/src/lib/process/tests/daemon_unittest.cc b/src/lib/process/tests/daemon_unittest.cc index d2fea0ba72..a9b09fa7d5 100644 --- a/src/lib/process/tests/daemon_unittest.cc +++ b/src/lib/process/tests/daemon_unittest.cc @@ -48,6 +48,7 @@ namespace { /// @brief Daemon Test test fixture class class DaemonTest : public ::testing::Test { public: + /// @brief Constructor DaemonTest() : env_copy_() { // Take a copy of KEA_PIDFILE_DIR environment variable value @@ -324,4 +325,4 @@ TEST_F(DaemonTest, exitValue) { // More tests will appear here as we develop Daemon class. -}; +} diff --git a/src/lib/process/tests/log_parser_unittests.cc b/src/lib/process/tests/log_parser_unittests.cc index 6d12801a28..487f7c0d98 100644 --- a/src/lib/process/tests/log_parser_unittests.cc +++ b/src/lib/process/tests/log_parser_unittests.cc @@ -465,4 +465,4 @@ TEST_F(LoggingTest, emptyPattern) { /// check if the file is indeed created or configure stdout destination, then /// swap console file descriptors and check that messages are really logged. -}; +} diff --git a/src/lib/process/tests/logging_info_unittests.cc b/src/lib/process/tests/logging_info_unittests.cc index 091c8df9a9..f2b7531d97 100644 --- a/src/lib/process/tests/logging_info_unittests.cc +++ b/src/lib/process/tests/logging_info_unittests.cc @@ -50,6 +50,7 @@ TEST(LoggingDestination, equals) { /// @brief Test fixture class for testing @c LoggingInfo. class LoggingInfoTest : public ::testing::Test { public: + /// @brief Constructor LoggingInfoTest() = default; diff --git a/src/lib/process/testutils/d_test_stubs.h b/src/lib/process/testutils/d_test_stubs.h index 421a6419a1..9873aebfa1 100644 --- a/src/lib/process/testutils/d_test_stubs.h +++ b/src/lib/process/testutils/d_test_stubs.h @@ -290,6 +290,7 @@ public: } private: + /// @brief Constructor is private to protect singleton integrity. DStubController(); @@ -303,6 +304,7 @@ private: bool use_alternate_parser_; public: + /// @brief Destructor virtual ~DStubController() = default; }; @@ -645,6 +647,7 @@ typedef boost::shared_ptr DStubContextPtr; /// are parsed. This is used to test ordered and non-ordered parsing. class DStubCfgMgr : public DCfgMgrBase { public: + /// @brief Constructor DStubCfgMgr(); diff --git a/src/lib/stats/tests/stats_mgr_unittest.cc b/src/lib/stats/tests/stats_mgr_unittest.cc index 61c005d45e..104e2dd649 100644 --- a/src/lib/stats/tests/stats_mgr_unittest.cc +++ b/src/lib/stats/tests/stats_mgr_unittest.cc @@ -37,6 +37,7 @@ static const StatsDuration& dur1245(hours(1) + minutes(2) + seconds(45)); /// before the test and any statistics are wiped out after it. class StatsMgrTest : public ::testing::Test { public: + /// @brief Constructor /// /// Makes sure that the Statistics Manager is instantiated. diff --git a/src/lib/testutils/sandbox.h b/src/lib/testutils/sandbox.h index 2ce1ea20ae..056a71dfb7 100644 --- a/src/lib/testutils/sandbox.h +++ b/src/lib/testutils/sandbox.h @@ -38,6 +38,7 @@ private: } public: + /// @brief Sandbox constructor. Sandbox() { char tmpl[] = {P_tmpdir "/kea-XXXXXX"}; @@ -65,8 +66,7 @@ public: } }; - -}; // end of isc::test namespace -}; // end of isc namespace +} // end of isc::test namespace +} // end of isc namespace #endif // SANDBOX_H diff --git a/src/lib/testutils/unix_control_client.cc b/src/lib/testutils/unix_control_client.cc index 4dce8696d0..779071e85e 100644 --- a/src/lib/testutils/unix_control_client.cc +++ b/src/lib/testutils/unix_control_client.cc @@ -137,6 +137,6 @@ int UnixControlClient::selectCheck(const unsigned int timeout_sec) { return (select(maxfd + 1, &read_fds, NULL, NULL, &select_timeout)); } -}; -}; -}; +} +} +} diff --git a/src/lib/testutils/unix_control_client.h b/src/lib/testutils/unix_control_client.h index 225c9491bf..28390b488b 100644 --- a/src/lib/testutils/unix_control_client.h +++ b/src/lib/testutils/unix_control_client.h @@ -59,8 +59,8 @@ public: int socket_fd_; }; -}; // end of isc::dhcp::test namespace -}; // end of isc::dhcp namespace -}; // end of isc namespace +} // end of isc::dhcp::test namespace +} // end of isc::dhcp namespace +} // end of isc namespace #endif // UNIX_CONTROL_CLIENT_H diff --git a/src/lib/util/buffer.h b/src/lib/util/buffer.h index 73d6a227e4..48c8d530de 100644 --- a/src/lib/util/buffer.h +++ b/src/lib/util/buffer.h @@ -293,6 +293,7 @@ protected: /// the \c InputBuffer and \c MessageRenderer classes. class OutputBuffer { public: + /// /// \name Constructors and Destructor /// diff --git a/src/lib/util/csv_file.cc b/src/lib/util/csv_file.cc index f74a90b8f0..cf45932fc0 100644 --- a/src/lib/util/csv_file.cc +++ b/src/lib/util/csv_file.cc @@ -555,6 +555,5 @@ CSVRow::unescapeCharacters(const std::string& escaped_str) { return(ss.str()); } - } // end of isc::util namespace } // end of isc namespace diff --git a/src/lib/util/io/socketsession.cc b/src/lib/util/io/socketsession.cc index b391070522..85a2ed3627 100644 --- a/src/lib/util/io/socketsession.cc +++ b/src/lib/util/io/socketsession.cc @@ -335,6 +335,7 @@ readFail(int actual_len, int expected_len) { // SocketSessionReceiver::pop that ensures the socket is closed unless it // can be safely passed to the caller via release(). struct ScopedSocket : boost::noncopyable { + /// @brief Constructor ScopedSocket(int fd) : fd_(fd) { } diff --git a/src/lib/util/io/socketsession.h b/src/lib/util/io/socketsession.h index 49f692a760..08dd85fa47 100644 --- a/src/lib/util/io/socketsession.h +++ b/src/lib/util/io/socketsession.h @@ -171,10 +171,12 @@ public: /// See description of \c SocketSessionForwarder for the expected interface. class BaseSocketSessionForwarder { protected: + /// @brief Constructor BaseSocketSessionForwarder() = default; public: + /// @brief Destructor virtual ~BaseSocketSessionForwarder() = default; @@ -195,9 +197,9 @@ public: /// See the description of \ref SocketSessionUtility for other details of how /// the session forwarding works. class SocketSessionForwarder : boost::noncopyable, - public BaseSocketSessionForwarder -{ + public BaseSocketSessionForwarder { public: + /// The constructor. /// /// It's constructed with path information of the intended receiver, @@ -424,6 +426,7 @@ private: /// the session forwarding works. class SocketSessionReceiver : boost::noncopyable { public: + /// The constructor. /// /// \exception SocketSessionError Any error on an operation that is diff --git a/src/lib/util/memory_segment.h b/src/lib/util/memory_segment.h index f14bb35010..34acce6794 100644 --- a/src/lib/util/memory_segment.h +++ b/src/lib/util/memory_segment.h @@ -53,6 +53,7 @@ public: /// MemorySegmentLocal should be used in code. class MemorySegment { public: + /// \brief Constructor MemorySegment() = default; diff --git a/src/lib/util/memory_segment_local.h b/src/lib/util/memory_segment_local.h index eda19ba716..9b582a50a7 100644 --- a/src/lib/util/memory_segment_local.h +++ b/src/lib/util/memory_segment_local.h @@ -22,6 +22,7 @@ namespace util { /// documentation for usage. class MemorySegmentLocal : public MemorySegment { public: + /// \brief Constructor /// /// Creates a local memory segment object diff --git a/src/lib/util/pid_file.h b/src/lib/util/pid_file.h index 73fc57cf52..d4df0b0949 100644 --- a/src/lib/util/pid_file.h +++ b/src/lib/util/pid_file.h @@ -39,6 +39,7 @@ public: /// process is still running. class PIDFile { public: + /// @brief Constructor /// /// @param filename PID filename. diff --git a/src/lib/util/state_model.h b/src/lib/util/state_model.h index 2574f2faef..ad1329b667 100644 --- a/src/lib/util/state_model.h +++ b/src/lib/util/state_model.h @@ -60,6 +60,7 @@ enum StatePausing { /// the state model should be paused when entering this state. class State : public LabeledValue { public: + /// @brief Constructor /// /// @param value is the numeric value of the state @@ -117,6 +118,7 @@ typedef boost::shared_ptr StatePtr; /// text labels, and their handlers. class StateSet : public LabeledValueSet { public: + /// @brief Constructor StateSet() = default; diff --git a/src/lib/util/strutil.cc b/src/lib/util/strutil.cc index a685786781..5396eef6a0 100644 --- a/src/lib/util/strutil.cc +++ b/src/lib/util/strutil.cc @@ -309,6 +309,7 @@ decodeFormattedHexString(const std::string& hex_string, class StringSanitizerImpl { public: + /// @brief Constructor StringSanitizerImpl(const std::string& char_set, const std::string& char_replacement) : char_set_(char_set), char_replacement_(char_replacement) { diff --git a/src/lib/util/tests/pid_file_unittest.cc b/src/lib/util/tests/pid_file_unittest.cc index 8f7b78bd9e..f4c0d47367 100644 --- a/src/lib/util/tests/pid_file_unittest.cc +++ b/src/lib/util/tests/pid_file_unittest.cc @@ -20,6 +20,7 @@ const char* TESTNAME = "pid_file.test"; class PIDFileTest : public ::testing::Test { public: + /// @brief Constructor PIDFileTest() = default; @@ -202,4 +203,5 @@ TEST_F(PIDFileTest, noDeleteFile) { // Delete a file we haven't created pid_file.deleteFile(); } + } // end of anonymous namespace diff --git a/src/lib/util/tests/random_number_generator_unittest.cc b/src/lib/util/tests/random_number_generator_unittest.cc index b0edc288d5..d1194ecde2 100644 --- a/src/lib/util/tests/random_number_generator_unittest.cc +++ b/src/lib/util/tests/random_number_generator_unittest.cc @@ -27,6 +27,7 @@ using namespace std; /// Or maybe we can trust the boost implementation class UniformRandomIntegerGeneratorTest : public ::testing::Test { public: + /// @brief Constructor UniformRandomIntegerGeneratorTest() : gen_(min_, max_) { } @@ -80,6 +81,7 @@ TEST_F(UniformRandomIntegerGeneratorTest, IntegerRange) { /// \brief Test Fixture Class for weighted random number generator class WeightedRandomIntegerGeneratorTest : public ::testing::Test { public: + /// @brief Constructor WeightedRandomIntegerGeneratorTest() = default; diff --git a/src/lib/util/tests/state_model_unittest.cc b/src/lib/util/tests/state_model_unittest.cc index bc4860ab39..dc6fd6c056 100644 --- a/src/lib/util/tests/state_model_unittest.cc +++ b/src/lib/util/tests/state_model_unittest.cc @@ -69,6 +69,7 @@ public: StateModelTest() : dummy_called_(false), work_completed_(false), failure_explanation_("") { } + /// @brief Destructor virtual ~StateModelTest() = default; diff --git a/src/lib/util/tests/time_utilities_unittest.cc b/src/lib/util/tests/time_utilities_unittest.cc index 892f48e0e6..14412f9aaa 100644 --- a/src/lib/util/tests/time_utilities_unittest.cc +++ b/src/lib/util/tests/time_utilities_unittest.cc @@ -30,6 +30,7 @@ namespace { class DNSSECTimeTest : public ::testing::Test { protected: + /// @brief Constructor DNSSECTimeTest() = default; diff --git a/src/lib/util/thread_pool.h b/src/lib/util/thread_pool.h index 9b979d2b7d..ae89f35c7c 100644 --- a/src/lib/util/thread_pool.h +++ b/src/lib/util/thread_pool.h @@ -239,6 +239,7 @@ private: /// @tparam QueueContainer a 'queue like' container template > struct ThreadPoolQueue { + /// @brief Constructor /// /// Creates the thread pool queue in 'disabled' state diff --git a/src/lib/util/unlock_guard.h b/src/lib/util/unlock_guard.h index b1d0f29281..86e6f008cc 100644 --- a/src/lib/util/unlock_guard.h +++ b/src/lib/util/unlock_guard.h @@ -20,6 +20,7 @@ namespace util { template class UnlockGuard : public boost::noncopyable { public: + /// @brief Constructor. /// /// Unlock mutex object on constructor. diff --git a/src/lib/util/versioned_csv_file.h b/src/lib/util/versioned_csv_file.h index 53a2ed9b4c..7bc6f4286c 100644 --- a/src/lib/util/versioned_csv_file.h +++ b/src/lib/util/versioned_csv_file.h @@ -22,6 +22,7 @@ public: /// @brief Contains the metadata for a single column in a file. class VersionedColumn { public: + /// @brief Constructor /// /// @param name Name of the column. @@ -310,7 +311,6 @@ private: enum InputSchemaState input_schema_state_; }; - } // namespace isc::util } // namespace isc diff --git a/src/lib/yang/adaptor.h b/src/lib/yang/adaptor.h index 1b955a368b..9ba7c7cee6 100644 --- a/src/lib/yang/adaptor.h +++ b/src/lib/yang/adaptor.h @@ -127,7 +127,7 @@ public: }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_ADAPTOR_H diff --git a/src/lib/yang/adaptor_config.h b/src/lib/yang/adaptor_config.h index 2992537ae1..4e713249b8 100644 --- a/src/lib/yang/adaptor_config.h +++ b/src/lib/yang/adaptor_config.h @@ -287,7 +287,7 @@ protected: const std::string& space); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_ADAPTOR_CONFIG_H diff --git a/src/lib/yang/adaptor_host.h b/src/lib/yang/adaptor_host.h index 33b5ad548d..721e7071d7 100644 --- a/src/lib/yang/adaptor_host.h +++ b/src/lib/yang/adaptor_host.h @@ -41,7 +41,7 @@ public: static void quoteIdentifier(isc::data::ElementPtr host); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_ADAPTOR_HOST_H diff --git a/src/lib/yang/adaptor_option.h b/src/lib/yang/adaptor_option.h index 0535c1b8b6..2e0ae004dc 100644 --- a/src/lib/yang/adaptor_option.h +++ b/src/lib/yang/adaptor_option.h @@ -105,7 +105,7 @@ protected: size_t params_size); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_ADAPTOR_OPTION_H diff --git a/src/lib/yang/adaptor_pool.h b/src/lib/yang/adaptor_pool.h index 27df546780..df2163e9af 100644 --- a/src/lib/yang/adaptor_pool.h +++ b/src/lib/yang/adaptor_pool.h @@ -92,7 +92,7 @@ protected: isc::data::ConstElementPtr pools); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_ADAPTOR_POOL_H diff --git a/src/lib/yang/adaptor_subnet.h b/src/lib/yang/adaptor_subnet.h index 64071c3463..a84786a0cf 100644 --- a/src/lib/yang/adaptor_subnet.h +++ b/src/lib/yang/adaptor_subnet.h @@ -60,7 +60,7 @@ public: static void updateRelay(isc::data::ElementPtr subnet); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_ADAPTOR_SUBNET_H diff --git a/src/lib/yang/tests/config_unittests.cc b/src/lib/yang/tests/config_unittests.cc index 531fa18d04..0f11d12539 100644 --- a/src/lib/yang/tests/config_unittests.cc +++ b/src/lib/yang/tests/config_unittests.cc @@ -430,4 +430,4 @@ TEST_F(ConfigTest, designExample) { EXPECT_TRUE(verify(designExampleTree)); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_class_unittests.cc b/src/lib/yang/tests/translator_class_unittests.cc index 2a57275a9c..60672eb87e 100644 --- a/src/lib/yang/tests/translator_class_unittests.cc +++ b/src/lib/yang/tests/translator_class_unittests.cc @@ -145,4 +145,4 @@ TEST_F(TranslatorClassesTest, set) { EXPECT_NO_THROW(sess_->validate()); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_control_socket_unittests.cc b/src/lib/yang/tests/translator_control_socket_unittests.cc index 8f10177589..de05e933bf 100644 --- a/src/lib/yang/tests/translator_control_socket_unittests.cc +++ b/src/lib/yang/tests/translator_control_socket_unittests.cc @@ -153,4 +153,4 @@ TEST_F(TranslatorControlSocketTest, setEmpty) { EXPECT_FALSE(sock); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_database_unittests.cc b/src/lib/yang/tests/translator_database_unittests.cc index b6e387c69c..a00090cee5 100644 --- a/src/lib/yang/tests/translator_database_unittests.cc +++ b/src/lib/yang/tests/translator_database_unittests.cc @@ -343,4 +343,4 @@ TEST_F(TranslatorDatabasesTest, setEmpties) { EXPECT_FALSE(databases); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_host_unittests.cc b/src/lib/yang/tests/translator_host_unittests.cc index 84d2093d2c..b7677344ab 100644 --- a/src/lib/yang/tests/translator_host_unittests.cc +++ b/src/lib/yang/tests/translator_host_unittests.cc @@ -216,4 +216,4 @@ TEST_F(TranslatorHostsTest, getMany) { "\"ip-addresses\": [ \"2001:db8::2\" ] } ]"); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_logger_unittests.cc b/src/lib/yang/tests/translator_logger_unittests.cc index a78963e8f9..2667109833 100644 --- a/src/lib/yang/tests/translator_logger_unittests.cc +++ b/src/lib/yang/tests/translator_logger_unittests.cc @@ -181,4 +181,4 @@ TEST_F(TranslatorLoggersTest, set) { /// @todo: Implement a test that will cover multiple loggers. -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_option_data_unittests.cc b/src/lib/yang/tests/translator_option_data_unittests.cc index 6e55a790a6..afb2453e7e 100644 --- a/src/lib/yang/tests/translator_option_data_unittests.cc +++ b/src/lib/yang/tests/translator_option_data_unittests.cc @@ -162,4 +162,4 @@ TEST_F(TranslatorOptionDataListTest, set) { EXPECT_NO_THROW(sess_->validate()); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_option_def_unittests.cc b/src/lib/yang/tests/translator_option_def_unittests.cc index 14c35e336c..0441458130 100644 --- a/src/lib/yang/tests/translator_option_def_unittests.cc +++ b/src/lib/yang/tests/translator_option_def_unittests.cc @@ -162,4 +162,4 @@ TEST_F(TranslatorOptionDefListTest, set) { EXPECT_NO_THROW(sess_->validate()); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_pd_pool_unittests.cc b/src/lib/yang/tests/translator_pd_pool_unittests.cc index 49aa5de339..b8ee604317 100644 --- a/src/lib/yang/tests/translator_pd_pool_unittests.cc +++ b/src/lib/yang/tests/translator_pd_pool_unittests.cc @@ -373,4 +373,4 @@ TEST_F(TranslatorPdPoolsTest, getListKea) { "\"2001:db8:0:2000::\", \"prefix-len\": 56 } ]"); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_pool_unittests.cc b/src/lib/yang/tests/translator_pool_unittests.cc index 3a3a31feeb..7c16021507 100644 --- a/src/lib/yang/tests/translator_pool_unittests.cc +++ b/src/lib/yang/tests/translator_pool_unittests.cc @@ -307,4 +307,4 @@ TEST_F(TranslatorPoolsTest, setKea) { EXPECT_NO_THROW(sess_->validate()); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_shared_network_unittests.cc b/src/lib/yang/tests/translator_shared_network_unittests.cc index e1d6dfa847..0b7b08f67e 100644 --- a/src/lib/yang/tests/translator_shared_network_unittests.cc +++ b/src/lib/yang/tests/translator_shared_network_unittests.cc @@ -237,4 +237,4 @@ TEST_F(TranslatorSharedNetworksTest, getList) { EXPECT_EQ(exp_both, networks->str()); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/tests/translator_subnet_unittests.cc b/src/lib/yang/tests/translator_subnet_unittests.cc index 2270fa05ca..e1b6c08d8e 100644 --- a/src/lib/yang/tests/translator_subnet_unittests.cc +++ b/src/lib/yang/tests/translator_subnet_unittests.cc @@ -483,4 +483,4 @@ TEST_F(TranslatorSubnetsTest, setTwoKea) { EXPECT_NO_THROW(sess_->validate()); } -}; // end of anonymous namespace +} // end of anonymous namespace diff --git a/src/lib/yang/translator.h b/src/lib/yang/translator.h index 046a0801c3..8933a52774 100644 --- a/src/lib/yang/translator.h +++ b/src/lib/yang/translator.h @@ -132,7 +132,7 @@ protected: std::string model_; }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_H diff --git a/src/lib/yang/translator_class.h b/src/lib/yang/translator_class.h index fa5e413f77..71f53b61dc 100644 --- a/src/lib/yang/translator_class.h +++ b/src/lib/yang/translator_class.h @@ -167,7 +167,7 @@ protected: isc::data::ConstElementPtr elem); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_CLASS_H diff --git a/src/lib/yang/translator_config.h b/src/lib/yang/translator_config.h index 8452e8c8f4..85e15c8db6 100644 --- a/src/lib/yang/translator_config.h +++ b/src/lib/yang/translator_config.h @@ -530,7 +530,7 @@ protected: const std::string& name); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_CONFIG_H diff --git a/src/lib/yang/translator_control_socket.h b/src/lib/yang/translator_control_socket.h index e367881be4..2008c36c7a 100644 --- a/src/lib/yang/translator_control_socket.h +++ b/src/lib/yang/translator_control_socket.h @@ -119,7 +119,7 @@ protected: isc::data::ConstElementPtr elem); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_CONTROL_SOCKET_H diff --git a/src/lib/yang/translator_database.h b/src/lib/yang/translator_database.h index 8c4c8799b8..3e252c26fc 100644 --- a/src/lib/yang/translator_database.h +++ b/src/lib/yang/translator_database.h @@ -213,7 +213,7 @@ protected: isc::data::ConstElementPtr elem); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_DATABASE_H diff --git a/src/lib/yang/translator_host.h b/src/lib/yang/translator_host.h index 747231d89c..561656a6e0 100644 --- a/src/lib/yang/translator_host.h +++ b/src/lib/yang/translator_host.h @@ -198,7 +198,7 @@ protected: isc::data::ConstElementPtr elem); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_HOST_H diff --git a/src/lib/yang/translator_logger.h b/src/lib/yang/translator_logger.h index 777c5f6014..d36d315dbf 100644 --- a/src/lib/yang/translator_logger.h +++ b/src/lib/yang/translator_logger.h @@ -217,7 +217,7 @@ protected: isc::data::ConstElementPtr elem); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_LOGGER_H diff --git a/src/lib/yang/translator_option_data.h b/src/lib/yang/translator_option_data.h index b3676ba368..6459f28c27 100644 --- a/src/lib/yang/translator_option_data.h +++ b/src/lib/yang/translator_option_data.h @@ -169,7 +169,7 @@ protected: isc::data::ConstElementPtr elem); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_OPTION_DATA_H diff --git a/src/lib/yang/translator_option_def.h b/src/lib/yang/translator_option_def.h index 7ab502b46f..1048b9765a 100644 --- a/src/lib/yang/translator_option_def.h +++ b/src/lib/yang/translator_option_def.h @@ -176,7 +176,7 @@ protected: isc::data::ConstElementPtr elem); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_OPTION_DEF_H diff --git a/src/lib/yang/translator_pd_pool.h b/src/lib/yang/translator_pd_pool.h index d9f381ba51..834e26eefb 100644 --- a/src/lib/yang/translator_pd_pool.h +++ b/src/lib/yang/translator_pd_pool.h @@ -231,7 +231,7 @@ protected: isc::data::ConstElementPtr elem); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_PD_POOL_H diff --git a/src/lib/yang/translator_pool.h b/src/lib/yang/translator_pool.h index ab09e3f4c8..079e9d6a15 100644 --- a/src/lib/yang/translator_pool.h +++ b/src/lib/yang/translator_pool.h @@ -250,7 +250,7 @@ protected: isc::data::ConstElementPtr elem); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_POOL_H diff --git a/src/lib/yang/translator_shared_network.h b/src/lib/yang/translator_shared_network.h index e271582a6a..82d8157428 100644 --- a/src/lib/yang/translator_shared_network.h +++ b/src/lib/yang/translator_shared_network.h @@ -240,7 +240,7 @@ protected: isc::data::ConstElementPtr elem); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_SHARED_NETWORK_H diff --git a/src/lib/yang/translator_subnet.h b/src/lib/yang/translator_subnet.h index 6adb66a6ad..9e8ec2afaa 100644 --- a/src/lib/yang/translator_subnet.h +++ b/src/lib/yang/translator_subnet.h @@ -369,7 +369,7 @@ protected: const std::string& subsel); }; -}; // end of namespace isc::yang -}; // end of namespace isc +} // end of namespace isc::yang +} // end of namespace isc #endif // ISC_TRANSLATOR_SUBNET_H -- GitLab