This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [HEAD] Teach testsuite/lib/objc.exp about Darwin frameworks

On 3 Jun, 2004, at 4.42, Nicola Pero wrote:

Could you please make the linking against Foundation conditional for the
Apple runtime?

Here goes -- does this look OK? I'd like to commit this, and then later,
once we figure out how to distinguish Mac OS X from Darwin, we can conditionally
use David's NSConstantString @implementation.



2004-06-03  Ziemowit Laski  <>

        * lib/objc.exp (objc_target_compile): When running tests
        on Mac OS X, do not pass down '-framework Foundation' if
        the GNU runtime is being used.

Index: gcc/testsuite/lib/objc.exp
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/objc.exp,v
retrieving revision 1.22
diff -c -3 -p -r1.22 objc.exp
*** gcc/testsuite/lib/objc.exp  2 Jun 2004 19:48:49 -0000       1.22
--- gcc/testsuite/lib/objc.exp  3 Jun 2004 21:47:34 -0000
*************** proc objc_target_compile { source dest t
*** 184,193 ****
        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"

--- 184,193 ----
        append ld_library_path ":${libobjc_dir}"

! # If we are running on Mac OS X and using the NeXT runtime, we'll need
! # to point the linker at the Foundation framework, where many goodies
! # (e.g., NSConstantString) # reside.
! elseif { [string match "*-*-darwin*" $target_triplet] } {
lappend options "libs=-framework Foundation"

Even this wouldn't be entirely satisfactory, as there are people trying to
compile and use gnustep-base with the Apple runtime, in which cases you'd
need the Apple runtime + linking against gnustep-base.

I suppose the solution would be to #include a trivial implementation of
NSConstantString in the tests when compiled with the Apple runtime. That
way you don't depend on anything external and it just works, and you can
test with multiple library combinations.

If you want to do this (I don't have an Apple runtime at hand), it would
be good - should be quite easy (and little bit of fun) to write a trivial
NSConstantString implementation.

Else, I don't think we should be too picky and prevent improvements - I
think Zem's change is an improvement over what we have, so it's a good
change -- I'd just suggest adding comments to it about how to make it
better, so that if there is someone interested in that stuff (eg running
the tests on Darwin without Foundation) in the future, they'll know from
the comments how/what to do to extend the tests to support that.

:-), the minimal NSConstantString implementation was the first thing on
my mind also. But I wasn't looking for perfection. The problem I have,
is that on non OS X Darwin with the GNU runtime these test should pass
and now would fail.

It would be nice if the gcc testsuite could be testing the Apple runtime
in the absence of Foundation, but that hasn't worked before either which
is why I didn't ask for the minimal NSConstantString implementation.
Yet if there is interest, I could hack up patch for test cases which
should make linking against Foundation obsolete.

I personally think this (patches providing the minimal NSConstantString
implementation to make linking against foundation libraries obsolete)
would be best and if you had the time to produce such patches that would
be fabulous.

Otherwise, adding -framework Foundation, but only if the Apple runtime is
used, and a short comment saying a minimal NSConstantString implementation
would be the real fix rather than that hack, would be my second choice (I
suppose if you supply a patch for that to Zem he'd like it).

Thanks for looking into this.

Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]