]> sigrok.org Git - libsigrok.git/commitdiff
Fix multiple C++ bindings warnings with gcc 8.
authorUwe Hermann <redacted>
Sun, 22 Jul 2018 15:07:26 +0000 (17:07 +0200)
committerUwe Hermann <redacted>
Sun, 22 Jul 2018 15:08:44 +0000 (17:08 +0200)
  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) {
               ^~~~~~~~~~~~~~~~

bindings/cxx/ConfigKey_methods.cpp
bindings/cxx/classes.cpp

index ee0a74ebd820091198eb1ec72ccd8808b5a90179..9c3668ffbb35e9ee4337b7951c0dc7cac08215e2 100644 (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;
index bf826e3c73b809f07eb7441825eb309b404dc5f2..5bc5dc2fed78f594d0605f4a58bdd644ccfb0239 100644 (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;
        }