[c++client] use ATTRIBUTE_DEPRECATED attribute

Added the deprecated attribute to the methods/functions marked as such
in the C++ client API.

Also, added -Wdocumentation-deprecated-sync flag to spot cases when
a method marked as deprecated by in-line doc lacks corresponding
deprecation attribute (if compiling with clang).

Change-Id: I1a48587d1132ada7da63953d7da6cae0f84a0baf
Reviewed-on: http://gerrit.cloudera.org:8080/4529
Reviewed-by: Adar Dembo <[email protected]>
Tested-by: Kudu Jenkins


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

Branch: refs/heads/master
Commit: 4824f6458ccb680209c537f5967a8a42d2a6dd76
Parents: 8da741f
Author: Alexey Serbin <[email protected]>
Authored: Fri Sep 23 14:21:19 2016 -0700
Committer: Alexey Serbin <[email protected]>
Committed: Sat Sep 24 05:35:24 2016 +0000

----------------------------------------------------------------------
 CMakeLists.txt           |  5 +++++
 src/kudu/client/client.h | 20 +++++++++++++-------
 src/kudu/client/schema.h | 18 +++++++++++-------
 3 files changed, 29 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/4824f645/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a652c0..9b6c40a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -221,6 +221,11 @@ if ("${COMPILER_FAMILY}" STREQUAL "clang")
   # Clang generates ambiguous member template warnings when calling the ev++ 
api.
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-ambiguous-member-template")
 
+  # Emit a warning when the method/function marked as deprecated
+  # in its in-line documentation but lacks the deprecated attribute
+  # ATTRIBUTE_DEPRECATED in its signature.
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdocumentation-deprecated-sync")
+
   # Only hardcode -fcolor-diagnostics if stderr is opened on a terminal. 
Otherwise
   # the color codes show up as noisy artifacts.
   #

http://git-wip-us.apache.org/repos/asf/kudu/blob/4824f645/src/kudu/client/client.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/client.h b/src/kudu/client/client.h
index 5a3f7b7..b3cf5ba 100644
--- a/src/kudu/client/client.h
+++ b/src/kudu/client/client.h
@@ -675,7 +675,8 @@ class KUDU_EXPORT KuduTableCreator {
   /// @param [in] split_rows
   ///   The row to use for partitioning.
   /// @return Reference to the modified table creator.
-  KuduTableCreator& split_rows(const std::vector<const KuduPartialRow*>& 
split_rows);
+  KuduTableCreator& split_rows(const std::vector<const KuduPartialRow*>& 
split_rows)
+      ATTRIBUTE_DEPRECATED("use add_range_partition_split() instead");
 
   /// Set the table replication factor.
   ///
@@ -1573,7 +1574,8 @@ class KUDU_EXPORT KuduScanner {
   ///   Column names to use for the projection.
   /// @return Operation result status.
   Status SetProjectedColumns(const std::vector<std::string>& col_names)
-    WARN_UNUSED_RESULT;
+      WARN_UNUSED_RESULT
+      ATTRIBUTE_DEPRECATED("use SetProjectedColumnNames() instead");
 
   /// Add a predicate for the scan.
   ///
@@ -1602,7 +1604,8 @@ class KUDU_EXPORT KuduScanner {
   /// @param [in] key
   ///   The primary key to use as an opaque slice of data.
   /// @return Operation result status.
-  Status AddLowerBoundRaw(const Slice& key);
+  Status AddLowerBoundRaw(const Slice& key)
+      ATTRIBUTE_DEPRECATED("use AddLowerBound() instead");
 
   /// Add an upper bound (exclusive) primary key for the scan.
   ///
@@ -1621,7 +1624,8 @@ class KUDU_EXPORT KuduScanner {
   /// @param [in] key
   ///   The encoded primary key is an opaque slice of data.
   /// @return Operation result status.
-  Status AddExclusiveUpperBoundRaw(const Slice& key);
+  Status AddExclusiveUpperBoundRaw(const Slice& key)
+      ATTRIBUTE_DEPRECATED("use AddExclusiveUpperBound() instead");
 
   /// Add a lower bound (inclusive) partition key for the scan.
   ///
@@ -1702,7 +1706,8 @@ class KUDU_EXPORT KuduScanner {
   /// @param [out] rows
   ///   Placeholder for the result.
   /// @return Operation result status.
-  Status NextBatch(std::vector<KuduRowResult>* rows);
+  Status NextBatch(std::vector<KuduRowResult>* rows)
+      ATTRIBUTE_DEPRECATED("use NextBatch(KuduScanBatch*) instead");
 
   /// Fetch the next batch of results for this scanner.
   ///
@@ -1755,9 +1760,10 @@ class KUDU_EXPORT KuduScanner {
   /// @deprecated Use SetFaultTolerant() instead.
   ///
   /// @param [in] order_mode
-  ///   Result record orderind mode to set.
+  ///   Result record ordering mode to set.
   /// @return Operation result status.
-  Status SetOrderMode(OrderMode order_mode) WARN_UNUSED_RESULT;
+  Status SetOrderMode(OrderMode order_mode) WARN_UNUSED_RESULT
+      ATTRIBUTE_DEPRECATED("use SetFaultTolerant() instead");
 
   /// Make scans resumable at another tablet server if current server fails.
   ///

http://git-wip-us.apache.org/repos/asf/kudu/blob/4824f645/src/kudu/client/schema.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/schema.h b/src/kudu/client/schema.h
index a09a88d..a7bb667 100644
--- a/src/kudu/client/schema.h
+++ b/src/kudu/client/schema.h
@@ -85,12 +85,14 @@ class KUDU_EXPORT KuduColumnStorageAttributes {
   ///   Compression type for the column storage.
   /// @param [in] block_size
   ///   Block size (in bytes, uncompressed data) for the column storage.
-  KuduColumnStorageAttributes(EncodingType encoding = AUTO_ENCODING,
-                              CompressionType compression = 
DEFAULT_COMPRESSION,
-                              int32_t block_size = 0)
+  explicit KuduColumnStorageAttributes(
+      EncodingType encoding = AUTO_ENCODING,
+      CompressionType compression = DEFAULT_COMPRESSION,
+      int32_t block_size = 0)
+      ATTRIBUTE_DEPRECATED("this constructor will be private in a future 
release")
       : encoding_(encoding),
-      compression_(compression),
-      block_size_(block_size) {
+        compression_(compression),
+        block_size_(block_size) {
   }
 
   /// @return Encoding type for the column storage.
@@ -155,7 +157,8 @@ class KUDU_EXPORT KuduColumnSchema {
                    DataType type,
                    bool is_nullable = false,
                    const void* default_value = NULL,
-                   KuduColumnStorageAttributes attributes = 
KuduColumnStorageAttributes());
+                   KuduColumnStorageAttributes attributes = 
KuduColumnStorageAttributes())
+      ATTRIBUTE_DEPRECATED("use KuduSchemaBuilder instead");
 
   /// Construct KuduColumnSchema object as a copy of another object.
   ///
@@ -439,7 +442,8 @@ class KUDU_EXPORT KuduSchema {
   ///   Number of key columns in the schema.
   /// @return Operation result status.
   Status Reset(const std::vector<KuduColumnSchema>& columns, int key_columns)
-    WARN_UNUSED_RESULT;
+      ATTRIBUTE_DEPRECATED("this method will be removed in a future release")
+      WARN_UNUSED_RESULT;
 
   /// Check whether the schema is identical to the other one.
   ///

Reply via email to