diff options
Diffstat (limited to 'src/schedule')
-rw-r--r-- | src/schedule/ScheduleCreater.c | 30 | ||||
-rw-r--r-- | src/schedule/ScheduleSorter.c | 9 |
2 files changed, 36 insertions, 3 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) diff --git a/src/schedule/ScheduleSorter.c b/src/schedule/ScheduleSorter.c index edfb009c..e97874cb 100644 --- a/src/schedule/ScheduleSorter.c +++ b/src/schedule/ScheduleSorter.c @@ -166,7 +166,8 @@ int CCTKi_ScheduleSort(int size, signed char **array, int *order) @returntype int @returndesc - 0 - success + 0 - success + <0 - -error_column @endreturndesc @@*/ int CCTKi_ScheduleAddRow(int size, @@ -190,7 +191,11 @@ int CCTKi_ScheduleAddRow(int size, { if(thisorders[column]) { - if(array[row][column] && array[row][column] != (signed char)thisorders[column]) retval--; + if(array[row][column] && array[row][column] != (signed char)thisorders[column]) + { + retval = -(1+column); + break; + } array[row][column] = (signed char)( thisorders[column]); array[column][row] = (signed char)( -thisorders[column]); } |