From a09110fd2917c2121b096754868decbfd6582866 Mon Sep 17 00:00:00 2001 From: Tom Cornebize Date: Thu, 23 Jun 2022 09:54:20 +0200 Subject: [PATCH] Remove the -Wformat-security warning Applying the patch from @agiersch --- include/simgrid/Exception.hpp | 9 +-------- include/xbt/asserts.hpp | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/include/simgrid/Exception.hpp b/include/simgrid/Exception.hpp index a8520fc88b..342bd4bb2e 100644 --- a/include/simgrid/Exception.hpp +++ b/include/simgrid/Exception.hpp @@ -154,14 +154,7 @@ DECLARE_SIMGRID_EXCEPTION(ParseError, PARSE_ERROR_CONSTRUCTOR); #undef PARSE_ERROR_CONSTRUCTOR /** Exception raised by xbt_enforce, when an assertion is not satisfied */ -#define ASSERTION_ERROR_CONSTRUCTOR \ - template AssertionError(const char * f, Args... args) \ - : Exception(XBT_THROW_POINT, xbt::string_printf(f, args...)) \ - { \ - } - -DECLARE_SIMGRID_EXCEPTION(AssertionError, ASSERTION_ERROR_CONSTRUCTOR); -#undef ASSERTION_ERROR_CONSTRUCTOR +DECLARE_SIMGRID_EXCEPTION(AssertionError); #undef DECLARE_SIMGRID_EXCEPTION diff --git a/include/xbt/asserts.hpp b/include/xbt/asserts.hpp index d018d04aba..84f647a047 100644 --- a/include/xbt/asserts.hpp +++ b/include/xbt/asserts.hpp @@ -28,7 +28,7 @@ #define _xbt_enforce_ARGN(cond, ...) \ do { \ if (!(cond)) { \ - throw simgrid::AssertionError(__VA_ARGS__); \ + throw simgrid::AssertionError(XBT_THROW_POINT, xbt::string_printf(__VA_ARGS__)); \ } \ } while (0) -- 2.20.1