Skip to content

Respect MSVC grammar for __declspec(deprecated) when using YR_DEPRECATED #1911

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

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions libyara/include/yara/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ struct YR_RULES
// deprecated, which will raise a warning if used.
// TODO(vmalvarez): Remove this field when a reasonable a few versions
// after 4.1 has been released.
YR_RULE* rules_list_head YR_DEPRECATED;
YR_DEPRECATED(YR_RULE* rules_list_head);
};

// Array of pointers with an entry for each of the defined strings. The idx
Expand All @@ -576,7 +576,7 @@ struct YR_RULES
// deprecated, which will raise a warning if used.
// TODO(vmalvarez): Remove this field when a reasonable a few versions
// after 4.1 has been released.
YR_STRING* strings_list_head YR_DEPRECATED;
YR_DEPRECATED(YR_STRING* strings_list_head);
};

// Array of pointers with an entry for each external variable.
Expand All @@ -588,7 +588,7 @@ struct YR_RULES
// as deprecated, which will raise a warning if used.
// TODO(vmalvarez): Remove this field when a reasonable a few versions
// after 4.1 has been released.
YR_EXTERNAL_VARIABLE* externals_list_head YR_DEPRECATED;
YR_DEPRECATED(YR_EXTERNAL_VARIABLE* externals_list_head);
};

// Pointer to the Aho-Corasick transition table.
Expand Down
42 changes: 21 additions & 21 deletions libyara/include/yara/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,38 +55,38 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if defined(_WIN32) || defined(__CYGWIN__)
#ifdef YR_BUILDING_DLL
#ifdef __GNUC__
#define YR_API EXTERNC __attribute__((dllexport))
#define YR_DEPRECATED_API EXTERNC __attribute__((deprecated))
#define YR_DEPRECATED __attribute__((deprecated))
#define YR_API EXTERNC __attribute__((dllexport))
#define YR_DEPRECATED_API EXTERNC __attribute__((deprecated))
#define YR_DEPRECATED(statement) statement __attribute__((deprecated))
#else
#define YR_API EXTERNC __declspec(dllexport)
#define YR_DEPRECATED_API EXTERNC __declspec(deprecated)
#define YR_DEPRECATED __declspec(deprecated)
#define YR_API EXTERNC __declspec(dllexport)
#define YR_DEPRECATED_API EXTERNC __declspec(deprecated)
#define YR_DEPRECATED(statement) __declspec(deprecated) statement
#endif
#elif defined(YR_IMPORTING_DLL)
#ifdef __GNUC__
#define YR_API EXTERNC __attribute__((dllimport))
#define YR_DEPRECATED_API EXTERNC __attribute__((deprecated))
#define YR_DEPRECATED __attribute__((deprecated))
#define YR_API EXTERNC __attribute__((dllimport))
#define YR_DEPRECATED_API EXTERNC __attribute__((deprecated))
#define YR_DEPRECATED(statement) statement __attribute__((deprecated))
#else
#define YR_API EXTERNC __declspec(dllimport)
#define YR_DEPRECATED_API EXTERNC __declspec(deprecated)
#define YR_DEPRECATED __declspec(deprecated)
#define YR_API EXTERNC __declspec(dllimport)
#define YR_DEPRECATED_API EXTERNC __declspec(deprecated)
#define YR_DEPRECATED(statement) __declspec(deprecated) statement
#endif
#else
#define YR_API EXTERNC
#define YR_DEPRECATED_API EXTERNC
#define YR_DEPRECATED
#define YR_API EXTERNC
#define YR_DEPRECATED_API EXTERNC
#define YR_DEPRECATED(statement) statement
#endif
#else
#if __GNUC__ >= 4
#define YR_API EXTERNC __attribute__((visibility("default")))
#define YR_DEPRECATED_API YR_API __attribute__((deprecated))
#define YR_DEPRECATED __attribute__((deprecated))
#define YR_API EXTERNC __attribute__((visibility("default")))
#define YR_DEPRECATED_API YR_API __attribute__((deprecated))
#define YR_DEPRECATED(statement) statement __attribute__((deprecated))
#else
#define YR_API EXTERNC
#define YR_DEPRECATED_API EXTERNC
#define YR_DEPRECATED
#define YR_API EXTERNC
#define YR_DEPRECATED_API EXTERNC
#define YR_DEPRECATED(statement) statement
#endif
#endif

Expand Down