Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid depending on C++11 stuff when including C/SMPI headers
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 4 Jul 2016 14:55:57 +0000 (16:55 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 5 Jul 2016 07:54:49 +0000 (09:54 +0200)
The user might compile C++ without C++11 and would not be able to
compile the code even if he would be able to compile it in C.

34 files changed:
examples/simdag/test/sd_test.cpp
include/xbt/ex.h
include/xbt/ex.hpp [new file with mode: 0644]
src/bindings/java/JavaContext.cpp
src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_synchro.cpp
src/bindings/java/jmsg_vm.cpp
src/instr/instr_paje_values.cpp
src/msg/msg_gos.cpp
src/msg/msg_mailbox.cpp
src/msg/msg_synchro.cpp
src/msg/msg_vm.cpp
src/s4u/s4u_conditionVariable.cpp
src/simix/smx_deployment.cpp
src/simix/smx_environment.cpp
src/simix/smx_host.cpp
src/simix/smx_io.cpp
src/simix/smx_network.cpp
src/simix/smx_process.cpp
src/simix/smx_synchro.cpp
src/smpi/smpi_bench.cpp
src/smpi/smpi_comm.cpp
src/smpi/smpi_mpi_dt.cpp
src/smpi/smpi_pmpi.cpp
src/xbt/config.cpp
src/xbt/cunit.cpp
src/xbt/dict.cpp
src/xbt/dynar.cpp
src/xbt/ex.cpp
src/xbt/xbt_replay.cpp
src/xbt/xbt_str.cpp
teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp
teshsuite/xbt/mmalloc/mmalloc_test.cpp
tools/cmake/DefinePackages.cmake

index f4eaf75..a73be5f 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "simgrid/simdag.h"
 #include "xbt/ex.h"
+#include <xbt/ex.hpp>
 #include "xbt/log.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test, "Logging specific to this SimDag example");
index ce91604..8fbd00d 100644 (file)
 
 #include <stdlib.h>
 
-#ifdef __cplusplus
-#include <stdexcept>
-#include <xbt/exception.hpp>
-#endif
-
 #include "xbt/base.h"
 #include "xbt/sysdep.h"
 #include "xbt/misc.h"
@@ -97,23 +92,6 @@ typedef enum {
   vm_error                      /**< vm  error */
 } xbt_errcat_t;
 
-#ifdef __cplusplus
-XBT_PUBLIC_CLASS xbt_ex :
-  public std::runtime_error,
-  public simgrid::xbt::WithContextException {
-public:
-  xbt_ex() : std::runtime_error("") {}
-  xbt_ex(const char* message) : std::runtime_error(message) {}
-  ~xbt_ex() override;
-
-  xbt_errcat_t category;        /**< category like HTTP (what went wrong) */
-  int value;                    /**< like errno (why did it went wrong) */
-  const char *file;             /**< Thrown point */
-  int line;                     /**< Thrown point */
-  const char *func;             /**< Thrown point */
-};
-#endif
-
 SG_BEGIN_DECL()
 
 XBT_PUBLIC(const char *) xbt_ex_catname(xbt_errcat_t cat);
diff --git a/include/xbt/ex.hpp b/include/xbt/ex.hpp
new file mode 100644 (file)
index 0000000..1afc1bb
--- /dev/null
@@ -0,0 +1,66 @@
+/* Copyright (c) 2005-2015. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/*  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>       */
+/*  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>         */
+/*  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>           */
+/*  All rights reserved.                                                    */
+
+/* This code is inspirated from the OSSP version (as retrieved back in 2004)*/
+/* It was heavily modified to fit the SimGrid framework.                    */
+
+/* The OSSP version has the following copyright notice:
+**  OSSP ex - Exception Handling
+**  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>
+**
+**  This file is part of OSSP ex, an exception handling library
+**  which can be found at http://www.ossp.org/pkg/lib/ex/.
+**
+**  Permission to use, copy, modify, and distribute this software for
+**  any purpose with or without fee is hereby granted, provided that
+**  the above copyright notice and this permission notice appear in all
+**  copies.
+**
+**  THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESSED OR IMPLIED
+**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+**  SUCH DAMAGE.
+ */
+
+/* The extensions made for the SimGrid project can either be distributed    */
+/* under the same license, or under the LGPL v2.1                           */
+
+#ifndef SIMGRID_XBT_EX_HPP
+#define SIMGRID_XBT_EX_HPP
+
+#include <stdexcept>
+#include <xbt/exception.hpp>
+
+#include <xbt/ex.h>
+
+struct XBT_PUBLIC() xbt_ex :
+  public std::runtime_error,
+  public simgrid::xbt::WithContextException {
+public:
+  xbt_ex() : std::runtime_error("") {}
+  xbt_ex(const char* message) : std::runtime_error(message) {}
+  ~xbt_ex() override;
+
+  xbt_errcat_t category;        /**< category like HTTP (what went wrong) */
+  int value;                    /**< like errno (why did it went wrong) */
+  const char *file;             /**< Thrown point */
+  int line;                     /**< Thrown point */
+  const char *func;             /**< Thrown point */
+};
+
+#endif
index 19f7601..2f63009 100644 (file)
 #include <xbt/function_types.h>
 #include <simgrid/simix.h>
 #include <xbt/ex.h>
+#include <xbt/ex.hpp>
 #include "JavaContext.hpp"
 #include "jxbt_utilities.h"
 #include "xbt/dynar.h"
 #include "../../simix/smx_private.h"
+
 extern JavaVM *__java_vm;
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(jmsg, "MSG for Java(TM)");
index e9a59f6..c6d0e7f 100644 (file)
@@ -6,6 +6,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
+
 #include "jmsg_process.h"
 
 #include "jmsg.h"
index 0ae09a7..7cbac4c 100644 (file)
@@ -6,6 +6,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
+
 #include "jmsg.h"
 #include "xbt/synchro_core.h"
 #include "jmsg_synchro.h"
index 8ce32c8..063819d 100644 (file)
@@ -6,6 +6,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
+
 #include "jmsg.h"
 #include "jmsg_vm.h"
 #include "jmsg_host.h"
index ee6c353..7d69e51 100644 (file)
@@ -4,6 +4,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
+
 #include "src/instr/instr_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_values, instr, "Paje tracing event system (values)");
index c9cd6f4..d3b5016 100644 (file)
@@ -3,6 +3,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
+
 #include "src/simix/smx_private.h" /* MSG_task_listen looks inside the rdv directly. Not clean. */
 #include "msg_private.h"
 #include "mc/mc.h"
index 06413a6..470b4c6 100644 (file)
@@ -6,6 +6,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
+
 #include "simgrid/msg.h"
 #include "msg_private.h"
 
index fa6cad5..ff5d328 100644 (file)
@@ -4,6 +4,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
+
 #include "msg_private.h"
 #include "xbt/sysdep.h"
 #include "xbt/synchro_core.h"
index 351a03c..8836491 100644 (file)
@@ -9,6 +9,8 @@
  * 2. use parallel tasks to simulate CPU overhead and remove the experimental code generating micro computation tasks
  */
 
+#include <xbt/ex.hpp>
+
 #include "msg_private.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
index 52b5b90..ae29352 100644 (file)
@@ -1,6 +1,7 @@
 #include <exception>
 #include <mutex>
 
+#include <xbt/ex.hpp>
 #include <xbt/log.hpp>
 
 #include "simgrid/s4u/conditionVariable.hpp"
index db1becc..b7bd180 100644 (file)
@@ -8,6 +8,7 @@
 #include <vector>
 
 #include "smx_private.h"
+#include <xbt/ex.hpp>
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/dict.h"
index 372f255..eb36275 100644 (file)
@@ -5,6 +5,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "smx_private.h"
+#include <xbt/ex.hpp>
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/xbt_os_time.h"
index 12aaf1b..4449d49 100644 (file)
@@ -5,6 +5,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "smx_private.h"
+#include <xbt/ex.hpp>
 #include "xbt/sysdep.h"
 #include "mc/mc.h"
 #include "src/mc/mc_replay.h"
index c43a07f..1d737c3 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "src/surf/surf_interface.hpp"
 #include "smx_private.h"
+#include <xbt/ex.hpp>
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/dict.h"
index 9274071..c2f5b84 100644 (file)
@@ -5,6 +5,8 @@
 
 #include <boost/range/algorithm.hpp>
 
+#include <xbt/ex.hpp>
+
 #include "src/surf/surf_interface.hpp"
 #include "src/simix/smx_private.h"
 #include "xbt/log.h"
index bb91a10..2ee77d7 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "src/surf/surf_interface.hpp"
 #include "smx_private.h"
+#include <xbt/ex.hpp>
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/dict.h"
index c8ec7fe..305fc32 100644 (file)
@@ -7,7 +7,8 @@
 
 #include "src/surf/surf_interface.hpp"
 #include "smx_private.h"
-#include "xbt/log.h"
+#include <xbt/ex.hpp>
+#include <xbt/log.h>
 
 #include "src/simix/SynchroRaw.hpp"
 
index 3128889..1b887eb 100644 (file)
@@ -12,6 +12,7 @@
 #include "src/internal_config.h"
 #include "private.h"
 #include "private.hpp"
+#include <xbt/ex.hpp>
 #include "xbt/dict.h"
 #include "xbt/sysdep.h"
 #include "xbt/ex.h"
index 6d3f9a9..ab6fa84 100644 (file)
@@ -7,6 +7,7 @@
 #include <stdlib.h>
 
 #include "private.h"
+#include <xbt/ex.hpp>
 #include "xbt/dict.h"
 #include "smpi_mpi_dt_private.h"
 #include "limits.h"
index 74edd06..43af712 100644 (file)
@@ -13,6 +13,7 @@
 #include "smpi_mpi_dt_private.h"
 #include "mc/mc.h"
 #include "xbt/replay.h"
+#include <xbt/ex.hpp>
 #include "simgrid/modelchecker.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi_dt, smpi, "Logging specific to SMPI (datatype)");
index cf6d2f1..eb4e490 100644 (file)
@@ -5,6 +5,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
+
 #include "private.h"
 #include "smpi_mpi_dt_private.h"
 
index b2210e3..6041903 100644 (file)
@@ -15,6 +15,7 @@
 #include <typeinfo>
 #include <type_traits>
 
+#include <xbt/ex.hpp>
 #include <xbt/config.h>
 #include <xbt/config.hpp>
 #include "xbt/misc.h"
@@ -822,6 +823,7 @@ int xbt_cfg_get_boolean(const char *key)
 
 #include "xbt.h"
 #include "xbt/ex.h"
+#include <xbt/ex.hpp>
 
 #include <xbt/config.hpp>
 
index 1cfd7f8..4ca449f 100644 (file)
@@ -12,6 +12,7 @@
 #include "src/internal_config.h"
 #include <stdio.h>
 
+#include <xbt/ex.hpp>
 #include "xbt/sysdep.h"         /* bvprintf */
 #include "xbt/cunit.h"
 #include "xbt/dynar.h"
index 1eb3cb6..9035e7a 100644 (file)
@@ -6,10 +6,13 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+
 #include <string.h>
 #include <stdio.h>
+
 #include "xbt/dict.h"
 #include "xbt/ex.h"
+#include <xbt/ex.hpp>
 #include "xbt/log.h"
 #include "xbt/mallocator.h"
 #include "src/xbt_modinter.h"
@@ -574,6 +577,7 @@ void xbt_dict_postexit(void)
 #include <time.h>
 #include "xbt.h"
 #include "xbt/ex.h"
+#include <xbt/ex.hpp>
 #include "src/internal_config.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_dict);
index 35ca11a..dbd8961 100644 (file)
@@ -10,6 +10,7 @@
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/ex.h"
+#include <xbt/ex.hpp>
 #include "xbt/dynar.h"
 #include <sys/types.h>
 
index 2ba0698..0c11397 100644 (file)
@@ -48,6 +48,7 @@
 #include <xbt/backtrace.hpp>
 #include "src/internal_config.h"           /* execinfo when available */
 #include "xbt/ex.h"
+#include <xbt/ex.hpp>
 #include "xbt/log.h"
 #include "xbt/log.hpp"
 #include "xbt/backtrace.h"
@@ -146,6 +147,7 @@ const char *xbt_ex_catname(xbt_errcat_t cat)
 #ifdef SIMGRID_TEST
 #include <stdio.h>
 #include "xbt/ex.h"
+#include <xbt/ex.hpp>
 
 XBT_TEST_SUITE("xbt_ex", "Exception Handling");
 
index 705cd0f..2d1a2ce 100644 (file)
@@ -4,6 +4,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
 #include "src/internal_config.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
index fb38748..8a956b7 100644 (file)
@@ -6,6 +6,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
 #include "src/internal_config.h"
 #include "xbt/misc.h"
 #include "xbt/sysdep.h"
@@ -516,6 +517,7 @@ double xbt_str_parse_double(const char* str, const char* error_msg)
 }
 
 #ifdef SIMGRID_TEST
+#include <xbt/ex.hpp>
 #include "xbt/str.h"
 
 XBT_TEST_SUITE("xbt_str", "String Handling");
index e06412a..c0df999 100644 (file)
@@ -4,6 +4,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <xbt/ex.hpp>
 #include "simgrid/msg.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
index c5706b6..43edad4 100644 (file)
@@ -14,6 +14,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <xbt/ex.hpp>
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(test,"this test");
 
 #define BUFFSIZE 204800
index e8a4abd..1e6ac4f 100644 (file)
@@ -676,6 +676,7 @@ set(headers_to_install
   include/xbt/dynar.h
   include/xbt/dynar.hpp
   include/xbt/ex.h
+  include/xbt/ex.hpp
   include/xbt/exception.hpp
   include/xbt/backtrace.h
   include/xbt/backtrace.hpp