mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Hack for bug in gcc 3.1
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13774 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
13a53a8093
commit
d2c71f1834
5 changed files with 48 additions and 6 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2002-06-04 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Headers/gnustep/base/NSByteOrder.h: Hack for bug in gcc 3.1
|
||||
* Source/externs.m (_gcc3_1_hack): Idem. (modified patch from
|
||||
benhur@inf.ufsm.br).
|
||||
|
||||
* Source/GSFFIInvocation.m (gs_objc_msg_forward): Alloc closure
|
||||
with fastMallocBuffer.
|
||||
|
||||
* Documentation/coding-standards.texi: Update.
|
||||
|
||||
2002-06-02 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Foundation/NSObject.h: Removed ([_dealloc]),
|
||||
|
|
|
@ -71,6 +71,18 @@ This document explains the official coding standards which developers
|
|||
for GNUstep base should follow. Note that these standards are in addition
|
||||
to GNU coding standards, not a replacement of them.
|
||||
|
||||
To summarize, always add a ChangeLog message whenever your commit a
|
||||
change. Make sure your patch, if possible, improves the operation of
|
||||
the library, not just fixes things - i.e. there are many places where
|
||||
things are just hacked together from long ago and really aren't
|
||||
correct. It's better to rewrite the whole thing correctly, then just
|
||||
make some temporary fix.
|
||||
|
||||
Some particular pieces of code which may seem odd or wrong may in fact
|
||||
be there for particular and obscure, but necessary reasons. If you
|
||||
have questions, ask on @email{bug-gnustep@@gnu.org} or
|
||||
@email{gnustep-dev@@gnu.org}.
|
||||
|
||||
@c ******************************************************************
|
||||
@node ChangeLog Entries, Coding Style, Introduction, Top
|
||||
@section ChangeLog Entries
|
||||
|
@ -134,7 +146,7 @@ x++, y++;
|
|||
|
||||
Brackets should have space only before the leading bracket and after
|
||||
the trailing bracket (as in this example), though there are odd occasions
|
||||
where those spcaes might be omitted ((eg. when brackets are doubled)).
|
||||
where those spaces might be omitted ((eg. when brackets are doubled)).
|
||||
This applies to square brackets too.
|
||||
|
||||
Where round brackets are used for type-casts or at the end of a statement,
|
||||
|
@ -284,7 +296,7 @@ in use.
|
|||
@section Error Handling
|
||||
|
||||
Initialization methods (e.g. -init) should, upon failure to
|
||||
initialize the class, deallocate itself and return nil. This may mean
|
||||
initialize the class, release itself and return nil. This may mean
|
||||
in certain cases, that it should catch exceptions, since the calling
|
||||
method will be expecting a nil object rather than an exception on
|
||||
failure. However, init methods should endeavor to provide some
|
||||
|
|
|
@ -94,6 +94,12 @@ GSSwapHostI64ToLittle(gsu64 in) __attribute__((unused));
|
|||
static inline gsu128
|
||||
GSSwapHostI128ToLittle(gsu128 in) __attribute__((unused));
|
||||
|
||||
#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 1)
|
||||
/* gcc 3.1 with option -O2 generates bad (i386?) code when compiling
|
||||
the following inline functions inside a .m file. A call to a
|
||||
dumb function seems to work. */
|
||||
extern void _gcc3_1_hack(void);
|
||||
#endif
|
||||
|
||||
static inline gsu16
|
||||
GSSwapI16(gsu16 in)
|
||||
|
@ -103,6 +109,9 @@ GSSwapI16(gsu16 in)
|
|||
gsu8 byt[2];
|
||||
} dst;
|
||||
union swap *src = (union swap*)∈
|
||||
#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 1)
|
||||
_gcc3_1_hack();
|
||||
#endif
|
||||
dst.byt[0] = src->byt[1];
|
||||
dst.byt[1] = src->byt[0];
|
||||
return dst.num;
|
||||
|
@ -116,6 +125,9 @@ GSSwapI32(gsu32 in)
|
|||
gsu8 byt[4];
|
||||
} dst;
|
||||
union swap *src = (union swap*)∈
|
||||
#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 1)
|
||||
_gcc3_1_hack();
|
||||
#endif
|
||||
dst.byt[0] = src->byt[3];
|
||||
dst.byt[1] = src->byt[2];
|
||||
dst.byt[2] = src->byt[1];
|
||||
|
@ -131,6 +143,9 @@ GSSwapI64(gsu64 in)
|
|||
gsu8 byt[8];
|
||||
} dst;
|
||||
union swap *src = (union swap*)∈
|
||||
#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 1)
|
||||
_gcc3_1_hack();
|
||||
#endif
|
||||
dst.byt[0] = src->byt[7];
|
||||
dst.byt[1] = src->byt[6];
|
||||
dst.byt[2] = src->byt[5];
|
||||
|
@ -150,6 +165,9 @@ GSSwapI128(gsu128 in)
|
|||
gsu8 byt[16];
|
||||
} dst;
|
||||
union swap *src = (union swap*)∈
|
||||
#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 1)
|
||||
_gcc3_1_hack();
|
||||
#endif
|
||||
dst.byt[0] = src->byt[15];
|
||||
dst.byt[1] = src->byt[14];
|
||||
dst.byt[2] = src->byt[13];
|
||||
|
@ -293,7 +311,6 @@ NSSwapHostLongToLittle(unsigned long num) __attribute__((unused));
|
|||
static inline unsigned short
|
||||
NSSwapHostShortToLittle(unsigned short num) __attribute__((unused));
|
||||
|
||||
|
||||
/*
|
||||
* Basic byte swapping routines and type conversions
|
||||
*/
|
||||
|
|
|
@ -167,12 +167,12 @@ static IMP gs_objc_msg_forward (SEL sel)
|
|||
NSCAssert1(sig, @"No signature for selector %@", NSStringFromSelector(sel));
|
||||
|
||||
/* Construct the frame and closure. */
|
||||
/* Note: We alloc cframe here, but it's passed to GSFFIInvocationCallback
|
||||
/* Note: We malloc cframe here, but it's passed to GSFFIInvocationCallback
|
||||
where it becomes owned by the callback invocation, so we don't have to
|
||||
worry about freeing it */
|
||||
cframe = cifframe_from_info([sig methodInfo], [sig numberOfArguments], NULL);
|
||||
/* Free the closure through NSData */
|
||||
amemory = [NSMutableData dataWithLength: sizeof(ffi_closure)];
|
||||
/* Autorelease the closure through fastMallocBuffer */
|
||||
amemory = _fastMallocBuffer(sizeof(ffi_closure));
|
||||
cclosure = [amemory mutableBytes];
|
||||
if (cframe == NULL || cclosure == NULL)
|
||||
{
|
||||
|
|
|
@ -688,3 +688,5 @@ const NSHashTableCallBacks NSPointerToStructHashCallBacks =
|
|||
(NSHT_describe_func_t) _NS_int_p_describe
|
||||
};
|
||||
|
||||
/* For bug in gcc 3.1. See NSByteOrder.h */
|
||||
void _gcc3_1_hack(void){}
|
||||
|
|
Loading…
Reference in a new issue