Kashirin Alex created THRIFT-5342:
-------------------------------------

             Summary: Apply 'noexcept' attribute to Init/Copy/Move Constructors 
and Assignments
                 Key: THRIFT-5342
                 URL: https://issues.apache.org/jira/browse/THRIFT-5342
             Project: Thrift
          Issue Type: Improvement
          Components: C++ - Compiler
            Reporter: Kashirin Alex


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:

 
{code:java}
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) : | ^~~~~~~~~~~~~~~~~~~~~~
{code}
 
 * _The option "moveable_types" of the CPP-generator can be a suggestion for a 
default_
  

Holding on with the pull-request of [The 
Commit|https://github.com/kashirin-alex/thrift/commit/2dc513b626af620342a0d4d87d37d13152dd6f6d]
 for the changes to be on after THRIFT-5341

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to