From: Arnaud Giersch Date: Thu, 15 Nov 2012 16:07:03 +0000 (+0100) Subject: Put the TRY..CATCH inside a wrapper function. X-Git-Tag: v3_9_rc1~91^2~89 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/70471e9e6a4c9b3530bee7fa1b02ffc24e95494f Put the TRY..CATCH inside a wrapper function. Avoid spurious warnings about variables that might be clobbered by setjmp/longjmp. --- diff --git a/teshsuite/simdag/platforms/flatifier.c b/teshsuite/simdag/platforms/flatifier.c index 729d27bd6f..dad86de903 100644 --- a/teshsuite/simdag/platforms/flatifier.c +++ b/teshsuite/simdag/platforms/flatifier.c @@ -70,6 +70,19 @@ static int parse_cmdline(int *timings, int *downgrade, char **platformFile, int return wrong_option; } +static void create_environment(xbt_os_timer_t parse_time, const char *platformFile) +{ + xbt_ex_t e; + TRY { + xbt_os_timer_start(parse_time); + SD_create_environment(platformFile); + xbt_os_timer_stop(parse_time); + } + CATCH(e) { + xbt_die("Error while loading %s: %s", platformFile, e.msg); + } +} + int main(int argc, char **argv) { char *platformFile = NULL; @@ -86,7 +99,6 @@ int main(int argc, char **argv) char *src,*dst,*key,*data; sg_routing_edge_t value1; sg_routing_edge_t value2; - xbt_ex_t e; const SD_workstation_t *hosts; const SD_link_t *links; @@ -107,14 +119,7 @@ int main(int argc, char **argv) link_ctn = link_ctn_v2; } - TRY { - xbt_os_timer_start(parse_time); - SD_create_environment(platformFile); - xbt_os_timer_stop(parse_time); - } - CATCH(e) { - xbt_die("Error while loading %s: %s",platformFile,e.msg); - } + create_environment(parse_time, platformFile); if (timings) { XBT_INFO("Parsing time: %fs (%d hosts, %d links)",