mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Improved checks for native ObjC exceptions. We now check the runtime support here, and disable them from here regardless of what gnustep-make did (this makes it easier to change the runtime without reconfiguring gnustep-make). Small update to ObjC runtime code for GCC 4.6
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32820 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9eacfdee70
commit
88621c104a
5 changed files with 137 additions and 31 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
||||||
|
2011-04-09 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
|
* Source/Additions/GSObjCRuntime.m (GSSelectorFromNameAndTypes):
|
||||||
|
Uncommented case for __GNU_LIBOBJC__.
|
||||||
|
|
||||||
|
2011-04-09 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
|
* configure.ac: Updated the checks to enable native Objective-C
|
||||||
|
exceptions. If native exceptions were enabled in gnustep-make -
|
||||||
|
because the compiler supports them -, but are disabled here
|
||||||
|
because there is no uncaught exception handler in the runtime,
|
||||||
|
print an explanation without aborting; we now disable them via
|
||||||
|
base.make.
|
||||||
|
* configure: Regnerated.
|
||||||
|
* base.make.in: Set USE_OBJC_EXCEPTIONS to no if we disabled
|
||||||
|
native exceptions when configuring.
|
||||||
|
|
||||||
2011-04-09 Nicola Pero <nicola.pero@meta-innovation.com>
|
2011-04-09 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
* Tests/GNUmakefile: Updated comments.
|
* Tests/GNUmakefile: Updated comments.
|
||||||
|
|
|
@ -143,10 +143,8 @@ GSSelectorFromNameAndTypes(const char *name, const char *types)
|
||||||
{
|
{
|
||||||
#if NeXT_RUNTIME
|
#if NeXT_RUNTIME
|
||||||
return sel_getUid(name);
|
return sel_getUid(name);
|
||||||
/* Don't do the next line until the function works.
|
|
||||||
#elif defined (__GNU_LIBOBJC__)
|
#elif defined (__GNU_LIBOBJC__)
|
||||||
return sel_registerTypedName(name, types);
|
return sel_registerTypedName(name, types);
|
||||||
*/
|
|
||||||
#elif defined (__GNUSTEP_RUNTIME__)
|
#elif defined (__GNUSTEP_RUNTIME__)
|
||||||
return sel_registerTypedName_np(name, types);
|
return sel_registerTypedName_np(name, types);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -55,4 +55,12 @@ endif
|
||||||
GNUSTEP_BASE_HAVE_MDNS=@HAVE_MDNS@
|
GNUSTEP_BASE_HAVE_MDNS=@HAVE_MDNS@
|
||||||
GNUSTEP_BASE_HAVE_AVAHI=@HAVE_AVAHI@
|
GNUSTEP_BASE_HAVE_AVAHI=@HAVE_AVAHI@
|
||||||
GNUSTEP_BASE_HAVE_UCI=@HAVE_UCI@
|
GNUSTEP_BASE_HAVE_UCI=@HAVE_UCI@
|
||||||
|
|
||||||
|
# If we determined that the Objective-C runtime does not support
|
||||||
|
# native Objective-C exceptions, turn them off. This overrides
|
||||||
|
# the USE_OBJC_EXCEPTIONS setting in gnustep-make's config.make.
|
||||||
|
ifeq (@BASE_NATIVE_OBJC_EXCEPTIONS@, 0)
|
||||||
|
USE_OBJC_EXCEPTIONS = no
|
||||||
|
endif
|
||||||
|
|
||||||
endif # BASE_MAKE_LOADED
|
endif # BASE_MAKE_LOADED
|
||||||
|
|
76
configure
vendored
76
configure
vendored
|
@ -647,6 +647,7 @@ DEFINE_INT8_T
|
||||||
INCLUDE_STDINT
|
INCLUDE_STDINT
|
||||||
HAVE_PTS_STREAM_MODULES
|
HAVE_PTS_STREAM_MODULES
|
||||||
HAVE_OBJC_SYNC_ENTER
|
HAVE_OBJC_SYNC_ENTER
|
||||||
|
BASE_NATIVE_OBJC_EXCEPTIONS
|
||||||
GS_MIXEDABI
|
GS_MIXEDABI
|
||||||
GS_NONFRAGILE
|
GS_NONFRAGILE
|
||||||
OBJCFLAGS
|
OBJCFLAGS
|
||||||
|
@ -715,7 +716,6 @@ build_vendor
|
||||||
build_cpu
|
build_cpu
|
||||||
build
|
build
|
||||||
BASE_NONFRAGILE_ABI
|
BASE_NONFRAGILE_ABI
|
||||||
BASE_NATIVE_OBJC_EXCEPTIONS
|
|
||||||
target_alias
|
target_alias
|
||||||
host_alias
|
host_alias
|
||||||
build_alias
|
build_alias
|
||||||
|
@ -802,8 +802,7 @@ CFLAGS
|
||||||
LDFLAGS
|
LDFLAGS
|
||||||
LIBS
|
LIBS
|
||||||
CPPFLAGS
|
CPPFLAGS
|
||||||
CPP
|
CPP'
|
||||||
CPPFLAGS'
|
|
||||||
ac_subdirs_all='SSL'
|
ac_subdirs_all='SSL'
|
||||||
|
|
||||||
# Initialize some variables set by options.
|
# Initialize some variables set by options.
|
||||||
|
@ -2572,16 +2571,6 @@ if test -z "$LIBRARY_COMBO"; then
|
||||||
LIBRARY_COMBO=`gnustep-config --variable=LIBRARY_COMBO 2>&5`
|
LIBRARY_COMBO=`gnustep-config --variable=LIBRARY_COMBO 2>&5`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exceptions=`gnustep-config --objc-flags | grep _NATIVE_OBJC_EXCEPTIONS 2>&5`
|
|
||||||
if test -z "$exceptions"; then
|
|
||||||
exceptions=no
|
|
||||||
BASE_NATIVE_OBJC_EXCEPTIONS=0
|
|
||||||
else
|
|
||||||
exceptions=yes
|
|
||||||
BASE_NATIVE_OBJC_EXCEPTIONS=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
nonfragile=`gnustep-config --objc-flags | grep _NONFRAGILE_ABI 2>&5`
|
nonfragile=`gnustep-config --objc-flags | grep _NONFRAGILE_ABI 2>&5`
|
||||||
if test -z "$nonfragile"; then
|
if test -z "$nonfragile"; then
|
||||||
nonfragile=no
|
nonfragile=no
|
||||||
|
@ -6940,9 +6929,40 @@ rm -f conftest*
|
||||||
|
|
||||||
# Don't revert any Objective-C flags as they are used in the next test
|
# Don't revert any Objective-C flags as they are used in the next test
|
||||||
|
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Native Objective-C exceptions
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# First of all, determine if native Objective-C exceptions are enabled
|
||||||
|
# in gnustep-make. They are enabled if the compiler supports it; they
|
||||||
|
# are disabled if it doesn't. And, of course, the user may have
|
||||||
|
# forced one behaviour or the other. Note that we go and look at the
|
||||||
|
# actual config.make file to be able to know what was configured in
|
||||||
|
# gnustep-make regardless of any gnustep-base that is currently
|
||||||
|
# installed. We can't use `gnustep-config --objc-flags` because that
|
||||||
|
# may report native exceptions as disabled because the currently
|
||||||
|
# installed gnustep-base has them disabled.
|
||||||
|
if grep USE_OBJC_EXCEPTIONS $CURRENT_GNUSTEP_MAKEFILES/$lobj_dir/config.make | grep yes >&5 2>&5; then
|
||||||
|
exceptions=yes
|
||||||
|
else
|
||||||
|
exceptions=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
# At this point, if exceptions=no, then native exceptions are disabled
|
||||||
|
# and won't be used. If exceptions=yes, we need to check if they work
|
||||||
|
# and if the runtime has proper support for them. If it does, we'll
|
||||||
|
# happily use them; if it doesn't, we'll automatically disable them
|
||||||
|
# because they don't work. ;-)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# One of these is needed by for handling uncaught exceptions
|
# One of these is needed by for handling uncaught exceptions
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# TODO: These checks are not really needed if native exceptions are
|
||||||
|
# disabled. So maybe we should not run them at all in that case. On
|
||||||
|
# the other hand, that case is going to become more and more unusual.
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objc_setUncaughtExceptionHandler() in runtime" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objc_setUncaughtExceptionHandler() in runtime" >&5
|
||||||
$as_echo_n "checking for objc_setUncaughtExceptionHandler() in runtime... " >&6; }
|
$as_echo_n "checking for objc_setUncaughtExceptionHandler() in runtime... " >&6; }
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
@ -7018,14 +7038,38 @@ fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_unexpected" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_unexpected" >&5
|
||||||
$as_echo "$have_unexpected" >&6; }
|
$as_echo "$have_unexpected" >&6; }
|
||||||
|
|
||||||
|
# TODO: It would also be nice to actually test that native Objective-C
|
||||||
|
# exceptions work.
|
||||||
|
|
||||||
if test "$exceptions" = "yes"; then
|
if test "$exceptions" = "yes"; then
|
||||||
if test $have_set_unexpected = no; then
|
if test x"$have_set_uncaught_exception_handler" = x"no"; then
|
||||||
if test $have_unexpected = no; then
|
if test x"$have_set_unexpected" = x"no"; then
|
||||||
as_fn_error $? "Your objective-c runtime library does not appear to support any mechanism to set a handler for uncaught native exceptions. Please upgrade your runtime or re-install gnustep-make without native-objc-exceptions!" "$LINENO" 5
|
if test x"$have_unexpected" = x"no"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Disabling native Objective-C exceptions because the ObjC runtime" >&5
|
||||||
|
$as_echo "$as_me: Disabling native Objective-C exceptions because the ObjC runtime" >&6;}
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: has no way to set an uncaught exception handler. Please install" >&5
|
||||||
|
$as_echo "$as_me: has no way to set an uncaught exception handler. Please install" >&6;}
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: a recent Objective-C runtime if you want to use them." >&5
|
||||||
|
$as_echo "$as_me: a recent Objective-C runtime if you want to use them." >&6;}
|
||||||
|
exceptions="no";
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable native Objective-C exceptions" >&5
|
||||||
|
$as_echo_n "checking whether to enable native Objective-C exceptions... " >&6; }
|
||||||
|
if test "$exceptions" = "yes"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
BASE_NATIVE_OBJC_EXCEPTIONS=1
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
BASE_NATIVE_OBJC_EXCEPTIONS=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Don't revert any Objective-C flags as they are used in the next test
|
# Don't revert any Objective-C flags as they are used in the next test
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
65
configure.ac
65
configure.ac
|
@ -85,16 +85,6 @@ if test -z "$LIBRARY_COMBO"; then
|
||||||
LIBRARY_COMBO=`gnustep-config --variable=LIBRARY_COMBO 2>&5`
|
LIBRARY_COMBO=`gnustep-config --variable=LIBRARY_COMBO 2>&5`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exceptions=`gnustep-config --objc-flags | grep _NATIVE_OBJC_EXCEPTIONS 2>&5`
|
|
||||||
if test -z "$exceptions"; then
|
|
||||||
exceptions=no
|
|
||||||
BASE_NATIVE_OBJC_EXCEPTIONS=0
|
|
||||||
else
|
|
||||||
exceptions=yes
|
|
||||||
BASE_NATIVE_OBJC_EXCEPTIONS=1
|
|
||||||
fi
|
|
||||||
AC_SUBST(BASE_NATIVE_OBJC_EXCEPTIONS)
|
|
||||||
|
|
||||||
nonfragile=`gnustep-config --objc-flags | grep _NONFRAGILE_ABI 2>&5`
|
nonfragile=`gnustep-config --objc-flags | grep _NONFRAGILE_ABI 2>&5`
|
||||||
if test -z "$nonfragile"; then
|
if test -z "$nonfragile"; then
|
||||||
nonfragile=no
|
nonfragile=no
|
||||||
|
@ -1700,9 +1690,40 @@ AC_EGREP_HEADER(objc_get_uninstalled_dtable, objc/objc-api.h,
|
||||||
|
|
||||||
# Don't revert any Objective-C flags as they are used in the next test
|
# Don't revert any Objective-C flags as they are used in the next test
|
||||||
|
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Native Objective-C exceptions
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# First of all, determine if native Objective-C exceptions are enabled
|
||||||
|
# in gnustep-make. They are enabled if the compiler supports it; they
|
||||||
|
# are disabled if it doesn't. And, of course, the user may have
|
||||||
|
# forced one behaviour or the other. Note that we go and look at the
|
||||||
|
# actual config.make file to be able to know what was configured in
|
||||||
|
# gnustep-make regardless of any gnustep-base that is currently
|
||||||
|
# installed. We can't use `gnustep-config --objc-flags` because that
|
||||||
|
# may report native exceptions as disabled because the currently
|
||||||
|
# installed gnustep-base has them disabled.
|
||||||
|
if grep USE_OBJC_EXCEPTIONS $CURRENT_GNUSTEP_MAKEFILES/$lobj_dir/config.make | grep yes >&5 2>&5; then
|
||||||
|
exceptions=yes
|
||||||
|
else
|
||||||
|
exceptions=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
# At this point, if exceptions=no, then native exceptions are disabled
|
||||||
|
# and won't be used. If exceptions=yes, we need to check if they work
|
||||||
|
# and if the runtime has proper support for them. If it does, we'll
|
||||||
|
# happily use them; if it doesn't, we'll automatically disable them
|
||||||
|
# because they don't work. ;-)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# One of these is needed by for handling uncaught exceptions
|
# One of these is needed by for handling uncaught exceptions
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# TODO: These checks are not really needed if native exceptions are
|
||||||
|
# disabled. So maybe we should not run them at all in that case. On
|
||||||
|
# the other hand, that case is going to become more and more unusual.
|
||||||
|
|
||||||
AC_MSG_CHECKING(for objc_setUncaughtExceptionHandler() in runtime)
|
AC_MSG_CHECKING(for objc_setUncaughtExceptionHandler() in runtime)
|
||||||
AC_LINK_IFELSE([#include "$srcdir/config/config.setUncaughtExceptionHandler.m"],
|
AC_LINK_IFELSE([#include "$srcdir/config/config.setUncaughtExceptionHandler.m"],
|
||||||
have_set_uncaught_exception_handler=yes, have_set_uncaught_exception_handler=no)
|
have_set_uncaught_exception_handler=yes, have_set_uncaught_exception_handler=no)
|
||||||
|
@ -1734,14 +1755,32 @@ if test $have_unexpected = yes; then
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT($have_unexpected)
|
AC_MSG_RESULT($have_unexpected)
|
||||||
|
|
||||||
|
# TODO: It would also be nice to actually test that native Objective-C
|
||||||
|
# exceptions work.
|
||||||
|
|
||||||
if test "$exceptions" = "yes"; then
|
if test "$exceptions" = "yes"; then
|
||||||
if test $have_set_unexpected = no; then
|
if test x"$have_set_uncaught_exception_handler" = x"no"; then
|
||||||
if test $have_unexpected = no; then
|
if test x"$have_set_unexpected" = x"no"; then
|
||||||
AC_MSG_ERROR([Your objective-c runtime library does not appear to support any mechanism to set a handler for uncaught native exceptions. Please upgrade your runtime or re-install gnustep-make without native-objc-exceptions!])
|
if test x"$have_unexpected" = x"no"; then
|
||||||
|
AC_MSG_NOTICE([Disabling native Objective-C exceptions because the ObjC runtime])
|
||||||
|
AC_MSG_NOTICE([has no way to set an uncaught exception handler. Please install])
|
||||||
|
AC_MSG_NOTICE([a recent Objective-C runtime if you want to use them.])
|
||||||
|
exceptions="no";
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether to enable native Objective-C exceptions)
|
||||||
|
if test "$exceptions" = "yes"; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
BASE_NATIVE_OBJC_EXCEPTIONS=1
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
BASE_NATIVE_OBJC_EXCEPTIONS=0
|
||||||
|
fi
|
||||||
|
AC_SUBST(BASE_NATIVE_OBJC_EXCEPTIONS)
|
||||||
|
|
||||||
# Don't revert any Objective-C flags as they are used in the next test
|
# Don't revert any Objective-C flags as they are used in the next test
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue