1

NSDeprecated which tunnels through CF_Deprecated into the clang attribute availability only handles deprecation for MACOSX and IOS.

Are there any calls or series of macros that replicate this tool for third parties.

I am working on V2 of an SDK and there are certain calls we want to deprecate as well as EOL.

(Please note, this SDK is still in Objective-C; so Swift only solutions don't solve my issue)

The deprecation warnings and errors would be fantastic at compilation and code generation time; however, I fear this is something I'd need to spin on my own.

Any pointers or reference on this before I have to decide if I need to kill the time on this side project?

Dru Freeman
  • 1,766
  • 3
  • 19
  • 41
  • Perhaps this? http://stackoverflow.com/questions/25405133/how-to-manually-deprecate-members – Will M. Jul 09 '15 at 15:03
  • that looks like it is only for Swift, the SDK is still in Objective C – Dru Freeman Jul 09 '15 at 15:09
  • I edited the post to point out I do need an Obj-C solution) – Dru Freeman Jul 09 '15 at 15:11
  • something like `+ (void) testStuff __deprecated_msg("deprecated, use XYZ instead");` would give you a compiler error, if that is what you want. – Will M. Jul 09 '15 at 16:21
  • This is a good stopgap solution. At least I can label the issues. What will help is being able to mark deprecated as per versions. Feel free to add this as an answer and I'll uproot it and select it if nothing better comes in. – Dru Freeman Jul 09 '15 at 17:18

3 Answers3

2

You can #define a macro in your SDK project to make a shorthand for the deprecation message. We did something similar in the Core Plot project.

Eric Skroch
  • 27,381
  • 3
  • 29
  • 36
1

There is a function attribute deprecated provided by GNU compiler. The syntax to mark deprecated functions is:

void Foo() __attribute__( (deprecated("message", "replacement")) );

The first one is the message to display when emitting the warning; the second one enables the compiler to provide a Fix-It to replace the deprecated name with a new name.

More information on using function attributes can be found in GCC Attribute Syntax documentation or Attributes in Clang documentation

voromax
  • 3,369
  • 2
  • 30
  • 53
0

some handy macros are in the NSObjCRuntime.h from Apple.

NS_DEPRECATED_IOS(6.0,10.0)

works like a charm.

Karsten
  • 1,869
  • 22
  • 38