rust/0001-Fix-Wcatch-value-from-GCC-8.patch
2018-02-06 23:37:33 -08:00

58 lines
2.2 KiB
Diff

From 327c3d06258576cc9d9f2e5c0861abc72ebd10ef Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 2 Feb 2018 16:23:04 -0800
Subject: [PATCH] Fix -Wcatch-value from GCC 8
These instances may simply be caught by reference instead.
---
src/tools/asm2wasm.cpp | 2 +-
src/tools/s2wasm.cpp | 2 +-
src/wasm/wasm-s-parser.cpp | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/tools/asm2wasm.cpp b/src/tools/asm2wasm.cpp
index 75a2c4d15e2e..6d14067d240f 100644
--- a/src/tools/asm2wasm.cpp
+++ b/src/tools/asm2wasm.cpp
@@ -87,7 +87,7 @@ int main(int argc, const char *argv[]) {
[&trapMode](Options *o, const std::string &argument) {
try {
trapMode = trapModeFromString(argument);
- } catch (std::invalid_argument e) {
+ } catch (std::invalid_argument &e) {
std::cerr << "Error: " << e.what() << "\n";
exit(EXIT_FAILURE);
}
diff --git a/src/tools/s2wasm.cpp b/src/tools/s2wasm.cpp
index 32af57dba5bf..c5e1d52b8d96 100644
--- a/src/tools/s2wasm.cpp
+++ b/src/tools/s2wasm.cpp
@@ -92,7 +92,7 @@ int main(int argc, const char *argv[]) {
[&trapMode](Options *o, const std::string &argument) {
try {
trapMode = trapModeFromString(argument);
- } catch (std::invalid_argument e) {
+ } catch (std::invalid_argument &e) {
std::cerr << "Error: " << e.what() << "\n";
exit(EXIT_FAILURE);
}
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 0de3edf3f6b4..78a150f8146c 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -1408,9 +1408,9 @@ Name SExpressionWasmBuilder::getLabel(Element& s) {
uint64_t offset;
try {
offset = std::stoll(s.c_str(), nullptr, 0);
- } catch (std::invalid_argument) {
+ } catch (std::invalid_argument&) {
throw ParseException("invalid break offset");
- } catch (std::out_of_range) {
+ } catch (std::out_of_range&) {
throw ParseException("out of range break offset");
}
if (offset > nameMapper.labelStack.size()) throw ParseException("invalid label", s.line, s.col);
--
2.14.3