discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applications that fail to build with new gnustep from svn


From: David Chisnall
Subject: Re: applications that fail to build with new gnustep from svn
Date: Wed, 6 Apr 2011 19:04:22 +0100

On 6 Apr 2011, at 18:15, Sebastian Reitenbach wrote:

> Calling [GSMutableArray -count] with incorrect signature.  Method has
> L8@0:4, selector has I8@0:4

These are warnings, and typically indicate that the code may not be 64-bit 
safe.  In this specific instance, it will work correctly as long as 
sizeof(unsigned long) == sizeof(unsigned int).  The most likely cause of this 
is someone using a header that declares:

- (unsigned int)count;

And then calling a method declared as:

- (NSUInteger)count;

It's worth fixing these (you can turn off reporting in libobjc2, and I probably 
will with the 1.3 release by default).

> regarding SOPE;
> * what do I do regarding this MethodList_t, is there an equivalent
> replacement?

MethodList_t is a pointer to the internal method structure.  There is no direct 
equivalent (except, perhaps, Method*), because user code should not be directly 
modifying the internal runtime data structures.  It should be using the public 
interfaces.  Generally, you want to use the method_* functions for these


> * what do I do with those friends: error: incomplete definition of type
> 'struct objc_class'

The same thing.  User code should not be directly modifying the class 
structure.  Use the class_* family of functions if you need to modify classes.

> regarding gdl2:
> * what can I do with the Ivar related things David pointed out already
> to use some ivar_* functions, any examples available?

All of the public runtime functions are documented here:

http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html

I can give you some examples if you tell me exactly what you need to do.

> NGObjCRuntime.m:118:25: error: unknown type name 'MethodList_t'
> fillMethodListWithSpecs(MethodList_t methods, SEL _selector, va_list *va)
>                        ^

This one is another case of trying to manipulate runtime data structures 
directly.

> NGObjCRuntime.m:151:16: warning: 'sel_get_name' is deprecated
> [-Wdeprecated-declarations]
>    selname  = sel_get_name(selector);
>               ^

Not really important, but libobjc2 marks all of the legacy GCC runtime APIs as 
deprecated - new code should use the Apple ones, which work everywhere 
(including with the old GCC runtime, via wrappers in -base)

> NGObjCRuntime.m:172:23: error: incomplete definition of type 'struct
> objc_class'
>  return ((Class)self)->instance_size;
>         ~~~~~~~~~~~~~^

Should be class_getInstanceSize(self) - again, all runtime data structures are 
now opaque.

> + (void)addClassMethodList:(MethodList_t)_methods {
>                            ^

Unfortunately, there is no public interface for adding a load of methods - you 
have to add them one at a time.  I would like to add an interface for doing 
this (since it's more efficient to add methods in a group) - I'll have a chat 
with Blane about a possible interface for this, to make sure that we implement 
something Apple-compatible.


> PCParser.m:127:24: error: initializer element is not a compile-time constant
> static SEL selString = @selector(string:);
>                       ^~~~~~~~~~~~~~~~~~

The simplest fix for these is to turn them into:

#define selString @selector(string:)

This also has the advantage that the generated code will be both smaller and 
faster.  

David

-- Sent from my Cray X1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]