Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove extern "C" from cpp files.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 28 Mar 2018 14:32:20 +0000 (16:32 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 28 Mar 2018 14:36:54 +0000 (16:36 +0200)
Specifying extern "C" at declaration in header files should be sufficient.

33 files changed:
src/mc/mc_memory.cpp
src/mc/mc_page_snapshot.cpp
src/mc/mc_snapshot.cpp
src/msg/msg_actions.cpp
src/msg/msg_deployment.cpp
src/msg/msg_environment.cpp
src/msg/msg_global.cpp
src/msg/msg_gos.cpp
src/msg/msg_legacy.cpp
src/msg/msg_mailbox.cpp
src/msg/msg_process.cpp
src/msg/msg_task.cpp
src/plugins/file_system/s4u_FileSystem.cpp
src/plugins/vm/VmLiveMigration.cpp
src/plugins/vm/s4u_VirtualMachine.cpp
src/s4u/s4u_actor.cpp
src/s4u/s4u_link.cpp
src/s4u/s4u_netzone.cpp
src/s4u/s4u_storage.cpp
src/simdag/sd_daxloader.cpp
src/simgrid/host.cpp
src/simix/ActorImpl.cpp
src/surf/plugins/dirty_page_tracking.cpp
src/surf/plugins/host_dvfs.cpp
src/surf/plugins/host_energy.cpp
src/surf/plugins/host_load.cpp
src/surf/plugins/link_energy.cpp
src/surf/xml/surfxml_parseplatf.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/backtrace.cpp
src/xbt/dynar.cpp
src/xbt/exception.cpp
src/xbt/memory_map.cpp

index 2864b9d..b0a39d9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017. The SimGrid Team.
+/* Copyright (c) 2008-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -16,8 +16,6 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_memory, mc,
                                 "Logging specific to MC (memory)");
 
-extern "C" {
-
 /* Initialize the model-checker memory subsystem */
 /* It creates the two heap regions: std_heap and mc_heap */
 void MC_memory_init()
@@ -25,5 +23,3 @@ void MC_memory_init()
   if (not malloc_use_mmalloc())
     xbt_die("Model-checking support is not enabled: run with simgrid-mc.");
 }
-
-}
index dacbbb6..a7f21c2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2017. The SimGrid Team.
+/* Copyright (c) 2014-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -19,8 +19,6 @@
 
 using simgrid::mc::remote;
 
-extern "C" {
-
 /** @brief Restore a snapshot of a region
  *
  *  If possible, the restoration will be incremental
@@ -51,5 +49,3 @@ void mc_region_restore_sparse(simgrid::mc::RemoteClient* process, mc_mem_region_
   mc_restore_page_snapshot_region(process,
     (void*) reg->permanent_address().address(), reg->page_data());
 }
-
-}
index 09e9e17..391fef8 100644 (file)
@@ -20,8 +20,6 @@
 #include "src/mc/mc_private.hpp"
 #include "src/mc/mc_snapshot.hpp"
 
-extern "C" {
-
 /** @brief Find the snapshoted region from a pointer
  *
  *  @param addr     Pointer
@@ -141,8 +139,6 @@ int MC_snapshot_region_memcmp(
   return res;
 }
 
-} // extern "C"
-
 namespace simgrid {
 namespace mc {
 
index 82619ee..7377183 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -10,8 +10,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_action, msg, "MSG actions for trace driven simulation");
 
-extern "C" {
-
 void MSG_action_init()
 {
   MSG_function_register_default(simgrid::xbt::replay_runner);
@@ -52,4 +50,3 @@ msg_error_t MSG_action_trace_run(char *path)
 
   return res;
 }
-}
index ae3d87a..8382a62 100644 (file)
@@ -1,12 +1,10 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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 "src/msg/msg_private.hpp"
 
-extern "C" {
-
 /** \ingroup msg_simulation
  * \brief An application deployer.
  *
@@ -59,4 +57,3 @@ void MSG_set_function(const char *host_id, const char *function_name, xbt_dynar_
 {
   SIMIX_process_set_function(host_id, function_name, arguments, -1, -1);
 }
-}
index 2b995a4..5bdf7ae 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -11,8 +11,6 @@
 #include <lualib.h>
 #endif
 
-extern "C" {
-
 /********************************* MSG **************************************/
 
 /** \ingroup msg_simulation
@@ -33,5 +31,3 @@ void MSG_create_environment(const char *file)
 {
   SIMIX_create_environment(file);
 }
-
-}
index 9845fdf..719640c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -13,8 +13,6 @@
 XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg, "Logging specific to MSG (kernel)");
 
-extern "C" {
-
 MSG_Global_t msg_global = nullptr;
 static void MSG_exit();
 
@@ -122,4 +120,3 @@ unsigned long int MSG_get_sent_msg()
 {
   return msg_global->sent_msg;
 }
-}
index ed37ad0..1b9e132 100644 (file)
@@ -11,8 +11,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_gos, msg, "Logging specific to MSG (gos)");
 
-extern "C" {
-
 /** \ingroup msg_task_usage
  * \brief Executes a task and waits for its termination.
  *
@@ -915,4 +913,3 @@ const char *MSG_task_get_category (msg_task_t task)
 {
   return task->category;
 }
-}
index 849f151..7f65062 100644 (file)
@@ -7,8 +7,6 @@
 
 #define MSG_CALL(type, oldname, args)
 
-extern "C" {
-
 /* ************************** Actors *************************** */
 int MSG_process_get_PID(sg_actor_t actor)
 {
@@ -306,4 +304,3 @@ void MSG_vm_destroy(sg_vm_t vm)
 {
   sg_vm_destroy(vm);
 }
-}
index b99055d..0446eb9 100644 (file)
@@ -1,6 +1,6 @@
 /* Mailboxes in MSG */
 
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -10,8 +10,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg, "Logging specific to MSG (mailbox)");
 
-extern "C" {
-
 /** \ingroup msg_mailbox_management
  * \brief Set the mailbox to receive in asynchronous mode
  *
@@ -25,4 +23,3 @@ void MSG_mailbox_set_async(const char *alias){
   simgrid::s4u::Mailbox::byName(alias)->setReceiver(simgrid::s4u::Actor::self());
   XBT_VERB("%s mailbox set to receive eagerly for myself\n",alias);
 }
-}
index 0217d64..a9e2a3c 100644 (file)
@@ -10,8 +10,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, "Logging specific to MSG (process)");
 
-extern "C" {
-
 /** @addtogroup m_process_management
  *
  *  Processes (#msg_process_t) are independent agents that can do stuff on their own. They are in charge of executing
@@ -141,7 +139,6 @@ msg_process_t MSG_process_create_with_environment(const char *name, xbt_main_fun
   xbt_free(argv);
   return res;
 }
-}
 
 msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data, msg_host_t host,
                                               std::map<std::string, std::string>* properties)
@@ -160,8 +157,6 @@ msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<vo
   return process->ciface();
 }
 
-extern "C" {
-
 /* Become a process in the simulation
  *
  * Currently this can only be called by the main thread (once) and only work with some thread factories
@@ -349,4 +344,3 @@ XBT_PUBLIC void MSG_process_unref(msg_process_t process)
 {
   intrusive_ptr_release(process);
 }
-}
index 3e1d68b..679cb34 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -7,8 +7,6 @@
 #include "src/simix/smx_private.hpp"
 #include <algorithm>
 
-extern "C" {
-
 /** @addtogroup m_task_management
  *
  *  Since most scheduling algorithms rely on a concept of task  that can be either <em>computed</em> locally or
@@ -333,4 +331,3 @@ void MSG_task_set_bound(msg_task_t task, double bound)
   if (task->simdata->compute)
     simcall_execution_set_bound(task->simdata->compute, task->simdata->bound);
 }
-}
index 9200d1a..947ea06 100644 (file)
@@ -350,8 +350,6 @@ static void onHostCreation(simgrid::s4u::Host& host)
 }
 
 /* **************************** Public interface *************************** */
-SG_BEGIN_DECL()
-
 void sg_storage_file_system_init()
 {
   if (not FileSystemStorageExt::EXTENSION_ID.valid()) {
@@ -505,5 +503,3 @@ xbt_dict_t sg_host_get_storage_content(sg_host_t host)
 
   return contents;
 }
-
-SG_END_DECL()
index e3a21aa..b584d69 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -287,8 +287,6 @@ void MigrationTx::operator()()
 }
 }
 
-SG_BEGIN_DECL()
-
 static void onVirtualMachineShutdown(simgrid::s4u::VirtualMachine* vm)
 {
   if (vm->getImpl()->isMigrating) {
@@ -372,5 +370,3 @@ void sg_vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm)
 
   vm->getImpl()->isMigrating = false;
 }
-
-SG_END_DECL()
index 5dfaf83..c283575 100644 (file)
@@ -200,7 +200,6 @@ void VirtualMachine::setBound(double bound)
 
 /* **************************** Public C interface *************************** */
 
-SG_BEGIN_DECL()
 /** @brief Create a new VM object with the default parameters
  * A VM is treated as a host. The name of the VM must be unique among all hosts.
  */
@@ -306,5 +305,3 @@ void sg_vm_destroy(sg_vm_t vm)
 {
   vm->destroy();
 }
-
-SG_END_DECL()
index 0f329ae..6a9fd4d 100644 (file)
@@ -401,7 +401,7 @@ void migrate(Host* new_host)
 } // namespace simgrid
 
 /* **************************** Public C interface *************************** */
-SG_BEGIN_DECL()
+
 /** \ingroup m_actor_management
  * \brief Returns the process ID of \a actor.
  *
@@ -555,5 +555,3 @@ void sg_actor_set_kill_time(sg_actor_t actor, double kill_time)
 {
   actor->setKillTime(kill_time);
 }
-
-SG_END_DECL()
index 269f3ab..02e0102 100644 (file)
@@ -18,8 +18,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_link, s4u, "Logging specific to the S4U link
  * C API *
  *********/
 
-extern "C" {
-
 const char* sg_link_name(sg_link_t link)
 {
   return link->getCname();
@@ -68,7 +66,6 @@ void sg_link_exit()
 {
   simgrid::surf::LinkImpl::linksExit();
 }
-}
 
 /***********
  * C++ API *
index b17967d..930acfe 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -114,7 +114,7 @@ void NetZone::addRoute(sg_netpoint_t /*src*/, sg_netpoint_t /*dst*/, sg_netpoint
 } // namespace simgrid
 
 /* **************************** Public C interface *************************** */
-SG_BEGIN_DECL()
+
 sg_netzone_t sg_zone_get_root()
 {
   return simgrid::s4u::Engine::getInstance()->getNetRoot();
@@ -155,5 +155,3 @@ void sg_zone_get_hosts(sg_netzone_t netzone, xbt_dynar_t whereto)
   for (auto const& host : hosts)
     xbt_dynar_push(whereto, &host);
 }
-
-SG_END_DECL()
index 5279b41..78b3013 100644 (file)
@@ -95,7 +95,7 @@ simgrid::xbt::signal<void(s4u::Storage&)> Storage::onDestruction;
 } /* namespace simgrid */
 
 /* **************************** Public C interface *************************** */
-SG_BEGIN_DECL()
+
 /** @addtogroup sg_storage_management
  * (#sg_storage_t) and the functions for managing it.
  */
@@ -202,5 +202,3 @@ sg_size_t sg_storage_write(sg_storage_t storage, sg_size_t size)
 {
   return storage->write(size);
 }
-
-SG_END_DECL()
index 185966b..9503873 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_daxparse, sd, "Parsing DAX files");
 
-extern "C" {
 #include "dax_dtd.h"
 #include "dax_dtd.c"
-}
 
 /* Ensure that transfer tasks have unique names even though a file is used several times */
 void uniq_transfer_task_name(SD_task_t task)
index 0ee923f..346a1c4 100644 (file)
@@ -19,8 +19,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts");
 
-extern "C" {
-
 size_t sg_host_count()
 {
   return simgrid::s4u::Engine::getInstance()->getHostCount();
@@ -338,5 +336,3 @@ sg_host_t sg_host_self()
   smx_actor_t process = SIMIX_process_self();
   return (process == nullptr) ? nullptr : process->host;
 }
-
-} // extern "C"
index bf3a1bf..7047bb2 100644 (file)
@@ -814,8 +814,8 @@ void SIMIX_process_auto_restart_set(smx_actor_t process, int auto_restart) {
  * \param properties the properties of the process
  * \param auto_restart either it is autorestarting or not.
  */
-extern "C" smx_actor_t simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host,
-                                              int argc, char** argv, std::map<std::string, std::string>* properties)
+smx_actor_t simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host, int argc,
+                                   char** argv, std::map<std::string, std::string>* properties)
 {
   if (name == nullptr)
     name = "";
index e5232cc..78ec09b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2017, 2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -102,8 +102,6 @@ static void onExecCompletion(simgrid::kernel::activity::ExecImplPtr exec)
   vm->getImpl()->extension<simgrid::vm::VmDirtyPageTrackingExt>()->untrack(exec);
 }
 
-SG_BEGIN_DECL()
-
 void sg_vm_dirty_page_tracking_init()
 {
   if (not simgrid::vm::VmDirtyPageTrackingExt::EXTENSION_ID.valid()) {
@@ -164,5 +162,3 @@ double sg_vm_get_max_downtime(sg_vm_t vm)
 {
   return vm->getImpl()->extension<simgrid::vm::VmDirtyPageTrackingExt>()->getMaxDowntime();
 }
-
-SG_END_DECL()
index 555d67a..1f11563 100644 (file)
@@ -294,7 +294,6 @@ static void on_host_added(simgrid::s4u::Host& host)
 }
 
 /* **************************** Public interface *************************** */
-extern "C" {
 
 /** \ingroup SURF_plugin_load
  * \brief Initializes the HostDvfs plugin
@@ -315,4 +314,3 @@ void sg_host_dvfs_plugin_init()
   xbt_cfg_register_string(property_governor, "performance", nullptr,
                           "Which Governor should be used that adapts the CPU frequency?");
 }
-}
index 4f288b7..2e16379 100644 (file)
@@ -451,7 +451,6 @@ static void onSimulationEnd()
 }
 
 /* **************************** Public interface *************************** */
-extern "C" {
 
 /** \ingroup plugin_energy
  * \brief Enable host energy plugin
@@ -532,4 +531,3 @@ double sg_host_get_current_consumption(sg_host_t host)
              "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
   return host->extension<HostEnergy>()->getCurrentWattsValue();
 }
-}
index f30692e..9fc9f07 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -173,7 +173,6 @@ static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::kerne
 }
 
 /* **************************** Public interface *************************** */
-extern "C" {
 
 /** \ingroup plugin_load
  * \brief Initializes the HostLoad plugin
@@ -250,4 +249,3 @@ void sg_host_load_reset(sg_host_t host)
 
   host->extension<HostLoad>()->reset();
 }
-}
index d4a9f37..966da21 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved.               */
+/* Copyright (c) 2017, 2018. The SimGrid Team. All rights reserved.               */
 
 /* 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. */
@@ -175,7 +175,7 @@ static void onSimulationEnd()
   XBT_INFO("Total energy over all links: %f", total_energy);
 }
 /* **************************** Public interface *************************** */
-SG_BEGIN_DECL()
+
 int sg_link_energy_is_inited()
 {
   return LinkEnergy::EXTENSION_ID.valid();
@@ -230,4 +230,3 @@ double sg_link_get_consumed_energy(sg_link_t link)
 {
   return link->extension<LinkEnergy>()->getConsumedEnergy();
 }
-SG_END_DECL()
index a8d085c..d287f06 100644 (file)
 #include "src/surf/xml/platf_private.hpp"
 
 #if SIMGRID_HAVE_LUA
-extern "C" {
 #include "src/bindings/lua/simgrid_lua.hpp"
 
 #include <lua.h>                /* Always include this when calling Lua */
 #include <lauxlib.h>            /* Always include this when calling Lua */
 #include <lualib.h>             /* Prototype for luaL_openlibs(), */
-}
 #endif
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
@@ -32,7 +30,6 @@ XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link
 XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_bw;
 XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_lat;
 
-extern "C" {
 void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect)
 {
   xbt_assert(traces_set_list.find(trace_connect->trace) != traces_set_list.end(),
@@ -169,4 +166,3 @@ void parse_platform_file(const char *file)
   if (parse_status)
     surf_parse_error(std::string("Parse error in ") + file);
 }
-}
index 3aa93c7..73d9c14 100644 (file)
@@ -21,8 +21,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF parsing module");
 
-extern "C" {
-
 #include "simgrid_dtd.c"
 
 static const char* surf_parsed_filename; // Currently parsed file (for the error messages)
@@ -100,7 +98,6 @@ int surf_parse_get_int(std::string s)
     return -1;
   }
 }
-}
 
 namespace {
 
@@ -199,8 +196,6 @@ double surf_parse_get_value_with_unit(const char* string, const unit_scale& unit
 }
 }
 
-extern "C" {
-
 double surf_parse_get_time(const char* string, const char* entity_kind, std::string name)
 {
   static const unit_scale units{std::make_pair("w", 7 * 24 * 60 * 60),
@@ -994,4 +989,3 @@ int surf_parse()
 {
   return surf_parse_lex();
 }
-}
index 022ae52..c05076a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2005-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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 "src/internal_config.h"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_backtrace, xbt, "Backtrace");
 
-}
-
 static bool startWith(std::string str, const char* prefix)
 {
   return strncmp(str.c_str(), prefix, strlen(prefix)) == 0;
index 3af1516..b2420da 100644 (file)
@@ -75,7 +75,7 @@ static inline void _xbt_dynar_get_elm(void *const dst, const xbt_dynar_t dynar,
   memcpy(dst, elm, dynar->elmsize);
 }
 
-extern "C" void xbt_dynar_dump(xbt_dynar_t dynar)
+void xbt_dynar_dump(xbt_dynar_t dynar)
 {
   XBT_INFO("Dynar dump: size=%lu; used=%lu; elmsize=%lu; data=%p; free_f=%p",
         dynar->size, dynar->used, dynar->elmsize, dynar->data, dynar->free_f);
@@ -89,7 +89,7 @@ extern "C" void xbt_dynar_dump(xbt_dynar_t dynar)
  * Creates a new dynar. If a free_func is provided, the elements have to be pointer of pointer. That is to say that
  * dynars can contain either base types (int, char, double, etc) or pointer of pointers (struct **).
  */
-extern "C" xbt_dynar_t xbt_dynar_new(const unsigned long elmsize, void_f_pvoid_t const free_f)
+xbt_dynar_t xbt_dynar_new(const unsigned long elmsize, void_f_pvoid_t const free_f)
 {
   xbt_dynar_t dynar = xbt_new0(s_xbt_dynar_t, 1);
 
@@ -105,7 +105,7 @@ extern "C" xbt_dynar_t xbt_dynar_new(const unsigned long elmsize, void_f_pvoid_t
 /** @brief Initialize a dynar structure that was not malloc'ed
  * This can be useful to keep temporary dynars on the stack
  */
-extern "C" void xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f)
+void xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f)
 {
   dynar->size    = 0;
   dynar->used    = 0;
@@ -115,7 +115,7 @@ extern "C" void xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, v
 }
 
 /** @brief Destroy a dynar that was created with xbt_dynar_init */
-extern "C" void xbt_dynar_free_data(xbt_dynar_t dynar)
+void xbt_dynar_free_data(xbt_dynar_t dynar)
 {
   xbt_dynar_reset(dynar);
   if (dynar)
@@ -129,7 +129,7 @@ extern "C" void xbt_dynar_free_data(xbt_dynar_t dynar)
  * kilkil a dynar BUT NOT its content. Ie, the array is freed, but the content is not touched (the \a free_f function
  * is not used)
  */
-extern "C" void xbt_dynar_free_container(xbt_dynar_t* dynar)
+void xbt_dynar_free_container(xbt_dynar_t* dynar)
 {
   if (dynar && *dynar) {
     xbt_dynar_t d = *dynar;
@@ -143,7 +143,7 @@ extern "C" void xbt_dynar_free_container(xbt_dynar_t* dynar)
  *
  * \param dynar who to squeeze
  */
-extern "C" void xbt_dynar_reset(xbt_dynar_t const dynar)
+void xbt_dynar_reset(xbt_dynar_t const dynar)
 {
   _sanity_check_dynar(dynar);
 
@@ -159,7 +159,7 @@ extern "C" void xbt_dynar_reset(xbt_dynar_t const dynar)
  * \param d1 dynar to keep
  * \param d2 dynar to merge into d1. This dynar is free at end.
  */
-extern "C" void xbt_dynar_merge(xbt_dynar_t* d1, xbt_dynar_t* d2)
+void xbt_dynar_merge(xbt_dynar_t* d1, xbt_dynar_t* d2)
 {
   if((*d1)->elmsize != (*d2)->elmsize)
     xbt_die("Element size must are not equal");
@@ -187,7 +187,7 @@ extern "C" void xbt_dynar_merge(xbt_dynar_t* d1, xbt_dynar_t* d2)
  * Set \a empty_slots_wanted to zero to reduce the dynar internal array as much as possible.
  * Note that if \a empty_slots_wanted is greater than the array size, the internal array is expanded instead of shrunk.
  */
-extern "C" void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted)
+void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted)
 {
   _xbt_dynar_resize(dynar, dynar->used + empty_slots_wanted);
 }
@@ -198,7 +198,7 @@ extern "C" void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted)
  *
  * kilkil a dynar and its content
  */
-extern "C" void xbt_dynar_free(xbt_dynar_t* dynar)
+void xbt_dynar_free(xbt_dynar_t* dynar)
 {
   if (dynar && *dynar) {
     xbt_dynar_reset(*dynar);
@@ -207,7 +207,7 @@ extern "C" void xbt_dynar_free(xbt_dynar_t* dynar)
 }
 
 /** \brief free a dynar passed as void* (handy to store dynar in dynars or dict) */
-extern "C" void xbt_dynar_free_voidp(void* d)
+void xbt_dynar_free_voidp(void* d)
 {
   xbt_dynar_t dynar = (xbt_dynar_t)d;
   xbt_dynar_free(&dynar);
@@ -217,7 +217,7 @@ extern "C" void xbt_dynar_free_voidp(void* d)
  *
  * \param dynar the dynar we want to mesure
  */
-extern "C" unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
+unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
 {
   return (dynar ? (unsigned long) dynar->used : (unsigned long) 0);
 }
@@ -226,7 +226,7 @@ extern "C" unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
  *
  *\param dynar the dynat we want to check
  */
-extern "C" int xbt_dynar_is_empty(const xbt_dynar_t dynar)
+int xbt_dynar_is_empty(const xbt_dynar_t dynar)
 {
   return (xbt_dynar_length(dynar) == 0);
 }
@@ -237,7 +237,7 @@ extern "C" int xbt_dynar_is_empty(const xbt_dynar_t dynar)
  * \param idx index of the slot we want to retrieve
  * \param[out] dst where to put the result to.
  */
-extern "C" void xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void* const dst)
+void xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void* const dst)
 {
   _sanity_check_dynar(dynar);
   _check_inbound_idx(dynar, idx);
@@ -254,7 +254,7 @@ extern "C" void xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long i
  * \warning The returned value is the actual content of the dynar.
  * Make a copy before fooling with it.
  */
-extern "C" void* xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx)
+void* xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx)
 {
   void *res;
   _sanity_check_dynar(dynar);
@@ -264,7 +264,7 @@ extern "C" void* xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long
   return res;
 }
 
-extern "C" void* xbt_dynar_set_at_ptr(const xbt_dynar_t dynar, const unsigned long idx)
+void* xbt_dynar_set_at_ptr(const xbt_dynar_t dynar, const unsigned long idx)
 {
   _sanity_check_dynar(dynar);
 
@@ -286,7 +286,7 @@ extern "C" void* xbt_dynar_set_at_ptr(const xbt_dynar_t dynar, const unsigned lo
  *
  * If you want to free the previous content, use xbt_dynar_replace().
  */
-extern "C" void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void* const src)
+void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void* const src)
 {
   memcpy(xbt_dynar_set_at_ptr(dynar, idx), src, dynar->elmsize);
 }
@@ -300,7 +300,7 @@ extern "C" void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void* cons
  * Set the Nth element of a dynar, expanding the dynar if needed, AND DO free the previous value at this position. If
  * you don't want to free the previous content, use xbt_dynar_set().
  */
-extern "C" void xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, const void* const object)
+void xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, const void* const object)
 {
   _sanity_check_dynar(dynar);
 
@@ -318,7 +318,7 @@ extern "C" void xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, co
  * You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
  * xbt_dynar_insert_at_as() does.
  */
-extern "C" void* xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx)
+void* xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx)
 {
   void *res;
   unsigned long old_used;
@@ -349,7 +349,7 @@ extern "C" void* xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx)
  * Set the Nth element of a dynar, expanding the dynar if needed, and moving the previously existing value and all
  * subsequent ones to one position right in the dynar.
  */
-extern "C" void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, const void* const src)
+void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, const void* const src)
 {
   /* checks done in xbt_dynar_insert_at_ptr */
   memcpy(xbt_dynar_insert_at_ptr(dynar, idx), src, dynar->elmsize);
@@ -363,7 +363,7 @@ extern "C" void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, cons
  * If the object argument of this function is a non-null pointer, the removed element is copied to this address. If not,
  * the element is freed using the free_f function passed at dynar creation.
  */
-extern "C" void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void* const object)
+void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void* const object)
 {
   _sanity_check_dynar(dynar);
   _check_inbound_idx(dynar, idx);
@@ -391,7 +391,7 @@ extern "C" void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void
  *
  * Each of the removed elements is freed using the free_f function passed at dynar creation.
  */
-extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const int idx)
+void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const int idx)
 {
   if (not n)
     return;
@@ -434,7 +434,7 @@ extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned in
  * Raises not_found_error if not found. If you have less than 2 millions elements, you probably want to use
  * #xbt_dynar_search_or_negative() instead, so that you don't have to TRY/CATCH on element not found.
  */
-extern "C" unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const elem)
+unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const elem)
 {
   unsigned long it;
 
@@ -455,7 +455,7 @@ extern "C" unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const el
  * Note that usually, the dynar indices are unsigned integers. If you have more than 2 million elements in your dynar,
  * this very function will not work (but the other will).
  */
-extern "C" signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void* const elem)
+signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void* const elem)
 {
   unsigned long it;
 
@@ -472,7 +472,7 @@ extern "C" signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void
  * Beware that if your dynar contains pointed values (such as strings) instead of scalar, this function is probably not
  * what you want. Check the documentation of xbt_dynar_search() for more info.
  */
-extern "C" int xbt_dynar_member(xbt_dynar_t const dynar, void* const elem)
+int xbt_dynar_member(xbt_dynar_t const dynar, void* const elem)
 {
   unsigned long it;
 
@@ -489,13 +489,13 @@ extern "C" int xbt_dynar_member(xbt_dynar_t const dynar, void* const elem)
  * You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
  * xbt_dynar_push_as() does.
  */
-extern "C" void* xbt_dynar_push_ptr(xbt_dynar_t const dynar)
+void* xbt_dynar_push_ptr(xbt_dynar_t const dynar)
 {
   return xbt_dynar_insert_at_ptr(dynar, dynar->used);
 }
 
 /** @brief Add an element at the end of the dynar */
-extern "C" void xbt_dynar_push(xbt_dynar_t const dynar, const void* const src)
+void xbt_dynar_push(xbt_dynar_t const dynar, const void* const src)
 {
   /* checks done in xbt_dynar_insert_at_ptr */
   memcpy(xbt_dynar_insert_at_ptr(dynar, dynar->used), src, dynar->elmsize);
@@ -506,7 +506,7 @@ extern "C" void xbt_dynar_push(xbt_dynar_t const dynar, const void* const src)
  * You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
  * xbt_dynar_pop_as() does.
  */
-extern "C" void* xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
+void* xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
 {
   _check_populated_dynar(dynar);
   XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
@@ -515,7 +515,7 @@ extern "C" void* xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
 }
 
 /** @brief Get and remove the last element of the dynar */
-extern "C" void xbt_dynar_pop(xbt_dynar_t const dynar, void* const dst)
+void xbt_dynar_pop(xbt_dynar_t const dynar, void* const dst)
 {
   /* sanity checks done by remove_at */
   XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
@@ -526,7 +526,7 @@ extern "C" void xbt_dynar_pop(xbt_dynar_t const dynar, void* const dst)
  *
  * This is less efficient than xbt_dynar_push()
  */
-extern "C" void xbt_dynar_unshift(xbt_dynar_t const dynar, const void* const src)
+void xbt_dynar_unshift(xbt_dynar_t const dynar, const void* const src)
 {
   /* sanity checks done by insert_at */
   xbt_dynar_insert_at(dynar, 0, src);
@@ -536,7 +536,7 @@ extern "C" void xbt_dynar_unshift(xbt_dynar_t const dynar, const void* const src
  *
  * This is less efficient than xbt_dynar_pop()
  */
-extern "C" void xbt_dynar_shift(xbt_dynar_t const dynar, void* const dst)
+void xbt_dynar_shift(xbt_dynar_t const dynar, void* const dst)
 {
   /* sanity checks done by remove_at */
   xbt_dynar_remove_at(dynar, 0, dst);
@@ -546,7 +546,7 @@ extern "C" void xbt_dynar_shift(xbt_dynar_t const dynar, void* const dst)
  *
  * The mapped function may change the value of the element itself, but should not mess with the structure of the dynar.
  */
-extern "C" void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
+void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
 {
   char *const data = (char *) dynar->data;
   const unsigned long elmsize = dynar->elmsize;
@@ -565,7 +565,7 @@ extern "C" void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
  *
  * This function can be used while traversing without problem.
  */
-extern "C" void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int* const cursor)
+void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int* const cursor)
 {
   xbt_dynar_remove_at(dynar, *cursor, nullptr);
   *cursor -= 1;
@@ -597,7 +597,7 @@ extern "C" void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int* const curso
  * \param dynar the dynar to sort
  * \param compar_fn comparison function of type (int (compar_fn*) (const void*) (const void*)).
  */
-extern "C" void xbt_dynar_sort(xbt_dynar_t dynar, int_f_cpvoid_cpvoid_t compar_fn)
+void xbt_dynar_sort(xbt_dynar_t dynar, int_f_cpvoid_cpvoid_t compar_fn)
 {
   if (dynar->data != nullptr)
     qsort(dynar->data, dynar->used, dynar->elmsize, compar_fn);
@@ -608,7 +608,7 @@ static int strcmp_voidp(const void *pa, const void *pb) {
 }
 
 /** @brief Sorts a dynar of strings (ie, char* data) */
-extern "C" xbt_dynar_t xbt_dynar_sort_strings(xbt_dynar_t dynar)
+xbt_dynar_t xbt_dynar_sort_strings(xbt_dynar_t dynar)
 {
   xbt_dynar_sort(dynar, strcmp_voidp);
   return dynar; // to enable functional uses
@@ -621,7 +621,7 @@ extern "C" xbt_dynar_t xbt_dynar_sort_strings(xbt_dynar_t dynar)
  *
  *  Note: The dynar won't be usable afterwards.
  */
-extern "C" void* xbt_dynar_to_array(xbt_dynar_t dynar)
+void* xbt_dynar_to_array(xbt_dynar_t dynar)
 {
   void *res;
   xbt_dynar_shrink(dynar, 1);
@@ -642,7 +642,7 @@ extern "C" void* xbt_dynar_to_array(xbt_dynar_t dynar)
  *  considered equal, and a value different of zero when they are considered different. Finally, d2 is destroyed
  *  afterwards.
  */
-extern "C" int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2, int (*compar)(const void*, const void*))
+int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2, int (*compar)(const void*, const void*))
 {
   int i ;
   int size;
index 1455134..0b6b899 100644 (file)
 #include <xbt/log.h>
 #include <xbt/log.hpp>
 
-extern "C" {
 XBT_LOG_EXTERNAL_CATEGORY(xbt);
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_exception, xbt, "Exceptions");
-}
 
 namespace simgrid {
 namespace xbt {
index b575f5e..2be233b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -52,9 +52,7 @@
 
 #include "memory_map.hpp"
 
-extern "C" {
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_memory_map, xbt, "Logging specific to algorithms for memory_map");
-}
 
 namespace simgrid {
 namespace xbt {