From 720536a08e4e33639869e1b7a99d9ec923409c0b Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 23 Aug 2021 17:48:28 +0300 Subject: [PATCH] Fix for issue 675 (#676) --- .../boost/math/tools/header_deprecated.hpp | 22 ++++++++++++++----- test/Jamfile.v2 | 1 + test/header_deprecated_test.cpp | 12 ++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 test/header_deprecated_test.cpp diff --git a/include/boost/math/tools/header_deprecated.hpp b/include/boost/math/tools/header_deprecated.hpp index 8f4a5db25b..867fcaa217 100644 --- a/include/boost/math/tools/header_deprecated.hpp +++ b/include/boost/math/tools/header_deprecated.hpp @@ -6,12 +6,22 @@ #ifndef BOOST_MATH_TOOLS_HEADER_DEPRECATED #define BOOST_MATH_TOOLS_HEADER_DEPRECATED -#ifdef _MSC_VER -// Expands to "This header is deprecated; use expr instead." -#define BOOST_MATH_HEADER_DEPRECATED(expr) __pragma("This header is deprecated; use " expr " instead.") -#else // GNU, Clang, Intel, IBM, etc. +#ifndef BOOST_MATH_STANDALONE + +# include +# define BOOST_MATH_HEADER_DEPRECATED(expr) BOOST_HEADER_DEPRECATED(expr) + +#else + +# ifdef _MSC_VER // Expands to "This header is deprecated; use expr instead." -#define BOOST_MATH_HEADER_DEPRECATED(expr) _Pragma("This header is deprecated; use " expr " instead.") -#endif +# define BOOST_MATH_HEADER_DEPRECATED(expr) __pragma("This header is deprecated; use " expr " instead.") +# else // GNU, Clang, Intel, IBM, etc. +// Expands to "This header is deprecated use expr instead" +# define BOOST_MATH_HEADER_DEPRECATED_MESSAGE(expr) _Pragma(#expr) +# define BOOST_MATH_HEADER_DEPRECATED(expr) BOOST_MATH_HEADER_DEPRECATED_MESSAGE(message "This header is deprecated use " expr " instead") +# endif + +#endif // BOOST_MATH_STANDALONE #endif // BOOST_MATH_TOOLS_HEADER_DEPRECATED diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 6ef83e630b..1653cb545e 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -874,6 +874,7 @@ test-suite mp : ; test-suite misc : + [ run header_deprecated_test.cpp ] [ run threading_sanity_check.cpp ] [ run test_tr1.cpp ../build//boost_math_tr1 diff --git a/test/header_deprecated_test.cpp b/test/header_deprecated_test.cpp new file mode 100644 index 0000000000..2f131ae772 --- /dev/null +++ b/test/header_deprecated_test.cpp @@ -0,0 +1,12 @@ +// (C) Copyright Matt Borland 2021. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include + +int main() +{ + BOOST_MATH_HEADER_DEPRECATED(""); + return 0; +}