]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduce DEAL_II[_DEPRECATED_EARLY]_WITH_COMMENT
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 6 Jul 2023 21:41:27 +0000 (17:41 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 6 Jul 2023 21:41:27 +0000 (17:41 -0400)
cmake/checks/check_01_cxx_features.cmake
include/deal.II/base/config.h.in

index da8701b5c8b9363772a98759ae59286f4273f781..b06e86256b7450ec26672d7ec3b416de39cce7cc 100644 (file)
@@ -26,8 +26,6 @@
 #   DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS
 #   DEAL_II_HAVE_CXX17_LEGENDRE_FUNCTIONS
 #   DEAL_II_FALLTHROUGH
-#   DEAL_II_DEPRECATED
-#   DEAL_II_DEPRECATED_EARLY
 #   DEAL_II_CONSTEXPR
 #
 
@@ -376,8 +374,6 @@ unset_if_changed(CHECK_CXX_FEATURES_FLAGS_SAVED
   "${CMAKE_REQUIRED_FLAGS}${CMAKE_CXX_STANDARD}"
   DEAL_II_HAVE_FP_EXCEPTIONS
   DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
-  DEAL_II_HAVE_CXX17_ATTRIBUTE_DEPRECATED
-  DEAL_II_HAVE_ATTRIBUTE_DEPRECATED
   DEAL_II_HAVE_CXX17_ATTRIBUTE_FALLTHROUGH
   DEAL_II_HAVE_ATTRIBUTE_FALLTHROUGH
   DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS
@@ -448,79 +444,6 @@ CHECK_CXX_SOURCE_COMPILES(
   "
   DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS)
 
-
-#
-# Even though [[deprecated]] is a C++14 feature we have to check
-# whether we can actually use the [[deprecated]] attribute in all
-# cases we care about; some of the following are C++17 features.
-#
-CHECK_CXX_SOURCE_COMPILES(
-  "
-  [[deprecated]] int old_fn ();
-  int old_fn () { return 0; }
-
-  struct [[deprecated]] bob
-  {
-    [[deprecated]] bob(int i);
-    [[deprecated]] void test();
-  };
-
-  enum color
-  {
-    red [[deprecated]]
-  };
-
-  template <int dim>
-  struct foo {};
-  using bar [[deprecated]] = foo<2>;
-
-  int main () {}
-  "
-  DEAL_II_HAVE_CXX17_ATTRIBUTE_DEPRECATED
-  )
-
-#
-# Also test the corresponding GCC extension
-#
-CHECK_CXX_SOURCE_COMPILES(
-  "
-  __attribute__((deprecated)) int old_fn ();
-  int old_fn () { return 0; }
-
-  struct __attribute__((deprecated)) bob
-  {
-    __attribute__((deprecated)) bob(int i);
-    __attribute__((deprecated)) void test();
-  };
-
-  enum color
-  {
-    red __attribute__((deprecated))
-  };
-
-  template <int dim>
-  struct foo {};
-  using bar __attribute__((deprecated)) = foo<2>;
-
-  int main () {}
-  "
-  DEAL_II_HAVE_ATTRIBUTE_DEPRECATED
-  )
-
-if(DEAL_II_HAVE_CXX17_ATTRIBUTE_DEPRECATED)
-  set(DEAL_II_DEPRECATED "[[deprecated]]")
-elseif(DEAL_II_HAVE_ATTRIBUTE_DEPRECATED AND NOT DEAL_II_WITH_CUDA)
-  set(DEAL_II_DEPRECATED "__attribute__((deprecated))")
-else()
-  set(DEAL_II_DEPRECATED " ")
-endif()
-if(DEAL_II_EARLY_DEPRECATIONS)
-  set(DEAL_II_DEPRECATED_EARLY ${DEAL_II_DEPRECATED})
-else()
-  set(DEAL_II_DEPRECATED_EARLY " ")
-endif()
-
-
 #
 # Try to enable a fallthrough attribute. This is a language feature in C++17,
 # but a compiler extension in earlier language versions.
index 6218b7bbd78ecc541d169f866ae5117637712552..6b3fcf06564a9054b091f48e8b74998aec97a99a 100644 (file)
  * Macro indicating that the current feature will be removed in a future
  * release.
  */
-#cmakedefine DEAL_II_DEPRECATED @DEAL_II_DEPRECATED@
+#define DEAL_II_DEPRECATED [[deprecated]]
+#define DEAL_II_DEPRECATED_WITH_COMMENT(comment) [[deprecated(comment)]]
 
 /**
  * Same as above, but for things that have been deprecated during the current
  * deprecated prior to a release until <em>after</em> that release has been
  * finalized - see DEAL_II_EARLY_DEPRECATIONS for more information.
  */
+#cmakedefine DEAL_II_EARLY_DEPRECATIONS
 #ifndef DEAL_II_DEPRECATED_EARLY
 // guard to allow user to override DEAL_II_DEPRECATED_EARLY
-#cmakedefine DEAL_II_DEPRECATED_EARLY @DEAL_II_DEPRECATED_EARLY@
+#ifdef DEAL_II_EARLY_DEPRECATIONS
+#define DEAL_II_DEPRECATED_EARLY [[deprecated]]
+#else
+#define DEAL_II_DEPRECATED_EARLY
+#endif
+#endif
+
+#ifndef DEAL_II_DEPRECATED_EARLY_WITH_COMMENT
+// guard to allow user to override DEAL_II_DEPRECATED_EARLY
+#ifdef DEAL_II_EARLY_DEPRECATIONS
+#define DEAL_II_DEPRECATED_EARLY_WITH_COMMENT(comment) [[deprecated(comment)]]
+#else
+#define DEAL_II_DEPRECATED_EARLY_WITH_COMMENT(comment)
 #endif
+#endif
+
 #cmakedefine DEAL_II_FALLTHROUGH @DEAL_II_FALLTHROUGH@
 #cmakedefine DEAL_II_CONSTEXPR @DEAL_II_CONSTEXPR@
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.