From bdf2ddfb26f52f588f54723f27dc23591797790a Mon Sep 17 00:00:00 2001 From: John Maddock Date: Fri, 8 Feb 2002 12:42:59 +0000 Subject: [PATCH] Added support for BOOST_NO_EXCEPTIONS [SVN r12756] --- config.htm | 10 ++++++--- configure | 36 ++++++++++++++++---------------- test/boost_no_exceptions.ipp | 40 ++++++++++++++++++++++++++++++++++++ test/config_info.cpp | 1 + test/config_test.cpp | 8 +++++++- test/no_exceptions_fail.cpp | 36 ++++++++++++++++++++++++++++++++ test/no_exceptions_pass.cpp | 36 ++++++++++++++++++++++++++++++++ test/regression.cfg | 2 ++ 8 files changed, 147 insertions(+), 22 deletions(-) create mode 100644 test/boost_no_exceptions.ipp create mode 100644 test/no_exceptions_fail.cpp create mode 100644 test/no_exceptions_pass.cpp diff --git a/config.htm b/config.htm index 32d19205..5b2ebef9 100644 --- a/config.htm +++ b/config.htm @@ -1,4 +1,3 @@ - @@ -12,8 +11,8 @@ content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot"> -

Boost

+

Boost

Boost Configuration Reference

@@ -540,6 +539,11 @@ struct foo : { class X { ... }; + + BOOST_NO_EXCEPTIONS + Compiler + The compiler does not support exception handling. + BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS Compiler diff --git a/configure b/configure index eaccd1ae..df2a190a 100644 --- a/configure +++ b/configure @@ -78,7 +78,7 @@ $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; ex # We need space, tab and new line, in precisely that order. as_nl=' ' -IFS=" $as_nl" +IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } @@ -745,7 +745,7 @@ do | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" ac_sep=" " ;; @@ -772,7 +772,7 @@ trap 'exit_status=$? *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ @@ -858,7 +858,7 @@ echo "$as_me: current value: $ac_new_val" >&2;} # we pass some twice (in addition to the command line arguments). if test "$ac_new_set" = set; then case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args '$ac_arg'" ;; @@ -883,7 +883,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; +' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac @@ -1146,9 +1146,9 @@ if test "$cross_compiling" != yes; then cross_compiling=no else if test "$cross_compiling" = maybe; then - cross_compiling=yes + cross_compiling=yes else - { { echo "$as_me:1151: error: cannot run C++ compiled programs. + { { echo "$as_me:1151: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'." >&2;} @@ -1608,8 +1608,8 @@ ac_cv_lib_rt=ac_cv_lib_rt_main for file in ./test/boost_no*.cxx; do basename=`echo $file | sed 's/.*boost_\(.*\)\.cxx/\1/'` - macroname=`cat $file | grep '^//[] []*MACRO:' | sed 's/.*MACRO:[] []*\([]_A-Z0-9[]*\).*/\1/'` - title=`cat $file | grep '^//[] []*TITLE:' | sed 's/.*TITLE:[] []*\([]^ [].*\)/\1/'` + macroname=`cat $file | grep '^//[] []*MACRO:' | sed 's/.*MACRO:[] []*\([]_A-Z0-9[]*\).*/\1/'` + title=`cat $file | grep '^//[] []*TITLE:' | sed 's/.*TITLE:[] []*\([]^ [].*\)/\1/'` namespace=`echo $macroname | tr [:upper:] [:lower:]` #echo file = $file @@ -1747,8 +1747,8 @@ done for file in ./test/boost_has*.cxx; do basename=`echo $file | sed 's/.*boost_\(.*\)\.cxx/\1/'` - macroname=`cat $file | grep '^//[] []*MACRO:' | sed 's/.*MACRO:[] []*\([]_A-Z0-9[]*\).*/\1/'` - title=`cat $file | grep '^//[] []*TITLE:' | sed 's/.*TITLE:[] []*\([]^ [].*\)/\1/'` + macroname=`cat $file | grep '^//[] []*MACRO:' | sed 's/.*MACRO:[] []*\([]_A-Z0-9[]*\).*/\1/'` + title=`cat $file | grep '^//[] []*TITLE:' | sed 's/.*TITLE:[] []*\([]^ [].*\)/\1/'` namespace=`echo $macroname | tr [:upper:] [:lower:]` # echo $file @@ -2009,13 +2009,13 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ + ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; +s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; -s/^[^=]*=[ ]*$//; +s/^[^=]*=[ ]*$//; }' fi @@ -2029,13 +2029,13 @@ fi cat >confdef2opt.sed <<\EOF t clear : clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g @@ -2128,7 +2128,7 @@ $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; ex # We need space, tab and new line, in precisely that order. as_nl=' ' -IFS=" $as_nl" +IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } diff --git a/test/boost_no_exceptions.ipp b/test/boost_no_exceptions.ipp new file mode 100644 index 00000000..34a98474 --- /dev/null +++ b/test/boost_no_exceptions.ipp @@ -0,0 +1,40 @@ +// (C) Copyright John Maddock 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// MACRO: BOOST_NO_EXCEPTIONS +// TITLE: exception handling support +// DESCRIPTION: The compiler in its current translation mode supports +// exception handling. + + +namespace boost_no_exceptions{ + +void throw_it(int i) +{ + throw i; +} + +int test() +{ + try + { + throw_it(2); + } + catch(int i) + { + return (i == 2) ? 0 : -1; + } + catch(...) + { + return -1; + } + return -1; +} + +} + + + + diff --git a/test/config_info.cpp b/test/config_info.cpp index db0c0588..ef8c2314 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -857,6 +857,7 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_CWCTYPE); PRINT_MACRO(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS); PRINT_MACRO(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS); + PRINT_MACRO(BOOST_NO_EXCEPTIONS); PRINT_MACRO(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS); PRINT_MACRO(BOOST_NO_FUNCTION_TEMPLATE_ORDERING); PRINT_MACRO(BOOST_NO_HASH); diff --git a/test/config_test.cpp b/test/config_test.cpp index 2e5f646b..b84b3b8c 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -10,7 +10,7 @@ // Do not edit this file, it was generated automatically by // ../tools/generate from boost_*.cxx on -// Sun Feb 3 10:12:32 EST 2002 +// Fri Feb 8 11:29:25 2002 #include #define BOOST_INCLUDE_MAIN @@ -62,6 +62,11 @@ namespace boost_no_dependent_nested_derivations = empty_boost; #else namespace boost_no_dependent_types_in_template_value_parameters = empty_boost; #endif +#ifndef BOOST_NO_EXCEPTIONS +#include "boost_no_exceptions.cxx" +#else +namespace boost_no_exceptions = empty_boost; +#endif #ifndef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS #include "boost_no_exp_func_tem_arg.cxx" #else @@ -360,6 +365,7 @@ int test_main( int, char *[] ) BOOST_TEST(0 == boost_no_inclass_member_initialization::test()); BOOST_TEST(0 == boost_no_function_template_ordering::test()); BOOST_TEST(0 == boost_no_explicit_function_template_arguments::test()); + BOOST_TEST(0 == boost_no_exceptions::test()); BOOST_TEST(0 == boost_no_dependent_types_in_template_value_parameters::test()); BOOST_TEST(0 == boost_no_dependent_nested_derivations::test()); BOOST_TEST(0 == boost_no_cwctype::test()); diff --git a/test/no_exceptions_fail.cpp b/test/no_exceptions_fail.cpp new file mode 100644 index 00000000..337d45b2 --- /dev/null +++ b/test/no_exceptions_fail.cpp @@ -0,0 +1,36 @@ + +// (C) Copyright Boost.org 1999. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// Test file for macro BOOST_NO_EXCEPTIONS +// This file should not compile, if it does then +// BOOST_NO_EXCEPTIONS need not be defined. +// see boost_no_exceptions.cxx for more details + +// Do not edit this file, it was generated automatically by +// ../tools/generate from boost_no_exceptions.cxx on +// Fri Feb 8 11:29:25 2002 + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include +#include "test.hpp" + +#ifdef BOOST_NO_EXCEPTIONS +#include "boost_no_exceptions.cxx" +#else +#error "this file should not compile" +#endif + +int cpp_main( int, char *[] ) +{ + return boost_no_exceptions::test(); +} + diff --git a/test/no_exceptions_pass.cpp b/test/no_exceptions_pass.cpp new file mode 100644 index 00000000..a5367dce --- /dev/null +++ b/test/no_exceptions_pass.cpp @@ -0,0 +1,36 @@ + +// (C) Copyright Boost.org 1999. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// Test file for macro BOOST_NO_EXCEPTIONS +// This file should compile, if it does not then +// BOOST_NO_EXCEPTIONS needs to be defined. +// see boost_no_exceptions.cxx for more details + +// Do not edit this file, it was generated automatically by +// ../tools/generate from boost_no_exceptions.cxx on +// Fri Feb 8 11:29:25 2002 + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include +#include "test.hpp" + +#ifndef BOOST_NO_EXCEPTIONS +#include "boost_no_exceptions.cxx" +#else +namespace boost_no_exceptions = empty_boost; +#endif + +int cpp_main( int, char *[] ) +{ + return boost_no_exceptions::test(); +} + diff --git a/test/regression.cfg b/test/regression.cfg index 3c448c0b..7acd95a1 100644 --- a/test/regression.cfg +++ b/test/regression.cfg @@ -23,6 +23,8 @@ run libs/config/test/no_dep_nested_class_pass.cpp link-fail libs/config/test/no_dep_nested_class_fail.cpp run libs/config/test/no_dep_val_param_pass.cpp link-fail libs/config/test/no_dep_val_param_fail.cpp +run libs/config/test/no_exceptions_pass.cpp +link-fail libs/config/test/no_exceptions_fail.cpp run libs/config/test/no_exp_func_tem_arg_pass.cpp link-fail libs/config/test/no_exp_func_tem_arg_fail.cpp run libs/config/test/no_func_tmp_order_pass.cpp