From: Sven Verdoolaege Date: Sat, 9 Aug 2008 13:49:49 +0000 (+0200) Subject: avoid preprocessor conditionals X-Git-Tag: isl-0.01~458 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=60a47c13e01346f5c63aa46c80bd8e1f73910f48;p=platform%2Fupstream%2Fisl.git avoid preprocessor conditionals --- diff --git a/Makefile.am b/Makefile.am index f46706a..692b5c2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,18 +9,18 @@ lib_LTLIBRARIES = libisl.la if HAVE_POLYLIB ISL_POLYLIB = \ isl_map_polylib.c \ - isl_map_polylib.h \ isl_polylib.h endif if HAVE_PIPLIB ISL_PIPLIB = \ - isl_lp_piplib.h \ isl_lp_piplib.c \ isl_map_piplib.c \ - isl_map_piplib.h \ - isl_piplib.h \ isl_piplib.c +else +ISL_PIPLIB = \ + isl_lp_no_piplib.c \ + isl_map_no_piplib.c endif if BUNDLED_PIPLIB PIPLIB_LA = $(top_builddir)/piplib/libpiplibMP.la @@ -45,15 +45,12 @@ libisl_la_SOURCES = \ isl_seq.c \ isl_seq.h EXTRA_libisl_la_SOURCES = \ - isl_lp_piplib.h \ isl_lp_piplib.c \ + isl_lp_no_piplib.c \ isl_map_piplib.c \ - isl_map_piplib.h \ + isl_map_no_piplib.c \ isl_map_polylib.c \ - isl_map_polylib.h \ - isl_piplib.h \ - isl_piplib.c \ - isl_polylib.h + isl_piplib.c libisl_la_LIBADD = $(PIPLIB_LA) @PIPLIB_LIBS@ @POLYLIB_LIBS@ -lgmp libisl_la_LDFLAGS = -release @VERSION@ @PIPLIB_LDFLAGS@ @POLYLIB_LDFLAGS@ \ @GMP_LDFLAGS@ diff --git a/include/isl_lp_piplib.h b/include/isl_lp_piplib.h index 4374d3b..c1363ea 100644 --- a/include/isl_lp_piplib.h +++ b/include/isl_lp_piplib.h @@ -2,7 +2,6 @@ #define ISL_LP_PIPLIB_H #include -#include #if defined(__cplusplus) extern "C" { diff --git a/include/isl_map_piplib.h b/include/isl_map_piplib.h index fb12c01..193f7e9 100644 --- a/include/isl_map_piplib.h +++ b/include/isl_map_piplib.h @@ -2,26 +2,18 @@ #define ISL_MAP_PIPLIB_H #include -#include #if defined(__cplusplus) extern "C" { #endif -PipMatrix *isl_basic_map_to_pip(struct isl_basic_map *bmap, unsigned pip_param, - unsigned extra_front, unsigned extra_back); - -struct isl_map *isl_map_from_quast(struct isl_ctx *ctx, PipQuast *q, - unsigned keep, - struct isl_basic_set *context, - struct isl_set **rest); -struct isl_map *pip_isl_basic_map_lexmax(struct isl_ctx *ctx, +struct isl_map *isl_pip_basic_map_lexmax(struct isl_ctx *ctx, struct isl_basic_map *bmap, struct isl_basic_set *dom, struct isl_set **empty); -struct isl_map *pip_isl_basic_map_lexmin(struct isl_ctx *ctx, +struct isl_map *isl_pip_basic_map_lexmin(struct isl_ctx *ctx, struct isl_basic_map *bmap, struct isl_basic_set *dom, struct isl_set **empty); -struct isl_map *pip_isl_basic_map_compute_divs(struct isl_ctx *ctx, +struct isl_map *isl_pip_basic_map_compute_divs(struct isl_ctx *ctx, struct isl_basic_map *bmap); #if defined(__cplusplus) diff --git a/include/isl_piplib.h b/include/isl_piplib.h index f075b57..e58d21e 100644 --- a/include/isl_piplib.h +++ b/include/isl_piplib.h @@ -3,6 +3,7 @@ #include #include +#include #ifndef ISL_PIPLIB #error "no piplib" #endif @@ -11,4 +12,7 @@ void isl_seq_cpy_to_pip(Entier *dst, isl_int *src, unsigned len); +PipMatrix *isl_basic_map_to_pip(struct isl_basic_map *bmap, unsigned pip_param, + unsigned extra_front, unsigned extra_back); + #endif diff --git a/isl_lp.c b/isl_lp.c index 2e3d5fc..d9da0d5 100644 --- a/isl_lp.c +++ b/isl_lp.c @@ -1,15 +1,9 @@ #include "isl_ctx.h" #include "isl_lp.h" -#ifdef ISL_PIPLIB #include "isl_lp_piplib.h" -#endif enum isl_lp_result isl_solve_lp(struct isl_basic_map *bmap, int maximize, isl_int *f, isl_int denom, isl_int *opt) { -#ifdef ISL_PIPLIB return isl_pip_solve_lp(bmap, maximize, f, denom, opt); -#else - return isl_lp_error; -#endif } diff --git a/isl_lp_no_piplib.c b/isl_lp_no_piplib.c new file mode 100644 index 0000000..9258272 --- /dev/null +++ b/isl_lp_no_piplib.c @@ -0,0 +1,7 @@ +#include "isl_lp_piplib.h" + +enum isl_lp_result isl_pip_solve_lp(struct isl_basic_map *bmap, int maximize, + isl_int *f, isl_int denom, isl_int *opt) +{ + return isl_lp_error; +} diff --git a/isl_map.c b/isl_map.c index 99045af..2df3161 100644 --- a/isl_map.c +++ b/isl_map.c @@ -6,9 +6,7 @@ #include "isl_set.h" #include "isl_map.h" #include "isl_map_private.h" -#ifdef ISL_PIPLIB #include "isl_map_piplib.h" -#endif static struct isl_basic_map *basic_map_init(struct isl_ctx *ctx, struct isl_basic_map *bmap, @@ -1903,26 +1901,14 @@ struct isl_map *isl_basic_map_lexmax(struct isl_ctx *ctx, struct isl_basic_map *bmap, struct isl_basic_set *dom, struct isl_set **empty) { -#ifdef ISL_PIPLIB - return pip_isl_basic_map_lexmax(ctx, bmap, dom, empty); -#else - isl_basic_map_free(ctx, bmap); - isl_basic_set_free(ctx, dom); - return NULL; -#endif + return isl_pip_basic_map_lexmax(ctx, bmap, dom, empty); } struct isl_map *isl_basic_map_lexmin(struct isl_ctx *ctx, struct isl_basic_map *bmap, struct isl_basic_set *dom, struct isl_set **empty) { -#ifdef ISL_PIPLIB - return pip_isl_basic_map_lexmin(ctx, bmap, dom, empty); -#else - isl_basic_map_free(ctx, bmap); - isl_basic_set_free(ctx, dom); - return NULL; -#endif + return isl_pip_basic_map_lexmin(ctx, bmap, dom, empty); } struct isl_set *isl_basic_set_lexmin(struct isl_ctx *ctx, @@ -1952,12 +1938,7 @@ struct isl_map *isl_basic_map_compute_divs(struct isl_ctx *ctx, { if (bmap->n_div == 0) return isl_map_from_basic_map(ctx, bmap); -#ifdef ISL_PIPLIB - return pip_isl_basic_map_compute_divs(ctx, bmap); -#else - isl_basic_map_free(ctx, bmap); - return NULL; -#endif + return isl_pip_basic_map_compute_divs(ctx, bmap); } struct isl_map *isl_map_compute_divs(struct isl_ctx *ctx, struct isl_map *map) diff --git a/isl_map_no_piplib.c b/isl_map_no_piplib.c new file mode 100644 index 0000000..469f62c --- /dev/null +++ b/isl_map_no_piplib.c @@ -0,0 +1,26 @@ +#include "isl_map_piplib.h" + +struct isl_map *isl_pip_basic_map_lexmax(struct isl_ctx *ctx, + struct isl_basic_map *bmap, struct isl_basic_set *dom, + struct isl_set **empty) +{ + isl_basic_map_free(ctx, bmap); + isl_basic_set_free(ctx, dom); + return NULL; +} + +struct isl_map *isl_pip_basic_map_lexmin(struct isl_ctx *ctx, + struct isl_basic_map *bmap, struct isl_basic_set *dom, + struct isl_set **empty) +{ + isl_basic_map_free(ctx, bmap); + isl_basic_set_free(ctx, dom); + return NULL; +} + +struct isl_map *isl_pip_basic_map_compute_divs(struct isl_ctx *ctx, + struct isl_basic_map *bmap) +{ + isl_basic_map_free(ctx, bmap); + return NULL; +} diff --git a/isl_map_piplib.c b/isl_map_piplib.c index 8dad265..f5741c0 100644 --- a/isl_map_piplib.c +++ b/isl_map_piplib.c @@ -1,7 +1,7 @@ -#include #include "isl_set.h" #include "isl_map.h" -#include "isl_map_private.h" +#include "isl_piplib.h" +#include "isl_map_piplib.h" static void copy_values_from(isl_int *dst, Entier *src, unsigned n) { @@ -204,7 +204,7 @@ error: * Returns a map with "context" as domain and as range the first * "keep" variables in the quast lists. */ -struct isl_map *isl_map_from_quast(struct isl_ctx *ctx, PipQuast *q, +static struct isl_map *isl_map_from_quast(struct isl_ctx *ctx, PipQuast *q, unsigned keep, struct isl_basic_set *context, struct isl_set **rest) @@ -421,21 +421,21 @@ error: return NULL; } -struct isl_map *pip_isl_basic_map_lexmax(struct isl_ctx *ctx, +struct isl_map *isl_pip_basic_map_lexmax(struct isl_ctx *ctx, struct isl_basic_map *bmap, struct isl_basic_set *dom, struct isl_set **empty) { return extremum_on(ctx, bmap, dom, empty, 1); } -struct isl_map *pip_isl_basic_map_lexmin(struct isl_ctx *ctx, +struct isl_map *isl_pip_basic_map_lexmin(struct isl_ctx *ctx, struct isl_basic_map *bmap, struct isl_basic_set *dom, struct isl_set **empty) { return extremum_on(ctx, bmap, dom, empty, 0); } -struct isl_map *pip_isl_basic_map_compute_divs(struct isl_ctx *ctx, +struct isl_map *isl_pip_basic_map_compute_divs(struct isl_ctx *ctx, struct isl_basic_map *bmap) { PipMatrix *domain = NULL, *context = NULL;