Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Fix shimmeringHighlightWidth documentation and deprecation attribute #56

Conversation

guillaumealgis
Copy link
Contributor

The property shimmeringHighlightWidth is causing 2 warnings with strict compiler flags.

The first one is because placing @deprecated right after @abstract in the documentation comment block causes the parser to think the @abstract is empty.
This is fixed by moving @deprecated at the end of the comment block.

The second is caused by the method being documented as @deprecated but not marked as such with a compiler attribute. This is fixed by using the DEPRECATED_MSG_ATTRIBUTE macro.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@grp
Copy link
Contributor

grp commented Mar 18, 2016

Thanks for the fix. Where does DEPRECATED_MSG_ATTRIBUTE come from?

@guillaumealgis
Copy link
Contributor Author

DEPRECATED_MSG_ATTRIBUTE is defined by Apple in the iOS SDK AvailabilityMacros.h. Here's the full definition of the macro:

/*
 * only certain compilers support __attribute__((deprecated))
 */
#if defined(__has_feature) && defined(__has_attribute)
    #if __has_attribute(deprecated)
        #define DEPRECATED_ATTRIBUTE        __attribute__((deprecated))
        #if __has_feature(attribute_deprecated_with_message)
            #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
        #else
            #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated))
        #endif
    #else
        #define DEPRECATED_ATTRIBUTE
        #define DEPRECATED_MSG_ATTRIBUTE(s)
    #endif
#elif defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
    #define DEPRECATED_ATTRIBUTE        __attribute__((deprecated))
    #if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))
        #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
    #else
        #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated))
    #endif
#else
    #define DEPRECATED_ATTRIBUTE
    #define DEPRECATED_MSG_ATTRIBUTE(s)
#endif

As far as I can tell, it has been around since the first version of the SDK.

Note that another option is to simply use DEPRECATED_ATTRIBUTE, but I thought providing a message with the replacement property name was helpful to the user.

@grp
Copy link
Contributor

grp commented Mar 18, 2016

Cool, thanks! I had always seen __attribute__((deprecated)) used directly.

grp added a commit that referenced this pull request Mar 18, 2016
…deprecated-fix

Fix shimmeringHighlightWidth documentation and deprecation attribute
@grp grp merged commit aee5bfa into facebookarchive:master Mar 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants