lordgamez commented on a change in pull request #1020: URL: https://github.com/apache/nifi-minifi-cpp/pull/1020#discussion_r591709350
########## File path: bstrp_functions.sh ########## @@ -375,6 +376,7 @@ show_supported_features() { echo "4. Use Shared Dependency Links .$(print_feature_status USE_SHARED_LIBS)" echo "5. Build Profile ...............$(print_multi_option_status BUILD_PROFILE)" echo "6. Create ASAN build ...........$(print_feature_status ASAN_ENABLED)" + echo "7. Treat warnings as errors.....$(print_feature_status FAIL_ON_WARNINGS)" Review comment: Sure, updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: cmake/Date.cmake ########## @@ -69,6 +69,9 @@ if (NOT date_src_POPULATED) add_library(date::tz ALIAS date-tz) target_include_directories(date-tz PUBLIC ${DATE_INCLUDE_DIR}) target_compile_features(date-tz PUBLIC cxx_std_11) + if (NOT WIN32) + target_compile_options(date-tz PRIVATE "-Wno-error") Review comment: I tried that at first, but it seemed to be way more problematic as a lot of CMakeFiles needed to be updated for that. The other reason I decided to do it this way is because code added in the future will be automatically have the warning compile options, without the need to explicitly define them again. In the third party libraries they are not part of the PASSTHROUGH cmake options, only the Date.cmake file had to be updated with this option as they do not use those options. ########## File path: controller/Controller.h ########## @@ -36,7 +36,7 @@ bool sendSingleCommand(std::unique_ptr<minifi::io::Socket> socket, uint8_t op, c minifi::io::BufferStream stream; stream.write(&op, 1); stream.write(value); - return socket->write(const_cast<uint8_t*>(stream.getBuffer()), gsl::narrow<int>(stream.size())) == stream.size(); + return gsl::narrow<size_t>(socket->write(const_cast<uint8_t*>(stream.getBuffer()), gsl::narrow<int>(stream.size()))) == stream.size(); Review comment: Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: extensions/coap/controllerservice/CoapResponse.h ########## @@ -73,7 +73,7 @@ class CoapResponse { * Returns a const pointer to the constant data. * @return data pointer. */ - const uint8_t * const getData() const { + uint8_t* getData() const { Review comment: Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: extensions/openwsman/processors/SourceInitiatedSubscriptionListener.cpp ########## @@ -249,11 +249,11 @@ bool SourceInitiatedSubscriptionListener::loadState() { std::string SourceInitiatedSubscriptionListener::Handler::millisecondsToXsdDuration(int64_t milliseconds) { char buf[1024]; - snprintf(buf, sizeof(buf), "PT%lld.%03lldS", milliseconds / 1000, milliseconds % 1000); + snprintf(buf, sizeof(buf), "PT%ld.%03ldS", milliseconds / 1000, milliseconds % 1000); Review comment: Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: extensions/rocksdb-repos/RocksDatabase.h ########## @@ -84,6 +84,7 @@ class RocksDatabase { }; RocksDatabase(const rocksdb::Options& options, const std::string& name, Mode mode = Mode::ReadWrite); + virtual ~RocksDatabase() = default; Review comment: Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: extensions/script/lua/LuaBaseStream.cpp ########## @@ -54,15 +54,15 @@ std::string LuaBaseStream::read(size_t len) { // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf auto read = stream_->read(reinterpret_cast<uint8_t *>(&buffer[0]), static_cast<int>(len)); - if (read != len) { - buffer.resize(static_cast<size_t >(read)); + if (gsl::narrow<size_t>(read) != len) { + buffer.resize(gsl::narrow<size_t>(read)); Review comment: Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: extensions/script/lua/LuaBaseStream.cpp ########## @@ -54,15 +54,15 @@ std::string LuaBaseStream::read(size_t len) { // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf auto read = stream_->read(reinterpret_cast<uint8_t *>(&buffer[0]), static_cast<int>(len)); - if (read != len) { - buffer.resize(static_cast<size_t >(read)); + if (gsl::narrow<size_t>(read) != len) { + buffer.resize(gsl::narrow<size_t>(read)); } - return std::move(buffer); + return buffer; } size_t LuaBaseStream::write(std::string buf) { - return static_cast<size_t>(stream_->write(reinterpret_cast<uint8_t *>(const_cast<char *>(buf.data())), + return gsl::narrow<size_t>(stream_->write(reinterpret_cast<uint8_t *>(const_cast<char *>(buf.data())), Review comment: Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: extensions/script/python/PythonScriptEngine.cpp ########## @@ -33,7 +33,7 @@ Interpreter *getInterpreter() { } PythonScriptEngine::PythonScriptEngine() { - auto intepreter = getInterpreter(); + getInterpreter(); Review comment: I am a bit unsure about this. Checking back in #500 this seems to be always part of the initialization, but I do not know how those members actually work in the context of the python interpeter. Is there a way to test this? ########## File path: extensions/standard-processors/processors/ListenSyslog.cpp ########## @@ -187,7 +187,7 @@ void ListenSyslog::runThread() { struct sockaddr_in cli_addr; clilen = sizeof(cli_addr); int recvlen = recvfrom(_serverSocket, _buffer, sizeof(_buffer), 0, (struct sockaddr *) &cli_addr, &clilen); - if (recvlen > 0 && (uint64_t) (recvlen + getEventQueueByteSize()) <= _recvBufSize) { + if (recvlen > 0 && (uint64_t) (recvlen + getEventQueueByteSize()) <= gsl::narrow<uint64_t>(_recvBufSize)) { Review comment: Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: extensions/standard-processors/processors/ListenSyslog.cpp ########## @@ -204,7 +204,7 @@ void ListenSyslog::runThread() { logger_->log_debug("ListenSysLog client socket %d close", clientSocket); it = _clientSockets.erase(it); } else { - if ((uint64_t) (recvlen + getEventQueueByteSize()) <= _recvBufSize) { + if ((uint64_t) (recvlen + getEventQueueByteSize()) <= gsl::narrow<uint64_t>(_recvBufSize)) { Review comment: Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: extensions/standard-processors/processors/ListenSyslog.h ########## @@ -191,7 +191,7 @@ class ListenSyslog : public core::Processor { void pollEvent(std::queue<SysLogEvent> &list, int maxSize) { std::lock_guard<std::mutex> lock(mutex_); - while (!_eventQueue.empty() && (maxSize == 0 || list.size() < maxSize)) { + while (!_eventQueue.empty() && (maxSize == 0 || list.size() < gsl::narrow<uint32_t>(maxSize))) { Review comment: Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: libminifi/include/utils/Monitors.h ########## @@ -41,7 +41,7 @@ class AfterExecute { AfterExecute() = default; - explicit AfterExecute(AfterExecute &&other) { + explicit AfterExecute(AfterExecute&& /*other*/) { Review comment: Yes, updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: libminifi/test/unit/GeneralUtilsTest.cpp ########## @@ -130,7 +130,7 @@ TEST_CASE("GeneralUtils::invoke FunctionObject", "[invoke function object]") { REQUIRE(false == utils::invoke(&free_function, false)); const auto n = 3; - const auto int_timesn = [n](const int i) { return n * i; }; + const auto int_timesn = [=](const int i) { return n * i; }; Review comment: Removed the capture altogether as it is not needed for this test. Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ########## File path: nanofi/src/api/nanofi.cpp ########## @@ -457,7 +457,7 @@ int get_content(const flow_file_record* ff, uint8_t* target, int size) { return stream->read(target, size); } else { file_buffer fb = file_to_buffer(ff->contentLocation); - size_t copy_size = size < fb.file_len ? size : gsl::narrow<size_t>(fb.file_len); + size_t copy_size = static_cast<size_t>(size) < fb.file_len ? size : gsl::narrow<size_t>(fb.file_len); Review comment: Updated in 267cda83a77a5a6d05f9df714d0c923814351826 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org