Olav,
patch looks good. I have some questions; see inline.
On So, 2008-11-23 at 22:02 +0000, Olav Sandstaa wrote:
> #At file:///home/os136802/mysql/develop/repo/falcon-bug39419/ based on
> revid:john.embretsen@stripped
>
> 2916 Olav Sandstaa 2008-11-23
> Bug#39419 Falcon should not be compiled if compiler or options do not support
> exceptions
>
> Adds a check to configure that verifies that the compiler with the
> given compiler options will produce code that handles C++ exceptions. This
> test is done by running a small program that throws an catches an exception.
> If this program does not work correctly, configure will exit will an error
> message and needs to be re-run either with correct compiler options of with
> Falcon disabled.
>
> Adds a check to the Falcon source code that tests that GCC and Windows
> compilers are
> compiling with C++ exceptions enabled. This test will fail during compilation
> if the
> compiler is not running with C++ exceptions enabled.
> modified:
> storage/falcon/ha_falcon.cpp
> storage/falcon/plug.in
>
> per-file messages:
> storage/falcon/ha_falcon.cpp
> Added compile time test for checking that C++ exceptions are enabled. Currently
> only
> GCC and Microsoft compilers will be tested.
> storage/falcon/plug.in
> Added test to verify that the compiler with the given compiler options will
> produce code
> that handles C++ exceptions.
> === modified file 'storage/falcon/ha_falcon.cpp'
>
> === modified file 'storage/falcon/ha_falcon.cpp'
> --- a/storage/falcon/ha_falcon.cpp 2008-11-16 11:30:45 +0000
> +++ b/storage/falcon/ha_falcon.cpp 2008-11-23 22:02:22 +0000
> @@ -46,6 +46,11 @@
> #include "ScaledBinary.h"
> #include "BigInt.h"
>
> +/* Verify that the compiler options have enabled C++ exception support */
> +#if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || (defined (_MSVC_VER)
> && !defined (_CPPUNWIND))
> +#error Falcon needs to be compiled with support for C++ exceptions. Please check
> your compiler settings.
> +#endif
> +
> //#define NO_OPTIMIZE
> #define VALIDATE
> //#define DEBUG_BACKLOG
>
> === modified file 'storage/falcon/plug.in'
> --- a/storage/falcon/plug.in 2008-11-03 08:56:28 +0000
> +++ b/storage/falcon/plug.in 2008-11-23 22:02:22 +0000
> @@ -106,9 +106,6 @@
> )
> ])
>
> - CXXFLAGS=$ac_save_CXXFLAGS
> - AC_LANG_POP([C++])
> -
* What is $ac_save_CXXFLAGS?
* What does AC_LANG_POP do?
> # Falcon uses exceptions and STL.
> CXXLDFLAGS="$CXXLDFLAGS $falcon_cxx_enable_stl"
> FALCON_CXXFLAGS="$falcon_cxx_no_invalid_offsetof
> $falcon_cxx_enable_implicit_templates $falcon_cxx_enable_exceptions"
> @@ -119,6 +116,34 @@
>
> AC_SUBST([FALCON_CXXFLAGS])
>
> + # Check that C++ exceptions works in an executable by actually running a
> + # compiled program and throwing and catching an exception
> + CXXFLAGS=$FALCON_CXXFLAGS
What is the difference between $ac_save_CXXFLAGS and $FALCON_CXXFLAGS?
> + AC_CACHE_CHECK([if compiler and compiler options support C++ exceptions for
> Falcon],
> + falcon_supported_by_compiler,[
> + AC_TRY_RUN([
> + int main() {
> + try {
> + throw 1;
> + }
> + catch (int) {
> + return 0;
> + }
> + return -1;
> + }
> + ], falcon_supported_by_compiler="yes",
> + falcon_supported_by_compiler="no", )
> + ])
> +
> + if test "$falcon_supported_by_compiler" != "yes"; then
> + echo "Falcon must be compiled with support for C++ exceptions enabled."
> + echo "Please adjust your compiler flags or disable support for Falcon
> (--without-plugin-falcon)."
> + exit 1
> + fi
> +
> + CXXFLAGS=$ac_save_CXXFLAGS
> + AC_LANG_POP([C++])
You moved the above two lines down. Does $ac_save_CXXFLAGS collects the
CXXFLAGS we need? I guess AC_LANG_POP() tells me that we are done with
[C++] tests?
[cut]
--
Hakan Küçükyılmaz, Senior Software Engineer DBTG/MySQL +49 160
98953296
Sun Microsystems GmbH Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfang Engels, Dr. Roland Boemer
Vorsitz d. Aufs.rat.: Martin Haering HRB MUC 161028 49.011, 8.376