Thu 02 Dec 2004 02:35:16 AM UTC, original submission:
checking "for forwarding callback in runtime" currently checks if "__objc_msg_forward" is present in the preprocessed file from gcc (by invoking gcc with -E):
starting at line 13843:
have_forward_hook=yes
echo "$as_me:$LINENO: checking \"for forwarding callback in runtime\"" >&5
echo $ECHO_N "checking \"for forwarding callback in runtime\"... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <objc/objc-api.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "__objc_msg_forward" >/dev/null 2>&1; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; have_forward_hook=no
fi
rm -f conftest*
in line 13856 there is a grep for "__objc_msg_forward". If that is present it is assumed that forwarding callback in runtime is working.
there are some problems with that way of doing this.
At first, as andrew pinski pointed out it is in no way guarantied that forwarding callback works if grep find a occurrence of "__objc_msg_forward".
there could also be a variable named that way in the code.
Second and more important is that -E and -fgnu-runtime don't work together in the upcoming version 4.0 of gcc (and this is hard to fix according to pinskia at gcc dot gnu dot org):
cc1: warning: command line option "-fgnu-runtime" is valid for ObjC/ObjC++ but not for C
See also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18772
because of that pinskia also proposed a better (and more robust) check for that feature:
try to compile:
#include <objc/objc-api.h>
...
IMP (*__objc_msg_forward1)(SEL) = __objc_msg_forward;
...
for questions please mail to
lars dot sonchocky-helldorf at hamburg dot de
and/or
pinskia at gcc dot gnu dot org
regards, Lars
|