Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 24 Feb 2017 22:02:13 +0000 (23:02 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 24 Feb 2017 22:14:11 +0000 (23:14 +0100)
- Ignore RngStream, which we did not author
- Mark the whole java bindings as using the C linkage, because the JVM
  wants it so. So we cannot move these symbols in a namespace.
- Mark the whole XML cruft as using the C linkage, because FlexML
  wants it so.
- Mark the whole MSG API as using the C linkage, because it does.

28 files changed:
sonar-project.properties
src/bindings/java/jmsg.cpp
src/bindings/java/jmsg_as.cpp
src/bindings/java/jmsg_comm.cpp
src/bindings/java/jmsg_file.cpp
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_rngstream.cpp
src/bindings/java/jmsg_storage.cpp
src/bindings/java/jmsg_synchro.cpp
src/bindings/java/jmsg_task.cpp
src/bindings/java/jmsg_vm.cpp
src/bindings/java/jtrace.cpp
src/bindings/java/jxbt_utilities.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_host.cpp
src/msg/msg_io.cpp
src/msg/msg_mailbox.cpp
src/msg/msg_private.h
src/msg/msg_process.cpp
src/msg/msg_task.cpp
src/msg/msg_vm.cpp
src/surf/xml/surfxml_parseplatf.cpp
src/surf/xml/surfxml_sax_cb.cpp

index eea3c1d..a829347 100644 (file)
@@ -40,13 +40,20 @@ sonar.issue.ignore.multicriteria.c3.resourceKey=**/*.cpp
 sonar.issue.ignore.multicriteria.c4.ruleKey=c:PPMacroName
 sonar.issue.ignore.multicriteria.c4.resourceKey=include/smpi/smpi_extended_traces.h
 
+
+
 # Exclude some files from the analysis:
 #  - our unit tests 
 #  - the tests that we borrowed elsewhere (MPICH and ISP)
 #  - Flex-generated files
 #  - Collectives that we borrowed elsewhere (mpich, openMPI and other implems)
 #  - the NAS, that are included in our examples
-sonar.exclusions=src/*_unit.c*,teshsuite/smpi/mpich3-test/**,teshsuite/smpi/isp/**,**/*_dtd.c,**/*_dtd.h,**/*yy.c,src/smpi/colls/*,examples/smpi/NAS/*
+#  - RngStream, that is included in SimGrid
+sonar.exclusions=src/*_unit.c*,teshsuite/smpi/mpich3-test/**,teshsuite/smpi/isp/**,**/*_dtd.c,**/*_dtd.h,**/*yy.c,src/smpi/colls/*,examples/smpi/NAS/*,src/xbt/RngStream.c,include/xbt/RngStream.h
+
+# Exclude our examples from the duplication detection.
+# Examples are expected to be somehow repetitive
+sonar.cpd.exclusions=examples/**
 
 # Ignore some files based on regex on their content (not working)
 #sonar.issue.ignore.allfile=flexGenerated,flexMLGenerated
@@ -70,6 +77,8 @@ sonar.cfamily.build-wrapper-output=bw-outputs
 sonar.sourceEncoding=UTF-8
 
 sonar.java.source=7
+sonar.c.std=gnu11
+sonar.cpp.std=gnu++11
 
 # Talk to me (travis don't like it, it's too much)
 # sonar.verbose=true
index 819951b..41db649 100644 (file)
@@ -255,12 +255,12 @@ Java_org_simgrid_msg_Msg_deployApplication(JNIEnv * env, jclass cls, jstring jde
   MSG_launch_application(deploymentFile);
 }
 
-SG_END_DECL()
-
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_energyInit() {
   sg_host_energy_plugin_init();
 }
 
+SG_END_DECL()
+
 /** Run a Java org.simgrid.msg.Process
  *
  *  If needed, this waits for the process starting time.
index 0a3f1c3..1fefe77 100644 (file)
@@ -21,6 +21,8 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
+SG_BEGIN_DECL()
+
 static jmethodID jas_method_As_constructor;
 static jfieldID jas_field_As_bind;
 
@@ -165,3 +167,5 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
   xbt_dynar_free(&table);
   return jtable;
 }
+
+SG_END_DECL()
index 4802bd5..fa87558 100644 (file)
@@ -13,6 +13,8 @@
 #include <simgrid/msg.h>
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
+SG_BEGIN_DECL()
+
 static jfieldID jcomm_field_Comm_bind;
 static jfieldID jcomm_field_Comm_finished;
 static jfieldID jcomm_field_Comm_receiving;
@@ -163,3 +165,5 @@ JNIEXPORT int JNICALL Java_org_simgrid_msg_Comm_waitAny(JNIEnv *env, jclass cls,
   xbt_dynar_free(&dyn);
   return rank;
 }
+
+SG_END_DECL()
index b061e25..5b203d9 100644 (file)
@@ -9,6 +9,8 @@
 #include "jmsg_file.h"
 #include "jxbt_utilities.h"
 
+SG_BEGIN_DECL()
+
 void jfile_bind(JNIEnv *env, jobject jfile, msg_file_t fd) {
   env->SetLongField(jfile, jfile_field_bind, reinterpret_cast<std::intptr_t>(fd));
 }
@@ -52,3 +54,5 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_File_close(JNIEnv *env, jobject jfil
   MSG_file_close(file);
   jfile_bind(env, jfile, nullptr);
 }
+
+SG_END_DECL()
index 386ba55..8211551 100644 (file)
@@ -23,6 +23,8 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
+SG_BEGIN_DECL()
+
 static jmethodID jhost_method_Host_constructor;
 static jfieldID jhost_field_Host_bind;
 static jfieldID jhost_field_Host_name;
@@ -404,3 +406,5 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getPowerPeakAt(JNIEnv* env,
   msg_host_t host = jhost_get_native(env, jhost);
   return MSG_host_get_power_peak_at(host, pstate);
 }
+
+SG_END_DECL()
index 8488ee2..9d62ccf 100644 (file)
@@ -17,7 +17,7 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
-extern "C" {
+SG_BEGIN_DECL()
 
 jfieldID jprocess_field_Process_bind;
 jfieldID jprocess_field_Process_host;
@@ -396,4 +396,4 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_getCount(JNIEnv * env, jclas
   return (jint) MSG_process_get_number();
 }
 
-} // extern C
+SG_END_DECL()
index a7e82b7..08bccc4 100644 (file)
@@ -11,6 +11,8 @@
 #include "jmsg_rngstream.h"
 #include "jxbt_utilities.h"
 
+SG_BEGIN_DECL()
+
 jfieldID jrngstream_bind;
 
 RngStream jrngstream_to_native(JNIEnv *env, jobject jrngstream) {
@@ -144,3 +146,5 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_RngStream_randInt(JNIEnv *env, jobje
 
   return (jint)RngStream_RandInt(rngstream, (int)i, (int)j);
 }
+
+SG_END_DECL()
index ee48e40..427d242 100644 (file)
@@ -16,6 +16,8 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
+SG_BEGIN_DECL()
+
 static jmethodID jstorage_method_Storage_constructor;
 static jfieldID jstorage_field_Storage_bind;
 static jfieldID jstorage_field_Storage_name;
@@ -233,3 +235,5 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Storage_all(JNIEnv * env, jc
   xbt_dynar_free(&table);
   return jtable;
 }
+
+SG_END_DECL()
index 0b2da88..9314977 100644 (file)
@@ -15,6 +15,8 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
+SG_BEGIN_DECL()
+
 static jfieldID jsynchro_field_Mutex_bind;
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_nativeInit(JNIEnv *env, jclass cls) {
@@ -94,3 +96,5 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_nativeFinalize(JNIEnv * en
   sem = (msg_sem_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Semaphore_bind);
   MSG_sem_destroy(sem);
 }
+
+SG_END_DECL()
index cd4a262..7be5a84 100644 (file)
@@ -21,6 +21,8 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
+SG_BEGIN_DECL()
+
 static jmethodID jtask_method_Comm_constructor;
 
 static jfieldID jtask_field_Task_bind;
@@ -638,3 +640,5 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_Task_listenFrom(JNIEnv * env, jclass
 
   return (jint) rv;
 }
+
+SG_END_DECL()
index 23b0c5a..9312488 100644 (file)
@@ -18,6 +18,8 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
+SG_BEGIN_DECL()
+
 static jfieldID jvm_field_bind;
 
 void jvm_bind(JNIEnv *env, jobject jvm, msg_vm_t vm)
@@ -124,3 +126,4 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_resume(JNIEnv *env, jobject jvm)
   MSG_vm_resume(vm);
 }
 
+SG_END_DECL()
index 79b8257..d097358 100644 (file)
@@ -24,6 +24,8 @@
 // Define a new category
 XBT_LOG_NEW_DEFAULT_CATEGORY (jtrace, "TRACE for Java(TM)");
 
+SG_BEGIN_DECL()
+
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostStateDeclare(JNIEnv * env, jclass cls, jstring js)
 {
   const char *s = env->GetStringUTFChars(js, 0);
@@ -191,3 +193,5 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSetWithTim
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcdstVariableAddWithTime (JNIEnv *env, jclass cls, jdouble, jstring, jstring, jstring, jdouble);
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSubWithTime (JNIEnv *env, jclass cls, jdouble, jstring, jstring, jstring, jdouble);
 */
+
+SG_END_DECL()
index d6fe7e7..c1e5b4a 100644 (file)
@@ -12,6 +12,8 @@
 #include "xbt/str.h"
 #include "jxbt_utilities.h"
 
+SG_BEGIN_DECL()
+
 jclass jxbt_get_class(JNIEnv * env, const char *name)
 {
   jclass cls = env->FindClass(name);
@@ -236,3 +238,5 @@ void jxbt_throw_task_cancelled(JNIEnv * env, char *details)
 {
   jxbt_throw_by_name(env, "org/simgrid/msg/TaskCancelledException", details);
 }
+
+SG_END_DECL()
index 2ad8a58..944d9e3 100644 (file)
@@ -10,6 +10,8 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_action, msg, "MSG actions for trace driven simulation");
 
+SG_BEGIN_DECL()
+
 void MSG_action_init()
 {
   _xbt_replay_action_init();
@@ -57,3 +59,5 @@ msg_error_t MSG_action_trace_run(char *path)
 
   return res;
 }
+
+SG_END_DECL()
index f21b33b..e188b59 100644 (file)
@@ -5,6 +5,8 @@
 
 #include "src/msg/msg_private.h"
 
+SG_BEGIN_DECL()
+
 /** \ingroup msg_simulation
  * \brief An application deployer.
  *
@@ -57,3 +59,5 @@ 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);
 }
+
+SG_END_DECL()
index 15f3b15..122783e 100644 (file)
@@ -13,6 +13,8 @@
 #include <lualib.h>
 #endif
 
+SG_BEGIN_DECL()
+
 /********************************* MSG **************************************/
 
 /** \ingroup msg_simulation
@@ -80,3 +82,5 @@ xbt_dynar_t MSG_environment_as_get_hosts(msg_netzone_t netzone)
 {
   return netzone->hosts();
 }
+
+SG_END_DECL()
index 97c3e86..3b0e79a 100644 (file)
@@ -13,6 +13,8 @@
 XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg, "Logging specific to MSG (kernel)");
 
+SG_BEGIN_DECL()
+
 MSG_Global_t msg_global = nullptr;
 static void MSG_exit();
 
@@ -135,3 +137,5 @@ unsigned long int MSG_get_sent_msg()
 {
   return msg_global->sent_msg;
 }
+
+SG_END_DECL()
index d9af33e..bab4a4d 100644 (file)
@@ -10,6 +10,8 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_gos, msg, "Logging specific to MSG (gos)");
 
+SG_BEGIN_DECL()
+
 /** \ingroup msg_task_usage
  * \brief Executes a task and waits for its termination.
  *
@@ -906,3 +908,5 @@ const char *MSG_task_get_category (msg_task_t task)
 {
   return task->category;
 }
+
+SG_END_DECL()
index ade4a63..e8f6518 100644 (file)
@@ -11,6 +11,8 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg);
 
 simgrid::xbt::Extension<simgrid::s4u::Host, simgrid::MsgHostExt> simgrid::MsgHostExt::EXTENSION_ID;
 
+SG_BEGIN_DECL()
+
 int sg_storage_max_file_descriptors = 1024;
 
 /** @addtogroup m_host_management
@@ -281,3 +283,5 @@ xbt_dict_t MSG_host_get_storage_content(msg_host_t host)
   xbt_dict_free(&storage_list);
   return contents;
 }
+
+SG_END_DECL()
index 2552c98..0aa6823 100644 (file)
@@ -9,6 +9,8 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_io, msg, "Logging specific to MSG (io)");
 
+SG_BEGIN_DECL()
+
 /** @addtogroup msg_file
  * (#msg_file_t) and the functions for managing it.
  *
@@ -606,3 +608,5 @@ const char *MSG_storage_get_host(msg_storage_t storage) {
   msg_storage_priv_t priv = MSG_storage_priv(storage);
   return priv->hostname;
 }
+
+SG_END_DECL()
index b4d55aa..d27f199 100644 (file)
@@ -10,6 +10,8 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg, "Logging specific to MSG (mailbox)");
 
+SG_BEGIN_DECL()
+
 /** \ingroup msg_mailbox_management
  * \brief Set the mailbox to receive in asynchronous mode
  *
@@ -25,3 +27,4 @@ void MSG_mailbox_set_async(const char *alias){
   XBT_VERB("%s mailbox set to receive eagerly for myself\n",alias);
 }
 
+SG_END_DECL()
index b71ae37..69d838b 100644 (file)
@@ -107,10 +107,11 @@ typedef struct MSG_Global {
   void_f_pvoid_t process_data_cleanup;
 } s_MSG_Global_t, *MSG_Global_t;
 
+SG_BEGIN_DECL()
+
 XBT_PUBLIC_DATA(MSG_Global_t) msg_global;
 
 /*************************************************************/
-SG_BEGIN_DECL()
 
 XBT_PRIVATE msg_host_t __MSG_host_create(sg_host_t host);
 XBT_PRIVATE msg_storage_t __MSG_storage_create(smx_storage_t storage);
index 4603d88..72f9207 100644 (file)
@@ -10,6 +10,8 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, "Logging specific to MSG (process)");
 
+SG_BEGIN_DECL()
+
 /** @addtogroup m_process_management
  *
  *  Processes (#msg_process_t) are independent agents that can do stuff on their own. They are in charge of executing
@@ -128,6 +130,8 @@ msg_process_t MSG_process_create_with_environment(const char *name, xbt_main_fun
   return res;
 }
 
+SG_END_DECL()
+
 msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data, msg_host_t host,
                                               xbt_dict_t properties)
 {
@@ -145,6 +149,8 @@ msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<vo
   return process;
 }
 
+SG_BEGIN_DECL()
+
 /* Become a process in the simulation
  *
  * Currently this can only be called by the main thread (once) and only work with some thread factories
@@ -459,3 +465,5 @@ XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_re
 XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process) {
   return simcall_process_restart(process);
 }
+
+SG_END_DECL()
index d0cbebb..8d0f635 100644 (file)
@@ -6,6 +6,8 @@
 #include "msg_private.h"
 #include "src/simix/smx_private.h"
 
+SG_BEGIN_DECL()
+
 /** @addtogroup m_task_management
  *
  *  Since most scheduling algorithms rely on a concept of task  that can be either <em>computed</em> locally or
@@ -315,3 +317,5 @@ 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);
 }
+
+SG_END_DECL()
index e1f2576..ebcaa9c 100644 (file)
@@ -19,6 +19,8 @@
 #include "simgrid/host.h"
 #include "simgrid/simix.hpp"
 
+SG_BEGIN_DECL()
+
 struct dirty_page {
   double prev_clock;
   double prev_remaining;
@@ -882,3 +884,5 @@ void MSG_vm_set_bound(msg_vm_t vm, double bound)
   simgrid::simix::kernelImmediate(
       [vm, bound]() { static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->setBound(bound); });
 }
+
+SG_END_DECL()
index 14ebf6d..8d876f8 100644 (file)
@@ -26,6 +26,8 @@ extern "C" {
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
 
+SG_BEGIN_DECL()
+
 /*
  *  Allow the cluster tag to mess with the parsing buffer.
  * (this will probably become obsolete once the cluster tag do not mess with the parsing callbacks directly)
@@ -239,8 +241,7 @@ void parse_platform_file(const char *file)
 
     if (parse_status)
       surf_parse_error("Parse error in %s", file);
-
   }
-
-
 }
+
+SG_END_DECL()
index f855907..63708b1 100644 (file)
@@ -24,7 +24,9 @@
 #include "src/surf/xml/platf_private.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF parsing module");
-#undef CLEANUP
+
+SG_BEGIN_DECL()
+
 int ETag_surfxml_include_state();
 
 #include "simgrid_dtd.c"
@@ -1046,3 +1048,5 @@ static int _surf_parse() {
 }
 
 int_f_void_t surf_parse = _surf_parse;
+
+SG_END_DECL()