This is an automated email from the ASF dual-hosted git repository.

bennoe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 752b6f24c6682c949526cc3e27a704b7383e5fa6
Author: Benno Evers <[email protected]>
AuthorDate: Wed Jan 8 12:16:14 2020 +0100

    Added special case to stout's handling of C++ attributes.
    
    Added a special case for the `[[deprecated]]` attribute to
    handle configurations where clang claims to support this
    attribute but also emits a warning that it should not be used.
    
    Review: https://reviews.apache.org/r/71971
---
 3rdparty/stout/include/stout/attributes.hpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/3rdparty/stout/include/stout/attributes.hpp 
b/3rdparty/stout/include/stout/attributes.hpp
index 54d438d..367dc79 100644
--- a/3rdparty/stout/include/stout/attributes.hpp
+++ b/3rdparty/stout/include/stout/attributes.hpp
@@ -31,7 +31,6 @@
 #  define STOUT_NORETURN __attribute__((noreturn))
 #endif
 
-
 // Non-namespaced version for backwards compatibility.
 #define NORETURN STOUT_NORETURN
 
@@ -43,7 +42,18 @@
 #endif
 
 
-#if STOUT_HAS_CPP_ATTRIBUTE(deprecated) > 0
+// We need to special-case clang because some older versions of
+// clang claim that they support `[[deprecated]]`, but will emit
+// a warning that it should only be used after C++14 (failing the
+// build if warnings are treated as errors).
+//
+// TODO(bevers): Add an optional argument to this macro, so users
+// can specify a deprecation reason and a recommended alternative.
+#if defined(__clang__) && __cplusplus >= 201402L
+#  define STOUT_DEPRECATED [[deprecated]]
+#elif defined(__clang__)
+#  define STOUT_DEPRECATED __attribute__((deprecated))
+#elif STOUT_HAS_CPP_ATTRIBUTE(deprecated) > 0
 #  define STOUT_DEPRECATED [[deprecated]]
 #else
 #  define STOUT_DEPRECATED

Reply via email to