Make deprecation macro name consistent (it applies to methods, not just functions) and add attribute to mark non-portable features.

This commit is contained in:
rfm 2025-03-27 10:27:23 +00:00
parent bc16a59440
commit c19d77bd0e
4 changed files with 30 additions and 10 deletions

View file

@ -138,15 +138,15 @@ GS_EXPORT_CLASS
- (void) setSizeFunction: (NSUInteger (*)(const void *item))func;
- (void) setUsesStrongWriteBarrier: (BOOL)flag GS_DEPRECATED_FUNC;
- (void) setUsesStrongWriteBarrier: (BOOL)flag GS_DEPRECATED;
- (void) setUsesWeakReadAndWriteBarriers: (BOOL)flag GS_DEPRECATED_FUNC;
- (void) setUsesWeakReadAndWriteBarriers: (BOOL)flag GS_DEPRECATED;
- (NSUInteger (*)(const void *item)) sizeFunction;
- (BOOL) usesStrongWriteBarrier GS_DEPRECATED_FUNC;
- (BOOL) usesStrongWriteBarrier GS_DEPRECATED;
- (BOOL) usesWeakReadAndWriteBarriers GS_DEPRECATED_FUNC;
- (BOOL) usesWeakReadAndWriteBarriers GS_DEPRECATED;
@end

View file

@ -526,7 +526,7 @@ GSClassSwizzle(id instance, Class newClass);
#if GS_API_VERSION(GS_API_ANY,011500)
GS_EXPORT const char *
GSLastErrorStr(long error_id) GS_DEPRECATED_FUNC;
GSLastErrorStr(long error_id) GS_DEPRECATED;
#endif

View file

@ -241,14 +241,21 @@
* depending on where the attribute can be applied.
*/
/* This macro is placed immediately before the name of a method or function
* to mark it as deprecated (ie it should not be used and is likely to be
* removed in a later release).
* Please do not use the older GS_DEPRECATED_FUNC macro, it's deprecated ;-)
*/
#if defined(__clang__) || GS_GCC_MINREQ(3,1)
# define GS_DEPRECATED_FUNC __attribute__((deprecated))
# define GS_DEPRECATED __attribute__((deprecated))
#else
# define GS_DEPRECATED_FUNC
# define GS_DEPRECATED
#endif
#define GS_DEPRECATED_FUNC
/* This attribute is placed immediately before the name of a method
* or function to mark it as unimplemented.
/** This macro is placed immediately before the name of a method or function
* to mark it as unimplemented, though likley to become available in a later
* release.
*/
#if defined(__clang__) || GS_GCC_MINREQ(3,1)
# define GS_UNIMPLEMENTED __attribute__((deprecated("*** not implemented - please contribute an implementation before using this feature ***")))
@ -256,6 +263,18 @@
# define GS_UNIMPLEMENTED
#endif
/** This macro is placed immediately before the name of a method or function
* to mark it as non-portable... a feature which does not work on all platforms
* and should not be used unless you are specifically intending to write
* non portable code which will only ever be used on a platform known to
* support the feature.
*/
#if defined(__clang__) || GS_GCC_MINREQ(3,1)
# define GS_NON_PORTABLE __attribute__((deprecated("*** not portable - please do not use this feature ***")))
#else
# define GS_NON_PORTABLE
#endif
#define GS_UNUSED_ARG __attribute__((unused))
#define GS_UNUSED_FUNC __attribute__((unused))

View file

@ -1292,8 +1292,8 @@ main(int argc, char **argv, char **env)
[wm setObject: @"//" forKey: @"DEFINE_BLOCK_TYPE"];
[wm setObject: @"//" forKey: @"DEFINE_BLOCK_TYPE"];
[wm setObject: @"//" forKey: @"DEFINE_BLOCK_TYPE_NO_ARGS"];
[wm setObject: @"" forKey: @"GS_ATTRIB_DEPRECATED"];
[wm setObject: @"" forKey: @"GS_DECLARE"];
[wm setObject: @"" forKey: @"GS_DEPRECATED"];
[wm setObject: @"" forKey: @"GS_DEPRECATED_FUNC"];
[wm setObject: @"extern" forKey: @"GS_EXPORT"];
[wm setObject: @"" forKey: @"GS_EXPORT_CLASS"];
@ -1301,6 +1301,7 @@ main(int argc, char **argv, char **env)
[wm setObject: @"" forKey: @"GS_GEOM_ATTR"];
[wm setObject: @"extern" forKey: @"GS_GEOM_SCOPE"];
[wm setObject: @"" forKey: @"GS_IMPORT"];
[wm setObject: @"" forKey: @"GS_NON_PORTABLE"];
[wm setObject: @"" forKey: @"GS_NORETURN_METHOD"];
[wm setObject: @"//" forKey: @"GS_PRIVATE_INTERNAL"];
[wm setObject: @"" forKey: @"GS_RANGE_ATTR"];