From 3cbf54871089cc3dc50b6832652b5765e1601039 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 28 Mar 2018 16:32:20 +0200 Subject: [PATCH] Remove extern "C" from cpp files. Specifying extern "C" at declaration in header files should be sufficient. --- src/mc/mc_memory.cpp | 6 +- src/mc/mc_page_snapshot.cpp | 6 +- src/mc/mc_snapshot.cpp | 4 -- src/msg/msg_actions.cpp | 5 +- src/msg/msg_deployment.cpp | 5 +- src/msg/msg_environment.cpp | 6 +- src/msg/msg_global.cpp | 5 +- src/msg/msg_gos.cpp | 3 - src/msg/msg_legacy.cpp | 3 - src/msg/msg_mailbox.cpp | 5 +- src/msg/msg_process.cpp | 6 -- src/msg/msg_task.cpp | 5 +- src/plugins/file_system/s4u_FileSystem.cpp | 4 -- src/plugins/vm/VmLiveMigration.cpp | 6 +- src/plugins/vm/s4u_VirtualMachine.cpp | 3 - src/s4u/s4u_actor.cpp | 4 +- src/s4u/s4u_link.cpp | 3 - src/s4u/s4u_netzone.cpp | 6 +- src/s4u/s4u_storage.cpp | 4 +- src/simdag/sd_daxloader.cpp | 2 - src/simgrid/host.cpp | 4 -- src/simix/ActorImpl.cpp | 4 +- src/surf/plugins/dirty_page_tracking.cpp | 6 +- src/surf/plugins/host_dvfs.cpp | 2 - src/surf/plugins/host_energy.cpp | 2 - src/surf/plugins/host_load.cpp | 4 +- src/surf/plugins/link_energy.cpp | 5 +- src/surf/xml/surfxml_parseplatf.cpp | 4 -- src/surf/xml/surfxml_sax_cb.cpp | 6 -- src/xbt/backtrace.cpp | 6 +- src/xbt/dynar.cpp | 72 +++++++++++----------- src/xbt/exception.cpp | 2 - src/xbt/memory_map.cpp | 4 +- 33 files changed, 57 insertions(+), 155 deletions(-) diff --git a/src/mc/mc_memory.cpp b/src/mc/mc_memory.cpp index 2864b9d35d..b0a39d9ef9 100644 --- a/src/mc/mc_memory.cpp +++ b/src/mc/mc_memory.cpp @@ -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."); } - -} diff --git a/src/mc/mc_page_snapshot.cpp b/src/mc/mc_page_snapshot.cpp index dacbbb6841..a7f21c26a4 100644 --- a/src/mc/mc_page_snapshot.cpp +++ b/src/mc/mc_page_snapshot.cpp @@ -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()); } - -} diff --git a/src/mc/mc_snapshot.cpp b/src/mc/mc_snapshot.cpp index 09e9e17bef..391fef8075 100644 --- a/src/mc/mc_snapshot.cpp +++ b/src/mc/mc_snapshot.cpp @@ -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 { diff --git a/src/msg/msg_actions.cpp b/src/msg/msg_actions.cpp index 82619ee002..7377183231 100644 --- a/src/msg/msg_actions.cpp +++ b/src/msg/msg_actions.cpp @@ -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; } -} diff --git a/src/msg/msg_deployment.cpp b/src/msg/msg_deployment.cpp index ae3d87a062..8382a6284e 100644 --- a/src/msg/msg_deployment.cpp +++ b/src/msg/msg_deployment.cpp @@ -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); } -} diff --git a/src/msg/msg_environment.cpp b/src/msg/msg_environment.cpp index 2b995a4ce3..5bdf7aecf3 100644 --- a/src/msg/msg_environment.cpp +++ b/src/msg/msg_environment.cpp @@ -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 #endif -extern "C" { - /********************************* MSG **************************************/ /** \ingroup msg_simulation @@ -33,5 +31,3 @@ void MSG_create_environment(const char *file) { SIMIX_create_environment(file); } - -} diff --git a/src/msg/msg_global.cpp b/src/msg/msg_global.cpp index 9845fdf860..719640c9cb 100644 --- a/src/msg/msg_global.cpp +++ b/src/msg/msg_global.cpp @@ -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; } -} diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index ed37ad07c4..1b9e132bed 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -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; } -} diff --git a/src/msg/msg_legacy.cpp b/src/msg/msg_legacy.cpp index 849f1517c5..7f65062359 100644 --- a/src/msg/msg_legacy.cpp +++ b/src/msg/msg_legacy.cpp @@ -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); } -} diff --git a/src/msg/msg_mailbox.cpp b/src/msg/msg_mailbox.cpp index b99055d82f..0446eb9da3 100644 --- a/src/msg/msg_mailbox.cpp +++ b/src/msg/msg_mailbox.cpp @@ -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); } -} diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index 0217d64316..a9e2a3c01a 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -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 code, void* data, msg_host_t host, std::map* properties) @@ -160,8 +157,6 @@ msg_process_t MSG_process_create_from_stdfunc(const char* name, std::functionciface(); } -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); } -} diff --git a/src/msg/msg_task.cpp b/src/msg/msg_task.cpp index 3e1d68be7a..679cb34df5 100644 --- a/src/msg/msg_task.cpp +++ b/src/msg/msg_task.cpp @@ -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 -extern "C" { - /** @addtogroup m_task_management * * Since most scheduling algorithms rely on a concept of task that can be either computed 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); } -} diff --git a/src/plugins/file_system/s4u_FileSystem.cpp b/src/plugins/file_system/s4u_FileSystem.cpp index 9200d1a2f3..947ea06d0a 100644 --- a/src/plugins/file_system/s4u_FileSystem.cpp +++ b/src/plugins/file_system/s4u_FileSystem.cpp @@ -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() diff --git a/src/plugins/vm/VmLiveMigration.cpp b/src/plugins/vm/VmLiveMigration.cpp index e3a21aaefb..b584d69edc 100644 --- a/src/plugins/vm/VmLiveMigration.cpp +++ b/src/plugins/vm/VmLiveMigration.cpp @@ -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() diff --git a/src/plugins/vm/s4u_VirtualMachine.cpp b/src/plugins/vm/s4u_VirtualMachine.cpp index 5dfaf837c6..c283575dfc 100644 --- a/src/plugins/vm/s4u_VirtualMachine.cpp +++ b/src/plugins/vm/s4u_VirtualMachine.cpp @@ -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() diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 0f329aea03..6a9fd4d0d9 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -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() diff --git a/src/s4u/s4u_link.cpp b/src/s4u/s4u_link.cpp index 269f3ab138..02e0102f68 100644 --- a/src/s4u/s4u_link.cpp +++ b/src/s4u/s4u_link.cpp @@ -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 * diff --git a/src/s4u/s4u_netzone.cpp b/src/s4u/s4u_netzone.cpp index b17967db20..930acfecb2 100644 --- a/src/s4u/s4u_netzone.cpp +++ b/src/s4u/s4u_netzone.cpp @@ -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() diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index 5279b41205..78b3013ab7 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -95,7 +95,7 @@ simgrid::xbt::signal 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() diff --git a/src/simdag/sd_daxloader.cpp b/src/simdag/sd_daxloader.cpp index 185966bcf3..9503873735 100644 --- a/src/simdag/sd_daxloader.cpp +++ b/src/simdag/sd_daxloader.cpp @@ -13,10 +13,8 @@ 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) diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 0ee923f7bf..346a1c45b7 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -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" diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index bf3a1bf874..7047bb2d0e 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -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* 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* properties) { if (name == nullptr) name = ""; diff --git a/src/surf/plugins/dirty_page_tracking.cpp b/src/surf/plugins/dirty_page_tracking.cpp index e5232cc8bd..78ec09b3ef 100644 --- a/src/surf/plugins/dirty_page_tracking.cpp +++ b/src/surf/plugins/dirty_page_tracking.cpp @@ -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()->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()->getMaxDowntime(); } - -SG_END_DECL() diff --git a/src/surf/plugins/host_dvfs.cpp b/src/surf/plugins/host_dvfs.cpp index 555d67ae53..1f11563731 100644 --- a/src/surf/plugins/host_dvfs.cpp +++ b/src/surf/plugins/host_dvfs.cpp @@ -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?"); } -} diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index 4f288b7e81..2e16379893 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -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()->getCurrentWattsValue(); } -} diff --git a/src/surf/plugins/host_load.cpp b/src/surf/plugins/host_load.cpp index f30692e307..9fc9f0722a 100644 --- a/src/surf/plugins/host_load.cpp +++ b/src/surf/plugins/host_load.cpp @@ -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()->reset(); } -} diff --git a/src/surf/plugins/link_energy.cpp b/src/surf/plugins/link_energy.cpp index d4a9f3780c..966da21260 100644 --- a/src/surf/plugins/link_energy.cpp +++ b/src/surf/plugins/link_energy.cpp @@ -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()->getConsumedEnergy(); } -SG_END_DECL() diff --git a/src/surf/xml/surfxml_parseplatf.cpp b/src/surf/xml/surfxml_parseplatf.cpp index a8d085c5cc..d287f06c6e 100644 --- a/src/surf/xml/surfxml_parseplatf.cpp +++ b/src/surf/xml/surfxml_parseplatf.cpp @@ -13,13 +13,11 @@ #include "src/surf/xml/platf_private.hpp" #if SIMGRID_HAVE_LUA -extern "C" { #include "src/bindings/lua/simgrid_lua.hpp" #include /* Always include this when calling Lua */ #include /* Always include this when calling Lua */ #include /* Prototype for luaL_openlibs(), */ -} #endif XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse); @@ -32,7 +30,6 @@ XBT_PRIVATE std::unordered_map trace_connect_list_link XBT_PRIVATE std::unordered_map trace_connect_list_link_bw; XBT_PRIVATE std::unordered_map 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); } -} diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 3aa93c7489..73d9c14d91 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -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(); } -} diff --git a/src/xbt/backtrace.cpp b/src/xbt/backtrace.cpp index 022ae52a55..c05076a8d9 100644 --- a/src/xbt/backtrace.cpp +++ b/src/xbt/backtrace.cpp @@ -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. */ @@ -22,12 +22,8 @@ #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; diff --git a/src/xbt/dynar.cpp b/src/xbt/dynar.cpp index 3af15166c8..b2420dac6e 100644 --- a/src/xbt/dynar.cpp +++ b/src/xbt/dynar.cpp @@ -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; diff --git a/src/xbt/exception.cpp b/src/xbt/exception.cpp index 14551349ab..0b6b899b9d 100644 --- a/src/xbt/exception.cpp +++ b/src/xbt/exception.cpp @@ -20,10 +20,8 @@ #include #include -extern "C" { XBT_LOG_EXTERNAL_CATEGORY(xbt); XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_exception, xbt, "Exceptions"); -} namespace simgrid { namespace xbt { diff --git a/src/xbt/memory_map.cpp b/src/xbt/memory_map.cpp index b575f5e3ec..2be233b060 100644 --- a/src/xbt/memory_map.cpp +++ b/src/xbt/memory_map.cpp @@ -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 { -- 2.20.1