community icon indicating copy to clipboard operation
community copied to clipboard

C++11 transition

Open mkraposhin opened this issue 1 year ago • 5 comments

  1. Ability to compile OpenSDN parts using C++11 standard of language
  2. Elemination of old (deprectated) constructions: auto_ptr, NULL, etc

Requires:

  • Update log4cplus to the newer version (because the older one uses auto_ptr): setLayout
  • Refactoring of contrail-common/database (gen_if.cc, cql_if.cc,etc), since it uses boost::bind, which is not compatible with std::unique_ptr

mkraposhin avatar Apr 25 '24 12:04 mkraposhin

With the next commits the code compiles w/o errors with the key -std=c++11 and auto_ptr class usage has been removed from the generated sources:

https://gerrit.opensdn.io/c/opensdn-io/tf-build/+/530 https://gerrit.opensdn.io/c/opensdn-io/tf-controller/+/540 https://gerrit.opensdn.io/c/opensdn-io/tf-common/+/539 https://gerrit.opensdn.io/c/opensdn-io/tf-analytics/+/538

https://gerrit.opensdn.io/c/opensdn-io/tf-controller/+/556 https://gerrit.opensdn.io/c/opensdn-io/tf-api-client/+/554

mkraposhin avatar Apr 25 '24 12:04 mkraposhin

Nice. Do we have a full list of what remains to be done to complete this?

randybias avatar May 09 '24 07:05 randybias

There are several new commits, that have already passed CI/CD:

  • https://gerrit.opensdn.io/c/opensdn-io/tf-controller/+/612
  • https://gerrit.opensdn.io/c/opensdn-io/tf-common/+/610
  • https://gerrit.opensdn.io/c/opensdn-io/tf-api-client/+/611
  • https://gerrit.opensdn.io/c/opensdn-io/tf-analytics/+/613

Now I have to verify them on my test facility.

To accomplish all work, next steps are neccesary:

  • update of log4cplus library to newer versions that use unique_ptr instead of auto_ptr;
  • refactoring of contrail-common/database (this is large amount of work and it can be done later);
  • testing of new code on OpenStack installations (with at least 2 hypervisors).

mkraposhin avatar May 13 '24 07:05 mkraposhin

Updates?

randybias avatar Jun 14 '24 07:06 randybias

I introduced a newer version of log4cplus C++ library into the build container and updated all the code that uses log4cplus: https://gerrit.opensdn.io/c/opensdn-io/tf-controller/+/675

There is still one unit test that sometime work and sometime - not. I'm concentrating on it not.

To make OpenSDN fully C++11 comliant, it's neccesary to refactor CQL database driver, but I don't think I can accomplish this before the first release. So, I would say, nowadays we are 95% C++ compliant.

mkraposhin avatar Jun 19 '24 08:06 mkraposhin