From e9c5d1c084d89a5c8ea21c34ecb4d4b6703e7d16 Mon Sep 17 00:00:00 2001 From: David Ayers Date: Mon, 7 Jun 2004 10:48:31 +0200 Subject: [PATCH] objc.exp (objc_target_compile): Revert the '-framework Foundation' flag fix... [gcc/testsuite/ChangeLog] 2004-06-07 David Ayers Ziemowit Laski * lib/objc.exp (objc_target_compile): Revert the '-framework Foundation' flag fix, since bare Darwin does not ship with the Foundation framework. * objc/execute/next_mapping.h: Provide a local NSConstantString @interface and @implementation. (objc_constant_string_init): A constructor function, used to initialize the NSConstantString meta-class object. * objc/execute/string1.m: Include "next_mapping.h" instead of . * objc/execute/string2.m: Likewise. * objc/execute/string3.m: Likewise. * objc/execute/string4.m: Likewise. Co-Authored-By: Ziemowit Laski From-SVN: r82685 --- gcc/testsuite/ChangeLog | 16 +++++++ gcc/testsuite/lib/objc.exp | 9 ---- gcc/testsuite/objc/execute/next_mapping.h | 52 ++++++++++++++++++++++- gcc/testsuite/objc/execute/string1.m | 2 +- gcc/testsuite/objc/execute/string2.m | 2 +- gcc/testsuite/objc/execute/string3.m | 2 +- gcc/testsuite/objc/execute/string4.m | 2 +- 7 files changed, 71 insertions(+), 14 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8d6561fc5a5..55cd0942b3e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2004-06-07 David Ayers + Ziemowit Laski + + * lib/objc.exp (objc_target_compile): Revert the '-framework + Foundation' flag fix, since bare Darwin does not ship + with the Foundation framework. + * objc/execute/next_mapping.h: Provide a local NSConstantString + @interface and @implementation. + (objc_string_init): A constructor function, used to initialize + the NSConstantString meta-class object. + * objc/execute/string1.m: Include "next_mapping.h" instead of + . + * objc/execute/string2.m: Likewise. + * objc/execute/string3.m: Likewise. + * objc/execute/string4.m: Likewise. + 2004-06-06 H.J. Lu * gcc.c-torture/execute/ieee/fp-cmp-4.c (FLOAT): New. Default diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp index d75f6f582ab..1b6c10d60fe 100644 --- a/gcc/testsuite/lib/objc.exp +++ b/gcc/testsuite/lib/objc.exp @@ -144,7 +144,6 @@ proc objc_target_compile { source dest type options } { global TOOL_OPTIONS global ld_library_path global objc_libgcc_s_path - global target_triplet set ld_library_path ".:${objc_libgcc_s_path}" lappend options "libs=-lobjc" @@ -183,14 +182,6 @@ proc objc_target_compile { source dest type options } { lappend options "additional_flags=${objc_link_flags}" append ld_library_path ":${libobjc_dir}" } - - # If we are running on Darwin, we'll need to point the linker at - # the Foundation framework, where many goodies (e.g., NSConstantString) - # reside. - if { [string match "*-*-darwin*" $target_triplet] } { - lappend options "libs=-framework Foundation" - } - lappend options "compiler=$OBJC_UNDER_TEST" # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but diff --git a/gcc/testsuite/objc/execute/next_mapping.h b/gcc/testsuite/objc/execute/next_mapping.h index 67c2ce34257..0a361896e12 100644 --- a/gcc/testsuite/objc/execute/next_mapping.h +++ b/gcc/testsuite/objc/execute/next_mapping.h @@ -1,10 +1,12 @@ /* This file "renames" various ObjC GNU runtime entry points (and fakes the existence of several others) if the NeXT runtime is being used. */ -/* Author: Ziemowit Laski */ +/* Authors: Ziemowit Laski */ +/* David Ayers */ #ifdef __NEXT_RUNTIME__ #include +#include #include #define objc_get_class(C) objc_getClass(C) @@ -848,4 +850,52 @@ void objc_layout_structure_get_info (struct objc_struct_layout *layout, *type = layout->prev_type; } +/* A small, portable NSConstantString implementation for use with the NeXT + runtime. + + On full-fledged Mac OS X systems, NSConstantString is provided + as part of the Foundation framework. However, on bare Darwin systems, + Foundation is not included, and hence there is no NSConstantString + implementation to link against. + + This code is derived from the GNU runtime's NXConstantString implementation. +*/ + +struct objc_class _NSConstantStringClassReference; + +@interface NSConstantString : Object +{ + char *c_string; + unsigned int len; +} + +-(const char *) cString; +-(unsigned int) length; + +@end + +@implementation NSConstantString + +-(const char *) cString +{ + return (c_string); +} + +-(unsigned int) length +{ + return (len); +} + +@end + +/* The NSConstantString metaclass will need to be initialized before we can + send messages to strings. */ + +void objc_constant_string_init (void) __attribute__((constructor)); +void objc_constant_string_init (void) { + memcpy (&_NSConstantStringClassReference, + objc_getClass ("NSConstantString"), + sizeof (_NSConstantStringClassReference)); +} + #endif /* #ifdef __NEXT_RUNTIME__ */ diff --git a/gcc/testsuite/objc/execute/string1.m b/gcc/testsuite/objc/execute/string1.m index 58a603c1f1f..ac49bd1f4f3 100644 --- a/gcc/testsuite/objc/execute/string1.m +++ b/gcc/testsuite/objc/execute/string1.m @@ -4,7 +4,7 @@ #include #ifdef __NEXT_RUNTIME__ -#import +#include "next_mapping.h" #else #include #endif diff --git a/gcc/testsuite/objc/execute/string2.m b/gcc/testsuite/objc/execute/string2.m index 01fb85c1189..63b0e9b8056 100644 --- a/gcc/testsuite/objc/execute/string2.m +++ b/gcc/testsuite/objc/execute/string2.m @@ -4,7 +4,7 @@ #include #ifdef __NEXT_RUNTIME__ -#import +#include "next_mapping.h" #else #include #endif diff --git a/gcc/testsuite/objc/execute/string3.m b/gcc/testsuite/objc/execute/string3.m index a8d29696899..442952478b7 100644 --- a/gcc/testsuite/objc/execute/string3.m +++ b/gcc/testsuite/objc/execute/string3.m @@ -4,7 +4,7 @@ #include #ifdef __NEXT_RUNTIME__ -#import +#include "next_mapping.h" #else #include #endif diff --git a/gcc/testsuite/objc/execute/string4.m b/gcc/testsuite/objc/execute/string4.m index 16025cbaed6..87b081c084d 100644 --- a/gcc/testsuite/objc/execute/string4.m +++ b/gcc/testsuite/objc/execute/string4.m @@ -4,7 +4,7 @@ #include #ifdef __NEXT_RUNTIME__ -#import +#include "next_mapping.h" #else #include #endif -- 2.30.2