Fix a clang++15 warning

* spot/parseaut/parseaut.yy: Move the try-block inside the code of the
constructors, so that they can refer to non-static members.
This commit is contained in:
Alexandre Duret-Lutz 2022-05-17 12:01:11 +02:00
parent 8a628d96bc
commit eecb9af21e

View file

@ -2552,45 +2552,51 @@ namespace spot
{ {
automaton_stream_parser::automaton_stream_parser(const std::string& name, automaton_stream_parser::automaton_stream_parser(const std::string& name,
automaton_parser_options opt) automaton_parser_options opt)
try
: filename_(name), opts_(opt) : filename_(name), opts_(opt)
{ {
if (hoayyopen(name, &scanner_)) try
throw std::runtime_error("Cannot open file "s + name); {
} if (hoayyopen(name, &scanner_))
catch (...) throw std::runtime_error("Cannot open file "s + name);
{ }
hoayyclose(scanner_); catch (...)
throw; {
hoayyclose(scanner_);
throw;
}
} }
automaton_stream_parser::automaton_stream_parser(int fd, automaton_stream_parser::automaton_stream_parser(int fd,
const std::string& name, const std::string& name,
automaton_parser_options opt) automaton_parser_options opt)
try
: filename_(name), opts_(opt) : filename_(name), opts_(opt)
{ {
if (hoayyopen(fd, &scanner_)) try
throw std::runtime_error("Cannot open file "s + name); {
} if (hoayyopen(fd, &scanner_))
catch (...) throw std::runtime_error("Cannot open file "s + name);
{ }
hoayyclose(scanner_); catch (...)
throw; {
hoayyclose(scanner_);
throw;
}
} }
automaton_stream_parser::automaton_stream_parser(const char* data, automaton_stream_parser::automaton_stream_parser(const char* data,
const std::string& filename, const std::string& filename,
automaton_parser_options opt) automaton_parser_options opt)
try
: filename_(filename), opts_(opt) : filename_(filename), opts_(opt)
{ {
hoayystring(data, &scanner_); try
} {
catch (...) hoayystring(data, &scanner_);
{ }
hoayyclose(scanner_); catch (...)
throw; {
hoayyclose(scanner_);
throw;
}
} }
automaton_stream_parser::~automaton_stream_parser() automaton_stream_parser::~automaton_stream_parser()