From 8837965d82bf43b77ac53f700fc10c324a7ce204 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Sun, 16 Oct 2011 17:22:20 +0100 Subject: [PATCH] Add CLOOG_ prefix to LANGUAGE_* macros CLooG uses the two macros LANGUAGE_C and LANGUAGE_FORTRAN to define the language used for pretty printing. LANGUAGE_C is commonly used in other contexts and created a conflict in GCC. By prefixing these macros with CLOOG_ we remove this conflict. Signed-off-by: Tobias Grosser --- doc/cloog.texi | 24 ++++++++++++------------ include/cloog/pprint.h | 5 ++--- source/input.c | 6 +++--- source/options.c | 2 +- source/pprint.c | 30 +++++++++++++++--------------- source/program.c | 8 ++++---- 6 files changed, 37 insertions(+), 38 deletions(-) diff --git a/doc/cloog.texi b/doc/cloog.texi index 56b50b8..2729f40 100644 --- a/doc/cloog.texi +++ b/doc/cloog.texi @@ -1812,18 +1812,18 @@ by @code{usr}. @example @group struct cloogoptions -@{ int l ; /* -l option. */ - int f ; /* -f option. */ - int strides ; /* -strides option. */ - int sh ; /* -sh option. */ - int first_unroll; /* -first-unroll option. */ - int esp ; /* -esp option. */ - int fsp ; /* -fsp option. */ - int otl ; /* -otl option. */ - int block ; /* -block option. */ - int compilable ; /* -compilable option. */ - int language; /* LANGUAGE_C or LANGUAGE_FORTRAN */ - int save_domains; /* Save unsimplified copy of domain. */ +@{ int l; /* -l option. */ + int f; /* -f option. */ + int strides; /* -strides option. */ + int sh; /* -sh option. */ + int first_unroll; /* -first-unroll option. */ + int esp; /* -esp option. */ + int fsp; /* -fsp option. */ + int otl; /* -otl option. */ + int block; /* -block option. */ + int compilable; /* -compilable option. */ + int language; /* CLOOG_LANGUAGE_C or CLOOG_LANGUAGE_FORTRAN */ + int save_domains; /* Save unsimplified copy of domain. */ @} ; typedef struct cloogoptions CloogOptions ; diff --git a/include/cloog/pprint.h b/include/cloog/pprint.h index 62fb244..55e2b5e 100644 --- a/include/cloog/pprint.h +++ b/include/cloog/pprint.h @@ -51,9 +51,8 @@ extern "C" # define EQTYPE_PUREITEM 2 # define EQTYPE_EXAFFINE 3 -# define LANGUAGE_C 0 -# define LANGUAGE_FORTRAN 1 - +#define CLOOG_LANGUAGE_C 0 +#define CLOOG_LANGUAGE_FORTRAN 1 /****************************************************************************** * Structure display function * diff --git a/source/input.c b/source/input.c index 1b83a97..0315d02 100644 --- a/source/input.c +++ b/source/input.c @@ -39,9 +39,9 @@ CloogInput *cloog_input_read(FILE *file, CloogOptions *options) cloog_die("Input error.\n"); if (language == 'f') - options->language = LANGUAGE_FORTRAN; + options->language = CLOOG_LANGUAGE_FORTRAN; else - options->language = LANGUAGE_C; + options->language = CLOOG_LANGUAGE_C; /* We then read the context data. */ context = cloog_domain_read_context(options->state, file); @@ -110,7 +110,7 @@ void cloog_input_dump_cloog(FILE *file, CloogInput *input, CloogOptions *opt) "# structure.\n\n"); /* Language. */ - if (opt->language == LANGUAGE_FORTRAN) { + if (opt->language == CLOOG_LANGUAGE_FORTRAN) { fprintf(file, "# Language: FORTRAN\n"); fprintf(file, "f\n\n"); } else { diff --git a/source/options.c b/source/options.c index 7fb5dbd..0a22f62 100644 --- a/source/options.c +++ b/source/options.c @@ -310,7 +310,7 @@ CloogOptions *cloog_options_malloc(CloogState *state) options->compilable = 0 ; /* No compilable code. */ options->callable = 0 ; /* No callable code. */ options->quiet = 0; /* Do print informational messages. */ - options->language = LANGUAGE_C; /* The default output language is C. */ + options->language = CLOOG_LANGUAGE_C; /* The default output language is C. */ options->save_domains = 0; /* Don't save domains. */ /* UNDOCUMENTED OPTIONS FOR THE AUTHOR ONLY */ options->leaks = 0 ; /* I don't want to print allocation statistics.*/ diff --git a/source/pprint.c b/source/pprint.c index 3dacec2..9269bee 100644 --- a/source/pprint.c +++ b/source/pprint.c @@ -135,7 +135,7 @@ void pprint_binary(struct cloogoptions *i, FILE *dst, struct clast_binary *b) const char *s1 = NULL, *s2 = NULL, *s3 = NULL; int group = b->LHS->type == clast_expr_red && ((struct clast_reduction*) b->LHS)->n > 1; - if (i->language == LANGUAGE_FORTRAN) { + if (i->language == CLOOG_LANGUAGE_FORTRAN) { switch (b->type) { case clast_bin_fdiv: s1 = "FLOOR(REAL(", s2 = ")/REAL(", s3 = "))"; @@ -222,7 +222,7 @@ void pprint_reduction(struct cloogoptions *i, FILE *dst, struct clast_reduction pprint_expr(i, dst, r->elts[0]); break; } - if (i->language == LANGUAGE_FORTRAN) + if (i->language == CLOOG_LANGUAGE_FORTRAN) pprint_minmax_f(i, dst, r); else pprint_minmax_c(i, dst, r); @@ -290,7 +290,7 @@ void pprint_user_stmt(struct cloogoptions *options, FILE *dst, fprintf(dst, ","); } fprintf(dst, ")"); - if (options->language != LANGUAGE_FORTRAN) + if (options->language != CLOOG_LANGUAGE_FORTRAN) fprintf(dst, ";"); fprintf(dst, "\n"); } @@ -299,7 +299,7 @@ void pprint_guard(struct cloogoptions *options, FILE *dst, int indent, struct clast_guard *g) { int k; - if (options->language == LANGUAGE_FORTRAN) + if (options->language == CLOOG_LANGUAGE_FORTRAN) fprintf(dst,"IF "); else fprintf(dst,"if "); @@ -307,7 +307,7 @@ void pprint_guard(struct cloogoptions *options, FILE *dst, int indent, fprintf(dst,"("); for (k = 0; k < g->n; ++k) { if (k > 0) { - if (options->language == LANGUAGE_FORTRAN) + if (options->language == CLOOG_LANGUAGE_FORTRAN) fprintf(dst," .AND. "); else fprintf(dst," && "); @@ -318,7 +318,7 @@ void pprint_guard(struct cloogoptions *options, FILE *dst, int indent, } if (g->n > 1) fprintf(dst,")"); - if (options->language == LANGUAGE_FORTRAN) + if (options->language == CLOOG_LANGUAGE_FORTRAN) fprintf(dst," THEN\n"); else fprintf(dst," {\n"); @@ -326,7 +326,7 @@ void pprint_guard(struct cloogoptions *options, FILE *dst, int indent, pprint_stmt_list(options, dst, indent + INDENT_STEP, g->then); fprintf(dst, "%*s", indent, ""); - if (options->language == LANGUAGE_FORTRAN) + if (options->language == CLOOG_LANGUAGE_FORTRAN) fprintf(dst,"END IF\n"); else fprintf(dst,"}\n"); @@ -335,7 +335,7 @@ void pprint_guard(struct cloogoptions *options, FILE *dst, int indent, void pprint_for(struct cloogoptions *options, FILE *dst, int indent, struct clast_for *f) { - if (options->language == LANGUAGE_FORTRAN) + if (options->language == CLOOG_LANGUAGE_FORTRAN) fprintf(dst, "DO "); else fprintf(dst, "for ("); @@ -343,22 +343,22 @@ void pprint_for(struct cloogoptions *options, FILE *dst, int indent, if (f->LB) { fprintf(dst, "%s=", f->iterator); pprint_expr(options, dst, f->LB); - } else if (options->language == LANGUAGE_FORTRAN) + } else if (options->language == CLOOG_LANGUAGE_FORTRAN) cloog_die("unbounded loops not allowed in FORTRAN.\n"); - if (options->language == LANGUAGE_FORTRAN) + if (options->language == CLOOG_LANGUAGE_FORTRAN) fprintf(dst,", "); else fprintf(dst,";"); if (f->UB) { - if (options->language != LANGUAGE_FORTRAN) + if (options->language != CLOOG_LANGUAGE_FORTRAN) fprintf(dst,"%s<=", f->iterator); pprint_expr(options, dst, f->UB); - } else if (options->language == LANGUAGE_FORTRAN) + } else if (options->language == CLOOG_LANGUAGE_FORTRAN) cloog_die("unbounded loops not allowed in FORTRAN.\n"); - if (options->language == LANGUAGE_FORTRAN) { + if (options->language == CLOOG_LANGUAGE_FORTRAN) { if (cloog_int_gt_si(f->stride, 1)) cloog_int_print(dst, f->stride); fprintf(dst,"\n"); @@ -375,7 +375,7 @@ void pprint_for(struct cloogoptions *options, FILE *dst, int indent, pprint_stmt_list(options, dst, indent + INDENT_STEP, f->body); fprintf(dst, "%*s", indent, ""); - if (options->language == LANGUAGE_FORTRAN) + if (options->language == CLOOG_LANGUAGE_FORTRAN) fprintf(dst,"END DO\n") ; else fprintf(dst,"}\n") ; @@ -390,7 +390,7 @@ void pprint_stmt_list(struct cloogoptions *options, FILE *dst, int indent, fprintf(dst, "%*s", indent, ""); if (CLAST_STMT_IS_A(s, stmt_ass)) { pprint_assignment(options, dst, (struct clast_assignment *) s); - if (options->language != LANGUAGE_FORTRAN) + if (options->language != CLOOG_LANGUAGE_FORTRAN) fprintf(dst, ";"); fprintf(dst, "\n"); } else if (CLAST_STMT_IS_A(s, stmt_user)) { diff --git a/source/program.c b/source/program.c index e5aa4fc..b7895ff 100644 --- a/source/program.c +++ b/source/program.c @@ -265,7 +265,7 @@ static void print_comment(FILE *file, CloogOptions *options, va_list args; va_start(args, fmt); - if (options->language == LANGUAGE_FORTRAN) { + if (options->language == CLOOG_LANGUAGE_FORTRAN) { fprintf(file, "! "); vfprintf(file, fmt, args); fprintf(file, "\n"); @@ -372,9 +372,9 @@ CloogOptions * options ; struct clast_stmt *root; if (program->language == 'f') - options->language = LANGUAGE_FORTRAN ; + options->language = CLOOG_LANGUAGE_FORTRAN ; else - options->language = LANGUAGE_C ; + options->language = CLOOG_LANGUAGE_C ; #ifdef CLOOG_RUSAGE print_comment(file, options, "Generated from %s by %s in %.2fs.", @@ -530,7 +530,7 @@ CloogProgram *cloog_program_alloc(CloogDomain *context, CloogUnionDomain *ud, /* Memory allocation for the CloogProgram structure. */ p = cloog_program_malloc() ; - if (options->language == LANGUAGE_FORTRAN) + if (options->language == CLOOG_LANGUAGE_FORTRAN) p->language = 'f'; else p->language = 'c'; -- 2.11.4.GIT