From 3e23c42b4689f2893f67844343be762874d0416d Mon Sep 17 00:00:00 2001 From: Maxime Perrotin Date: Wed, 6 Jun 2018 09:57:42 +0200 Subject: [PATCH] Fix code to get less warnings at build time --- c/ada_wrappers_backend.c | 20 ++++++++++---------- c/build_c_glue.c | 16 +++++++++------- c/build_gui_glue.c | 11 ++++------- c/build_rtds_glue.c | 8 ++++---- c/practical_functions.c | 2 +- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/c/ada_wrappers_backend.c b/c/ada_wrappers_backend.c index 092ed44..8a2b43c 100644 --- a/c/ada_wrappers_backend.c +++ b/c/ada_wrappers_backend.c @@ -72,13 +72,13 @@ void ada_wrappers_preamble(FV * fv) /* wrappers.adb top header */ fprintf(adb, "-- This file was generated automatically: DO NOT MODIFY IT !\n\n"); - fprintf(adb, - "-- pragma Style_Checks (Off);\n" - "-- pragma Warnings (Off);\n\n" - "with PolyORB_HI_Generated.Activity,\n" - " PolyORB_HI.Utils;\n" - "use PolyORB_HI_Generated.Activity,\n" - " PolyORB_HI.Utils;\n\n"); +// fprintf(adb, +// "-- pragma Style_Checks (Off);\n" +// "-- pragma Warnings (Off);\n\n" +// "with PolyORB_HI_Generated.Activity,\n" +// " PolyORB_HI.Utils;\n" +// "use PolyORB_HI_Generated.Activity,\n" +// " PolyORB_HI.Utils;\n\n"); fprintf(ads, "with Interfaces.C;\n"); @@ -158,7 +158,7 @@ void ada_wrappers_preamble(FV * fv) fprintf(ads, "\npackage %s_Wrappers is\n\n", fv->name); // To debug backdoor-related misuse of the passive functions stack: - fprintf(adb, "with PolyORB_HI.Output;\n\n"); +// fprintf(adb, "with PolyORB_HI.Output;\n\n"); fprintf(adb, "package body %s_Wrappers is\n\n", fv->name); @@ -308,7 +308,7 @@ void add_PI_to_ada_wrappers(Interface * i) " ------------------------------------------------------\n" " -- Provided Interface \"%s\"\n" " ------------------------------------------------------\n" - " procedure %s (Entity : PolyORB_HI_Generated.Deployment.Entity_Type", + " procedure %s (dummy_Entity : PolyORB_HI_Generated.Deployment.Entity_Type", i->name, i->name); @@ -327,7 +327,7 @@ void add_PI_to_ada_wrappers(Interface * i) " ------------------------------------------------------\n" " -- Asynchronous Provided Interface \"%s\"\n" " ------------------------------------------------------\n" - " procedure %s (Entity : PolyORB_HI_Generated.Deployment.Entity_Type", + " procedure %s (dummy_Entity : PolyORB_HI_Generated.Deployment.Entity_Type", i->name, i->name); diff --git a/c/build_c_glue.c b/c/build_c_glue.c index 3bc040b..fb6d07e 100644 --- a/c/build_c_glue.c +++ b/c/build_c_glue.c @@ -46,6 +46,7 @@ void c_preamble(FV * fv) " #include \n" "#else\n" " typedef unsigned size_t;\n" + " typedef int ssize_t;\n" "#endif\n\n"); fprintf(vm_if_h, "#ifdef __cplusplus\n" @@ -543,7 +544,7 @@ void add_RI_to_c_invoke_ri(Interface * i) } FOREACH(p, Parameter, i->in, { fprintf(invoke_ri, - " static char IN_buf_%s[%sasn1Scc%s%s] = {0};\n size_t size_IN_buf_%s=0;\n", + " static char IN_buf_%s[%sasn1Scc%s%s] = {0};\n ssize_t size_IN_buf_%s=0;\n", p->name, (native == p->encoding) ? "sizeof(" : "", p->type, @@ -685,12 +686,13 @@ void GLUE_C_InvokeRI(Interface * i) /* Discard duplicate RI (with different synchronism) - keep only the sync one */ if (asynch == i->synchronism) { FOREACH(interface, Interface, i->parent_fv->interfaces, { - if (RI == interface->direction && - !strcmp(interface->name, i->name) && - synch == interface->synchronism) { - return;} - } - ); + if (RI == interface->direction && + !strcmp(interface->name, i->name) && + synch == interface->synchronism) + { + return; + } + }); } add_RI_to_c_invoke_ri(i); } diff --git a/c/build_gui_glue.c b/c/build_gui_glue.c index de53989..5bb2da2 100644 --- a/c/build_gui_glue.c +++ b/c/build_gui_glue.c @@ -369,9 +369,7 @@ void create_queues_initialization_function(FV *fv) // fprintf(code_id, "void %s_startup(void)\n" "{\n" - " int res_RI = 0;\n" - " int res_PI = 0;\n" - " int msgsize_max = 8192;\n" + " unsigned msgsize_max = 8192;\n" " FILE *f = fopen(\"/proc/sys/fs/mqueue/msgsize_max\", \"r\");\n" " fscanf(f, \"%%d\", &msgsize_max);\n\n", fv->name); @@ -430,7 +428,7 @@ int create_maxelement_queue_size_compute_function_on_IF(T_RI_PI_NAME_LIST * IF_TYPE_STRING); fprintf(code_id, "{\n"); fprintf(code_id, - " int MAX_SIZE = sizeof(int); // The minimum size of a message (id + functional data) is the size of the id alone !\n\n"); + " size_t MAX_SIZE = sizeof(int); // The minimum size of a message (id + functional data) is the size of the id alone !\n\n"); //Initiate iterator on the linked list of IF provided iterator = IF_LIST; @@ -506,11 +504,10 @@ void create_incomming_data_pooler(char *NODE_NAME) fprintf(code_id, "{\n"); //Creates necessary local varaiables - fprintf(code_id, " int msgsz = 0;\n"); - fprintf(code_id, " unsigned int sender = 0;\n"); + //fprintf(code_id, " int msgsz = 0;\n"); + //fprintf(code_id, " unsigned int sender = 0;\n"); fprintf(code_id, " struct mq_attr msgq_attr;\n"); fprintf(code_id, " char* msgcontent = NULL;\n"); - fprintf(code_id, " int msg_cnt = 0;\n"); fprintf(code_id, " T_%s_RI_list message_recieved_type;\n\n\n", NODE_NAME); diff --git a/c/build_rtds_glue.c b/c/build_rtds_glue.c index 2a713ed..a6a040b 100644 --- a/c/build_rtds_glue.c +++ b/c/build_rtds_glue.c @@ -51,16 +51,16 @@ void rtds_glue_preamble(FV * fv) fv->name); fprintf(glue_h, "#include \"%s_p_decl.h\"\n\n", fv->name); - fprintf(glue_h, "static RTDS_Proc %s_instanceDescriptor;\n", fv->name); /* Declare the SDL instance descriptor */ - fprintf(glue_h, "static RTDS_GlobalProcessInfo %s_instanceContext;\n", fv->name); /* Declare the SDL instance context */ - fprintf(glue_h, "static RTDS_MessageHeader currentMessage;\n\n"); /* Declare the RTDS message header */ - /* b. glue_.c preamble */ fprintf(glue_c, "/* This file was generated automatically: DO NOT MODIFY IT ! */\n\n"); fprintf(glue_c, "#include \"glue_%s.h\"\n\n", fv->name); + fprintf(glue_c, "static RTDS_Proc %s_instanceDescriptor;\n", fv->name); /* Declare the SDL instance descriptor */ + fprintf(glue_c, "static RTDS_GlobalProcessInfo %s_instanceContext;\n", fv->name); /* Declare the SDL instance context */ + fprintf(glue_c, "static RTDS_MessageHeader currentMessage;\n\n"); /* Declare the RTDS message header */ + fprintf(glue_c, "RTDS_Proc* %s_instanceDescriptor_ptr = NULL;\n", fv->name); diff --git a/c/practical_functions.c b/c/practical_functions.c index 973eb4e..eed67d6 100644 --- a/c/practical_functions.c +++ b/c/practical_functions.c @@ -1244,7 +1244,7 @@ void List_C_Params_And_Size(Parameter * p, FILE ** file) comma ? ", " : "", (param_in == p->param_direction) ? "IN" : "OUT", p->name, - (param_in == p->param_direction) ? "size_IN" : "&size_OUT", + (param_in == p->param_direction) ? "(size_t)size_IN" : "&size_OUT", p->name); } -- GitLab