Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrapper to throw compiler warning for deprecated funcs #122

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions src/scitokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ extern "C" {
#include <time.h>
#endif

// Set up a wrapper macro to warn compiler of soon-to-be-deprecated functions
#if __cplusplus >= 201402L
#if defined(__has_cpp_attribute)
#if __has_cpp_attribute(deprecated)
#define DEPRECATION_WARNING(msg, func) [[deprecated(msg)]] func
#endif
#endif
jhiemstrawisc marked this conversation as resolved.
Show resolved Hide resolved
#else
#ifdef __GNUC__
#define DEPRECATION_WARNING(msg, func) func __attribute__ ((deprecated(msg)))
#elif defined(_MSC_VER)
#define DEPRECATION_WARNING(msg, func) __declspec(deprecated(msg)) func
#endif
jhiemstrawisc marked this conversation as resolved.
Show resolved Hide resolved
#endif

typedef void *SciTokenKey;
typedef void *SciToken;
typedef void *Validator;
Expand Down Expand Up @@ -294,8 +309,9 @@ int keycache_set_jwks(const char *issuer, const char *jwks, char **err_msg);
* APIs for managing scitokens configuration parameters.
*/

// On its way to deprecation
int config_set_int(const char *key, int value, char **err_msg);

jhiemstrawisc marked this conversation as resolved.
Show resolved Hide resolved
// On its way to deprecation. API wrapped in deprecation warning
DEPRECATION_WARNING("Use scitoken_ prefixed version instead", int config_set_int(const char *key, int value, char **err_msg));
jhiemstrawisc marked this conversation as resolved.
Show resolved Hide resolved

/**
* Update scitokens int parameters.
Expand All @@ -305,8 +321,8 @@ int config_set_int(const char *key, int value, char **err_msg);
*/
int scitoken_config_set_int(const char *key, int value, char **err_msg);

// on its way to deprecation
int config_get_int(const char *key, char **err_msg);
// On its way to deprecation. API wrapped in deprecation warning
DEPRECATION_WARNING("Use scitoken_ prefixed version instead", int config_get_int(const char *key, char **err_msg));
jhiemstrawisc marked this conversation as resolved.
Show resolved Hide resolved

/**
* Get current scitokens int parameters.
Expand Down