You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/07/27 15:08:58 UTC

[GitHub] [nifi-minifi-cpp] szaszm opened a new pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

szaszm opened a new pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144


   due to previously missing language and stdlib features
   
   ---
   
   Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [x] Is there a JIRA ticket associated with this PR? Is it referenced
        in the commit message?
   
   - [x] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [x] Has your PR been rebased against the latest commit within the target branch (typically main)?
   
   - [x] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [x] If applicable, have you updated the LICENSE file?
   - [x] If applicable, have you updated the NOTICE file?
   
   ### For documentation related changes:
   - [x] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] fgerlits closed pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
fgerlits closed pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] lordgamez commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
lordgamez commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r680040044



##########
File path: extensions/systemd/ConsumeJournald.cpp
##########
@@ -23,6 +23,7 @@
 #include "date/date.h"
 #include "spdlog/spdlog.h"  // TODO(szaszm): make fmt directly available
 #include "utils/GeneralUtils.h"
+#include "utils/OptionalUtils.h"

Review comment:
       This shouldn't be needed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
arpadboda commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r681950852



##########
File path: libminifi/test/unit/ProcessSessionTests.cpp
##########
@@ -31,25 +32,16 @@ REGISTER_RESOURCE(DummyProcessor, "A processor that does nothing.");
 
 class Fixture {
  public:
-  Fixture();
   core::ProcessSession &processSession() { return *process_session_; }
 
  private:
   TestController test_controller_;
-  std::shared_ptr<TestPlan> test_plan_;
-  std::shared_ptr<core::Processor> dummy_processor_;
-  std::shared_ptr<core::ProcessContext> context_;
-  std::unique_ptr<core::ProcessSession> process_session_;
+  std::shared_ptr<TestPlan> test_plan_ = test_controller_.createPlan();
+  std::shared_ptr<core::Processor> dummy_processor_ = test_plan_->addProcessor("DummyProcessor", "dummyProcessor");
+  std::shared_ptr<core::ProcessContext> context_ = [this] { test_plan_->runNextProcessor(); return test_plan_->getCurrentContext(); }();
+  std::unique_ptr<core::ProcessSession> process_session_ = std::make_unique<core::ProcessSession>(context_);
 };
 
-Fixture::Fixture() {

Review comment:
       What's the motivation behind deleting this?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r677564097



##########
File path: encrypt-config/ArgParser.h
##########
@@ -48,20 +48,20 @@ class Arguments {
 
   void set(const std::string& bool_key);
 
-  static utils::optional<Argument> getArg(const std::string& key);
-  static utils::optional<Flag> getFlag(const std::string& flag);
+  static std::optional<Argument> getArg(const std::string& key);
+  static std::optional<Flag> getFlag(const std::string& flag);
 
  public:
   static Arguments parse(int argc, char* argv[]);
 
   static std::string getHelp();
 
-  utils::optional<std::string> get(const std::string& key) const;
+  [[nodiscard]] std::optional<std::string> get(const std::string& key) const;

Review comment:
       I added a bunch of these `[[nodiscard]]` attributes where my IDE showed clang-tidy suggestions to do so. It made sense in all cases.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r679874978



##########
File path: libminifi/include/utils/StringUtils.h
##########
@@ -17,24 +17,23 @@
 #ifndef LIBMINIFI_INCLUDE_UTILS_STRINGUTILS_H_
 #define LIBMINIFI_INCLUDE_UTILS_STRINGUTILS_H_
 
-#include <string>
-#include <utility>
-#include <iostream>
+#include <algorithm>
 #include <cstring>
 #include <functional>
+#include <iostream>
+#include <map>
+#include <optional>
+#include <sstream>
+#include <string>
+#include <type_traits>
+#include <utility>
+#include <vector>
 #ifdef WIN32
   #include <cwctype>
   #include <cctype>
 #endif
-#include <algorithm>
-#include <sstream>
-#include <vector>
-#include <map>
-#include <type_traits>
 #include "utils/FailurePolicy.h"
-#include "utils/GeneralUtils.h"
 #include "utils/gsl.h"
-#include "utils/OptionalUtils.h"
 
 #if defined(WIN32) || (__cplusplus >= 201103L && (!defined(__GLIBCXX__) || (__cplusplus >= 201402L) ||  (defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE > 4)))

Review comment:
       The `HAVE_REGEX_CPP` macro doesn't seem to be used anywhere, so I'm removing the whole block. I'll leave the removal of utils::Regex to a followup: https://issues.apache.org/jira/browse/MINIFICPP-1508




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] fgerlits closed pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
fgerlits closed pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r679874978



##########
File path: libminifi/include/utils/StringUtils.h
##########
@@ -17,24 +17,23 @@
 #ifndef LIBMINIFI_INCLUDE_UTILS_STRINGUTILS_H_
 #define LIBMINIFI_INCLUDE_UTILS_STRINGUTILS_H_
 
-#include <string>
-#include <utility>
-#include <iostream>
+#include <algorithm>
 #include <cstring>
 #include <functional>
+#include <iostream>
+#include <map>
+#include <optional>
+#include <sstream>
+#include <string>
+#include <type_traits>
+#include <utility>
+#include <vector>
 #ifdef WIN32
   #include <cwctype>
   #include <cctype>
 #endif
-#include <algorithm>
-#include <sstream>
-#include <vector>
-#include <map>
-#include <type_traits>
 #include "utils/FailurePolicy.h"
-#include "utils/GeneralUtils.h"
 #include "utils/gsl.h"
-#include "utils/OptionalUtils.h"
 
 #if defined(WIN32) || (__cplusplus >= 201103L && (!defined(__GLIBCXX__) || (__cplusplus >= 201402L) ||  (defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE > 4)))

Review comment:
       The `HAVE_REGEX_CPP` macro doesn't seem to be used anywhere, so I'm removing the whole block. I'll leave the removal of utils::Regex to a followup: https://issues.apache.org/jira/browse/MINIFICPP-1508
   
   done in 4e2fed4 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
arpadboda commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r682385613



##########
File path: libminifi/test/unit/ProcessSessionTests.cpp
##########
@@ -31,25 +32,16 @@ REGISTER_RESOURCE(DummyProcessor, "A processor that does nothing.");
 
 class Fixture {
  public:
-  Fixture();
   core::ProcessSession &processSession() { return *process_session_; }
 
  private:
   TestController test_controller_;
-  std::shared_ptr<TestPlan> test_plan_;
-  std::shared_ptr<core::Processor> dummy_processor_;
-  std::shared_ptr<core::ProcessContext> context_;
-  std::unique_ptr<core::ProcessSession> process_session_;
+  std::shared_ptr<TestPlan> test_plan_ = test_controller_.createPlan();
+  std::shared_ptr<core::Processor> dummy_processor_ = test_plan_->addProcessor("DummyProcessor", "dummyProcessor");
+  std::shared_ptr<core::ProcessContext> context_ = [this] { test_plan_->runNextProcessor(); return test_plan_->getCurrentContext(); }();
+  std::unique_ptr<core::ProcessSession> process_session_ = std::make_unique<core::ProcessSession>(context_);
 };
 
-Fixture::Fixture() {

Review comment:
       No, just didn't find the place in the diff where it was actually moved to. :) Got it, thanks!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] lordgamez commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
lordgamez commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r680703833



##########
File path: extensions/systemd/ConsumeJournald.cpp
##########
@@ -23,6 +23,7 @@
 #include "date/date.h"
 #include "spdlog/spdlog.h"  // TODO(szaszm): make fmt directly available
 #include "utils/GeneralUtils.h"
+#include "utils/OptionalUtils.h"

Review comment:
       I see, thanks!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] martinzink commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
martinzink commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r679854325



##########
File path: libminifi/include/utils/StringUtils.h
##########
@@ -17,24 +17,23 @@
 #ifndef LIBMINIFI_INCLUDE_UTILS_STRINGUTILS_H_
 #define LIBMINIFI_INCLUDE_UTILS_STRINGUTILS_H_
 
-#include <string>
-#include <utility>
-#include <iostream>
+#include <algorithm>
 #include <cstring>
 #include <functional>
+#include <iostream>
+#include <map>
+#include <optional>
+#include <sstream>
+#include <string>
+#include <type_traits>
+#include <utility>
+#include <vector>
 #ifdef WIN32
   #include <cwctype>
   #include <cctype>
 #endif
-#include <algorithm>
-#include <sstream>
-#include <vector>
-#include <map>
-#include <type_traits>
 #include "utils/FailurePolicy.h"
-#include "utils/GeneralUtils.h"
 #include "utils/gsl.h"
-#include "utils/OptionalUtils.h"
 
 #if defined(WIN32) || (__cplusplus >= 201103L && (!defined(__GLIBCXX__) || (__cplusplus >= 201402L) ||  (defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE > 4)))

Review comment:
       I think this is always true now, and it could be simplified.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r682170512



##########
File path: libminifi/test/unit/ProcessSessionTests.cpp
##########
@@ -31,25 +32,16 @@ REGISTER_RESOURCE(DummyProcessor, "A processor that does nothing.");
 
 class Fixture {
  public:
-  Fixture();
   core::ProcessSession &processSession() { return *process_session_; }
 
  private:
   TestController test_controller_;
-  std::shared_ptr<TestPlan> test_plan_;
-  std::shared_ptr<core::Processor> dummy_processor_;
-  std::shared_ptr<core::ProcessContext> context_;
-  std::unique_ptr<core::ProcessSession> process_session_;
+  std::shared_ptr<TestPlan> test_plan_ = test_controller_.createPlan();
+  std::shared_ptr<core::Processor> dummy_processor_ = test_plan_->addProcessor("DummyProcessor", "dummyProcessor");
+  std::shared_ptr<core::ProcessContext> context_ = [this] { test_plan_->runNextProcessor(); return test_plan_->getCurrentContext(); }();
+  std::unique_ptr<core::ProcessSession> process_session_ = std::make_unique<core::ProcessSession>(context_);
 };
 
-Fixture::Fixture() {

Review comment:
       Just wanted to simplify the code by moving the initialization code to default member initializers. I can revert if you have any objections.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r677564097



##########
File path: encrypt-config/ArgParser.h
##########
@@ -48,20 +48,20 @@ class Arguments {
 
   void set(const std::string& bool_key);
 
-  static utils::optional<Argument> getArg(const std::string& key);
-  static utils::optional<Flag> getFlag(const std::string& flag);
+  static std::optional<Argument> getArg(const std::string& key);
+  static std::optional<Flag> getFlag(const std::string& flag);
 
  public:
   static Arguments parse(int argc, char* argv[]);
 
   static std::string getHelp();
 
-  utils::optional<std::string> get(const std::string& key) const;
+  [[nodiscard]] std::optional<std::string> get(const std::string& key) const;

Review comment:
       I added a bunch of these `[[nodiscard]]` attributes where my IDE showed clang-tidy suggestions to do so.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1144: MINIFICPP-1429 clean up pre-c++17 workarounds

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #1144:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1144#discussion_r680313572



##########
File path: extensions/systemd/ConsumeJournald.cpp
##########
@@ -23,6 +23,7 @@
 #include "date/date.h"
 #include "spdlog/spdlog.h"  // TODO(szaszm): make fmt directly available
 #include "utils/GeneralUtils.h"
+#include "utils/OptionalUtils.h"

Review comment:
       It's needed for utils::map, utils::flatMap and utils::orElse. Those are still our own and all of them are used in this file.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org