[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 <todd@apache.org>
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mpercy@apache.org>
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
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 @@
 #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")))