mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Cleanups suggested/provided by David Chisnall
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28160 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3452a47317
commit
c6937301b8
4 changed files with 97 additions and 97 deletions
|
@ -1,3 +1,11 @@
|
|||
2009-03-31 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Foundation/NSDebug.h:
|
||||
* Source/mframe.m:
|
||||
* Source/NSObject.m:
|
||||
Cleanups for building with other compilers as suggested/provided
|
||||
by David Chisnall.
|
||||
|
||||
2009-03-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSString.m: Fix error in parsing root of UNC path
|
||||
|
|
|
@ -282,9 +282,10 @@ GS_EXPORT BOOL NSDeallocateZombies;
|
|||
*/
|
||||
#define NSDebugFLLog(level, format, args...) \
|
||||
do { if (GSDebugSet(level) == YES) { \
|
||||
NSString *fmt = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
||||
NSLog(fmt , ## args); }} while (0)
|
||||
NSString *s = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, \
|
||||
[NSString stringWithFormat: format, ##args]); \
|
||||
NSLog(@"%@", s); }} while (0)
|
||||
|
||||
/**
|
||||
* This macro is a shorthand for NSDebugFLLog() using then default debug
|
||||
|
@ -292,9 +293,10 @@ GS_EXPORT BOOL NSDeallocateZombies;
|
|||
*/
|
||||
#define NSDebugFLog(format, args...) \
|
||||
do { if (GSDebugSet(@"dflt") == YES) { \
|
||||
NSString *fmt = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
||||
NSLog(fmt , ## args); }} while (0)
|
||||
NSString *s = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, \
|
||||
[NSString stringWithFormat: format, ##args]); \
|
||||
NSLog(@"%@", s); }} while (0)
|
||||
|
||||
/**
|
||||
* This macro is like NSDebugLLog() but includes the name and location
|
||||
|
@ -302,9 +304,10 @@ GS_EXPORT BOOL NSDeallocateZombies;
|
|||
*/
|
||||
#define NSDebugMLLog(level, format, args...) \
|
||||
do { if (GSDebugSet(level) == YES) { \
|
||||
NSString *fmt = GSDebugMethodMsg( \
|
||||
self, _cmd, __FILE__, __LINE__, format); \
|
||||
NSLog(fmt , ## args); }} while (0)
|
||||
NSString *s = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, \
|
||||
[NSString stringWithFormat: format, ##args]); \
|
||||
NSLog(@"%@", s); }} while (0)
|
||||
|
||||
/**
|
||||
* This macro is a shorthand for NSDebugMLLog() using then default debug
|
||||
|
@ -312,9 +315,10 @@ GS_EXPORT BOOL NSDeallocateZombies;
|
|||
*/
|
||||
#define NSDebugMLog(format, args...) \
|
||||
do { if (GSDebugSet(@"dflt") == YES) { \
|
||||
NSString *fmt = GSDebugMethodMsg( \
|
||||
self, _cmd, __FILE__, __LINE__, format); \
|
||||
NSLog(fmt , ## args); }} while (0)
|
||||
NSString *s = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, \
|
||||
[NSString stringWithFormat: format, ##args]); \
|
||||
NSLog(@"%@", s); }} while (0)
|
||||
|
||||
/**
|
||||
* This macro saves the name and location of the function in
|
||||
|
@ -361,10 +365,12 @@ GS_EXPORT BOOL NSDeallocateZombies;
|
|||
*/
|
||||
#define GSOnceFLog(format, args...) \
|
||||
do { static BOOL beenHere = NO; if (beenHere == NO) {\
|
||||
NSString *fmt = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
||||
NSString *s = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, \
|
||||
[NSString stringWithFormat: format, ##args]); \
|
||||
beenHere = YES; \
|
||||
NSLog(fmt , ## args); }} while (0)
|
||||
NSLog(@"%@", s); }} while (0)
|
||||
|
||||
/**
|
||||
* Macro to log a message only the first time it is encountered.<br />
|
||||
* Not entirely thread safe ... but that's not really important,
|
||||
|
@ -377,10 +383,11 @@ GS_EXPORT BOOL NSDeallocateZombies;
|
|||
*/
|
||||
#define GSOnceMLog(format, args...) \
|
||||
do { static BOOL beenHere = NO; if (beenHere == NO) {\
|
||||
NSString *fmt = GSDebugMethodMsg( \
|
||||
self, _cmd, __FILE__, __LINE__, format); \
|
||||
NSString *s = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, \
|
||||
[NSString stringWithFormat: format, ##args]); \
|
||||
beenHere = YES; \
|
||||
NSLog(fmt , ## args); }} while (0)
|
||||
NSLog(@"%@", s); }} while (0)
|
||||
|
||||
|
||||
|
||||
|
@ -430,9 +437,10 @@ GS_EXPORT BOOL NSDeallocateZombies;
|
|||
*/
|
||||
#define NSWarnFLog(format, args...) \
|
||||
do { if (GSDebugSet(@"NoWarn") == NO) { \
|
||||
NSString *fmt = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
||||
NSLog(fmt , ## args); }} while (0)
|
||||
NSString *s = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, \
|
||||
[NSString stringWithFormat: format, ##args]); \
|
||||
NSLog(@"%@", s); }} while (0)
|
||||
|
||||
/**
|
||||
* This macro is like NSWarnLog() but includes the name and location of the
|
||||
|
@ -440,9 +448,10 @@ GS_EXPORT BOOL NSDeallocateZombies;
|
|||
*/
|
||||
#define NSWarnMLog(format, args...) \
|
||||
do { if (GSDebugSet(@"NoWarn") == NO) { \
|
||||
NSString *fmt = GSDebugMethodMsg( \
|
||||
self, _cmd, __FILE__, __LINE__, format); \
|
||||
NSLog(fmt , ## args); }} while (0)
|
||||
NSString *s = GSDebugFunctionMsg( \
|
||||
__PRETTY_FUNCTION__, __FILE__, __LINE__, \
|
||||
[NSString stringWithFormat: format, ##args]); \
|
||||
NSLog(@"%@", s); }} while (0)
|
||||
#else
|
||||
#define NSWarnLog(format, args...)
|
||||
#define NSWarnFLog(format, args...)
|
||||
|
|
|
@ -907,9 +907,9 @@ warn_proc(char *msg, GC_word arg)
|
|||
{
|
||||
volatile short cw;
|
||||
|
||||
__asm__ volatile ("fstcw (%0)" : : "g" (&cw));
|
||||
__asm__ volatile ("fstcw %0" : : "g" (&cw));
|
||||
cw |= 1; /* Mask 'invalid' exception */
|
||||
__asm__ volatile ("fldcw (%0)" : : "g" (&cw));
|
||||
__asm__ volatile ("fldcw %0" : : "g" (&cw));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
125
Source/mframe.m
125
Source/mframe.m
|
@ -803,6 +803,60 @@ mframe_dissect_call (arglist_t argframe, const char *type,
|
|||
single data item (for distributed objects).
|
||||
*/
|
||||
|
||||
static inline id retframe_id(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
static inline Class retframe_Class(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
static inline SEL retframe_SEL(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
static inline unsigned long retframe_long(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
static inline unsigned long long retframe_longlong(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
static inline char* retframe_pointer(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
typedef struct {
|
||||
char val[4];
|
||||
} block;
|
||||
static inline block retframe_block(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
static inline float retframe_float (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
/* For extracting a return value of type `double' from RETFRAME. */
|
||||
static inline double retframe_double (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
/* For extracting a return value of type `char' from RETFRAME */
|
||||
static inline char retframe_char (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
static inline short retframe_short (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
static inline int retframe_int (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
|
||||
void
|
||||
mframe_do_call (DOContext *ctxt,
|
||||
void(*decoder)(DOContext*),
|
||||
|
@ -841,26 +895,6 @@ mframe_do_call (DOContext *ctxt,
|
|||
If so, we need to encode them, since the method may have changed them. */
|
||||
BOOL out_parameters = NO;
|
||||
const char *encoded_types = ctxt->type;
|
||||
/* For extracting a return value of type `float' from RETFRAME. */
|
||||
float retframe_float (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
/* For extracting a return value of type `double' from RETFRAME. */
|
||||
double retframe_double (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
/* For extracting a return value of type `char' from RETFRAME */
|
||||
char retframe_char (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
/* For extracting a return value of type `short' from RETFRAME */
|
||||
short retframe_short (void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
|
||||
/* Decode the object, (which is always the first argument to a method),
|
||||
into the local variable OBJECT. */
|
||||
|
@ -1620,30 +1654,18 @@ mframe_decode_return (const char *type, void* buffer, void* retframe)
|
|||
{
|
||||
case _C_ID:
|
||||
{
|
||||
inline id retframe_id(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(id*)buffer = retframe_id(retframe);
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_CLASS:
|
||||
{
|
||||
inline Class retframe_Class(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(Class*)buffer = retframe_Class(retframe);
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_SEL:
|
||||
{
|
||||
inline SEL retframe_SEL(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(SEL*)buffer = retframe_SEL(retframe);
|
||||
break;
|
||||
}
|
||||
|
@ -1651,10 +1673,6 @@ mframe_decode_return (const char *type, void* buffer, void* retframe)
|
|||
case _C_CHR:
|
||||
case _C_UCHR:
|
||||
{
|
||||
inline unsigned char retframe_char(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(unsigned char*)buffer = retframe_char(retframe);
|
||||
break;
|
||||
}
|
||||
|
@ -1662,10 +1680,6 @@ mframe_decode_return (const char *type, void* buffer, void* retframe)
|
|||
case _C_SHT:
|
||||
case _C_USHT:
|
||||
{
|
||||
inline unsigned short retframe_short(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(unsigned short*)buffer = retframe_short(retframe);
|
||||
break;
|
||||
}
|
||||
|
@ -1673,10 +1687,6 @@ mframe_decode_return (const char *type, void* buffer, void* retframe)
|
|||
case _C_INT:
|
||||
case _C_UINT:
|
||||
{
|
||||
inline unsigned int retframe_int(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(unsigned int*)buffer = retframe_int(retframe);
|
||||
break;
|
||||
}
|
||||
|
@ -1684,10 +1694,6 @@ mframe_decode_return (const char *type, void* buffer, void* retframe)
|
|||
case _C_LNG:
|
||||
case _C_ULNG:
|
||||
{
|
||||
inline unsigned long retframe_long(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(unsigned long*)buffer = retframe_long(retframe);
|
||||
break;
|
||||
}
|
||||
|
@ -1695,30 +1701,18 @@ mframe_decode_return (const char *type, void* buffer, void* retframe)
|
|||
case _C_LNG_LNG:
|
||||
case _C_ULNG_LNG:
|
||||
{
|
||||
inline unsigned long long retframe_longlong(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(unsigned long long*)buffer = retframe_longlong(retframe);
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_FLT:
|
||||
{
|
||||
inline float retframe_float(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(float*)buffer = retframe_float(retframe);
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_DBL:
|
||||
{
|
||||
inline double retframe_double(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(double*)buffer = retframe_double(retframe);
|
||||
break;
|
||||
}
|
||||
|
@ -1727,10 +1721,6 @@ mframe_decode_return (const char *type, void* buffer, void* retframe)
|
|||
case _C_ATOM:
|
||||
case _C_CHARPTR:
|
||||
{
|
||||
inline char* retframe_pointer(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(char**)buffer = retframe_pointer(retframe);
|
||||
break;
|
||||
}
|
||||
|
@ -1739,13 +1729,6 @@ mframe_decode_return (const char *type, void* buffer, void* retframe)
|
|||
case _C_STRUCT_B:
|
||||
case _C_UNION_B:
|
||||
{
|
||||
typedef struct {
|
||||
char val[4];
|
||||
} block;
|
||||
inline block retframe_block(void *rframe)
|
||||
{
|
||||
__builtin_return (rframe);
|
||||
}
|
||||
*(block*)buffer = retframe_block(retframe);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue