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

Silence negators deprecation warnings #2071

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 11 additions & 0 deletions include/oneapi/dpl/functional
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@
#define _ONEDPL_FUNCTIONAL

#include "oneapi/dpl/internal/common_config.h"

// Silence the deprecation warnings of the negators injected from <functional>
// The macro definition is contained in this header to avoid redefinition errors on the user side
Comment on lines +21 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my understanding - please correct if I am wrong - the "silence" macro effectively does not add the deprecation attribute to the negation functions. That means that a) if the standard header has been included before oneDPL headers, the warnings will still be there, and b) if we include the header with the "silence" macro defined, it will impact the whole translation unit anyway.

The direct conclusion from (b) is that undefining the macro makes no good whatsoever, and maybe even harms, by disabling the warnings and leaving no clue it has been made.

Copy link
Contributor

@akukanov akukanov Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I think we should not do this suppression. Since we position our headers as substitutes for the standard ones, in most if not all cases we should not change the behavior of the standard headers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I think we should not do this suppression. Since we position our headers as substitutes for the standard ones, in most if not all cases we should not change the behavior of the standard headers.

The suppression was questionable, and I wanted to hear an argument like that. I agree with it. Let me close the PR then.

#if _ONEDPL___cplusplus < 202002L && defined(_MSC_VER) && !defined(_SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING)
# define _SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING
# define _ONEDPL_SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING
#endif
#include <functional>
#if defined(_ONEDPL_SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING)
# undef _SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING
# undef _ONEDPL_SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING
#endif

#include "oneapi/dpl/utility"

Expand Down
Loading