Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5341 Fix Old-Style-Cast, Missing override and Possible noexcept
  3. THRIFT-5342

Apply 'noexcept' attribute to Init/Copy/Move Constructors and Assignments

    XMLWordPrintableJSON

Details

    Description

      The 'noexcept' attribute should be applied to the ctor & operator= for Copy & Move in cases when all fields of t_struct's storage do not throw and the Initializer ctor when no default values used.

       

      The cases of possible use of 'noexcept' can be seen with using the compiler-flag `-Wnoexcept`, these are some of the gcc warnings:

       

      swc-db/src/cc/include/swcdb/thrift/gen-cpp/Service_types.h:2436:3: warning: but ‘SWC::Thrift::FCellSerial::FCellSerial()’ does not throw; perhaps it should be declared ‘noexcept’$
       2436 | FCellSerial() : c(), ts(0) {
      
      swc-db/src/cc/include/swcdb/thrift/gen-cpp/Service_types.cpp:2508:1: warning: but ‘SWC::Thrift::SpecValueSerial_INT64::SpecValueSerial_INT64(const SWC::Thrift::SpecValueSerial_INT64&)’ does not throw; perhaps it should be declared ‘noexcept’ [-Wnoexcept] 2508 | SpecValueSerial_INT64::SpecValueSerial_INT64(const SpecValueSerial_INT64& other102) { | ^~~~~~~~~~~~~~~~~~~~~
      
      swc-db/src/cc/include/swcdb/thrift/gen-cpp/Broker.h:89:3: warning: but ‘SWC::Thrift::BrokerProcessorFactory::BrokerProcessorFactory(const std::shared_ptr<SWC::Thrift::BrokerIfFactory>&)’ does not throw; perhaps it should be declared ‘noexcept’ [-Wnoexcept] 89 | BrokerProcessorFactory(const ::std::shared_ptr< BrokerIfFactory >& handlerFactory) : | ^~~~~~~~~~~~~~~~~~~~~~
      

       

      • The option "moveable_types" of the CPP-generator can be a suggestion for a default
         

       

      Attachments

        Activity

          People

            kashirin.alex Kashirin Alex
            kashirin.alex Kashirin Alex
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: