From 6d84217836fda5938f0ed3568eb2b7ed9cb6dfc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Wed, 11 Sep 2013 01:03:25 +0200 Subject: [PATCH] Reduce likelihood of shadowing symbols in OPM_THROW The OPM_THROW macro uses an internal symbol, 'oss', which is, strictly speaking, in the client's namespace. Moreover, as the "EclipseGridParseHelpers.hpp" header uses the same symbol, and for similar purposes, this produces warnings at "-Wshadow" in GCC when compiling that header. Rename the macro's symbol to 'oss__' (double trailing underscore) to reduce the likelihood of shadowing a previous definition. --- opm/core/utility/ErrorMacros.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opm/core/utility/ErrorMacros.hpp b/opm/core/utility/ErrorMacros.hpp index aec19324..092a88bf 100644 --- a/opm/core/utility/ErrorMacros.hpp +++ b/opm/core/utility/ErrorMacros.hpp @@ -48,12 +48,12 @@ // std::runtime_error. // // Usage: OPM_THROW(ExceptionClass, "Error message " << value); -#define OPM_THROW(Exception, message) \ +#define OPM_THROW(Exception, message) \ do { \ - std::ostringstream oss; \ - oss << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \ + std::ostringstream oss__; \ + oss__ << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \ OPM_MESSAGE(message); \ - throw Exception(oss.str()); \ + throw Exception(oss__.str()); \ } while (false) // throw an exception if a condition is true