You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2020/06/17 04:53:36 UTC
[impala] branch master updated: IMPALA-9861: use [[nodiscard]] in
gcc
This is an automated email from the ASF dual-hosted git repository.
tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
The following commit(s) were added to refs/heads/master by this push:
new 692db77 IMPALA-9861: use [[nodiscard]] in gcc
692db77 is described below
commit 692db778f8375a800ef5e7c7ac671bffb5f95807
Author: Tim Armstrong <ta...@cloudera.com>
AuthorDate: Tue Jun 16 10:28:46 2020 -0700
IMPALA-9861: use [[nodiscard]] in gcc
This was unblocked by the GCC 7 upgrade.
Tested by removing a RETURN_IF_ERROR and making sure there was a compile
error.
Change-Id: I5290ee36388baef3d43adbde7c684125dbcf3bec
Reviewed-on: http://gerrit.cloudera.org:8080/16087
Reviewed-by: Joe McDonnell <jo...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
be/src/common/compiler-util.h | 15 ---------------
be/src/common/status.h | 2 +-
2 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/be/src/common/compiler-util.h b/be/src/common/compiler-util.h
index e45b645..ebfd0aa 100644
--- a/be/src/common/compiler-util.h
+++ b/be/src/common/compiler-util.h
@@ -53,21 +53,6 @@
#define RESTRICT __restrict__
#endif
-/// GCC 5+ and Clang 3.6+ support __has_cpp_attribute(). Always return false on compilers
-/// that don't know about __has_cpp_attribute().
-#if defined(__clang__) || __GNUC__ >= 5
-#define HAS_CPP_ATTRIBUTE(attr) __has_cpp_attribute(attr)
-#else
-#define HAS_CPP_ATTRIBUTE(attr) 0
-#endif
-
-// Use [[nodiscard]] specifier if supported by our compiler.
-#if HAS_CPP_ATTRIBUTE(nodiscard)
-#define NODISCARD [[nodiscard]]
-#else
-#define NODISCARD
-#endif
-
// Suppress warnings when ignoring the return value from a function annotated with
// WARN_UNUSED_RESULT. Based on ignore_result() in gutil/basictypes.h.
template<typename T>
diff --git a/be/src/common/status.h b/be/src/common/status.h
index 41f7663..1154df3 100644
--- a/be/src/common/status.h
+++ b/be/src/common/status.h
@@ -78,7 +78,7 @@ class StatusPB;
///
/// return Status::OK();
/// }
-class NODISCARD Status {
+class [[nodiscard]] Status {
public:
typedef strings::internal::SubstituteArg ArgType;