Commit acc2067b authored by Maxime Perrotin's avatar Maxime Perrotin

minor refactoring

parent e37d4b57
...@@ -2,6 +2,7 @@ GCCVERSION := $(shell gcc -v 2>&1 | grep ada | wc -l) ...@@ -2,6 +2,7 @@ GCCVERSION := $(shell gcc -v 2>&1 | grep ada | wc -l)
UNAME := $(shell uname) UNAME := $(shell uname)
VERSION=0.1 VERSION=0.1
CC=gcc
exec = buildsupport exec = buildsupport
sources = $(wildcard ada/*.ad? c/*.c include/*.h) sources = $(wildcard ada/*.ad? c/*.c include/*.h)
...@@ -36,7 +37,7 @@ endif ...@@ -36,7 +37,7 @@ endif
# We have to compile in C99 to support "long long" integers, as imposed by the "aadlinteger" type # We have to compile in C99 to support "long long" integers, as imposed by the "aadlinteger" type
# -Wall -Werror -Wextra -Wconversion -Wno-deprecated -Winit-self -Wsign-conversion -Wredundant-decls -Wvla -Wshadow -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wlogical-op -Wmissing-include-dirs -Winit-self -Wpointer-arith -Wcast-qual -Wcast-align -Wold-style-cast -Wno-error=old-style-cast -Wsign-promo -Wundef # -Wall -Werror -Wextra -Wconversion -Wno-deprecated -Winit-self -Wsign-conversion -Wredundant-decls -Wvla -Wshadow -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wlogical-op -Wmissing-include-dirs -Winit-self -Wpointer-arith -Wcast-qual -Wcast-align -Wold-style-cast -Wno-error=old-style-cast -Wsign-promo -Wundef
#clang -c -Wall -Werror -Iinclude c/*.c #clang -c -Wall -Werror -Iinclude c/*.c
gcc -c -W -g3 -g -Wall -Werror -Wextra -Werror=format-security -Wconversion -Wno-deprecated -Winit-self -Wsign-conversion -Wredundant-decls -Wvla -Wshadow -Wlogical-op -Wmissing-include-dirs -Winit-self -Wpointer-arith -Wcast-qual -Wcast-align -Wno-error=old-style-cast -Wundef -std=c99 -pedantic -Iinclude c/*.c $(CC) -c -W -g3 -g -Wall -Werror -Wextra -Werror=format-security -Wconversion -Wno-deprecated -Winit-self -Wsign-conversion -Wredundant-decls -Wvla -Wshadow -Wlogical-op -Wmissing-include-dirs -Winit-self -Wpointer-arith -Wcast-qual -Wcast-align -Wno-error=old-style-cast -Wundef -std=c99 -pedantic -Iinclude c/*.c
mv *.o tmpBuild/ mv *.o tmpBuild/
ADA_PROJECT_PATH=`ocarina-config --prefix`/lib/gnat:$$ADA_PROJECT_PATH $(gnatpath)gnatmake -x -g $(exec) -p -P buildsupport.gpr -XBUILD="debug" ADA_PROJECT_PATH=`ocarina-config --prefix`/lib/gnat:$$ADA_PROJECT_PATH $(gnatpath)gnatmake -x -g $(exec) -p -P buildsupport.gpr -XBUILD="debug"
# strip $(exec) # strip $(exec)
......
...@@ -1168,7 +1168,7 @@ FV_list *Find_All_Calling_FV(Interface * i) ...@@ -1168,7 +1168,7 @@ FV_list *Find_All_Calling_FV(Interface * i)
APPEND_TO_LIST (FV, result, function); APPEND_TO_LIST (FV, result, function);
} }
}) })
if (get_context()->test) { if (get_context()->test && NULL != result) {
printf("\n[Interface %s in FV %s] is called by:\n", printf("\n[Interface %s in FV %s] is called by:\n",
i->name, i->name,
i->parent_fv->name); i->parent_fv->name);
......
...@@ -150,7 +150,7 @@ void c_wrappers_preamble(FV * fv) ...@@ -150,7 +150,7 @@ void c_wrappers_preamble(FV * fv)
&& vhdl != fv->language) { && vhdl != fv->language) {
fprintf (cfile, "#include \"%s.h\"\n\n", fv->name); fprintf (cfile, "#include \"%s.h\"\n\n", fv->name);
} }
else if (simulink == fv->language) { else if (simulink == fv->language && NULL != fv->interfaces) {
Interface *simulink_entrypoint = fv->interfaces->value; Interface *simulink_entrypoint = fv->interfaces->value;
fprintf (cfile, "#include \"%s_Simulink.Simulink.h\"\n\n", fprintf (cfile, "#include \"%s_Simulink.Simulink.h\"\n\n",
simulink_entrypoint->name); simulink_entrypoint->name);
......
...@@ -1054,15 +1054,17 @@ int CountActivePI(Interface_list *interfaces) ...@@ -1054,15 +1054,17 @@ int CountActivePI(Interface_list *interfaces)
* IMPORTANT : it must be checked first that the number of IN and OUT * IMPORTANT : it must be checked first that the number of IN and OUT
* parameters are the same (using CountParams) * parameters are the same (using CountParams)
*/ */
void CheckInOutParams(Parameter * p_in, Parameter_list * p_out) bool CheckInOutParams(Parameter * p_in, Parameter_list * p_out)
{ {
if (NULL == p_out) if (NULL == p_out)
return; return false;
if (0 == strcmp(p_in->type, p_out->value->type)) if (0 == strcmp(p_in->type, p_out->value->type)) {
p_out = p_out->next; return true;
else }
p_out = NULL; else {
return false;
}
} }
/* /*
......
...@@ -1253,7 +1253,7 @@ void Preprocessing_Backend (System *s) ...@@ -1253,7 +1253,7 @@ void Preprocessing_Backend (System *s)
/* If the caller is passive we must create one connection /* If the caller is passive we must create one connection
* per calling thread */ * per calling thread */
if (passive_runtime == caller->runtime_nature) { if (passive_runtime == caller->runtime_nature && NULL != callee) {
FOREACH (ct, FV, caller->calling_threads, { FOREACH (ct, FV, caller->calling_threads, {
New_Connection ( New_Connection (
callee->name, strlen (callee->name), callee->name, strlen (callee->name),
...@@ -1266,7 +1266,7 @@ void Preprocessing_Backend (System *s) ...@@ -1266,7 +1266,7 @@ void Preprocessing_Backend (System *s)
}); });
APPEND_TO_LIST (Connection, connections_to_remove, cnt); APPEND_TO_LIST (Connection, connections_to_remove, cnt);
} }
else if (strcmp (callee->name, cnt->src_system)) { else if (NULL != callee && strcmp (callee->name, cnt->src_system)) {
New_Connection ( New_Connection (
callee->name, strlen (callee->name), callee->name, strlen (callee->name),
cnt->src_port, strlen (cnt->src_port), cnt->src_port, strlen (cnt->src_port),
......
...@@ -615,12 +615,9 @@ int CheckTestMode(Interface * i) ...@@ -615,12 +615,9 @@ int CheckTestMode(Interface * i)
return -1; /* not the same number of input and output parameters */ return -1; /* not the same number of input and output parameters */
FOREACH(p, Parameter, i->in, { FOREACH(p, Parameter, i->in, {
CheckInOutParams(p, p_result); if (false == CheckInOutParams(p, p_result)) return -1;
}) })
if (NULL == p_result)
return -1;
return 0; return 0;
} }
......
...@@ -944,8 +944,11 @@ void GenerateProcessor(Process *p, Process_list *processes) ...@@ -944,8 +944,11 @@ void GenerateProcessor(Process *p, Process_list *processes)
} }
}) })
fprintf(process, "%s : processor %s;\n", p->cpu->name, p->cpu->classifier); if (NULL != p->cpu) {
fprintf(process, "%s : processor %s;\n",
p->cpu->name,
p->cpu->classifier);
}
} }
/* External interface: Create the PROCESS IMPLEMENTATION part */ /* External interface: Create the PROCESS IMPLEMENTATION part */
......
...@@ -137,7 +137,7 @@ void Clear_Aplc_bindings_List (Aplc_binding_list *p); ...@@ -137,7 +137,7 @@ void Clear_Aplc_bindings_List (Aplc_binding_list *p);
void CheckForAsn1Params (Interface *i, int *result); void CheckForAsn1Params (Interface *i, int *result);
/* Check if a list of input parameters match a list of output parameters. */ /* Check if a list of input parameters match a list of output parameters. */
void CheckInOutParams (Parameter *p_in, Parameter_list *p_out); bool CheckInOutParams (Parameter *p_in, Parameter_list *p_out);
/* Check if a FV has context parameters (exclude Directives, Timers, etc.) */ /* Check if a FV has context parameters (exclude Directives, Timers, etc.) */
bool has_context_param(FV *fv); bool has_context_param(FV *fv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment