Fix multiple C++ bindings warnings with gcc 8.

bindings/cxx/classes.cpp: In function ‘int sigrok::call_log_callback(void*, int, const char*, __va_list_tag*)’:
  bindings/cxx/classes.cpp:242:17: warning: catching polymorphic type ‘class sigrok::Error’ by value [-Wcatch-value=]
    } catch (Error e) {
                   ^
  In file included from bindings/cxx/classes.cpp:1667:
  bindings/cxx/enums.cpp: In static member function ‘static Glib::VariantBase sigrok::ConfigKey::parse_string(std::__cxx11::string, sr_datatype)’:
  bindings/cxx/enums.cpp:789:13: warning: catching polymorphic type ‘class std::invalid_argument’ by value [-Wcatch-value=]
      } catch (invalid_argument) {
               ^~~~~~~~~~~~~~~~
  bindings/cxx/enums.cpp:804:13: warning: catching polymorphic type ‘class std::invalid_argument’ by value [-Wcatch-value=]
      } catch (invalid_argument) {
               ^~~~~~~~~~~~~~~~
This commit is contained in:
Uwe Hermann 2018-07-22 17:07:26 +02:00
parent 19d816c54a
commit 0875f11de4
2 changed files with 3 additions and 3 deletions

View File

@ -90,7 +90,7 @@ Glib::VariantBase ConfigKey::parse_string(string value, enum sr_datatype dt)
case SR_T_FLOAT:
try {
variant = g_variant_new_double(stod(value));
} catch (invalid_argument) {
} catch (invalid_argument&) {
throw Error(SR_ERR_ARG);
}
break;
@ -105,7 +105,7 @@ Glib::VariantBase ConfigKey::parse_string(string value, enum sr_datatype dt)
case SR_T_INT32:
try {
variant = g_variant_new_int32(stoi(value));
} catch (invalid_argument) {
} catch (invalid_argument&) {
throw Error(SR_ERR_ARG);
}
break;

View File

@ -239,7 +239,7 @@ static int call_log_callback(void *cb_data, int loglevel,
try {
(*callback)(LogLevel::get(loglevel), message.get());
} catch (Error e) {
} catch (Error &e) {
return e.result;
}