diff options
author | rhaas <rhaas@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2012-06-11 19:37:40 +0000 |
---|---|---|
committer | rhaas <rhaas@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2012-06-11 19:37:40 +0000 |
commit | 3d1f402c663ef0e6d76414f32e225fb0cb956e85 (patch) | |
tree | ca607dd81635577982b4042dfc83610228ac40d1 /src/schedule/ScheduleCreater.c | |
parent | ebd9d3057b889f2fe224c7cd7a0c539aa33a4d5c (diff) |
correctly detect circular schedule items
before this Cactus would not detect certain cyclic dependencies eg. ones where
two scheduled functions are each scheduled after the other or where a function
wants to be scheduled after itself.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4832 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/schedule/ScheduleCreater.c')
-rw-r--r-- | src/schedule/ScheduleCreater.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/schedule/ScheduleCreater.c b/src/schedule/ScheduleCreater.c index ace2c9a7..87283600 100644 --- a/src/schedule/ScheduleCreater.c +++ b/src/schedule/ScheduleCreater.c @@ -790,7 +790,14 @@ static int ScheduleSortGroup(t_sched_group *group) printf("\n"); #endif - CCTKi_ScheduleAddRow(group->n_scheditems, array, order, item, thisorders); + errcode = CCTKi_ScheduleAddRow(group->n_scheditems, array, order, item, thisorders); + if(errcode) + { + CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, "Cactus", + "Adding item %s to group %s failed due to a circular dependency on %s.\n", + group->scheditems[item].name, group->name, + group->scheditems[-errcode-1].name ); /*NOTREACHED*/ + } /* Clear the array for the next item. */ for(i=0; i < group->n_scheditems; i++) @@ -1047,9 +1054,30 @@ static int ScheduleSetupIfs(t_sched_item *item) #ifdef TEST_SCHEDULECREATOR +#include <stdarg.h> + #define func_x(x) \ int func_ ## x (void) { return printf("I'm func " #x "\n"); } +int CCTK_VWarn(int level, int line, const char *file, + const char *thorn, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + + fprintf(stdout, "WARNING[L%d,P0] (%s) in line %d of %s: ", level, thorn, line, file); + vfprintf(stdout, fmt, ap); + fputc('\n', stdout); + + va_end(ap); + + if(level == 0) + exit(1); + + return 0; +} + func_x(a) func_x(b) func_x(c) |