Skip to content

Commit 847b130

Browse files
authored
Use BOOST_DEFAULTED_FUNCTION on empty destructors (#122)
The compiler-generated copy constructor and copy assignment operator are deprecated since C++11 on classes with user-declared destructors. This change allows clean compilation with the -Wdeprecated-copy-dtor/-Wdeprecated-copy-with-user-provided-dtor flag. Co-authored-by: Ed Catmur <[email protected]>
1 parent 0a1e54b commit 847b130

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

include/boost/program_options/detail/config_file.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ namespace boost { namespace program_options { namespace detail {
7676
const std::set<std::string>& allowed_options,
7777
bool allow_unregistered = false);
7878

79-
virtual ~common_config_file_iterator() {}
79+
BOOST_DEFAULTED_FUNCTION(virtual ~common_config_file_iterator(), {})
8080

8181
public: // Method required by eof_iterator
8282

include/boost/program_options/errors.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ namespace boost { namespace program_options {
121121
/** gcc says that throw specification on dtor is loosened
122122
* without this line
123123
* */
124-
~error_with_option_name() throw() {}
124+
BOOST_DEFAULTED_FUNCTION(~error_with_option_name() throw(), {})
125125

126126

127127
//void dump() const
@@ -209,7 +209,7 @@ namespace boost { namespace program_options {
209209
multiple_values()
210210
: error_with_option_name("option '%canonical_option%' only takes a single argument"){}
211211

212-
~multiple_values() throw() {}
212+
BOOST_DEFAULTED_FUNCTION(~multiple_values() throw(), {})
213213
};
214214

215215
/** Class thrown when there are several occurrences of an
@@ -220,7 +220,7 @@ namespace boost { namespace program_options {
220220
multiple_occurrences()
221221
: error_with_option_name("option '%canonical_option%' cannot be specified more than once"){}
222222

223-
~multiple_occurrences() throw() {}
223+
BOOST_DEFAULTED_FUNCTION(~multiple_occurrences() throw(), {})
224224

225225
};
226226

@@ -233,7 +233,7 @@ namespace boost { namespace program_options {
233233
{
234234
}
235235

236-
~required_option() throw() {}
236+
BOOST_DEFAULTED_FUNCTION(~required_option() throw(), {})
237237
};
238238

239239
/** Base class of unparsable options,
@@ -258,7 +258,7 @@ namespace boost { namespace program_options {
258258
/** Does NOT set option name, because no option name makes sense */
259259
virtual void set_option_name(const std::string&) {}
260260

261-
~error_with_no_option_name() throw() {}
261+
BOOST_DEFAULTED_FUNCTION(~error_with_no_option_name() throw(), {})
262262
};
263263

264264

@@ -270,7 +270,7 @@ namespace boost { namespace program_options {
270270
{
271271
}
272272

273-
~unknown_option() throw() {}
273+
BOOST_DEFAULTED_FUNCTION(~unknown_option() throw(), {})
274274
};
275275

276276

@@ -283,7 +283,7 @@ namespace boost { namespace program_options {
283283
m_alternatives(xalternatives)
284284
{}
285285

286-
~ambiguous_option() throw() {}
286+
BOOST_DEFAULTED_FUNCTION(~ambiguous_option() throw(), {})
287287

288288
const std::vector<std::string>& alternatives() const throw() {return m_alternatives;}
289289

@@ -320,7 +320,7 @@ namespace boost { namespace program_options {
320320
{
321321
}
322322

323-
~invalid_syntax() throw() {}
323+
BOOST_DEFAULTED_FUNCTION(~invalid_syntax() throw(), {})
324324

325325
kind_t kind() const {return m_kind;}
326326

@@ -340,7 +340,7 @@ namespace boost { namespace program_options {
340340
m_substitutions["invalid_line"] = invalid_line;
341341
}
342342

343-
~invalid_config_file_syntax() throw() {}
343+
BOOST_DEFAULTED_FUNCTION(~invalid_config_file_syntax() throw(), {})
344344

345345
/** Convenience functions for backwards compatibility */
346346
virtual std::string tokens() const {return m_substitutions.find("invalid_line")->second; }
@@ -355,7 +355,7 @@ namespace boost { namespace program_options {
355355
const std::string& original_token = "",
356356
int option_style = 0):
357357
invalid_syntax(kind, option_name, original_token, option_style) {}
358-
~invalid_command_line_syntax() throw() {}
358+
BOOST_DEFAULTED_FUNCTION(~invalid_command_line_syntax() throw(), {})
359359
};
360360

361361

@@ -380,7 +380,7 @@ namespace boost { namespace program_options {
380380
{
381381
}
382382

383-
~validation_error() throw() {}
383+
BOOST_DEFAULTED_FUNCTION(~validation_error() throw(), {})
384384

385385
kind_t kind() const { return m_kind; }
386386

0 commit comments

Comments
 (0)