On 15 Mar 2007, at 08:37, Michael Gardner wrote:


I've got gcc-4.1.3_20070305, also compiled from ports, and it should
definitely support native ObjC exceptions (especially since I was able
to get them to work with the command in my first email). I've attached
gnustep-make's config.log, but I found something interesting about the
failed program:

#include <stdlib.h>
#include <objc/Object.h>

int main(int argc, char **argv)
{
     Object *o=nil;
     @try
     {
             o=[Object new];
             @throw o;
     }
     @catch (id foo)
     {
             if (o!=foo)
                     return 1;
     }
     return 0;
}

I saved this as 'conftest.c' and then compiled with the same command
that configure used:

gcc41 -o conftest -O2 -pipe   -x objective-c -I.   -fgnu-runtime
-fobjc-exceptions   conftest.c -lobjc  -pthread

The program crashed, as expected. However, on a whim I renamed
'conftest.c' to 'conftest.m', recompiled, and it ran! I thought the
file extension didn't matter when the language is manually specified
with -x as above, so what could be going on here? I'm also emailing my
config.log to the FreeBSD port's maintainer, but at this point I'm not
sure whether it's an issue with gnustep-make, its FreeBSD port, or
even gcc itself. Can somebody shine some light on this?

I thought that compiling with '-x objective-c' was supposed to have the same effect as compiling a file with a .m extension too. If that understanding is correct, I don't see how the behavior you are seeing could be anything other than a compiler bug.


_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to