Check the ctx argument of the memory macros
authorTobias Grosser <tobias@grosser.es>
Tue, 7 Jun 2011 19:15:15 +0000 (16:15 -0300)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 7 Jun 2011 19:40:24 +0000 (21:40 +0200)
commit157122e88673001b08d01e4ffed7a833b2d5c0b2
tree112416588897017042016996145a7ca521cb783c
parentadc3b3f624f1ce6362df58c3710e2ac116a39873
Check the ctx argument of the memory macros

Isl defines its own set of memory management macros. These macros currently
expect an isl_ctx*, but do not yet actively use it. Hence, it is possible to
pass a random string to these macros, without the compiler issuing any warnings.
And in case an isl_ctx* is passed, the compiler does not count the macro call
as a valid use, which may lead to some unexpected 'variable never used'
warnings.

We solve this, by adding a compile time check that always verifies that ctx has
the type isl_ctx*. This is also a valid use of ctx and consequently stops the
'variable never used' warnings. The check itself is designed such that it will
be optimized out during compilation.

While at this fix all cases, where some invalid structures were passed to the
memory location macros instead of an valid isl_ctx*.

Signed-off-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
include/isl/ctx.h
isl_map_simplify.c
isl_output.c
isl_polynomial.c
isl_transitive_closure.c