From c19d77bd0eec541a1018201f5c2a35af0205769a Mon Sep 17 00:00:00 2001 From: rfm Date: Thu, 27 Mar 2025 10:27:23 +0000 Subject: [PATCH] Make deprecation macro name consistent (it applies to methods, not just functions) and add attribute to mark non-portable features. --- Headers/Foundation/NSPointerFunctions.h | 8 ++++---- Headers/GNUstepBase/GSObjCRuntime.h | 2 +- Headers/GNUstepBase/GSVersionMacros.h | 27 +++++++++++++++++++++---- Tools/autogsdoc.m | 3 ++- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Headers/Foundation/NSPointerFunctions.h b/Headers/Foundation/NSPointerFunctions.h index 709ed801c..10413fb78 100644 --- a/Headers/Foundation/NSPointerFunctions.h +++ b/Headers/Foundation/NSPointerFunctions.h @@ -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 diff --git a/Headers/GNUstepBase/GSObjCRuntime.h b/Headers/GNUstepBase/GSObjCRuntime.h index ae53e7db4..a75b3e28a 100644 --- a/Headers/GNUstepBase/GSObjCRuntime.h +++ b/Headers/GNUstepBase/GSObjCRuntime.h @@ -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 diff --git a/Headers/GNUstepBase/GSVersionMacros.h b/Headers/GNUstepBase/GSVersionMacros.h index a407c7ba6..59562309e 100644 --- a/Headers/GNUstepBase/GSVersionMacros.h +++ b/Headers/GNUstepBase/GSVersionMacros.h @@ -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)) diff --git a/Tools/autogsdoc.m b/Tools/autogsdoc.m index 7db13f05e..d19697dec 100644 --- a/Tools/autogsdoc.m +++ b/Tools/autogsdoc.m @@ -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"];