Tweaks for building with clang

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29254 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-01-10 14:38:16 +00:00
parent 83b5863735
commit 87c6d320c5
24 changed files with 106 additions and 54 deletions

View file

@ -1,3 +1,30 @@
2010-01-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSMapTable.m:
* Source/NSHashTable.m:
* Source/NSPropertyList.m:
* Source/NSScanner.m:
* Source/GSArray.m:
* Source/GSStream.m:
* Source/NSPredicate.m:
* Source/GSHTTPURLHandle.m:
* Source/NSURLResponse.m:
* Source/NSPointerArray.m:
* Source/Additions/GSCategories.m:
* Source/Additions/GSMime.m:
* Source/NSData.m:
* Source/NSSerializer.m:
* Source/NSURLRequest.m:
* Source/GSFormat.m:
* Source/NSXMLParser.m:
* SSL/GSSSLHandle.m:
* Tools/sfparse.m:
* Tools/gdnc.m:
* Tools/gdomap.c:
* Tools/pl.m:
* config/config.loadtest.m:
Tweaks towards making base build/work better with clang
2010-01-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSCharacterSetData.h:

View file

@ -172,7 +172,7 @@ static BOOL permitSSLv2 = NO;
[super finalize];
}
- (int) read: (void*)buf length: (int)len
- (int) read: (void*)buf length: (NSUInteger)len
{
if (connected)
{
@ -462,7 +462,7 @@ static BOOL permitSSLv2 = NO;
}
}
- (int) write: (const void*)buf length: (int)len
- (int) write: (const void*)buf length: (NSUInteger)len
{
if (connected)
{

View file

@ -1489,7 +1489,7 @@ newLockAt(Class self, SEL _cmd, id *location)
if (*location == nil)
{
*location = [[self alloc] init];
*location = [[(id)self alloc] init];
}
[local_lock unlock];

View file

@ -2401,7 +2401,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
if ([d length] > 0)
{
NSLog(@"Additional data (%*.*s) ignored after parse complete",
[d length], [d length], [d bytes]);
(int)[d length], (int)[d length], [d bytes]);
}
needsMore = NO; /* Nothing more to do */
}
@ -2873,6 +2873,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
static NSCharacterSet *nonToken = nil;
static NSCharacterSet *tokenSet = nil;
static Class dictClass = 0;
+ (void) initialize
{
@ -2898,6 +2899,7 @@ static NSCharacterSet *tokenSet = nil;
{
documentClass = [GSMimeDocument class];
}
dictClass = NSClassFromString(@"_GSMutableInsensitiveDictionary");
}
}
@ -3494,7 +3496,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
{
if (params == nil)
{
params = [_GSMutableInsensitiveDictionary new];
params = [dictClass new];
}
[params setObject: v forKey: k];
}
@ -3514,7 +3516,7 @@ appendString(NSMutableData *m, unsigned offset, unsigned fold,
NSEnumerator *e = [d keyEnumerator];
NSString *k;
m = [[_GSMutableInsensitiveDictionary alloc] initWithCapacity: c];
m = [[dictClass alloc] initWithCapacity: c];
while ((k = [e nextObject]) != nil)
{
[m setObject: [d objectForKey: k]

View file

@ -47,7 +47,16 @@ static SEL oaiSel;
static Class GSArrayClass;
#else
static Class GSInlineArrayClass;
@class GSInlineArray;
/* This class stores objects inline in data beyond the end of the instance.
* However, when GC is enabled the object data is typed, and all data after
* the end of the class is ignored by the garbage collector (which would
* mean that objects in the array could be collected).
* We therefore do not provide the class ewhan GC is being used.
*/
@interface GSInlineArray : GSArray
{
}
@end
#endif
@class GSArray;
@ -382,17 +391,6 @@ static Class GSInlineArrayClass;
@end
#if !GS_WITH_GC
/* This class stores objects inline in data beyond the end of the instance.
* However, when GC is enabled the object data is typed, and all data after
* the end of the class is ignored by the garbage collector (which would
* mean that objects in the array could be collected).
* We therefore do not provide the class ewhan GC is being used.
*/
@interface GSInlineArray : GSArray
{
}
@end
@implementation GSInlineArray
- (void) dealloc
{

View file

@ -1173,9 +1173,9 @@ NSDictionary *locale)
int string_malloced;
do
{
const void *ptr;
ptr = NOT_IN_JUMP_RANGE (spec) ? REF (form_unknown)
: step4_jumps[CHAR_CLASS (spec)];
void *ptr;
ptr = NOT_IN_JUMP_RANGE (spec) ? (void*)REF (form_unknown)
: (void*)step4_jumps[CHAR_CLASS (spec)];
goto *ptr;
}
while (0);

View file

@ -585,7 +585,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
{
NSLog(@"%@ %p %s Unexpected data (%*.*s) from remote!",
NSStringFromSelector(_cmd), self, keepalive?"K":"",
[d length], [d length], [d bytes]);
(int)[d length], (int)[d length], [d bytes]);
}
[nc removeObserver: self name: nil object: sock];
[sock closeFile];

View file

@ -37,6 +37,7 @@
#import "GSStream.h"
#import "GSPrivate.h"
#import "GSSocketStream.h"
NSString * const NSStreamDataWrittenToMemoryStreamKey
= @"NSStreamDataWrittenToMemoryStreamKey";
@ -945,19 +946,17 @@ static RunLoopEventType typeForStream(NSStream *aStream)
@end
@class GSInetInputStream;
@class GSInet6InputStream;
@class GSInetOutputStream;
@class GSInet6OutputStream;
@class GSInetServerStream;
@class GSInet6ServerStream;
@class GSLocalServerStream;
@implementation GSServerStream
static Class localServerClass = 0;
+ (void) initialize
{
GSMakeWeakPointer(self, "delegate");
if (localServerClass == 0)
{
localServerClass = NSClassFromString(@"LocalServerStream");
}
}
+ (id) serverStreamToAddr: (NSString*)addr port: (NSInteger)port
@ -973,7 +972,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
+ (id) serverStreamToAddr: (NSString*)addr
{
return AUTORELEASE([[GSLocalServerStream alloc] initToAddr: addr]);
return AUTORELEASE([[localServerClass alloc] initToAddr: addr]);
}
- (id) initToAddr: (NSString*)addr port: (NSInteger)port
@ -989,7 +988,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
- (id) initToAddr: (NSString*)addr
{
RELEASE(self);
return [[GSLocalServerStream alloc] initToAddr: addr];
return [[localServerClass alloc] initToAddr: addr];
}
- (void) acceptWithInputStream: (NSInputStream **)inputStream

View file

@ -1471,7 +1471,7 @@ failure:
{
att = [[mgr fileAttributesAtPath: path
traverseLink: YES] mutableCopy];
IF_NO_GC(TEST_AUTORELEASE(att));
IF_NO_GC(AUTORELEASE(att));
}
#if defined(__MINGW32__)

View file

@ -39,7 +39,6 @@
@implementation NSHashTable
@class NSConcreteHashTable;
static Class abstractClass = 0;
static Class concreteClass = 0;
@ -58,7 +57,7 @@ static Class concreteClass = 0;
if (abstractClass == 0)
{
abstractClass = [NSHashTable class];
concreteClass = [NSConcreteHashTable class];
concreteClass = NSClassFromString(@"NSConcreteHashTable");
}
}

View file

@ -38,8 +38,6 @@
@implementation NSMapTable
@class NSConcreteMapTable;
static Class abstractClass = 0;
static Class concreteClass = 0;
@ -57,7 +55,7 @@ static Class concreteClass = 0;
if (abstractClass == 0)
{
abstractClass = [NSMapTable class];
concreteClass = [NSConcreteMapTable class];
concreteClass = NSClassFromString(@"NSConcreteMapTable");
}
}

View file

@ -37,7 +37,6 @@
#import "GSPrivate.h"
#import "NSConcretePointerFunctions.h"
@class NSConcretePointerArray;
static Class abstractClass = Nil;
static Class concreteClass = Nil;
@ -59,7 +58,7 @@ static Class concreteClass = Nil;
if (abstractClass == Nil)
{
abstractClass = [NSPointerArray class];
concreteClass = [NSConcretePointerArray class];
concreteClass = NSClassFromString(@"NSConcretePointerArray");
}
}

View file

@ -1410,9 +1410,9 @@
- (id) _eval_count: (NSArray *)expressions
{
if (_argc != 1)
; // error
return [NSNumber numberWithUnsignedInt: [[expressions objectAtIndex: 0] count]];
NSAssert(_argc == 1, NSInternalInconsistencyException);
return [NSNumber numberWithUnsignedInt:
[[expressions objectAtIndex: 0] count]];
}
- (id) _eval_avg: (NSArray *)expressions

View file

@ -114,6 +114,13 @@ extern BOOL GSScanDouble(unichar*, unsigned, double*);
@implementation GSXMLPListParser
static Class theClass = 0;
+ (void) initialize
{
theClass = NSClassFromString(@"GSSloppyXMLParser");
}
- (void) dealloc
{
RELEASE(key);
@ -129,7 +136,7 @@ extern BOOL GSScanDouble(unichar*, unsigned, double*);
{
if ((self = [super init]) != nil)
{
theParser = [[GSSloppyXMLParser alloc] initWithData: data];
theParser = [[theClass alloc] initWithData: data];
[theParser setDelegate: self];
opts = options;
}

View file

@ -934,7 +934,10 @@ typedef struct {
NSRange range;
unsigned int saveScanLocation = _scanLocation;
skipToNextField();
if (skipToNextField() == NO)
{
return NO;
}
range.location = _scanLocation;
range.length = [string length];
if (range.location + range.length > myLength())
@ -988,7 +991,10 @@ typedef struct {
NSRange found;
unsigned int saveScanLocation = _scanLocation;
skipToNextField();
if (skipToNextField() == NO)
{
return NO;
}
range.location = _scanLocation;
range.length = myLength() - _scanLocation;
found = [_string rangeOfString: string

View file

@ -503,7 +503,7 @@ initDeserializerInfo(_NSDeserializerInfo* info, NSData *d, unsigned *c, BOOL m)
*c += 9;
(*info->debImp)(d, debSel, &u, 1, c);
NSLog(@"Serialised data version %d not supported ..."
@" try another version of GNUstep");
@" try another version of GNUstep", u);
return NO;
}
}

View file

@ -354,6 +354,13 @@ typedef struct {
@implementation NSMutableURLRequest (NSMutableHTTPURLRequest)
static Class dictClass = 0;
+ (void) initialize
{
dictClass = NSClassFromString(@"_GSMutableInsensitiveDictionary");
}
- (void) addValue: (NSString *)value forHTTPHeaderField: (NSString *)field
{
NSString *old = [self valueForHTTPHeaderField: field];
@ -415,7 +422,7 @@ typedef struct {
{
if (this->headers == nil)
{
this->headers = [_GSMutableInsensitiveDictionary new];
this->headers = [dictClass new];
}
[this->headers setObject: value forKey: field];
}

View file

@ -51,6 +51,14 @@ typedef struct {
@implementation NSURLResponse (Private)
static Class dictClass = 0;
+ (void) initialize
{
dictClass = NSClassFromString(@"_GSMutableInsensitiveDictionary");
}
- (void) _setHeaders: (id)headers
{
NSEnumerator *e;
@ -129,7 +137,7 @@ typedef struct {
{
if (this->headers == 0)
{
this->headers = [_GSMutableInsensitiveDictionary new];
this->headers = [dictClass new];
}
[this->headers setObject: value forKey: field];
}

View file

@ -1198,8 +1198,10 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
while (c != '\'');
return NewUTF8STR(ap + 1, this->cp - ap - 2);
}
/* strict XML requires quoting (?)
if (!this->acceptHTML)
; // strict XML requires quoting (?)
;
*/
while (!isspace(c) && c != '>' && c != '/' && c != '?' && c != '=' &&c != EOF)
c = cget();
this->cp--; // go back to terminating character

View file

@ -52,7 +52,7 @@ gdnc_log (int prio, const char *ebuf)
{
if (is_daemon)
{
syslog (log_priority | prio, ebuf);
syslog (log_priority | prio, "%s", ebuf);
}
else if (prio == LOG_INFO)
{

View file

@ -278,7 +278,7 @@ gdomap_log (int prio)
{
if (is_daemon)
{
syslog (log_priority | prio, ebuf);
syslog (log_priority | prio, "%s", ebuf);
}
else if (prio == LOG_INFO)
{

View file

@ -72,7 +72,7 @@ id process_plist(NSData *inputData)
NS_DURING
propertyList = [string propertyList];
NS_HANDLER
NSLog([localException description]);
NSLog(@"%@", localException);
NS_ENDHANDLER
// return the results

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <Foundation/NSArray.h>
#include <Foundation/NSData.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSException.h>
#include <Foundation/NSString.h>
#include <Foundation/NSProcessInfo.h>

View file

@ -15,7 +15,6 @@
#include <objc/Object.h>
@interface Test : Object
static int test_result;
+(void) load;
+(int) test_result;
@end