You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2016/08/09 22:03:33 UTC

kudu git commit: [client][gutil] introduced ATTRIBUTE_DEPRECATED

Repository: kudu
Updated Branches:
  refs/heads/master 1bef82399 -> 0348499e3


[client][gutil] introduced ATTRIBUTE_DEPRECATED

The ATTRIBUTE_DEPRECATED macro is to mark deprecated methods.
An example of usage:

  void foo() ATTRIBUTE_DEPRECATED("use bar() instead");

Change-Id: Ib0d3c48fe8b5b599126ff45728d0b8da30ffe082
Reviewed-on: http://gerrit.cloudera.org:8080/3874
Reviewed-by: Todd Lipcon <to...@apache.org>
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mp...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/0348499e
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/0348499e
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/0348499e

Branch: refs/heads/master
Commit: 0348499e3a235df21ed4bc83cc4f12fce9f5bce4
Parents: 1bef823
Author: Alexey Serbin <as...@cloudera.com>
Authored: Tue Aug 9 13:34:46 2016 -0700
Committer: Mike Percy <mp...@apache.org>
Committed: Tue Aug 9 22:03:20 2016 +0000

----------------------------------------------------------------------
 src/kudu/client/stubs.h | 13 +++++++++++++
 src/kudu/gutil/port.h   | 11 +++++++++++
 2 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/0348499e/src/kudu/client/stubs.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/stubs.h b/src/kudu/client/stubs.h
index 52acc6f..a52bf77 100644
--- a/src/kudu/client/stubs.h
+++ b/src/kudu/client/stubs.h
@@ -63,6 +63,19 @@
 #endif
 #endif
 
+// For deprecated functions or variables, generate a warning at usage sites.
+// Verified to work as early as GCC 3.1.1 and clang 3.2 (so we'll assume any
+// clang is new enough).
+#ifndef ATTRIBUTE_DEPRECATED
+#if defined(__clang__) || \
+  (defined(COMPILER_GCC) && \
+   (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 30200)
+#define ATTRIBUTE_DEPRECATED(msg) __attribute__ ((deprecated (msg) ))
+#else
+#define ATTRIBUTE_DEPRECATED(msg)
+#endif
+#endif // #ifndef ATTRIBUTE_DEPRECATED
+
 #ifndef COMPILE_ASSERT
 // The COMPILE_ASSERT macro can be used to verify that a compile time
 // expression is true. For example, you could use it to verify the

http://git-wip-us.apache.org/repos/asf/kudu/blob/0348499e/src/kudu/gutil/port.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/port.h b/src/kudu/gutil/port.h
index d99e404..6222cca 100644
--- a/src/kudu/gutil/port.h
+++ b/src/kudu/gutil/port.h
@@ -374,6 +374,17 @@ inline void* memrchr(const void* bytes, int find_char, size_t len) {
 #define ATTRIBUTE_WEAK __attribute__ ((weak))
 #define HAVE_ATTRIBUTE_WEAK 1
 
+// For deprecated functions or variables, generate a warning at usage sites.
+// Verified to work as early as GCC 3.1.1 and clang 3.2 (so we'll assume any
+// clang is new enough).
+#if defined(__clang__) || \
+  (defined(COMPILER_GCC) && \
+   (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 30200)
+#define ATTRIBUTE_DEPRECATED(msg) __attribute__ ((deprecated (msg) ))
+#else
+#define ATTRIBUTE_DEPRECATED(msg)
+#endif
+
 // Tell the compiler to use "initial-exec" mode for a thread-local variable.
 // See http://people.redhat.com/drepper/tls.pdf for the gory details.
 #define ATTRIBUTE_INITIAL_EXEC __attribute__ ((tls_model ("initial-exec")))