Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #252 from NVIDIA/bugfix/cxx_20
Browse files Browse the repository at this point in the history
Fix deprecation warnings in C++20
  • Loading branch information
wmaxey authored Feb 19, 2022
2 parents 7664ea3 + bbb020f commit a2b367c
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 10 deletions.
13 changes: 13 additions & 0 deletions include/cuda/std/detail/libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,19 @@ typedef unsigned int char32_t;
# define _LIBCUDACXX_CONSTEXPR_AFTER_CXX17
#endif

// Macros to enter and leave a state where deprecation warnings are suppressed.
#if defined(_LIBCUDACXX_COMPILER_CLANG) || defined(_LIBCUDACXX_COMPILER_GCC)
# define _LIBCUDACXX_SUPPRESS_DEPRECATED_PUSH \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
# define _LIBCUDACXX_SUPPRESS_DEPRECATED_POP \
_Pragma("GCC diagnostic pop")
#else
# define _LIBCUDACXX_SUPPRESS_DEPRECATED_PUSH
# define _LIBCUDACXX_SUPPRESS_DEPRECATED_POP
#endif

// The _LIBCUDACXX_NODISCARD_ATTRIBUTE should only be used to define other
// NODISCARD macros to the correct attribute.
#if __has_cpp_attribute(nodiscard) || (defined(_LIBCUDACXX_COMPILER_MSVC) && _LIBCUDACXX_STD_VER > 14)
Expand Down
4 changes: 4 additions & 0 deletions include/cuda/std/detail/libcxx/include/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -1125,8 +1125,12 @@ template <class _Tp> struct _LIBCUDACXX_TEMPLATE_VIS add_rvalue_reference
template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
#endif

// Suppress deprecation notice for volatile-qualified return type resulting
// from volatile-qualified types _Tp.
_LIBCUDACXX_SUPPRESS_DEPRECATED_PUSH
template <class _Tp> _LIBCUDACXX_INLINE_VISIBILITY _Tp&& __declval(int);
template <class _Tp> _LIBCUDACXX_INLINE_VISIBILITY _Tp __declval(long);
_LIBCUDACXX_SUPPRESS_DEPRECATED_POP

template <class _Tp>
_LIBCUDACXX_INLINE_VISIBILITY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: c++17, c++2a
// XFAIL: c++17, c++2a, c++20

// <functional>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: c++17, c++2a
// XFAIL: c++17, c++2a, c++20

// <functional>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: c++17, c++2a
// XFAIL: c++17, c++2a, c++20

// <functional>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: c++17, c++2a
// XFAIL: c++17, c++2a, c++20

// <functional>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: c++17, c++2a
// XFAIL: c++17, c++2a, c++20

// <functional>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: c++17, c++2a
// XFAIL: c++17, c++2a, c++20

// <functional>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: c++17, c++2a
// XFAIL: c++17, c++2a, c++20

// <functional>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: c++17, c++2a
// XFAIL: c++17, c++2a, c++20

// <functional>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: c++03, c++11, c++14

// type_traits

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,27 @@
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03
// UNSUPPORTED: c++03
//
// <functional>
//
// result_of<Fn(ArgTypes...)>

// ADDITIONAL_COMPILE_FLAGS: -D_LIBCUDACXX_ENABLE_CXX20_REMOVED_TYPE_TRAITS
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS

#include <type_traits>
#include <functional>
#include <memory>
#include <utility>
#include "test_macros.h"

// Ignore warnings about volatile in parameters being deprecated.
// We know it is, but we still have to test it.
#if defined(TEST_COMPILER_GCC)
# pragma GCC diagnostic ignored "-Wvolatile"
#endif

struct wat
{
wat& operator*() { return *this; }
Expand Down Expand Up @@ -55,6 +65,9 @@ void test_result_of_imp()
#endif
}

// Do not warn on deprecated uses of 'volatile' below.
_LIBCUDACXX_SUPPRESS_DEPRECATED_PUSH

int main(int, char**)
{
{
Expand Down Expand Up @@ -171,3 +184,5 @@ int main(int, char**)

return 0;
}

_LIBCUDACXX_SUPPRESS_DEPRECATED_POP

0 comments on commit a2b367c

Please sign in to comment.