diff options
author | Murray Cumming <murrayc@murrayc-desktop.(none)> | 2007-07-21 23:04:07 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc-desktop.(none)> | 2007-07-21 23:04:07 +0200 |
commit | 1e3ccbc4fb196d719f2f72167e2bcb0630a318ee (patch) | |
tree | 4aa074995ea3c09a15a30f58b40542a741b3e81f | |
parent | 79cf762d59060706cc660d4afa8f4b14a60be85d (diff) |
2007-07-21 Murray Cumming <murrayc@murrayc.com>
* m4/reduced.m4: Added, containing CAIROMM_ARG_ENABLE_API_EXCEPTIONS().
* configure.in: Use CAIROMM_ARG_ENABLE_API_EXCEPTIONS() to add a
--enable-api-exceptions=yes/no option.
Used to generate a cairomm/cairommconfig.h config file, which
defines (or not) CAIROMM_EXCEPTIONS_ENABLED.
* cairomm/cairommconfig.h.in: Added, used to generate cairommconfig.h
* cairomm/private.cc:
* cairomm/private.h: Use ifdef to replace throw_exception() with an empty
implementation when exceptions are disabled.
This allows cairomm to be built when using CXXFLAGS=-fno-exceptions.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | cairomm/cairommconfig.h.in | 73 | ||||
-rw-r--r-- | cairomm/private.cc | 8 | ||||
-rw-r--r-- | cairomm/private.h | 4 | ||||
-rw-r--r-- | configure.in | 3 | ||||
-rw-r--r-- | m4/reduced.m4 | 20 |
6 files changed, 119 insertions, 1 deletions
@@ -1,3 +1,15 @@ +2007-07-21 Murray Cumming <murrayc@murrayc.com> + + * m4/reduced.m4: Added, containing CAIROMM_ARG_ENABLE_API_EXCEPTIONS(). + * configure.in: Use CAIROMM_ARG_ENABLE_API_EXCEPTIONS() to add a + --enable-api-exceptions=yes/no option. + Used to generate a cairomm/cairommconfig.h config file, which + defines (or not) CAIROMM_EXCEPTIONS_ENABLED. + * cairomm/cairommconfig.h.in: Added, used to generate cairommconfig.h + * cairomm/private.cc: + * cairomm/private.h: Use ifdef to replace throw_exception() with an empty + implementation when exceptions are disabled. + 2007-07-14 Jonathon Jongsma <jjongsma@gnome.org> * configure.in: post-release version number bump diff --git a/cairomm/cairommconfig.h.in b/cairomm/cairommconfig.h.in new file mode 100644 index 0000000..f1c7895 --- /dev/null +++ b/cairomm/cairommconfig.h.in @@ -0,0 +1,73 @@ +/* cairomm/cairommconfig.h.in. Generated from configure.in by autoheader. */ + +/* Defined when the --enable-api-exceptions configure argument was given */ +#undef CAIROMM_EXCEPTIONS_ENABLED + +/* define if the Boost library is available */ +#undef HAVE_BOOST + +/* define if the Boost::Unit_Test_Framework library is available */ +#undef HAVE_BOOST_UNIT_TEST_FRAMEWORK + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <list> header file. */ +#undef HAVE_LIST + +/* Define to 1 if you have the <map> header file. */ +#undef HAVE_MAP + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <string> header file. */ +#undef HAVE_STRING + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/cairomm/private.cc b/cairomm/private.cc index 5483f38..aaff833 100644 --- a/cairomm/private.cc +++ b/cairomm/private.cc @@ -16,6 +16,7 @@ * 02110-1301, USA. */ +#include <cairommconfig.h> //For CAIROMM_EXCEPTIONS_ENABLED #include <cairomm/private.h> #include <cairomm/exception.h> #include <stdexcept> @@ -24,6 +25,7 @@ namespace Cairo { +#ifdef CAIROMM_EXCEPTIONS_ENABLED void throw_exception(ErrorStatus status) { switch(status) @@ -71,6 +73,12 @@ void throw_exception(ErrorStatus status) break; } } +#else +void throw_exception(ErrorStatus /* status */) +{ + //Do nothing. The application should call get_status() instead. +} +#endif //CAIROMM_EXCEPTIONS_ENABLED } //namespace Cairo diff --git a/cairomm/private.h b/cairomm/private.h index 7b18c5b..6b911b5 100644 --- a/cairomm/private.h +++ b/cairomm/private.h @@ -23,10 +23,11 @@ #include <cairomm/exception.h> #include <string> - +#ifndef DOXYGEN_IGNORE_THIS namespace Cairo { +/// Throws the appropriate exception, if exceptions are enabled. void throw_exception(ErrorStatus status); //We inline this because it is called so often. @@ -44,6 +45,7 @@ void check_object_status_and_throw_exception(const T& object) } } // namespace Cairo +#endif //DOXYGEN_IGNORE_THIS #endif //__CAIROMM_PRIVATE_H diff --git a/configure.in b/configure.in index 658cd9d..bf940e6 100644 --- a/configure.in +++ b/configure.in @@ -30,6 +30,8 @@ VERSION=$GENERIC_VERSION AM_INIT_AUTOMAKE(cairomm, $GENERIC_VERSION) +AM_CONFIG_HEADER(cairomm/cairommconfig.h) + AC_PROG_CXX AC_PROG_CXXCPP AC_LANG_CPLUSPLUS @@ -125,6 +127,7 @@ if test "x$CAIROMM_DEVEL" = "xon" ; then CXXFLAGS="$CXXFLAGS -Wall -g -Werror -Wextra" fi +CAIROMM_ARG_ENABLE_API_EXCEPTIONS() dnl Check whether to build the documentation directory DOCS_SUBDIR="" dnl set DOCS_SUBDIR initially blank diff --git a/m4/reduced.m4 b/m4/reduced.m4 new file mode 100644 index 0000000..5a941fc --- /dev/null +++ b/m4/reduced.m4 @@ -0,0 +1,20 @@ +## CAIROMM_ARG_ENABLE_API_EXCEPTIONS() +## +## Provide the --enable-api-exceptions configure argument, enabled +## by default. +## +AC_DEFUN([CAIROMM_ARG_ENABLE_API_EXCEPTIONS], +[ + AC_ARG_ENABLE([api-exceptions], + [ --enable-api-exceptions Build exceptions API. + [[default=yes]]], + [cairomm_enable_api_exceptions="$enableval"], + [cairomm_enable_api_exceptions='yes']) + + if test "x$cairomm_enable_api_exceptions" = "xyes"; then + { + AC_DEFINE([CAIROMM_EXCEPTIONS_ENABLED],[1], [Defined when the --enable-api-exceptions configure argument was given]) + } + fi +]) + |