From 4f9f66262d0ec7b3993907f9363d5cc6ebba8e05 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 15 Dec 2018 18:49:52 +0000 Subject: [PATCH] Catch exceptions by reference Fixes `-Wcatch-value` warnings reported by gcc 8.2.0 --- src/fn_strings.cpp | 6 +++--- src/json.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fn_strings.cpp b/src/fn_strings.cpp index 780e7d8e6..1f33c343d 100644 --- a/src/fn_strings.cpp +++ b/src/fn_strings.cpp @@ -14,15 +14,15 @@ namespace Sass { try { throw; } - catch (utf8::invalid_code_point) { + catch (utf8::invalid_code_point&) { std::string msg("utf8::invalid_code_point"); error(msg, pstate, traces); } - catch (utf8::not_enough_room) { + catch (utf8::not_enough_room&) { std::string msg("utf8::not_enough_room"); error(msg, pstate, traces); } - catch (utf8::invalid_utf8) { + catch (utf8::invalid_utf8&) { std::string msg("utf8::invalid_utf8"); error(msg, pstate, traces); } diff --git a/src/json.cpp b/src/json.cpp index 8f433f5d0..f7d06e4c7 100644 --- a/src/json.cpp +++ b/src/json.cpp @@ -402,7 +402,7 @@ char *json_encode_string(const char *str) try { emit_string(&sb, str); } - catch (std::exception) { + catch (std::exception&) { sb_free(&sb); throw; } @@ -421,7 +421,7 @@ char *json_stringify(const JsonNode *node, const char *space) else emit_value(&sb, node); } - catch (std::exception) { + catch (std::exception&) { sb_free(&sb); throw; }