2006-07-05 Roland Levillain <roland(a)lrde.epita.fr>
Fix some tests using ntg::range.
* tests/types/tests/float_r2, tests/types/tests/range2,
* tests/types/tests/range2b: Fix tests.
Index: 10.230/integre/tests/types/tests/float_r2
--- 10.230/integre/tests/types/tests/float_r2 Tue, 20 Apr 2004 15:16:21 +0200 van-vl_n (oln/h/11_float_r2 1.3 600)
+++ 10.230(w)/integre/tests/types/tests/float_r2 Tue, 04 Jul 2006 14:13:52 +0200 levill_r (oln/h/11_float_r2 1.3 600)
@@ -28,4 +28,8 @@
typedef range<float_s, bounded_s<10, 20>, strict> sr;
sr f = 23.0; // ABORT
-(void) f;
+/* Make as if `f' is actually used. As we can't cast `f' to `void'
+ here (since it would produce an error in
+ `ntg::range<T, interval, behavior>::operator U()', we assign `f' to
+ itself. */
+f = f;
Index: 10.230/integre/tests/types/tests/range2b
--- 10.230/integre/tests/types/tests/range2b Tue, 20 Apr 2004 15:16:21 +0200 van-vl_n (oln/h/36_range2b 1.2 600)
+++ 10.230(w)/integre/tests/types/tests/range2b Tue, 04 Jul 2006 14:18:29 +0200 levill_r (oln/h/36_range2b 1.2 600)
@@ -27,4 +27,8 @@
// Public License.
range<int_u8, bounded_u<10, 13> > u = 14; // ABORT
-(void) u;
+/* Make as if `u' is actually used. As we can't cast `u' to `void'
+ here (since it would produce an error in
+ `ntg::range<T, interval, behavior>::operator U()', we assign `u' to
+ itself. */
+u = u;
Index: 10.230/integre/tests/types/tests/range2
--- 10.230/integre/tests/types/tests/range2 Tue, 20 Apr 2004 15:16:21 +0200 van-vl_n (oln/h/33_range2 1.2 600)
+++ 10.230(w)/integre/tests/types/tests/range2 Tue, 04 Jul 2006 14:17:13 +0200 levill_r (oln/h/33_range2 1.2 600)
@@ -27,4 +27,8 @@
// Public License.
range<int_u8, bounded_u<10, 13>, strict> u = 14; // ABORT
-(void) u;
+/* Make as if `u' is actually used. As we can't cast `u' to `void'
+ here (since it would produce an error in
+ `ntg::range<T, interval, behavior>::operator U()', we assign `u' to
+ itself. */
+u = u;
On 2006-07-04, Roland Levillain <roland(a)lrde.epita.fr> wrote:
>
> Fix C++ compiler identification.
>
> * config/oln.m4 (AC_CXX_FLAGS): Check for the Intel C++ compiler
> before the GNU C++ compiler.
>
>
> Index: 10.227/config/oln.m4
> --- 10.227/config/oln.m4 Fri, 30 Jun 2006 16:51:46 +0200 levill_r (oln/j/15_oln.m4 1.38.1.12 600)
> +++ 10.227(w)/config/oln.m4 Tue, 04 Jul 2006 11:33:53 +0200 levill_r (oln/j/15_oln.m4 1.38.1.12 600)
> @@ -465,15 +465,19 @@
> # specifications.
>
> # This macro checks for the following compilers :
> +# - Intel C++ (icpc)
> # - GNU C++ (g++)
> # - Sun WorkShop C++ (Sun/CC)
> -# - Intel C++ (icc)
> # - Comeau C++ (como)
> # and sets the following autoconf variables:
> # CXXFLAGS_DEBUG
> # CXXFLAGS_STRICT
> # CXXFLAGS_STRICT_ERRORS
> # CXXFLAGS_OPTIMIZE
> +#
> +# The Intel C++ compiler is checked before the GNU C++ compiler,
> +# because our test for the latter recognizes the former as G++ (i.e.,
> +# icpc defines __GNUC__). Perhaps we should use another test for G++.
>
First off, I thought about using __GNUG__ but icpc also defines it :(
__GNUG__
The GNU C compiler defines this when the compilation language is C++; use
`__GNUG__' to distinguish between GNU C and GNU C++.
icpc defines the following:
#define __GNUG__ 3
#define __GNUC__ 4
#define __GNUC_MINOR__ 0
#define __VERSION__ "Intel(R) C++ gcc 3.0 mode"
How about grepping the result of icpc -E?
<<<< test.cc <<<<
__VERSION__
>>>>>>>>>>>>>>>>>
if icpc -E test.cc | grep -i intel >/dev/null; then
echo 'ICPC'
else
echo 'Try something else :)'
fi
--
SIGOURE Benoit aka Tsuna
_____
/EPITA\ Promo 2008.CSI Rock & tRoll
2006-07-04 Roland Levillain <roland(a)lrde.epita.fr>
Fix C++ compiler identification.
* config/oln.m4 (AC_CXX_FLAGS): Check for the Intel C++ compiler
before the GNU C++ compiler.
Index: 10.227/config/oln.m4
--- 10.227/config/oln.m4 Fri, 30 Jun 2006 16:51:46 +0200 levill_r (oln/j/15_oln.m4 1.38.1.12 600)
+++ 10.227(w)/config/oln.m4 Tue, 04 Jul 2006 11:33:53 +0200 levill_r (oln/j/15_oln.m4 1.38.1.12 600)
@@ -465,15 +465,19 @@
# specifications.
# This macro checks for the following compilers :
+# - Intel C++ (icpc)
# - GNU C++ (g++)
# - Sun WorkShop C++ (Sun/CC)
-# - Intel C++ (icc)
# - Comeau C++ (como)
# and sets the following autoconf variables:
# CXXFLAGS_DEBUG
# CXXFLAGS_STRICT
# CXXFLAGS_STRICT_ERRORS
# CXXFLAGS_OPTIMIZE
+#
+# The Intel C++ compiler is checked before the GNU C++ compiler,
+# because our test for the latter recognizes the former as G++ (i.e.,
+# icpc defines __GNUC__). Perhaps we should use another test for G++.
AC_DEFUN([AC_CXX_FLAGS],
[dnl
@@ -482,7 +486,10 @@
AC_CACHE_CHECK([for C++ compiler-specific extra flags],
[ac_cv_cxx_style],
[ac_cv_cxx_style=unknown
- if test "x$ac_compiler_gnu" != xno; then
+ if $CXX -V 2>&1 | grep -i "Intel(R) C++">/dev/null 2>&1;
+ then
+ ac_cv_cxx_style=Intel
+ elif test "x$ac_compiler_gnu" != xno; then
[case `$CXX --version` in
*3.[2-9]* | \
*[4-9].* )
@@ -492,9 +499,6 @@
esac]
elif $CXX -V 2>&1 | grep -i "WorkShop">/dev/null 2>&1; then
ac_cv_cxx_style=Sun
- elif $CXX -V 2>&1 | grep -i "Intel(R) C++">/dev/null 2>&1;
- then
- ac_cv_cxx_style=Intel
else
echo "int main() {}" >conftest.cc
if $CXX --version conftest.cc 2>&1 \
2006-06-30 Roland Levillain <roland(a)lrde.epita.fr>
* oln/arith/internal/opdecls.hh (oln_arith_declare_binop_procs_):
Re-enable the third operator, but rename it as OPNAME_with_ret.
* oln/morpho/geodesic_erosion.hh: Typos in comments.
Index: 10.224/olena/oln/arith/internal/opdecls.hh
--- 10.224/olena/oln/arith/internal/opdecls.hh Thu, 22 Jun 2006 10:49:20 +0200 levill_r (oln/b/22_opdecls.hh 1.20 600)
+++ 10.224(w)/olena/oln/arith/internal/opdecls.hh Fri, 30 Jun 2006 11:40:04 +0200 levill_r (oln/b/22_opdecls.hh 1.20 600)
@@ -1,4 +1,5 @@
-// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004, 2006 EPITA Research and
+// Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -175,9 +176,41 @@
#define default_functor_return_type_cst_(OPNAME, I1, T2) \
typename default_functor_type_cst_(OPNAME, I1, T2)::result_type
-/// Declare front-end functions.
+/** \def Declare front-end functions.
+
+ OPNAME_with_ret used to be named OPNAME previously, but it caused
+ ambiguous calls with modern (and more compliant) compilers
+ (GCC 4.0, GCC 4.1, ICC 9.1). These compilers consider that
+
+ \code
+ OPNAME<T>(ima1, ima2);
+ \endcode
+
+ could be both interpreted as a call to
+
+ \code
+ template<class I1, class I2> inline
+ typename arith_return_type_proxy_##OPNAME##_<I1, I2>::ret
+ OPNAME(const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
+
+ (with I1 = T and I2 = typeof(ima2))
+ \endcode
+
+ as well as a call to
+
+ \code
+ template<class IRet, class I1, class I2> inline
+ typename mute<I1, oln_value_type(IRet)>::ret
+ OPNAME(const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
+
+ (with IRet = T, I1 = typeof(ima1), I2 = typeof(ima2)).
+ \endcode
+
+ Using different names for these operators removes the ambiguity. */
# define oln_arith_declare_binop_procs_(OPNAME) \
- /* \
+ /* \
FIXME: this is a workaround for an odd bug of icc and como \
http://www.lrde.epita.fr/cgi-bin/twiki/view/Know/MysteriousTemplateFunction… \
Remove this traits and use its content directly when this bug gets fixed. \
@@ -218,41 +251,21 @@
T2, \
ntg_return_type(OPNAME, T1, T2)>()), \
input1, input2); \
+ } \
+ \
+ /* Same as above, with inline conversion in the functor. */ \
+ /* This operator has a `_with_ret' suffix for disambiguation purpose */ \
+ /* (see above). */ \
+ template<class IRet, class I1, class I2> inline \
+ typename mute<I1, oln_value_type(IRet)>::ret \
+ OPNAME##_with_ret(const abstract::image<I1>& input1, const abstract::image<I2>& input2) \
+ { \
+ return apply2(f_##OPNAME<oln_value_type(I1), \
+ oln_value_type(I2), \
+ oln_value_type(IRet)>(), \
+ input1, input2); \
}
-/* FIXME: Used to be part from the previous macro, but causes ambiguous
- calls with G++ 4.0 and 4.1: theses compiler seems to consider that
-
- OPNAME(ima1, ima2);
-
- could be both interpreted as a call to
- template<class I1, class I2> inline
- typename arith_return_type_proxy_##OPNAME##_<I1, I2>::ret
- OPNAME(const abstract::image<I1>& input1,
- const abstract::image<I2>& input2)
-
- or
-
- template<class IRet, class I1, class I2> inline
- typename mute<I1, oln_value_type(IRet)>::ret
- OPNAME(const abstract::image<I1>& input1,
- const abstract::image<I2>& input2)
-
- despite the fact that this call doesn't resolve the first parameter
- (`IRet') of the second version. It might be a bug in the 4.x branch
- of G++. */
-//
-//
-// /* Same as above, with inline conversion in the functor. */
-// template<class IRet, class I1, class I2> inline
-// typename mute<I1, oln_value_type(IRet)>::ret
-// OPNAME(const abstract::image<I1>& input1, const abstract::image<I2>& input2)
-// {
-// return apply2(f_##OPNAME<oln_value_type(I1),
-// oln_value_type(I2),
-// oln_value_type(IRet)>(),
-// input1, input2);
-// }
/// Apply OPNAME with a constant as second operand.
# define oln_arith_declare_binopcst_procs_(OPNAME) \
Index: 10.224/olena/oln/morpho/geodesic_erosion.hh
--- 10.224/olena/oln/morpho/geodesic_erosion.hh Wed, 14 Apr 2004 00:08:50 +0200 thivol_d (oln/36_geodesic_e 1.20 600)
+++ 10.224(w)/olena/oln/morpho/geodesic_erosion.hh Fri, 23 Jun 2006 18:45:56 +0200 levill_r (oln/36_geodesic_e 1.20 600)
@@ -47,7 +47,7 @@
** \param N Exact type of neighborhood.
**
** \arg marker Image to work on.
- ** \arg mask Image used for geodesic dilation.
+ ** \arg mask Image used for geodesic erosion.
** \arg Ng Neighborhood to use.
**
** Compute the geodesic erosion of marker with respect to the
@@ -104,13 +104,13 @@
** \param N Exact type of neighborhood.
**
** \arg marker Image to work on.
- ** \arg mask Image used for geodesic dilation.
+ ** \arg mask Image used for geodesic erosion.
** \arg Ng Neighborhood to use.
**
- ** Compute the geodesic erosion of marker with respect to the
- ** mask mask image using se as structural element. Soille
+ ** Compute the geodesic erosion of marker with respect to the
+ ** mask image using se as structural element. Soille
** p.156. Computation is performed by hand (i.e without calling
- ** dilation).
+ ** erosion).
**
** \pre Marker must be greater or equal than mask.
**