You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ja...@apache.org on 2019/01/04 19:30:05 UTC

[pulsar] branch master updated: CPP Client - Turning switch case warnings into errors. (#3297)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new ffb2250  CPP Client - Turning switch case warnings into errors. (#3297)
ffb2250 is described below

commit ffb2250ca3edcad7daa39d6deb7af8fd12a2e48a
Author: Jai Asher <ja...@ccs.neu.edu>
AuthorDate: Fri Jan 4 11:29:57 2019 -0800

    CPP Client - Turning switch case warnings into errors. (#3297)
---
 pulsar-client-cpp/CMakeLists.txt          | 2 +-
 pulsar-client-cpp/include/pulsar/Result.h | 3 ++-
 pulsar-client-cpp/lib/ClientConnection.cc | 6 ++++++
 pulsar-client-cpp/lib/Commands.cc         | 6 ++++++
 pulsar-client-cpp/lib/Result.cc           | 3 +++
 5 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/pulsar-client-cpp/CMakeLists.txt b/pulsar-client-cpp/CMakeLists.txt
index 66b1fc9..1d03817 100644
--- a/pulsar-client-cpp/CMakeLists.txt
+++ b/pulsar-client-cpp/CMakeLists.txt
@@ -49,7 +49,7 @@ if (NOT C_STANDARD)
     set(C_STANDARD "-std=c11")
 endif(NOT C_STANDARD)
 
-set(CMAKE_CXX_FLAGS " -msse4.2 -mpclmul -Wno-deprecated-declarations ${CXX_STANDARD} ${CMAKE_CXX_FLAGS}")
+set(CMAKE_CXX_FLAGS " -msse4.2 -mpclmul -Werror=switch -Wno-deprecated-declarations ${CXX_STANDARD} ${CMAKE_CXX_FLAGS}")
 
 
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
diff --git a/pulsar-client-cpp/include/pulsar/Result.h b/pulsar-client-cpp/include/pulsar/Result.h
index 68480e8..c1975d7 100644
--- a/pulsar-client-cpp/include/pulsar/Result.h
+++ b/pulsar-client-cpp/include/pulsar/Result.h
@@ -57,6 +57,7 @@ enum Result
 
     ResultConsumerNotInitialized,         /// Consumer is not initialized
     ResultProducerNotInitialized,         /// Producer is not initialized
+    ResultProducerBusy,                   /// Producer with same name is already connected
     ResultTooManyLookupRequestException,  /// Too Many concurrent LookupRequest
 
     ResultInvalidTopicName,  /// Invalid topic name
@@ -73,7 +74,7 @@ enum Result
     ResultConsumerNotFound,                       /// Consumer not found
     ResultUnsupportedVersionError,  /// Error when an older client/version doesn't support a required feature
     ResultTopicTerminated,          /// Topic was already terminated
-    ResultCryptoError               /// Error when crypto operation fails
+    ResultCryptoError,              /// Error when crypto operation fails
 };
 
 // Return string representation of result code
diff --git a/pulsar-client-cpp/lib/ClientConnection.cc b/pulsar-client-cpp/lib/ClientConnection.cc
index d3215de..d170611 100644
--- a/pulsar-client-cpp/lib/ClientConnection.cc
+++ b/pulsar-client-cpp/lib/ClientConnection.cc
@@ -103,6 +103,12 @@ static Result getResult(ServerError serverError) {
 
         case TopicTerminatedError:
             return ResultTopicTerminated;
+
+        case ProducerBusy:
+            return ResultProducerBusy;
+
+        case InvalidTopicName:
+            return ResultInvalidTopicName;
     }
     // NOTE : Do not add default case in the switch above. In future if we get new cases for
     // ServerError and miss them in the switch above we would like to get notified. Adding
diff --git a/pulsar-client-cpp/lib/Commands.cc b/pulsar-client-cpp/lib/Commands.cc
index 4d9f1be..c40c899 100644
--- a/pulsar-client-cpp/lib/Commands.cc
+++ b/pulsar-client-cpp/lib/Commands.cc
@@ -453,6 +453,12 @@ std::string Commands::messageType(BaseCommand_Type type) {
         case BaseCommand::GET_TOPICS_OF_NAMESPACE_RESPONSE:
             return "GET_TOPICS_OF_NAMESPACE_RESPONSE";
             break;
+        case BaseCommand::GET_SCHEMA:
+            return "GET_SCHEMA";
+            break;
+        case BaseCommand::GET_SCHEMA_RESPONSE:
+            return "GET_SCHEMA_RESPONSE";
+            break;
     };
 }
 
diff --git a/pulsar-client-cpp/lib/Result.cc b/pulsar-client-cpp/lib/Result.cc
index 64e23e1..8971381 100644
--- a/pulsar-client-cpp/lib/Result.cc
+++ b/pulsar-client-cpp/lib/Result.cc
@@ -125,6 +125,9 @@ const char* pulsar::strResult(Result result) {
 
         case ResultCryptoError:
             return "CryptoError";
+
+        case ResultProducerBusy:
+            return "ProducerBusy";
     };
     // NOTE : Do not add default case in the switch above. In future if we get new cases for
     // ServerError and miss them in the switch above we would like to get notified. Adding