Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove the -Wformat-security warning
authorTom Cornebize <tom.cornebize@intel.com>
Thu, 23 Jun 2022 07:54:20 +0000 (09:54 +0200)
committerTom Cornebize <tom.cornebize@intel.com>
Thu, 23 Jun 2022 07:54:20 +0000 (09:54 +0200)
Applying the patch from @agiersch

include/simgrid/Exception.hpp
include/xbt/asserts.hpp

index a8520fc..342bd4b 100644 (file)
@@ -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<typename... Args> 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
 
index d018d04..84f647a 100644 (file)
@@ -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)