mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
Add a GS_PADDING_IVAR macro. This defines the void *gs_unused; instance variable with __attribute__((unused)) on clang so that the static analyser only reports unused ivars that we expect to be used. This also makes it slightly easier to add the padding ivar to new classes.
Note: The padding ivar has been added to NSRegularExpression. This will break the ABI for anyone subclassing NSRegularExpression, but hopefully that's no one (done before the next release, to make sure that we don't break the ABI between releases, only for people following -trunk). git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32033 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ae0204e45d
commit
31e5eb9c38
35 changed files with 47 additions and 108 deletions
|
@ -75,9 +75,7 @@ extern "C" {
|
||||||
NSMutableDictionary *objects;
|
NSMutableDictionary *objects;
|
||||||
NSMutableDictionary *params;
|
NSMutableDictionary *params;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
+ (NSString*) makeQuoted: (NSString*)v always: (BOOL)flag;
|
+ (NSString*) makeQuoted: (NSString*)v always: (BOOL)flag;
|
||||||
+ (NSString*) makeToken: (NSString*)t preservingCase: (BOOL)preserve;
|
+ (NSString*) makeToken: (NSString*)t preservingCase: (BOOL)preserve;
|
||||||
|
|
|
@ -228,6 +228,16 @@
|
||||||
|
|
||||||
#define GS_EXPOSE(X) (!GS_NONFRAGILE || defined(EXPOSE_##X##_IVARS))
|
#define GS_EXPOSE(X) (!GS_NONFRAGILE || defined(EXPOSE_##X##_IVARS))
|
||||||
|
|
||||||
|
#ifdef GS_NONFRAGILE
|
||||||
|
# define GS_PADDING_IVAR
|
||||||
|
#else
|
||||||
|
# ifdef __clang__
|
||||||
|
# define GS_PADDING_IVAR __attribute__((unused)) void *gs_unused;
|
||||||
|
# else
|
||||||
|
# define GS_PADDING_IVAR void *gs_unused;
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Include the appropriate header for ObjC2 blocks support if it is in use.
|
/* Include the appropriate header for ObjC2 blocks support if it is in use.
|
||||||
*
|
*
|
||||||
* FIXME: "OBJC2RUNTIME" is set to "1" if the runtime has
|
* FIXME: "OBJC2RUNTIME" is set to "1" if the runtime has
|
||||||
|
|
|
@ -70,9 +70,7 @@ extern "C" {
|
||||||
BOOL _encodingRoot;
|
BOOL _encodingRoot;
|
||||||
BOOL _initialPass;
|
BOOL _initialPass;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializing an archiver */
|
/* Initializing an archiver */
|
||||||
|
@ -178,9 +176,7 @@ extern "C" {
|
||||||
NSMutableDictionary *objDict; /* Class information store. */
|
NSMutableDictionary *objDict; /* Class information store. */
|
||||||
NSMutableArray *objSave;
|
NSMutableArray *objSave;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializing an unarchiver */
|
/* Initializing an unarchiver */
|
||||||
|
|
|
@ -194,9 +194,7 @@ typedef struct autorelease_array_list
|
||||||
/* The method to add an object to this pool */
|
/* The method to add an object to this pool */
|
||||||
void (*_addImp)(id, SEL, id);
|
void (*_addImp)(id, SEL, id);
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -119,9 +119,7 @@ GS_EXPORT NSString* const NSLoadedClasses;
|
||||||
unsigned _version;
|
unsigned _version;
|
||||||
NSString *_frameworkVersion;
|
NSString *_frameworkVersion;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return an array enumerating all the bundles in the application. This
|
/** Return an array enumerating all the bundles in the application. This
|
||||||
|
|
|
@ -61,9 +61,7 @@ extern "C" {
|
||||||
/** Total number of accesses to objects */
|
/** Total number of accesses to objects */
|
||||||
int64_t _totalAccesses;
|
int64_t _totalAccesses;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the maximum number of objects that are supported by this cache.
|
* Returns the maximum number of objects that are supported by this cache.
|
||||||
|
|
|
@ -77,9 +77,7 @@ typedef enum _NSPredicateOperatorType
|
||||||
NSUInteger _options;
|
NSUInteger _options;
|
||||||
NSPredicateOperatorType _type;
|
NSPredicateOperatorType _type;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
@public
|
@public
|
||||||
NSExpression *_left;
|
NSExpression *_left;
|
||||||
NSExpression *_right;
|
NSExpression *_right;
|
||||||
|
|
|
@ -134,9 +134,7 @@ typedef NSUInteger NSDateFormatterBehavior;
|
||||||
NSDateFormatterStyle _dateStyle;
|
NSDateFormatterStyle _dateStyle;
|
||||||
void *_formatter;
|
void *_formatter;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializing an NSDateFormatter */
|
/* Initializing an NSDateFormatter */
|
||||||
|
|
|
@ -129,9 +129,7 @@ extern "C" {
|
||||||
BOOL _raiseOnUnderflow;
|
BOOL _raiseOnUnderflow;
|
||||||
BOOL _raiseOnDivideByZero;
|
BOOL _raiseOnDivideByZero;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,9 +40,7 @@ extern "C" {
|
||||||
NSString *_lockPath;
|
NSString *_lockPath;
|
||||||
NSDate *_lockTime;
|
NSDate *_lockTime;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSDistributedLock*) lockWithPath: (NSString*)aPath;
|
+ (NSDistributedLock*) lockWithPath: (NSString*)aPath;
|
||||||
|
|
|
@ -86,9 +86,7 @@ GS_EXPORT NSString* const GSNetworkNotificationCenterType;
|
||||||
id _remote; /* Proxy for center. */
|
id _remote; /* Proxy for center. */
|
||||||
BOOL _suspended; /* Is delivery suspended? */
|
BOOL _suspended; /* Is delivery suspended? */
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
+ (NSNotificationCenter*) defaultCenter;
|
+ (NSNotificationCenter*) defaultCenter;
|
||||||
+ (NSNotificationCenter*) notificationCenterForType: (NSString*)type;
|
+ (NSNotificationCenter*) notificationCenterForType: (NSString*)type;
|
||||||
|
|
|
@ -121,9 +121,7 @@ GS_EXPORT NSString* const NSCocoaErrorDomain;
|
||||||
NSString *_domain;
|
NSString *_domain;
|
||||||
NSDictionary *_userInfo;
|
NSDictionary *_userInfo;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -162,9 +162,7 @@ GS_EXPORT NSString * const NSFileHandleOperationException;
|
||||||
NSFileHandle *_readHandle;
|
NSFileHandle *_readHandle;
|
||||||
NSFileHandle *_writeHandle;
|
NSFileHandle *_writeHandle;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
+ (id) pipe;
|
+ (id) pipe;
|
||||||
- (NSFileHandle*) fileHandleForReading;
|
- (NSFileHandle*) fileHandleForReading;
|
||||||
|
|
|
@ -203,9 +203,7 @@ typedef uint32_t OSType;
|
||||||
@private
|
@private
|
||||||
NSString *_lastError;
|
NSString *_lastError;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSFileManager*) defaultManager;
|
+ (NSFileManager*) defaultManager;
|
||||||
|
@ -389,9 +387,7 @@ typedef uint32_t OSType;
|
||||||
BOOL justContents: 1;
|
BOOL justContents: 1;
|
||||||
} _flags;
|
} _flags;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
- (NSDictionary*) directoryAttributes;
|
- (NSDictionary*) directoryAttributes;
|
||||||
- (NSDictionary*) fileAttributes;
|
- (NSDictionary*) fileAttributes;
|
||||||
|
|
|
@ -44,9 +44,7 @@ extern "C" {
|
||||||
NSSet *_names;
|
NSSet *_names;
|
||||||
NSSet *_addresses;
|
NSSet *_addresses;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,9 +50,7 @@ extern "C" {
|
||||||
NSUInteger _length;
|
NSUInteger _length;
|
||||||
NSUInteger *_indexes;
|
NSUInteger *_indexes;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,9 +50,7 @@ extern "C" {
|
||||||
BOOL _sendToSuper;
|
BOOL _sendToSuper;
|
||||||
void *_retptr;
|
void *_retptr;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -71,9 +71,7 @@ extern "C" {
|
||||||
NSMutableArray *_obj; /* Array of objects. */
|
NSMutableArray *_obj; /* Array of objects. */
|
||||||
NSPropertyListFormat _format;
|
NSPropertyListFormat _format;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,9 +238,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
NSZone *_zone; /* Zone for allocating objs. */
|
NSZone *_zone; /* Zone for allocating objs. */
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -104,9 +104,7 @@ GS_EXPORT NSString * const NSISO8601Calendar;
|
||||||
NSString *_localeId;
|
NSString *_localeId;
|
||||||
NSMutableDictionary *_components;
|
NSMutableDictionary *_components;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||||
|
|
|
@ -145,9 +145,7 @@ typedef NSUInteger NSNumberFormatterRoundingMode;
|
||||||
NSLocale *_locale;
|
NSLocale *_locale;
|
||||||
void *_formatter;
|
void *_formatter;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format
|
// Format
|
||||||
|
|
|
@ -211,9 +211,7 @@ typedef SOCKET NSSocketNativeHandle;
|
||||||
NSMapTable *events;
|
NSMapTable *events;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -94,9 +94,7 @@ extern "C" {
|
||||||
unsigned _version; /* Version of archiver used. */
|
unsigned _version; /* Version of archiver used. */
|
||||||
NSZone *_zone; /* Zone for allocating objs. */
|
NSZone *_zone; /* Zone for allocating objs. */
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,9 +51,7 @@ extern "C" {
|
||||||
NSPort *_send;
|
NSPort *_send;
|
||||||
NSMutableArray *_components;
|
NSMutableArray *_components;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* OpenStep compatibility.
|
* OpenStep compatibility.
|
||||||
|
|
|
@ -60,9 +60,7 @@ extern "C" {
|
||||||
NSMapTable *_portMap; /* Registered ports information. */
|
NSMapTable *_portMap; /* Registered ports information. */
|
||||||
NSMapTable *_nameMap; /* Registered names information. */
|
NSMapTable *_nameMap; /* Registered names information. */
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
+ (id) sharedInstance;
|
+ (id) sharedInstance;
|
||||||
- (NSPort*) portForName: (NSString*)name
|
- (NSPort*) portForName: (NSString*)name
|
||||||
|
|
|
@ -42,9 +42,7 @@ extern "C" {
|
||||||
Protocol *_myProtocol;
|
Protocol *_myProtocol;
|
||||||
NSObject *_myTarget;
|
NSObject *_myTarget;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creating a checker
|
// Creating a checker
|
||||||
|
|
|
@ -37,6 +37,7 @@ DEFINE_BLOCK_TYPE(GSRegexBlock, void, NSTextCheckingResult*, NSMatchingFlags, BO
|
||||||
@private
|
@private
|
||||||
GSREGEXTYPE *regex;
|
GSREGEXTYPE *regex;
|
||||||
NSRegularExpressionOptions options;
|
NSRegularExpressionOptions options;
|
||||||
|
GS_PADDING_IVAR;
|
||||||
}
|
}
|
||||||
+ (NSRegularExpression*)regularExpressionWithPattern: (NSString*)aPattern
|
+ (NSRegularExpression*)regularExpressionWithPattern: (NSString*)aPattern
|
||||||
options: (NSRegularExpressionOptions)opts
|
options: (NSRegularExpressionOptions)opts
|
||||||
|
|
|
@ -50,9 +50,7 @@ extern "C" {
|
||||||
BOOL _caseSensitive;
|
BOOL _caseSensitive;
|
||||||
BOOL _isUnicode;
|
BOOL _isUnicode;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -50,9 +50,7 @@ extern "C" {
|
||||||
BOOL _ascending;
|
BOOL _ascending;
|
||||||
SEL _selector;
|
SEL _selector;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a flag indicating whether the sort descriptor sorts objects
|
/** Returns a flag indicating whether the sort descriptor sorts objects
|
||||||
|
|
|
@ -54,9 +54,7 @@ extern "C" {
|
||||||
BOOL _hasCollected;
|
BOOL _hasCollected;
|
||||||
BOOL _hasNotified;
|
BOOL _hasNotified;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSTask*) launchedTaskWithLaunchPath: (NSString*)path
|
+ (NSTask*) launchedTaskWithLaunchPath: (NSString*)path
|
||||||
|
|
|
@ -72,9 +72,7 @@ extern "C" {
|
||||||
id _gcontext;
|
id _gcontext;
|
||||||
void *_runLoopInfo; // Per-thread runloop related info.
|
void *_runLoopInfo; // Per-thread runloop related info.
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused; // For future expansion
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,9 +51,7 @@ extern "C" {
|
||||||
SEL _selector;
|
SEL _selector;
|
||||||
id _info;
|
id _info;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creating timer objects. */
|
/* Creating timer objects. */
|
||||||
|
|
|
@ -98,9 +98,7 @@ GS_EXPORT NSString* const NSUndoManagerWillUndoChangeNotification;
|
||||||
unsigned _disableCount;
|
unsigned _disableCount;
|
||||||
unsigned _levelsOfUndo;
|
unsigned _levelsOfUndo;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) beginUndoGrouping;
|
- (void) beginUndoGrouping;
|
||||||
|
|
|
@ -228,9 +228,7 @@ GS_EXPORT NSString* const GSLocale;
|
||||||
NSRecursiveLock *_lock;
|
NSRecursiveLock *_lock;
|
||||||
NSDistributedLock *_fileLock;
|
NSDistributedLock *_fileLock;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,9 +88,7 @@ typedef NSUInteger NSXMLNodeKind;
|
||||||
NSUInteger _index;
|
NSUInteger _index;
|
||||||
id _objectValue;
|
id _objectValue;
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -74,9 +74,7 @@ GS_EXPORT NSString* const NSXMLParserErrorDomain;
|
||||||
void *_parser; // GSXMLParser
|
void *_parser; // GSXMLParser
|
||||||
void *_handler; // SAXHandler
|
void *_handler; // SAXHandler
|
||||||
#endif
|
#endif
|
||||||
#if !GS_NONFRAGILE
|
GS_PADDING_IVAR;
|
||||||
void *_unused;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue