introduce isl_size return type
commitc1363fd907175bc329488c3f3c22ded538c05a48
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Tue, 7 Aug 2018 10:09:42 +0000 (7 12:09 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Thu, 6 Sep 2018 14:58:32 +0000 (6 16:58 +0200)
tree99f99b32a6df67d0afed19d0739c38ba5c189386
parent46ae49fce768c16c2a434d5710e7d7400677f3e6
introduce isl_size return type

There are several functions in the API that return a value
that is always non-negative (if successful), such as a number
or a position.  Introduce an explicit return type for such
return values.  This serves to document what kind of value
is returned, much like the isl_bool and isl_stat types introduced
in isl-0.14.1-479-g370a8b7d07 (introduce isl_bool and isl_stat
return types, Mon May 4 09:45:16 2015 +0200).
The situation is slightly worse in this case, however,
because some of those functions now return "int", while
others return "unsigned".  Moreover, of those that return "int",
only some return a negative value on an error.
The isl_size type will improve consistency, always returning
a negative value on an error.

This commit only introduces the infrastructure.
The change of return type will be gradually introduced.

The internal representation used for isl_size is "int".
This should be large enough given that the functions
originally returned "int" or "unsigned".
An alternative would be to use "ssize_t" instead,
but there is no strong need and it requires special handling
on Windows.

Note that the isl_size return type will not be used for functions
returning a comparison (which can have a negative value on success).
A separate type for those functions may be introduced later.
It will also not be used for the isl_*_find_dim_by_* functions,
which use a negative value to indicate a failure to find
the dimension.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
cpp/cpp-checked.h.pre
doc/user.pod
include/isl/ctx.h
interface/cpp.cc
interface/generator.cc
interface/generator.h
interface/python.cc