Skip to content

Commit

Permalink
Handle the empty program in execution test.
Browse files Browse the repository at this point in the history
Added a special test instruction S0, corresponding only to the empty AST. That way, the execution test does something in the empty program case, and still warns in cases of no instruction being called in any other test.
Generated missing .good.c files for affected test cases.
  • Loading branch information
Emilien Bauer committed Oct 28, 2020
1 parent 0bdbddd commit 685f0eb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion source/pprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,12 @@ void pprint_stmt_list(struct cloogoptions *options, FILE *dst, int indent,
struct clast_stmt *s)
{
for ( ; s; s = s->next) {
if (CLAST_STMT_IS_A(s, stmt_root))
if (CLAST_STMT_IS_A(s, stmt_root))
{
if(options->callable && s->next == NULL)
fprintf(dst, "%*sS0\n", indent, "");
continue;
}
fprintf(dst, "%*s", indent, "");
if (CLAST_STMT_IS_A(s, stmt_ass)) {
pprint_assignment(options, dst, (struct clast_assignment *) s);
Expand Down
1 change: 1 addition & 0 deletions source/program.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ static void print_callable_preamble(FILE *file, CloogProgram *program,

print_macros(file);

fprintf(file, "#define S0 { hash(0); }\n");
for (blocklist = program->blocklist; blocklist; blocklist = blocklist->next) {
block = blocklist->block;
for (statement = block->statement; statement; statement = statement->next) {
Expand Down
4 changes: 3 additions & 1 deletion test/multi-stride.good.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated from multi-stride.cloog by CLooG 0.20.0-5e05a27 gmp bits in 0.00s. */
/* Generated from multi-stride.cloog by CLooG 0.20.0-044a1d0 gmp bits in 0.00s. */
extern void hash(int);

/* Useful macros. */
Expand All @@ -13,10 +13,12 @@ extern void hash(int);
#define IF_TIME(foo)
#endif

#define S0 { hash(0); }
#define S1(i,j,k) { hash(1); hash(i); hash(j); hash(k); }

void test()
{
/* Original iterators. */
int i, j, k;
S0
}
4 changes: 3 additions & 1 deletion test/openscop/empty.good.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated from empty.scop by CLooG 0.20.0-5e05a27 gmp bits in 0.00s. */
/* Generated from empty.scop by CLooG 0.20.0-044a1d0 gmp bits in 0.00s. */
extern void hash(int);

/* Useful macros. */
Expand All @@ -13,8 +13,10 @@ extern void hash(int);
#define IF_TIME(foo)
#endif

#define S0 { hash(0); }
#define S1() { hash(1); }

void test()
{
S0
}

0 comments on commit 685f0eb

Please sign in to comment.