#At file:///home/os136802/mysql/develop/repo/falcon-bug39419/ based on
revid:john.embretsen@stripped
2916 Olav Sandstaa 2008-11-25
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-25 13:38:06 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006, 2007 MySQL AB
+/* Copyright (C) 2006, 2007 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -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 (_MSC_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-25 13:38:06 +0000
@@ -106,9 +106,6 @@
)
])
- CXXFLAGS=$ac_save_CXXFLAGS
- AC_LANG_POP([C++])
-
# 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
+ 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++])
+
# When compiling with Sun Studio compiler on SPARC assembly code for
# Interlock operations needs to be included. This has been implemented
# as "inline templates" in a separate file
| Thread |
|---|
| • bzr commit into mysql-6.0-falcon-team branch (olav:2916) Bug#39419 | Olav Sandstaa | 25 Nov |