From: Tom Cornebize Date: Thu, 23 Jun 2022 07:54:20 +0000 (+0200) Subject: Remove the -Wformat-security warning X-Git-Tag: v3.32~184^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a09110fd2917c2121b096754868decbfd6582866 Remove the -Wformat-security warning Applying the patch from @agiersch --- 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)