From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

Fix warning on copying polymorphic type

It is rarely a good idea to capture an exception by value (making a copy)
instead of by reference, and it's even worse when the type is polymorphic
and copying it can result in "slicing". Gcc 8 started complaining about
such cases, even in cases where it doesn't matter (i.e., we don't even
use the exception we captured). So we need to change them to capture by
reference.

Signed-off-by: Nadav Har'El <n...@scylladb.com>

---
diff --git a/drivers/scsi-common.cc b/drivers/scsi-common.cc
--- a/drivers/scsi-common.cc
+++ b/drivers/scsi-common.cc
@@ -270,7 +270,7 @@ bool scsi_common::test_lun(u16 target, u16 lun)
         try {
             exec_inquiry(target, lun);
             exec_test_unit_ready(target, lun);
-        } catch (std::runtime_error err) {
+        } catch (std::runtime_error&) {
             nr++;
             continue;
         }
@@ -288,7 +288,7 @@ void scsi_common::scan()
             for (auto &lun : luns) {
                 add_lun(target, lun);
             }
-        } catch(std::runtime_error err) {
+        } catch(std::runtime_error&) {
             continue;
         }
     }

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to