mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +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
5d623d76fc
commit
c7c3c7c02e
35 changed files with 47 additions and 108 deletions
|
@ -75,9 +75,7 @@ extern "C" {
|
|||
NSMutableDictionary *objects;
|
||||
NSMutableDictionary *params;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
+ (NSString*) makeQuoted: (NSString*)v always: (BOOL)flag;
|
||||
+ (NSString*) makeToken: (NSString*)t preservingCase: (BOOL)preserve;
|
||||
|
|
|
@ -228,6 +228,16 @@
|
|||
|
||||
#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.
|
||||
*
|
||||
* FIXME: "OBJC2RUNTIME" is set to "1" if the runtime has
|
||||
|
|
|
@ -70,9 +70,7 @@ extern "C" {
|
|||
BOOL _encodingRoot;
|
||||
BOOL _initialPass;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/* Initializing an archiver */
|
||||
|
@ -178,9 +176,7 @@ extern "C" {
|
|||
NSMutableDictionary *objDict; /* Class information store. */
|
||||
NSMutableArray *objSave;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/* Initializing an unarchiver */
|
||||
|
|
|
@ -194,9 +194,7 @@ typedef struct autorelease_array_list
|
|||
/* The method to add an object to this pool */
|
||||
void (*_addImp)(id, SEL, id);
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -119,9 +119,7 @@ GS_EXPORT NSString* const NSLoadedClasses;
|
|||
unsigned _version;
|
||||
NSString *_frameworkVersion;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/** Return an array enumerating all the bundles in the application. This
|
||||
|
|
|
@ -61,9 +61,7 @@ extern "C" {
|
|||
/** Total number of accesses to objects */
|
||||
int64_t _totalAccesses;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
/**
|
||||
* Returns the maximum number of objects that are supported by this cache.
|
||||
|
|
|
@ -77,9 +77,7 @@ typedef enum _NSPredicateOperatorType
|
|||
NSUInteger _options;
|
||||
NSPredicateOperatorType _type;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
@public
|
||||
NSExpression *_left;
|
||||
NSExpression *_right;
|
||||
|
|
|
@ -134,9 +134,7 @@ typedef NSUInteger NSDateFormatterBehavior;
|
|||
NSDateFormatterStyle _dateStyle;
|
||||
void *_formatter;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/* Initializing an NSDateFormatter */
|
||||
|
|
|
@ -129,9 +129,7 @@ extern "C" {
|
|||
BOOL _raiseOnUnderflow;
|
||||
BOOL _raiseOnDivideByZero;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,9 +40,7 @@ extern "C" {
|
|||
NSString *_lockPath;
|
||||
NSDate *_lockTime;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
+ (NSDistributedLock*) lockWithPath: (NSString*)aPath;
|
||||
|
|
|
@ -86,9 +86,7 @@ GS_EXPORT NSString* const GSNetworkNotificationCenterType;
|
|||
id _remote; /* Proxy for center. */
|
||||
BOOL _suspended; /* Is delivery suspended? */
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
+ (NSNotificationCenter*) defaultCenter;
|
||||
+ (NSNotificationCenter*) notificationCenterForType: (NSString*)type;
|
||||
|
|
|
@ -121,9 +121,7 @@ GS_EXPORT NSString* const NSCocoaErrorDomain;
|
|||
NSString *_domain;
|
||||
NSDictionary *_userInfo;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -162,9 +162,7 @@ GS_EXPORT NSString * const NSFileHandleOperationException;
|
|||
NSFileHandle *_readHandle;
|
||||
NSFileHandle *_writeHandle;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
+ (id) pipe;
|
||||
- (NSFileHandle*) fileHandleForReading;
|
||||
|
|
|
@ -203,9 +203,7 @@ typedef uint32_t OSType;
|
|||
@private
|
||||
NSString *_lastError;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
+ (NSFileManager*) defaultManager;
|
||||
|
@ -389,9 +387,7 @@ typedef uint32_t OSType;
|
|||
BOOL justContents: 1;
|
||||
} _flags;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
- (NSDictionary*) directoryAttributes;
|
||||
- (NSDictionary*) fileAttributes;
|
||||
|
|
|
@ -44,9 +44,7 @@ extern "C" {
|
|||
NSSet *_names;
|
||||
NSSet *_addresses;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,9 +50,7 @@ extern "C" {
|
|||
NSUInteger _length;
|
||||
NSUInteger *_indexes;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,9 +50,7 @@ extern "C" {
|
|||
BOOL _sendToSuper;
|
||||
void *_retptr;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -71,9 +71,7 @@ extern "C" {
|
|||
NSMutableArray *_obj; /* Array of objects. */
|
||||
NSPropertyListFormat _format;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -240,9 +238,7 @@ extern "C" {
|
|||
#endif
|
||||
NSZone *_zone; /* Zone for allocating objs. */
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -104,9 +104,7 @@ GS_EXPORT NSString * const NSISO8601Calendar;
|
|||
NSString *_localeId;
|
||||
NSMutableDictionary *_components;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||
|
|
|
@ -145,9 +145,7 @@ typedef NSUInteger NSNumberFormatterRoundingMode;
|
|||
NSLocale *_locale;
|
||||
void *_formatter;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
// Format
|
||||
|
|
|
@ -211,9 +211,7 @@ typedef SOCKET NSSocketNativeHandle;
|
|||
NSMapTable *events;
|
||||
#endif
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -94,9 +94,7 @@ extern "C" {
|
|||
unsigned _version; /* Version of archiver used. */
|
||||
NSZone *_zone; /* Zone for allocating objs. */
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,9 +51,7 @@ extern "C" {
|
|||
NSPort *_send;
|
||||
NSMutableArray *_components;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
/**
|
||||
* OpenStep compatibility.
|
||||
|
|
|
@ -60,9 +60,7 @@ extern "C" {
|
|||
NSMapTable *_portMap; /* Registered ports information. */
|
||||
NSMapTable *_nameMap; /* Registered names information. */
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
+ (id) sharedInstance;
|
||||
- (NSPort*) portForName: (NSString*)name
|
||||
|
|
|
@ -42,9 +42,7 @@ extern "C" {
|
|||
Protocol *_myProtocol;
|
||||
NSObject *_myTarget;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
// Creating a checker
|
||||
|
|
|
@ -37,6 +37,7 @@ DEFINE_BLOCK_TYPE(GSRegexBlock, void, NSTextCheckingResult*, NSMatchingFlags, BO
|
|||
@private
|
||||
GSREGEXTYPE *regex;
|
||||
NSRegularExpressionOptions options;
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
+ (NSRegularExpression*)regularExpressionWithPattern: (NSString*)aPattern
|
||||
options: (NSRegularExpressionOptions)opts
|
||||
|
|
|
@ -50,9 +50,7 @@ extern "C" {
|
|||
BOOL _caseSensitive;
|
||||
BOOL _isUnicode;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -50,9 +50,7 @@ extern "C" {
|
|||
BOOL _ascending;
|
||||
SEL _selector;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/** Returns a flag indicating whether the sort descriptor sorts objects
|
||||
|
|
|
@ -54,9 +54,7 @@ extern "C" {
|
|||
BOOL _hasCollected;
|
||||
BOOL _hasNotified;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
+ (NSTask*) launchedTaskWithLaunchPath: (NSString*)path
|
||||
|
|
|
@ -72,9 +72,7 @@ extern "C" {
|
|||
id _gcontext;
|
||||
void *_runLoopInfo; // Per-thread runloop related info.
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused; // For future expansion
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,9 +51,7 @@ extern "C" {
|
|||
SEL _selector;
|
||||
id _info;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/* Creating timer objects. */
|
||||
|
|
|
@ -98,9 +98,7 @@ GS_EXPORT NSString* const NSUndoManagerWillUndoChangeNotification;
|
|||
unsigned _disableCount;
|
||||
unsigned _levelsOfUndo;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
- (void) beginUndoGrouping;
|
||||
|
|
|
@ -228,9 +228,7 @@ GS_EXPORT NSString* const GSLocale;
|
|||
NSRecursiveLock *_lock;
|
||||
NSDistributedLock *_fileLock;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -88,9 +88,7 @@ typedef NSUInteger NSXMLNodeKind;
|
|||
NSUInteger _index;
|
||||
id _objectValue;
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,9 +74,7 @@ GS_EXPORT NSString* const NSXMLParserErrorDomain;
|
|||
void *_parser; // GSXMLParser
|
||||
void *_handler; // SAXHandler
|
||||
#endif
|
||||
#if !GS_NONFRAGILE
|
||||
void *_unused;
|
||||
#endif
|
||||
GS_PADDING_IVAR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue