Skip to content

Commit

Permalink
Stokhos: Use standard deprecation macros
Browse files Browse the repository at this point in the history
  • Loading branch information
etphipp committed Sep 19, 2024
1 parent a5539af commit 3f9c2cc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
16 changes: 5 additions & 11 deletions packages/stokhos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ TRIBITS_PACKAGE(Stokhos)

TRIBITS_ADD_EXPLICIT_INSTANTIATION_OPTION()

SET (Stokhos_ENABLE_DEPRECATED_CODE_DEFAULT ON)
TRIBITS_ADD_OPTION_AND_DEFINE(
Stokhos_ENABLE_DEPRECATED_CODE
STOKHOS_ENABLE_DEPRECATED_CODE
"Whether Stokhos enables deprecated code (that is, anything marked with the STOKHOS_DEPRECATED macro) at compile time. Default is ON (deprecated code enabled)."
${Stokhos_ENABLE_DEPRECATED_CODE_DEFAULT}
)
TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION()

TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_DEBUG
STOKHOS_DEBUG
Expand Down Expand Up @@ -59,7 +53,7 @@ SET(Stokhos_ENABLE_Ensemble_Scalar_Type_Default OFF)
SET(Stokhos_ENABLE_PCE_Scalar_Type_Default OFF)
IF(Stokhos_ENABLE_Sacado)
SET(Stokhos_ENABLE_Ensemble_Scalar_Type_Default ON)
IF(Stokhos_ENABLE_DEPRECATED_CODE)
IF(NOT Stokhos_HIDE_DEPRECATED_CODE)
SET(Stokhos_ENABLE_PCE_Scalar_Type_Default ON)
ENDIF()
ENDIF()
Expand All @@ -75,10 +69,10 @@ TRIBITS_ADD_OPTION_AND_DEFINE(Stokhos_ENABLE_PCE_Scalar_Type
${Stokhos_ENABLE_PCE_Scalar_Type_Default} )

IF(Stokhos_ENABLE_PCE_Scalar_Type)
IF(Stokhos_ENABLE_DEPRECATED_CODE)
MESSAGE(WARNING "The PCE scalar type is deprecated in Stokhos but Stokhos_ENABLE_DEPRECATED_CODE=ON.")
IF(Stokhos_HIDE_DEPRECATED_CODE)
MESSAGE(FATAL_ERROR "The PCE scalar type is deprecated in Stokhos but Stokhos_HIDE_DEPRECATED_CODE=ON. You must set Stokhos_ENABLE_PCE_Scalar_Type=OFF or Stokhos_HIDE_DEPRECATED_CODE=OFF.")
ELSE()
MESSAGE(FATAL_ERROR "The PCE scalar type is deprecated in Stokhos but Stokhos_ENABLE_DEPRECATED_CODE=OFF. You must set Stokhos_ENABLE_PCE_Scalar_Type=OFF or Stokhos_ENABLE_DEPRECATED_CODE=ON.")
MESSAGE(WARNING "The PCE scalar type is deprecated in Stokhos but Stokhos_HIDE_DEPRECATED_CODE=OFF.")
ENDIF()
ENDIF()

Expand Down
4 changes: 4 additions & 0 deletions packages/stokhos/cmake/Stokhos_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,7 @@
#define STOKHOS_GEMV_CACHE_SIZE @Stokhos_Ensemble_GEMV_Cache_Size@
#define STOKHOS_GEMV_TEAM_SIZE @Stokhos_Ensemble_GEMV_Team_Size@
#endif // HAVE_STOKHOS_ENSEMBLE_GEMV

@STOKHOS_DEPRECATED_DECLARATIONS@

#cmakedefine Stokhos_SHOW_DEPRECATED_WARNINGS
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

#include "Stokhos_ConfigDefs.h"

#if defined(Stokhos_SHOW_DEPRECATED_WARNINGS)
#ifdef __GNUC__
#warning "The PCE scalar type is deprecated."
#endif
#endif

#include "Kokkos_Macros.hpp"

Expand Down

0 comments on commit 3f9c2cc

Please sign in to comment.