This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: No longer able to detect exception model right
- From: Phil Edwards <phil at jaj dot com>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Tue, 5 Aug 2003 16:55:06 -0400
- Subject: Re: No longer able to detect exception model right
- References: <E0C8F72C-C74A-11D7-9AF5-000393A6D2F2@physics.uc.edu> <20030805201049.GA1544@disaster.jaj.com>
On Tue, Aug 05, 2003 at 04:10:49PM -0400, Phil Edwards wrote:
> On Tue, Aug 05, 2003 at 09:44:04AM -0400, Andrew Pinski wrote:
> > After the update to configure in libstdc++ on openbsd (and any other
> > target that uses sjlj by default),
> > configure will say the exception model is "call frame" all the time
> > unless you use --enable-sjlj-exceptions
> > which is not right.
>
> Thinko on my part. Patch in progress.
Like so.
2003-08-05 Phil Edwards <pme@gcc.gnu.org>
* acinclude.m4 (GLIBCXX_ENABLE_SJLJ_EXCEPTIONS): Put down the crack
pipe, open the window to let out the fumes, redo the option-handling
logic to properly execute the detection test.
* aclocal.m4, configure: Regenerate.
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.259
diff -u -3 -p -r1.259 acinclude.m4
--- acinclude.m4 5 Aug 2003 02:00:03 -0000 1.259
+++ acinclude.m4 5 Aug 2003 20:52:30 -0000
@@ -1360,6 +1360,7 @@ dnl target may or may not support call f
dnl
dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
+dnl Neither one forces an attempt at detection.
dnl
dnl Defines:
dnl _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it
@@ -1368,17 +1369,17 @@ AC_DEFUN(GLIBCXX_ENABLE_SJLJ_EXCEPTIONS,
AC_MSG_CHECKING([for exception model to use])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
- GLIBCXX_ENABLE(sjlj-exceptions,no,,
+ GLIBCXX_ENABLE(sjlj-exceptions,auto,,
[force use of builtin_setjmp for exceptions],
- [:],
- [# Botheration. Now we've got to detect the exception model.
- # Link tests against libgcc.a are problematic since -- at least
- # as of this writing -- we've not been given proper -L bits for
- # single-tree newlib and libgloss.
- #
- # This is what AC_TRY_COMPILE would do if it didn't delete the
- # conftest files before we got a change to grep them first.
- cat > conftest.$ac_ext << EOF
+ [permit yes|no|auto])
+
+ if test $enable_sjlj_exceptions = auto; then
+ # Botheration. Now we've got to detect the exception model. Link tests
+ # against libgcc.a are problematic since we've not been given proper -L
+ # bits for single-tree newlib and libgloss.
+ #
+ # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
+ cat > conftest.$ac_ext << EOF
[#]line __oline__ "configure"
struct S { ~S(); };
void bar();
@@ -1388,27 +1389,34 @@ void foo()
bar();
}
EOF
- old_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS=-S
- if AC_TRY_EVAL(ac_compile); then
- if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
- enable_sjlj_exceptions=yes
- elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
- enable_sjlj_exceptions=no
- fi
- fi
- CXXFLAGS="$old_CXXFLAGS"
- rm -f conftest*
- ])
- if test $enable_sjlj_exceptions = yes; then
- AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
- [Define if the compiler is configured for setjmp/longjmp exceptions.])
- ac_exception_model_name=sjlj
- elif test x$enable_sjlj_exceptions = xno; then
- ac_exception_model_name="call frame"
- else
- AC_MSG_ERROR([unable to detect exception model])
- fi
+ old_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS=-S
+ if AC_TRY_EVAL(ac_compile); then
+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
+ enable_sjlj_exceptions=yes
+ elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
+ enable_sjlj_exceptions=no
+ fi
+ fi
+ CXXFLAGS="$old_CXXFLAGS"
+ rm -f conftest*
+ fi
+
+ # This is a tad weird, for hysterical raisins. We have to map enable/disable
+ # to two different models.
+ case $enable_sjlj_exceptions in
+ yes)
+ AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
+ [Define if the compiler is configured for setjmp/longjmp exceptions.])
+ ac_exception_model_name=sjlj
+ ;;
+ no)
+ ac_exception_model_name="call frame"
+ ;;
+ *)
+ AC_MSG_ERROR([unable to detect exception model])
+ ;;
+ esac
AC_LANG_RESTORE
AC_MSG_RESULT($ac_exception_model_name)
])